diff --git a/api/fixtures/example.go b/api/fixtures/example.go index 7e1ae9058d5..248de85219e 100644 --- a/api/fixtures/example.go +++ b/api/fixtures/example.go @@ -74,6 +74,7 @@ type ExampleOptions struct { Agent *ExampleAgentOptions Kubevirt *ExampleKubevirtOptions Azure *ExampleAzureOptions + PowerVS *ExamplePowerVSOptions NetworkType hyperv1.NetworkType ControlPlaneAvailabilityPolicy hyperv1.AvailabilityPolicy InfrastructureAvailabilityPolicy hyperv1.AvailabilityPolicy @@ -385,6 +386,80 @@ web_identity_token_file = /var/run/secrets/openshift/serviceaccount/token } services = getIngressServicePublishingStrategyMapping() + case o.PowerVS != nil: + buildIBMCloudCreds := func(name, apikey string) *corev1.Secret { + return &corev1.Secret{ + TypeMeta: metav1.TypeMeta{ + Kind: "Secret", + APIVersion: corev1.SchemeGroupVersion.String(), + }, + ObjectMeta: metav1.ObjectMeta{ + Namespace: namespace.Name, + Name: name, + }, + Data: map[string][]byte{ + "ibm-credentials.env": []byte(fmt.Sprintf(`IBMCLOUD_AUTH_TYPE=iam + IBMCLOUD_APIKEY=%s + IBMCLOUD_AUTH_URL=https://iam.cloud.ibm.com + `, apikey)), + }, + } + } + powerVSResources := &ExamplePowerVSResources{ + buildIBMCloudCreds(o.Name+"-cloud-ctrl-creds", o.PowerVS.ApiKey), + buildIBMCloudCreds(o.Name+"-node-mgmt-creds", o.PowerVS.ApiKey), + buildIBMCloudCreds(o.Name+"-cpo-creds", o.PowerVS.ApiKey), + } + resources = powerVSResources.AsObjects() + platformSpec = hyperv1.PlatformSpec{ + Type: hyperv1.PowerVSPlatform, + PowerVS: &hyperv1.PowerVSPlatformSpec{ + ResourceGroup: o.PowerVS.ResourceGroup, + Region: o.PowerVS.PowerVSRegion, + Zone: o.PowerVS.PowerVSZone, + ServiceInstanceID: o.PowerVS.PowerVSCloudInstanceID, + VPC: &hyperv1.PowerVSVPC{ + Name: o.PowerVS.Vpc, + Region: o.PowerVS.VpcRegion, + Subnet: o.PowerVS.VpcSubnet, + }, + KubeCloudControllerCreds: corev1.LocalObjectReference{Name: powerVSResources.KubeCloudControllerPowerVSCreds.Name}, + NodePoolManagementCreds: corev1.LocalObjectReference{Name: powerVSResources.NodePoolManagementPowerVSCreds.Name}, + ControlPlaneOperatorCreds: corev1.LocalObjectReference{Name: powerVSResources.ControlPlaneOperatorPowerVSCreds.Name}, + }, + } + services = []hyperv1.ServicePublishingStrategyMapping{ + { + Service: hyperv1.APIServer, + ServicePublishingStrategy: hyperv1.ServicePublishingStrategy{ + Type: hyperv1.LoadBalancer, + }, + }, + { + Service: hyperv1.OAuthServer, + ServicePublishingStrategy: hyperv1.ServicePublishingStrategy{ + Type: hyperv1.Route, + }, + }, + { + Service: hyperv1.OIDC, + ServicePublishingStrategy: hyperv1.ServicePublishingStrategy{ + Type: hyperv1.S3, + }, + }, + { + Service: hyperv1.Konnectivity, + ServicePublishingStrategy: hyperv1.ServicePublishingStrategy{ + Type: hyperv1.Route, + }, + }, + { + Service: hyperv1.Ignition, + ServicePublishingStrategy: hyperv1.ServicePublishingStrategy{ + Type: hyperv1.Route, + }, + }, + } default: panic("no platform specified") } @@ -620,6 +695,19 @@ web_identity_token_file = /var/run/secrets/openshift/serviceaccount/token } nodePools = append(nodePools, nodePool) } + case hyperv1.PowerVSPlatform: + nodePool := defaultNodePool(cluster.Name) + nodePool.Spec.Platform.PowerVS = &hyperv1.PowerVSNodePoolPlatform{ + ServiceInstanceID: o.PowerVS.PowerVSCloudInstanceID, + SysType: o.PowerVS.SysType, + ProcType: o.PowerVS.ProcType, + Processors: o.PowerVS.Processors, + Memory: o.PowerVS.Memory, + Subnet: &hyperv1.PowerVSResourceReference{ + ID: &o.PowerVS.PowerVSSubnetID, + }, + } + nodePools = append(nodePools, nodePool) default: panic("Unsupported platform") } diff --git a/api/fixtures/example_ibmcloud_powervs.go b/api/fixtures/example_ibmcloud_powervs.go new file mode 100644 index 00000000000..7ea345fd33b --- /dev/null +++ b/api/fixtures/example_ibmcloud_powervs.go @@ -0,0 +1,46 @@ +package fixtures + +import ( + corev1 "k8s.io/api/core/v1" + crclient "sigs.k8s.io/controller-runtime/pkg/client" +) + +type ExamplePowerVSOptions struct { + ApiKey string + AccountID string + ResourceGroup string + PowerVSRegion string + PowerVSZone string + PowerVSCloudInstanceID string + PowerVSSubnetID string + PowerVSCloudConnection string + VpcRegion string + Vpc string + VpcSubnet string + + // nodepool related options + SysType string + ProcType string + Processors string + Memory string +} + +type ExamplePowerVSResources struct { + KubeCloudControllerPowerVSCreds *corev1.Secret + NodePoolManagementPowerVSCreds *corev1.Secret + ControlPlaneOperatorPowerVSCreds *corev1.Secret +} + +func (o *ExamplePowerVSResources) AsObjects() []crclient.Object { + var objects []crclient.Object + if o.KubeCloudControllerPowerVSCreds != nil { + objects = append(objects, o.KubeCloudControllerPowerVSCreds) + } + if o.NodePoolManagementPowerVSCreds != nil { + objects = append(objects, o.NodePoolManagementPowerVSCreds) + } + if o.ControlPlaneOperatorPowerVSCreds != nil { + objects = append(objects, o.ControlPlaneOperatorPowerVSCreds) + } + return objects +} diff --git a/api/v1alpha1/hostedcluster_types.go b/api/v1alpha1/hostedcluster_types.go index a215339721f..c2f687509c4 100644 --- a/api/v1alpha1/hostedcluster_types.go +++ b/api/v1alpha1/hostedcluster_types.go @@ -475,7 +475,7 @@ const ( // PlatformType is a specific supported infrastructure provider. // -// +kubebuilder:validation:Enum=AWS;None;IBMCloud;Agent;KubeVirt;Azure +// +kubebuilder:validation:Enum=AWS;None;IBMCloud;Agent;KubeVirt;Azure;PowerVS type PlatformType string const ( @@ -496,6 +496,9 @@ const ( // AzurePlatform represents Azure infrastructure. AzurePlatform PlatformType = "Azure" + + // PowerVSPlatform represents PowerVS infrastructure. + PowerVSPlatform PlatformType = "PowerVS" ) // PlatformSpec specifies the underlying infrastructure provider for the cluster @@ -524,6 +527,12 @@ type PlatformSpec struct { // Azure defines azure specific settings Azure *AzurePlatformSpec `json:"azure,omitempty"` + + // IBMCloud defines IBMCloud specific settings for components + // + // +optional + // +immutable + PowerVS *PowerVSPlatformSpec `json:"powervs,omitempty"` } // AgentPlatformSpec specifies configuration for agent-based installations. @@ -538,6 +547,111 @@ type IBMCloudPlatformSpec struct { ProviderType configv1.IBMCloudProviderType `json:"providerType,omitempty"` } +// PowerVSPlatformSpec defines IBMCloud PowerVS specific settings for components +type PowerVSPlatformSpec struct { + // ResourceGroup is the IBMCloud Resource Group in which the cluster resides. If not + // specified then default resource group of the account will be used. + // + // +immutable + ResourceGroup string `json:"resourceGroup,omitempty"` + + // Region is the IBMCloud region in which the cluster resides. This configures the + // OCP control plane cloud integrations, and is used by NodePool to resolve + // the correct boot image for a given release. + // + // +immutable + Region string `json:"region"` + + // Zone is the availability zone where control plane cloud resources are + // created. + // + // +immutable + Zone string `json:"zone,omitempty"` + + // Subnet is the subnet to use for control plane cloud resources. + // + // +optional + Subnet *PowerVSResourceReference `json:"subnet,omitempty"` + + // ServiceInstanceID is the ServiceInstance to use for control plane cloud resources. + ServiceInstanceID string `json:"serviceInstanceID,omitempty"` + + // VPC specifies IBM Cloud PowerVS Load Balancing configuration for the control + // plane. + // + // +immutable + VPC *PowerVSVPC `json:"vpc,omitempty"` + + // KubeCloudControllerCreds is a reference to a secret containing cloud + // credentials with permissions matching the cloud controller policy. The + // secret should have exactly one key, `credentials`, whose value is an AWS + // credentials file. + // + // TODO(dan): document the "cloud controller policy" + // + // +immutable + KubeCloudControllerCreds corev1.LocalObjectReference `json:"kubeCloudControllerCreds"` + + // NodePoolManagementCreds is a reference to a secret containing cloud + // credentials with permissions matching the node pool management policy. The + // secret should have exactly one key, `credentials`, whose value is an AWS + // credentials file. + // + // TODO(dan): document the "node pool management policy" + // + // +immutable + NodePoolManagementCreds corev1.LocalObjectReference `json:"nodePoolManagementCreds"` + + // ControlPlaneOperatorCreds is a reference to a secret containing cloud + // credentials with permissions matching the control-plane-operator policy. + // The secret should have exactly one key, `credentials`, whose value is + // an AWS credentials file. + // + // TODO(dan): document the "control plane operator policy" + // + // +immutable + ControlPlaneOperatorCreds corev1.LocalObjectReference `json:"controlPlaneOperatorCreds"` +} + +// PowerVSVPC specifies IBM Cloud PowerVS LoadBalancer configuration for the control +// plane. +type PowerVSVPC struct { + // Name for VPC to used for all the service load balancer. + // +immutable + Name string `json:"name"` + + // Region is the IBMCloud region in which VPC gets created, this VPC used for all the ingress traffic + // into the OCP cluster. + // + // +immutable + Region string `json:"region"` + + // Zone is the availability zone where load balancer cloud resources are + // created. + // + // +immutable + // +optional + Zone string `json:"zone,omitempty"` + + // Subnet is the subnet to use for load balancer. + // + // +optional + Subnet string `json:"subnet,omitempty"` +} + +// PowerVSResourceReference is a reference to a specific IBMCloud PowerVS resource by ID, or Name. +// Only one of ID, or Name may be specified. Specifying more than one will result in +// a validation error. +type PowerVSResourceReference struct { + // ID of resource + // +optional + ID *string `json:"id,omitempty"` + + // Name of resource + // +optional + Name *string `json:"name,omitempty"` +} + // AWSCloudProviderConfig specifies AWS networking configuration. type AWSCloudProviderConfig struct { // Subnet is the subnet to use for control plane cloud resources. diff --git a/api/v1alpha1/nodepool_types.go b/api/v1alpha1/nodepool_types.go index d1a9b56d085..f53332e419c 100644 --- a/api/v1alpha1/nodepool_types.go +++ b/api/v1alpha1/nodepool_types.go @@ -316,6 +316,52 @@ type NodePoolPlatform struct { Agent *AgentNodePoolPlatform `json:"agent,omitempty"` Azure *AzureNodePoolPlatform `json:"azure,omitempty"` + + // PowerVS specifies the configuration used when using IBMCloud PowerVS platform. + // + // +optional + PowerVS *PowerVSNodePoolPlatform `json:"powervs,omitempty"` +} + +// PowerVSNodePoolPlatform specifies the configuration of a NodePool when operating +// on IBMCloud PowerVS platform. +type PowerVSNodePoolPlatform struct { + // ServiceInstanceID is the ServiceInstance to use for control plane cloud resources. + ServiceInstanceID string `json:"serviceInstanceID"` + + // SysType used to host the instance(e.g: s922, e980, e880) + // +optional + SysType string `json:"sysType,omitempty"` + + // ProcType (dedicated, shared, capped) + // +optional + ProcType string `json:"procType,omitempty"` + + // Processors specifies the number of processors allocated + // +optional + Processors string `json:"processors,omitempty"` + + // Memory specifies the amount of memory specified in GBs + // +optional + Memory string `json:"memory,omitempty"` + + // Image used for deploying the nodes + // +optional + Image *PowerVSResourceReference `json:"image,omitempty"` + + // StorageType for the image and nodes + // +optional + StorageType string `json:"storageType,omitempty"` + + // Subnet is the subnet to use for control plane cloud resources. + // + // +optional + Subnet *PowerVSResourceReference `json:"subnet,omitempty"` + + // DeletePolicy for the image + // + // +optional + DeletePolicy string `json:"deletePolicy,omitempty"` } // KubevirtNodePoolPlatform specifies the configuration of a NodePool when operating diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 20801c14a32..f669278b496 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -1398,6 +1398,11 @@ func (in *NodePoolPlatform) DeepCopyInto(out *NodePoolPlatform) { *out = new(AzureNodePoolPlatform) **out = **in } + if in.PowerVS != nil { + in, out := &in.PowerVS, &out.PowerVS + *out = new(PowerVSNodePoolPlatform) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePoolPlatform. @@ -1533,6 +1538,11 @@ func (in *PlatformSpec) DeepCopyInto(out *PlatformSpec) { *out = new(AzurePlatformSpec) **out = **in } + if in.PowerVS != nil { + in, out := &in.PowerVS, &out.PowerVS + *out = new(PowerVSPlatformSpec) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlatformSpec. @@ -1545,6 +1555,99 @@ func (in *PlatformSpec) DeepCopy() *PlatformSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PowerVSNodePoolPlatform) DeepCopyInto(out *PowerVSNodePoolPlatform) { + *out = *in + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(PowerVSResourceReference) + (*in).DeepCopyInto(*out) + } + if in.Subnet != nil { + in, out := &in.Subnet, &out.Subnet + *out = new(PowerVSResourceReference) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PowerVSNodePoolPlatform. +func (in *PowerVSNodePoolPlatform) DeepCopy() *PowerVSNodePoolPlatform { + if in == nil { + return nil + } + out := new(PowerVSNodePoolPlatform) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PowerVSPlatformSpec) DeepCopyInto(out *PowerVSPlatformSpec) { + *out = *in + if in.Subnet != nil { + in, out := &in.Subnet, &out.Subnet + *out = new(PowerVSResourceReference) + (*in).DeepCopyInto(*out) + } + if in.VPC != nil { + in, out := &in.VPC, &out.VPC + *out = new(PowerVSVPC) + **out = **in + } + out.KubeCloudControllerCreds = in.KubeCloudControllerCreds + out.NodePoolManagementCreds = in.NodePoolManagementCreds + out.ControlPlaneOperatorCreds = in.ControlPlaneOperatorCreds +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PowerVSPlatformSpec. +func (in *PowerVSPlatformSpec) DeepCopy() *PowerVSPlatformSpec { + if in == nil { + return nil + } + out := new(PowerVSPlatformSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PowerVSResourceReference) DeepCopyInto(out *PowerVSResourceReference) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PowerVSResourceReference. +func (in *PowerVSResourceReference) DeepCopy() *PowerVSResourceReference { + if in == nil { + return nil + } + out := new(PowerVSResourceReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PowerVSVPC) DeepCopyInto(out *PowerVSVPC) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PowerVSVPC. +func (in *PowerVSVPC) DeepCopy() *PowerVSVPC { + if in == nil { + return nil + } + out := new(PowerVSVPC) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Release) DeepCopyInto(out *Release) { *out = *in diff --git a/cmd/cluster/cluster.go b/cmd/cluster/cluster.go index ad7662f49b1..69be81879e2 100644 --- a/cmd/cluster/cluster.go +++ b/cmd/cluster/cluster.go @@ -12,6 +12,7 @@ import ( "github.com/openshift/hypershift/cmd/cluster/core" "github.com/openshift/hypershift/cmd/cluster/kubevirt" "github.com/openshift/hypershift/cmd/cluster/none" + powervs "github.com/openshift/hypershift/cmd/cluster/powervs" ) func NewCreateCommands() *cobra.Command { @@ -71,6 +72,7 @@ func NewCreateCommands() *cobra.Command { cmd.AddCommand(agent.NewCreateCommand(opts)) cmd.AddCommand(kubevirt.NewCreateCommand(opts)) cmd.AddCommand(azure.NewCreateCommand(opts)) + cmd.AddCommand(powervs.NewCreateCommand(opts)) return cmd } @@ -100,6 +102,7 @@ func NewDestroyCommands() *cobra.Command { cmd.AddCommand(agent.NewDestroyCommand(opts)) cmd.AddCommand(kubevirt.NewDestroyCommand(opts)) cmd.AddCommand(azure.NewDestroyCommand(opts)) + cmd.AddCommand(powervs.NewDestroyCommand(opts)) return cmd } diff --git a/cmd/cluster/core/create.go b/cmd/cluster/core/create.go index 37868bf2d5f..3161536d04f 100644 --- a/cmd/cluster/core/create.go +++ b/cmd/cluster/core/create.go @@ -61,10 +61,29 @@ type CreateOptions struct { AWSPlatform AWSPlatformOptions AgentPlatform AgentPlatformCreateOptions AzurePlatform AzurePlatformOptions + PowerVSPlatform PowerVSPlatformOptions Wait bool Timeout time.Duration } +type PowerVSPlatformOptions struct { + APIKey string + ResourceGroup string + PowerVSRegion string + PowerVSZone string + PowerVSCloudInstanceID string + PowerVSCloudConnection string + VpcRegion string + Vpc string + VpcSubnet string + + // nodepool related options + SysType string + ProcType string + Processors string + Memory string +} + type AgentPlatformCreateOptions struct { APIServerAddress string AgentNamespace string diff --git a/cmd/cluster/core/destroy.go b/cmd/cluster/core/destroy.go index dccfc3fa8b7..bdd6d13749f 100644 --- a/cmd/cluster/core/destroy.go +++ b/cmd/cluster/core/destroy.go @@ -30,6 +30,7 @@ type DestroyOptions struct { Namespace string AWSPlatform AWSPlatformDestroyOptions AzurePlatform AzurePlatformDestroyOptions + PowerVSPlatform PowerVSPlatformDestroyOptions InfraID string } @@ -45,6 +46,13 @@ type AzurePlatformDestroyOptions struct { Location string } +type PowerVSPlatformDestroyOptions struct { + ResourceGroup string + Region string + Zone string + VPCRegion string +} + func GetCluster(ctx context.Context, o *DestroyOptions) (*hyperv1.HostedCluster, error) { c, err := util.GetClient() if err != nil { diff --git a/cmd/cluster/powervs/create.go b/cmd/cluster/powervs/create.go new file mode 100644 index 00000000000..36705d91145 --- /dev/null +++ b/cmd/cluster/powervs/create.go @@ -0,0 +1,173 @@ +package powervs + +import ( + "context" + "encoding/json" + "fmt" + "io/ioutil" + "os" + "os/signal" + "syscall" + + apifixtures "github.com/openshift/hypershift/api/fixtures" + "github.com/openshift/hypershift/cmd/cluster/core" + powervsinfra "github.com/openshift/hypershift/cmd/infra/powervs" + "github.com/openshift/hypershift/cmd/log" + "github.com/openshift/hypershift/support/infraid" + "github.com/spf13/cobra" +) + +const ( + defaultCIDRBlock = "10.0.0.0/16" +) + +func NewCreateCommand(opts *core.CreateOptions) *cobra.Command { + cmd := &cobra.Command{ + Use: "powervs", + Short: "Creates basic functional HostedCluster resources on PowerVS PowerVS", + SilenceUsage: true, + } + + opts.PowerVSPlatform = core.PowerVSPlatformOptions{ + APIKey: os.Getenv("IBMCLOUD_API_KEY"), + PowerVSRegion: "us-south", + PowerVSZone: "us-south", + VpcRegion: "us-south", + SysType: "s922", + ProcType: "shared", + Processors: "0.5", + Memory: "32", + } + + cmd.Flags().StringVar(&opts.PowerVSPlatform.ResourceGroup, "resource-group", "", "IBM Cloud Resource group") + cmd.Flags().StringVar(&opts.PowerVSPlatform.PowerVSRegion, "powervs-region", opts.PowerVSPlatform.PowerVSRegion, "IBM Cloud PowerVS region") + cmd.Flags().StringVar(&opts.PowerVSPlatform.PowerVSZone, "powervs-zone", opts.PowerVSPlatform.PowerVSZone, "IBM Cloud PowerVS zone") + cmd.Flags().StringVar(&opts.PowerVSPlatform.PowerVSCloudInstanceID, "powervs-cloud-instance-id", "", "IBM PowerVS Cloud Instance ID") + cmd.Flags().StringVar(&opts.PowerVSPlatform.PowerVSCloudConnection, "powervs-cloud-connection", "", "IBM Cloud PowerVS Cloud Connection") + cmd.Flags().StringVar(&opts.PowerVSPlatform.VpcRegion, "vpc-region", opts.PowerVSPlatform.VpcRegion, "Name region") + cmd.Flags().StringVar(&opts.PowerVSPlatform.Vpc, "vpc", "", "Name Name") + cmd.Flags().StringVar(&opts.PowerVSPlatform.SysType, "sys-type", opts.PowerVSPlatform.SysType, "System type used to host the instance(e.g: s922, e980, e880)") + cmd.Flags().StringVar(&opts.PowerVSPlatform.ProcType, "proc-type", opts.PowerVSPlatform.ProcType, "Processor type (dedicated, shared, capped)") + cmd.Flags().StringVar(&opts.PowerVSPlatform.Processors, "processors", opts.PowerVSPlatform.Processors, "Number of processors allocated") + cmd.Flags().StringVar(&opts.PowerVSPlatform.Memory, "memory", opts.PowerVSPlatform.Memory, "Amount of memory allocated (in GB)") + + cmd.MarkFlagRequired("resource-group") + + // these options are only for development and testing purpose, + // can use these to reuse the existing resources, so hiding it. + // for using these flags, the connection b/w all the resources should be pre-set up properly + // e.g. cloud instance should contain a cloud connection attached to the dhcp server and provided vpc + cmd.Flags().MarkHidden("powervs-cloud-instance-id") + cmd.Flags().MarkHidden("powervs-cloud-connection") + cmd.Flags().MarkHidden("vpc") + + cmd.PreRunE = func(cmd *cobra.Command, args []string) error { + if opts.BaseDomain == "" { + return fmt.Errorf("--base-domain can't be empty") + } + return nil + } + cmd.Run = func(cmd *cobra.Command, args []string) { + ctx, cancel := context.WithCancel(context.Background()) + sigs := make(chan os.Signal, 1) + signal.Notify(sigs, syscall.SIGINT) + go func() { + <-sigs + cancel() + }() + + if err := CreateCluster(ctx, opts); err != nil { + log.Log.Error(err, "Failed to create cluster") + os.Exit(1) + } + } + + return cmd +} + +func CreateCluster(ctx context.Context, opts *core.CreateOptions) error { + if err := validate(opts); err != nil { + return err + } + if err := core.Validate(ctx, opts); err != nil { + return err + } + return core.CreateCluster(ctx, opts, applyPlatformSpecificsValues) +} + +func validate(opts *core.CreateOptions) error { + if opts.BaseDomain == "" { + return fmt.Errorf("--base-domain can't be empty") + } + + if opts.PowerVSPlatform.APIKey == "" { + return fmt.Errorf("IBMCLOUD_API_KEY not set") + } + return nil +} + +func applyPlatformSpecificsValues(ctx context.Context, exampleOptions *apifixtures.ExampleOptions, opts *core.CreateOptions) (err error) { + infraID := opts.InfraID + if len(infraID) == 0 { + infraID = infraid.New(opts.Name) + } + + // Load or create infrastructure for the cluster + var infra *powervsinfra.Infra + if len(opts.InfrastructureJSON) > 0 { + rawInfra, err := ioutil.ReadFile(opts.InfrastructureJSON) + if err != nil { + return fmt.Errorf("failed to read infra json file: %w", err) + } + infra = &powervsinfra.Infra{} + if err = json.Unmarshal(rawInfra, infra); err != nil { + return fmt.Errorf("failed to load infra json: %w", err) + } + } + + if infra == nil { + if len(infraID) == 0 { + infraID = infraid.New(opts.Name) + } + opt := &powervsinfra.CreateInfraOptions{ + BaseDomain: opts.BaseDomain, + ResourceGroup: opts.PowerVSPlatform.ResourceGroup, + InfraID: infraID, + PowerVSRegion: opts.PowerVSPlatform.PowerVSRegion, + PowerVSZone: opts.PowerVSPlatform.PowerVSZone, + PowerVSCloudInstanceID: opts.PowerVSPlatform.PowerVSCloudInstanceID, + PowerVSCloudConnection: opts.PowerVSPlatform.PowerVSCloudConnection, + VpcRegion: opts.PowerVSPlatform.VpcRegion, + Vpc: opts.PowerVSPlatform.Vpc, + Debug: true, + } + infra = &powervsinfra.Infra{} + err = infra.SetupInfra(opt) + if err != nil { + return fmt.Errorf("failed to create infra: %w", err) + } + } + + exampleOptions.BaseDomain = opts.BaseDomain + exampleOptions.ComputeCIDR = defaultCIDRBlock + exampleOptions.PrivateZoneID = infra.CisDomainID + exampleOptions.PublicZoneID = infra.CisDomainID + exampleOptions.InfraID = infraID + exampleOptions.PowerVS = &apifixtures.ExamplePowerVSOptions{ + ApiKey: opts.PowerVSPlatform.APIKey, + AccountID: infra.AccountID, + ResourceGroup: opts.PowerVSPlatform.ResourceGroup, + PowerVSRegion: opts.PowerVSPlatform.PowerVSRegion, + PowerVSZone: opts.PowerVSPlatform.PowerVSZone, + PowerVSCloudInstanceID: infra.PowerVSCloudInstanceID, + PowerVSSubnetID: infra.PowerVSDhcpSubnetID, + VpcRegion: opts.PowerVSPlatform.VpcRegion, + Vpc: infra.VpcName, + VpcSubnet: infra.VpcSubnetName, + SysType: opts.PowerVSPlatform.SysType, + ProcType: opts.PowerVSPlatform.ProcType, + Processors: opts.PowerVSPlatform.Processors, + Memory: opts.PowerVSPlatform.Memory, + } + return nil +} diff --git a/cmd/cluster/powervs/destroy.go b/cmd/cluster/powervs/destroy.go new file mode 100644 index 00000000000..26e0edb5d49 --- /dev/null +++ b/cmd/cluster/powervs/destroy.go @@ -0,0 +1,89 @@ +package powervs + +import ( + "context" + "fmt" + "os" + "os/signal" + "syscall" + + "github.com/spf13/cobra" + + "k8s.io/apimachinery/pkg/util/errors" + + "github.com/openshift/hypershift/cmd/cluster/core" + powervsinfra "github.com/openshift/hypershift/cmd/infra/powervs" + "github.com/openshift/hypershift/cmd/log" +) + +func NewDestroyCommand(opts *core.DestroyOptions) *cobra.Command { + cmd := &cobra.Command{ + Use: "powervs", + Short: "Destroys a HostedCluster and its resources on PowerVS", + SilenceUsage: true, + } + cmd.Run = func(cmd *cobra.Command, args []string) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + sigs := make(chan os.Signal, 1) + signal.Notify(sigs, syscall.SIGINT) + go func() { + <-sigs + cancel() + }() + + if err := DestroyCluster(ctx, opts); err != nil { + log.Log.Error(err, "Failed to destroy cluster") + os.Exit(1) + } + } + + return cmd +} + +func DestroyCluster(ctx context.Context, o *core.DestroyOptions) error { + hostedCluster, err := core.GetCluster(ctx, o) + if err != nil { + return err + } + if hostedCluster != nil { + o.InfraID = hostedCluster.Spec.InfraID + o.PowerVSPlatform.ResourceGroup = hostedCluster.Spec.Platform.PowerVS.ResourceGroup + o.PowerVSPlatform.Region = hostedCluster.Spec.Platform.PowerVS.Region + o.PowerVSPlatform.Zone = hostedCluster.Spec.Platform.PowerVS.Zone + o.PowerVSPlatform.VPCRegion = hostedCluster.Spec.Platform.PowerVS.VPC.Region + } + + var inputErrors []error + if o.InfraID == "" { + inputErrors = append(inputErrors, fmt.Errorf("infrastructure ID is required")) + } + if o.PowerVSPlatform.Region == "" { + inputErrors = append(inputErrors, fmt.Errorf("PowerVS region is required")) + } + if o.PowerVSPlatform.Zone == "" { + inputErrors = append(inputErrors, fmt.Errorf("PowerVS zone is required")) + } + if o.PowerVSPlatform.VPCRegion == "" { + inputErrors = append(inputErrors, fmt.Errorf("VPC region is required")) + } + if o.PowerVSPlatform.ResourceGroup == "" { + inputErrors = append(inputErrors, fmt.Errorf("resource group is required")) + } + if err := errors.NewAggregate(inputErrors); err != nil { + return fmt.Errorf("required inputs are missing: %w", err) + } + + return core.DestroyCluster(ctx, hostedCluster, o, destroyPlatformSpecifics) +} + +func destroyPlatformSpecifics(ctx context.Context, o *core.DestroyOptions) error { + return (&powervsinfra.DestroyInfraOptions{ + InfraID: o.InfraID, + ResourceGroup: o.PowerVSPlatform.ResourceGroup, + PowerVSRegion: o.PowerVSPlatform.Region, + PowerVSZone: o.PowerVSPlatform.Zone, + VpcRegion: o.PowerVSPlatform.VPCRegion, + }).Run(ctx) +} diff --git a/cmd/infra/create.go b/cmd/infra/create.go index d24dc69d3b0..08837d6be9a 100644 --- a/cmd/infra/create.go +++ b/cmd/infra/create.go @@ -5,6 +5,7 @@ import ( "github.com/openshift/hypershift/cmd/infra/aws" "github.com/openshift/hypershift/cmd/infra/azure" + "github.com/openshift/hypershift/cmd/infra/powervs" ) func NewCreateCommand() *cobra.Command { @@ -16,6 +17,7 @@ func NewCreateCommand() *cobra.Command { cmd.AddCommand(aws.NewCreateCommand()) cmd.AddCommand(azure.NewCreateCommand()) + cmd.AddCommand(powervs.NewCreateCommand()) return cmd } diff --git a/cmd/infra/destroy.go b/cmd/infra/destroy.go index dfeaa8b8d8e..9b1898298fc 100644 --- a/cmd/infra/destroy.go +++ b/cmd/infra/destroy.go @@ -5,6 +5,7 @@ import ( "github.com/openshift/hypershift/cmd/infra/aws" "github.com/openshift/hypershift/cmd/infra/azure" + "github.com/openshift/hypershift/cmd/infra/powervs" ) func NewDestroyCommand() *cobra.Command { @@ -16,6 +17,7 @@ func NewDestroyCommand() *cobra.Command { cmd.AddCommand(aws.NewDestroyCommand()) cmd.AddCommand(azure.NewDestroyCommand()) + cmd.AddCommand(powervs.NewDestroyCommand()) return cmd } diff --git a/cmd/infra/powervs/create.go b/cmd/infra/powervs/create.go new file mode 100644 index 00000000000..cacc10c2f31 --- /dev/null +++ b/cmd/infra/powervs/create.go @@ -0,0 +1,1109 @@ +package powervs + +import ( + "context" + "encoding/json" + "fmt" + "os" + "strings" + "time" + + "github.com/spf13/cobra" + "k8s.io/apimachinery/pkg/util/wait" + + "github.com/IBM-Cloud/power-go-client/clients/instance" + "github.com/IBM-Cloud/power-go-client/ibmpisession" + "github.com/IBM-Cloud/power-go-client/power/models" + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/networking-go-sdk/zonesv1" + "github.com/IBM/platform-services-go-sdk/globalcatalogv1" + "github.com/IBM/platform-services-go-sdk/iamidentityv1" + "github.com/IBM/platform-services-go-sdk/resourcecontrollerv2" + "github.com/IBM/platform-services-go-sdk/resourcemanagerv2" + "github.com/IBM/vpc-go-sdk/vpcv1" + + "github.com/openshift/hypershift/cmd/log" +) + +var cloudApiKey = os.Getenv("IBMCLOUD_API_KEY") + +const ( + // Resource name suffix for creation + cloudInstanceNameSuffix = "hypershift-nodepool" + vpcNameSuffix = "hypershift-vpc" + vpcSubnetNameSuffix = "hypershift-vpc-subnet" + cloudConnNameSuffix = "hypershift-cloud-connection" + + // Default cloud connection speed + defaultCloudConnSpeed = 5000 + + // CIS service name + cisService = "internet-svcs" + + // PowerVS service and plan name + powerVSService = "power-iaas" + powerVSServicePlan = "power-virtual-server-group" + + // Resource desired states + vpcAvailableState = "available" + cloudInstanceActiveState = "active" + dhcpServiceActiveState = "ACTIVE" + cloudConnectionEstablishedState = "established" + + // Resource undesired state + dhcpServiceErrorState = "ERROR" + + // Time duration for monitoring the resource readiness + pollingInterval = time.Second * 5 + vpcCreationTimeout = time.Minute * 5 + cloudInstanceCreationTimeout = time.Minute * 5 + cloudConnEstablishedStateTimeout = time.Minute * 30 + dhcpServerCreationTimeout = time.Minute * 30 + cloudConnUpdateTimeout = time.Minute * 10 +) + +// CreateInfraOptions ... +// command line options for setting up infra in IBM PowerVS cloud +type CreateInfraOptions struct { + BaseDomain string + ResourceGroup string + InfraID string + PowerVSRegion string + PowerVSZone string + PowerVSCloudInstanceID string + PowerVSCloudConnection string + VpcRegion string + Vpc string + OutputFile string + Debug bool +} + +type TimeDuration struct { + time.Duration +} + +// MarshalJSON ... +// custom marshaling func for time.Duration to parse Duration into user-friendly format +func (d *TimeDuration) MarshalJSON() (b []byte, err error) { + return []byte(fmt.Sprintf(`"%s"`, d.Round(time.Millisecond).String())), nil +} + +// UnmarshalJSON ... +// custom unmarshalling func for time.Duration +func (d *TimeDuration) UnmarshalJSON(b []byte) (err error) { + d.Duration, err = time.ParseDuration(strings.Trim(string(b), `"`)) + return +} + +type CreateStat struct { + Duration TimeDuration `json:"duration"` + Status string `json:"status,omitempty"` +} + +type InfraCreationStat struct { + Vpc CreateStat `json:"vpc"` + VpcSubnet CreateStat `json:"vpcSubnet"` + CloudInstance CreateStat `json:"cloudInstance"` + DhcpService CreateStat `json:"dhcpService"` + CloudConnState CreateStat `json:"cloudConnState"` +} + +// Infra ... +// resource info in IBM Cloud for setting up hypershift nodepool +type Infra struct { + ID string `json:"id"` + AccountID string `json:"accountID"` + CisCrn string `json:"cisCrn"` + CisDomainID string `json:"cisDomainID"` + ResourceGroupID string `json:"resourceGroupID"` + PowerVSCloudInstanceID string `json:"powerVSCloudInstanceID"` + PowerVSDhcpSubnetID string `json:"powerVSDhcpSubnetID"` + PowerVSDhcpID string `json:"powerVSDhcpID"` + PowerVSCloudConnectionID string `json:"powerVSCloudConnectionID"` + VpcName string `json:"vpcName"` + VpcID string `json:"vpcID"` + VpcCrn string `json:"vpcCrn"` + VpcRoutingTableID string `json:"-"` + VpcSubnetName string `json:"vpcSubnetName"` + VpcSubnetID string `json:"vpcSubnetID"` + Stats InfraCreationStat `json:"stats"` +} + +func NewCreateCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "powervs", + Short: "Creates PowerVS infrastructure resources for a cluster", + SilenceUsage: true, + } + + opts := CreateInfraOptions{ + PowerVSRegion: "us-south", + PowerVSZone: "us-south", + VpcRegion: "us-south", + } + + cmd.Flags().StringVar(&opts.BaseDomain, "base-domain", opts.BaseDomain, "IBM Cloud CIS Domain") + cmd.Flags().StringVar(&opts.ResourceGroup, "resource-group", opts.ResourceGroup, "IBM Cloud Resource Group") + cmd.Flags().StringVar(&opts.InfraID, "infra-id", opts.InfraID, "Cluster ID with which to tag IBM Cloud resources") + cmd.Flags().StringVar(&opts.PowerVSRegion, "powervs-region", opts.PowerVSRegion, "IBM Cloud PowerVS Region") + cmd.Flags().StringVar(&opts.PowerVSZone, "powervs-zone", opts.PowerVSZone, "IBM Cloud PowerVS Zone") + cmd.Flags().StringVar(&opts.PowerVSCloudInstanceID, "powervs-cloud-instance-id", opts.PowerVSCloudInstanceID, "IBM PowerVS Cloud Instance ID") + cmd.Flags().StringVar(&opts.VpcRegion, "vpc-region", opts.VpcRegion, "IBM Cloud VPC Region for VPC resources") + cmd.Flags().StringVar(&opts.Vpc, "vpc", opts.Vpc, "IBM Cloud VPC Name") + cmd.Flags().StringVar(&opts.PowerVSCloudConnection, "powervs-cloud-connection", opts.PowerVSCloudConnection, "IBM Cloud PowerVS Cloud Connection") + cmd.Flags().StringVar(&opts.OutputFile, "output-file", opts.OutputFile, "Path to file that will contain output information from infra resources (optional)") + cmd.Flags().BoolVar(&opts.Debug, "debug", opts.Debug, "Enabling this will print PowerVS API Request & Response logs") + + // these options are only for development and testing purpose, + // can use these to reuse the existing resources, so hiding it. + // for using these flags, the connection b/w all the resources should be pre-set up properly + // e.g. cloud instance should contain a cloud connection attached to the dhcp server and provided vpc + cmd.Flags().MarkHidden("powervs-cloud-instance-id") + cmd.Flags().MarkHidden("vpc") + cmd.Flags().MarkHidden("powervs-cloud-connection") + + cmd.MarkFlagRequired("base-domain") + cmd.MarkFlagRequired("resource-group") + cmd.MarkFlagRequired("infra-id") + + cmd.RunE = func(cmd *cobra.Command, args []string) error { + if err := opts.Run(cmd.Context()); err != nil { + log.Log.Error(err, "Failed to create infrastructure") + return err + } + log.Log.Info("Successfully created infrastructure") + return nil + } + + return cmd +} + +func (options *CreateInfraOptions) Run(ctx context.Context) (err error) { + infra := &Infra{ID: options.InfraID} + + defer func() { + out := os.Stdout + if len(options.OutputFile) > 0 { + var err error + out, err = os.Create(options.OutputFile) + if err != nil { + log.Log.WithName(options.InfraID).Error(err, "cannot create output file") + } + defer out.Close() + } + outputBytes, err := json.MarshalIndent(infra, "", " ") + if err != nil { + log.Log.WithName(options.InfraID).WithName(options.InfraID).Error(err, "failed to serialize output infra") + } + _, err = out.Write(outputBytes) + if err != nil { + log.Log.WithName(options.InfraID).Error(err, "failed to write output infra json") + } + }() + + err = infra.SetupInfra(options) + if err != nil { + return err + } + + return nil +} + +// SetupInfra ... +// infra creation orchestration +func (infra *Infra) SetupInfra(options *CreateInfraOptions) (err error) { + startTime := time.Now() + + log.Log.WithName(options.InfraID).Info("Setup infra started") + + // if IBMCLOUD_API_KEY is not set, infra cannot be set up. + if cloudApiKey == "" { + return fmt.Errorf("IBMCLOUD_API_KEY not set") + } + + infra.ResourceGroupID, err = getResourceGroupID(options.ResourceGroup) + if err != nil { + return fmt.Errorf("error getting id for resource group %s, %w", options.ResourceGroup, err) + } + + err = infra.setupBaseDomain(options) + if err != nil { + return fmt.Errorf("error setup base domain: %w", err) + } + + v1, err := createVpcService(options.VpcRegion, options.InfraID) + if err != nil { + return fmt.Errorf("error creating vpc service: %w", err) + } + + err = infra.setupVpc(options, v1) + if err != nil { + return fmt.Errorf("error setup vpc: %w", err) + } + + err = infra.setupVpcSubnet(options, v1) + if err != nil { + return fmt.Errorf("error setup vpc subnet: %w", err) + } + + session, err := createPowerVSSession(options.PowerVSRegion, options.PowerVSZone, options.Debug) + infra.AccountID = session.Options.UserAccount + if err != nil { + return fmt.Errorf("error creating powervs session: %w", err) + } + + err = infra.setupPowerVSCloudInstance(options) + if err != nil { + return fmt.Errorf("error setup powervs cloud instance: %w", err) + } + + err = infra.setupPowerVSCloudConnection(options, session) + if err != nil { + return fmt.Errorf("error setup powervs cloud connection: %w", err) + } + + err = infra.setupPowerVSDhcp(options, session) + if err != nil { + return fmt.Errorf("error setup powervs dhcp server: %w", err) + } + + err = infra.isCloudConnectionReady(options, session) + if err != nil { + return fmt.Errorf("cloud connection is not up: %w", err) + } + + log.Log.WithName(options.InfraID).Info("Setup infra completed in", "duration", time.Since(startTime).String()) + return +} + +// getIAMAuth... +// getting core.Authenticator +func getIAMAuth() *core.IamAuthenticator { + return &core.IamAuthenticator{ + ApiKey: cloudApiKey, + } +} + +// setupBaseDomain ... +// get domain id and crn of given base domain +func (infra *Infra) setupBaseDomain(options *CreateInfraOptions) (err error) { + rcv2, err := resourcecontrollerv2.NewResourceControllerV2(&resourcecontrollerv2.ResourceControllerV2Options{Authenticator: getIAMAuth()}) + if err != nil { + return + } + + if rcv2 == nil { + return fmt.Errorf("unable to get resource controller") + } + + // getting list of resource instance of type cis + serviceID, _, err := getServiceInfo(cisService, "") + + if err != nil { + err = fmt.Errorf("error retrieving cis service %w", err) + return + } + + f := func(start string) (isDone bool, nextUrl string, err error) { + listResourceOpt := resourcecontrollerv2.ListResourceInstancesOptions{ResourceID: &serviceID} + + // for getting the next page + if start != "" { + listResourceOpt.Start = &start + } + resourceList, _, err := rcv2.ListResourceInstances(&listResourceOpt) + + if err != nil { + return + } + + if resourceList == nil { + err = fmt.Errorf("resourceList returned is nil") + return + } + + // looping through all resource instance of type cis until given base domain is found + for _, resource := range resourceList.Resources { + // trying to loop over all resource's zones to find the matched domain name + // if any issue in processing current resource, will continue to process next resource's zones until the given domain name matches + var zv1 *zonesv1.ZonesV1 + zv1, err = zonesv1.NewZonesV1(&zonesv1.ZonesV1Options{Authenticator: getIAMAuth(), Crn: resource.CRN}) + if err != nil { + continue + } + if zv1 == nil { + continue + } + var zoneList *zonesv1.ListZonesResp + zoneList, _, err = zv1.ListZones(&zonesv1.ListZonesOptions{}) + if err != nil { + continue + } + + if zoneList != nil { + for _, zone := range zoneList.Result { + if *zone.Name == options.BaseDomain { + infra.CisCrn = *resource.CRN + infra.CisDomainID = *zone.ID + isDone = true + return + } + } + } + } + + // For paging over next set of resources getting the start token + if resourceList.NextURL != nil || *resourceList.NextURL != "" { + nextUrl = *resourceList.NextURL + return + } + + isDone = true + return + } + + err = pagingHelper(f) + if err != nil { + return + } + + if infra.CisCrn == "" || infra.CisDomainID == "" { + return fmt.Errorf("unable to get cis information with base domain %s", options.BaseDomain) + } + + log.Log.WithName(options.InfraID).Info("BaseDomain Info Ready", "CRN", infra.CisCrn, "DomainID", infra.CisDomainID) + return +} + +// getServiceInfo ... +// retrieving id info of given service and service plan +func getServiceInfo(service string, servicePlan string) (serviceID string, servicePlanID string, err error) { + gcv1, err := globalcatalogv1.NewGlobalCatalogV1(&globalcatalogv1.GlobalCatalogV1Options{Authenticator: getIAMAuth()}) + if err != nil { + return + } + + if gcv1 == nil { + err = fmt.Errorf("unable to get global catalog") + return + } + + // TO-DO need to explore paging for catalog list since ListCatalogEntriesOptions does not take start + include := "*" + listCatalogEntriesOpt := globalcatalogv1.ListCatalogEntriesOptions{Include: &include, Q: &service} + catalogEntriesList, _, err := gcv1.ListCatalogEntries(&listCatalogEntriesOpt) + if err != nil { + return + } + if catalogEntriesList != nil { + for _, catalog := range catalogEntriesList.Resources { + if *catalog.Name == service { + serviceID = *catalog.ID + } + } + } + + if serviceID == "" { + return "", "", fmt.Errorf("could not retrieve service id for service %s", service) + } else if servicePlan == "" { + return serviceID, "", nil + } else { + kind := "plan" + getChildOpt := globalcatalogv1.GetChildObjectsOptions{ID: &serviceID, Kind: &kind} + var childObjResult *globalcatalogv1.EntrySearchResult + childObjResult, _, err = gcv1.GetChildObjects(&getChildOpt) + if err != nil { + return + } + for _, plan := range childObjResult.Resources { + if *plan.Name == servicePlan { + servicePlanID = *plan.ID + return + } + } + } + err = fmt.Errorf("could not retrieve plan id for service name: %s & service plan name: %s", service, servicePlan) + return +} + +// getResourceGroupID ... +// retrieving id of resource group +func getResourceGroupID(resourceGroup string) (resourceGroupID string, err error) { + rmv2, err := resourcemanagerv2.NewResourceManagerV2(&resourcemanagerv2.ResourceManagerV2Options{Authenticator: getIAMAuth()}) + if err != nil { + return + } + + if rmv2 == nil { + err = fmt.Errorf("unable to get resource controller") + return + } + + rmv2ListResourceGroupOpt := resourcemanagerv2.ListResourceGroupsOptions{Name: &resourceGroup} + resourceGroupListResult, _, err := rmv2.ListResourceGroups(&rmv2ListResourceGroupOpt) + if err != nil { + return + } + + if resourceGroupListResult != nil { + for _, rg := range resourceGroupListResult.Resources { + if *rg.Name == resourceGroup { + resourceGroupID = *rg.ID + return + } + } + } + + err = fmt.Errorf("could not retrieve resource group id for %s", resourceGroup) + return +} + +// createCloudInstance ... +// creating powervs cloud instance +func (infra *Infra) createCloudInstance(options *CreateInfraOptions) (resourceInstance *resourcecontrollerv2.ResourceInstance, err error) { + + rcv2, err := resourcecontrollerv2.NewResourceControllerV2(&resourcecontrollerv2.ResourceControllerV2Options{Authenticator: getIAMAuth()}) + if err != nil { + return + } + + if rcv2 == nil { + err = fmt.Errorf("unable to get resource controller") + return + } + + serviceID, servicePlanID, err := getServiceInfo(powerVSService, powerVSServicePlan) + if err != nil { + err = fmt.Errorf("error retrieving id info for powervs service %w", err) + return + } + + cloudInstanceName := fmt.Sprintf("%s-%s", options.InfraID, cloudInstanceNameSuffix) + + // validate if already a cloud instance available with the infra provided + // if yes, make use of that instead of trying to create a new one + resourceInstance, err = validateCloudInstanceByName(cloudInstanceName, infra.ResourceGroupID, options.PowerVSZone, serviceID, servicePlanID) + + if resourceInstance != nil { + log.Log.WithName(options.InfraID).Info("Using existing PowerVS Cloud Instance", "name", cloudInstanceName) + return + } + + log.Log.WithName(options.InfraID).Info("Creating PowerVS Cloud Instance ...") + target := options.PowerVSZone + + resourceInstanceOpt := resourcecontrollerv2.CreateResourceInstanceOptions{Name: &cloudInstanceName, + ResourceGroup: &infra.ResourceGroupID, + ResourcePlanID: &servicePlanID, + Target: &target} + + startTime := time.Now() + resourceInstance, _, err = rcv2.CreateResourceInstance(&resourceInstanceOpt) + if err != nil { + return + } + + if resourceInstance == nil { + err = fmt.Errorf("create cloud instance returned nil") + return + } + + if *resourceInstance.State == cloudInstanceActiveState { + return + } + + f := func() (cond bool, err error) { + resourceInstance, _, err = rcv2.GetResourceInstance(&resourcecontrollerv2.GetResourceInstanceOptions{ID: resourceInstance.ID}) + log.Log.WithName(options.InfraID).Info("Waiting for cloud instance to up", "id", resourceInstance.ID, "state", *resourceInstance.State) + + if err != nil { + return + } + + if *resourceInstance.State == cloudInstanceActiveState { + cond = true + return + } + return + } + + err = wait.PollImmediate(pollingInterval, cloudInstanceCreationTimeout, f) + + infra.Stats.CloudInstance.Duration.Duration = time.Since(startTime) + + return +} + +// getAccount ... +// getting the account id from core.Authenticator +func getAccount(auth core.Authenticator) (accountID string, err error) { + iamv1, err := iamidentityv1.NewIamIdentityV1(&iamidentityv1.IamIdentityV1Options{Authenticator: auth}) + if err != nil { + return + } + + apiKeyDetailsOpt := iamidentityv1.GetAPIKeysDetailsOptions{IamAPIKey: &cloudApiKey} + apiKey, _, err := iamv1.GetAPIKeysDetails(&apiKeyDetailsOpt) + if err != nil { + return + } + if apiKey == nil { + err = fmt.Errorf("could retrieve account id") + return + } + + accountID = *apiKey.AccountID + return +} + +// createPowerVSSession ... +// creates PowerVSSession of type *ibmpisession.IBMPISession +func createPowerVSSession(powerVSRegion string, powerVSZone string, debug bool) (session *ibmpisession.IBMPISession, err error) { + auth := getIAMAuth() + account, err := getAccount(auth) + + if err != nil { + return + } + + opt := &ibmpisession.IBMPIOptions{Authenticator: auth, + Debug: debug, + Region: powerVSRegion, + UserAccount: account, + Zone: powerVSZone} + + session, err = ibmpisession.NewIBMPISession(opt) + return +} + +// createVpcService ... +// creates VpcService of type *vpcv1.VpcV1 +func createVpcService(region string, infraID string) (v1 *vpcv1.VpcV1, err error) { + v1, err = vpcv1.NewVpcV1(&vpcv1.VpcV1Options{ + ServiceName: "vpcs", + Authenticator: getIAMAuth(), + URL: fmt.Sprintf("https://%s.iaas.cloud.ibm.com/v1", region), + }) + log.Log.WithName(infraID).Info("Created VPC Service for", "URL", v1.GetServiceURL()) + return +} + +// setupPowerVSCloudInstance ... +// takes care of setting up powervs cloud instance +func (infra *Infra) setupPowerVSCloudInstance(options *CreateInfraOptions) (err error) { + log.Log.WithName(options.InfraID).Info("Setting up PowerVS Cloud Instance ...") + var cloudInstance *resourcecontrollerv2.ResourceInstance + if options.PowerVSCloudInstanceID != "" { + log.Log.WithName(options.InfraID).Info("Validating PowerVS Cloud Instance", "id", options.PowerVSCloudInstanceID) + cloudInstance, err = validateCloudInstanceByID(options.PowerVSCloudInstanceID) + if err != nil { + return fmt.Errorf("error validating cloud instance id %s, %w", options.PowerVSCloudInstanceID, err) + } + } else { + cloudInstance, err = infra.createCloudInstance(options) + if err != nil { + return fmt.Errorf("error creating cloud instance: %w", err) + } + } + + if cloudInstance != nil { + infra.PowerVSCloudInstanceID = *cloudInstance.GUID + infra.Stats.CloudInstance.Status = *cloudInstance.State + + } + + if infra.PowerVSCloudInstanceID == "" { + return fmt.Errorf("unable to setup powervs cloud instance") + } + + log.Log.WithName(options.InfraID).Info("PowerVS Cloud Instance Ready", "id", infra.PowerVSCloudInstanceID) + return +} + +// setupVpc ... +// takes care of setting up vpc +func (infra *Infra) setupVpc(options *CreateInfraOptions, v1 *vpcv1.VpcV1) (err error) { + log.Log.WithName(options.InfraID).Info("Setting up VPC ...") + var vpc *vpcv1.VPC + if options.Vpc != "" { + log.Log.WithName(options.InfraID).Info("Validating VPC", "name", options.Vpc) + vpc, err = validateVpc(options.Vpc, infra.ResourceGroupID, v1) + if err != nil { + return + } + } else { + vpc, err = infra.createVpc(options, infra.ResourceGroupID, v1) + if err != nil { + return + } + } + + if vpc != nil { + infra.VpcName = *vpc.Name + infra.VpcID = *vpc.ID + infra.VpcCrn = *vpc.CRN + infra.VpcRoutingTableID = *vpc.DefaultRoutingTable.ID + infra.Stats.Vpc.Status = *vpc.Status + } + + if infra.VpcID == "" { + return fmt.Errorf("unable to setup vpc") + } + + log.Log.WithName(options.InfraID).Info("VPC Ready", "ID", infra.VpcID) + return +} + +// createVpc ... +// creates a new vpc with the infra name or will return an existing vpc +func (infra *Infra) createVpc(options *CreateInfraOptions, resourceGroupID string, v1 *vpcv1.VpcV1) (vpc *vpcv1.VPC, err error) { + var startTime time.Time + vpcName := fmt.Sprintf("%s-%s", options.InfraID, vpcNameSuffix) + vpc, err = validateVpc(vpcName, resourceGroupID, v1) + + // if vpc already exist use it or proceed with creating a new one, no need to validate err + if vpc != nil && *vpc.Name == vpcName { + log.Log.WithName(options.InfraID).Info("Using existing VPC", "name", vpcName) + return + } + + log.Log.WithName(options.InfraID).Info("Creating VPC ...") + addressPrefixManagement := "auto" + + vpcOption := &vpcv1.CreateVPCOptions{ + ResourceGroup: &vpcv1.ResourceGroupIdentity{ID: &resourceGroupID}, + Name: &vpcName, + AddressPrefixManagement: &addressPrefixManagement, + } + + startTime = time.Now() + vpc, _, err = v1.CreateVPC(vpcOption) + if err != nil { + return + } + + f := func() (cond bool, err error) { + + vpc, _, err = v1.GetVPC(&vpcv1.GetVPCOptions{ID: vpc.ID}) + if err != nil { + return + } + + if *vpc.Status == vpcAvailableState { + cond = true + return + } + return + } + + err = wait.PollImmediate(pollingInterval, vpcCreationTimeout, f) + + if !startTime.IsZero() && vpc != nil { + infra.Stats.Vpc.Duration.Duration = time.Since(startTime) + } + + return +} + +// setupVpcSubnet ... +// takes care of setting up subnet in the vpc +func (infra *Infra) setupVpcSubnet(options *CreateInfraOptions, v1 *vpcv1.VpcV1) (err error) { + log.Log.WithName(options.InfraID).Info("Setting up VPC Subnet ...") + + log.Log.WithName(options.InfraID).Info("Getting existing VPC Subnet info ...") + var subnet *vpcv1.Subnet + f := func(start string) (isDone bool, nextUrl string, err error) { + // check for existing subnets + listSubnetOpt := vpcv1.ListSubnetsOptions{ResourceGroupID: &infra.ResourceGroupID, RoutingTableID: &infra.VpcRoutingTableID} + if start != "" { + listSubnetOpt.Start = &start + } + + vpcSubnetL, _, err := v1.ListSubnets(&listSubnetOpt) + if err != nil { + return + } + + if vpcSubnetL == nil { + err = fmt.Errorf("subnet list returned is nil") + return + } + + if len(vpcSubnetL.Subnets) > 0 { + for _, sn := range vpcSubnetL.Subnets { + if *sn.VPC.ID == infra.VpcID { + infra.VpcSubnetName = *sn.Name + infra.VpcSubnetID = *sn.ID + subnet = &sn + isDone = true + return + } + } + } + + if vpcSubnetL.Next != nil && *vpcSubnetL.Next.Href != "" { + nextUrl = *vpcSubnetL.Next.Href + return + } + isDone = true + return + } + + // if subnet already exist use it or proceed with creating a new one, no need to validate err + _ = pagingHelper(f) + + if infra.VpcSubnetID == "" { + subnet, err = infra.createVpcSubnet(options, v1) + if err != nil { + return + } + infra.VpcSubnetName = *subnet.Name + infra.VpcSubnetID = *subnet.ID + } + + if subnet != nil { + infra.Stats.VpcSubnet.Status = *subnet.Status + } + + log.Log.WithName(options.InfraID).Info("VPC Subnet Ready", "ID", infra.VpcSubnetID) + return +} + +// createVpcSubnet ... +// creates a new subnet in vpc with the infra name or will return an existing subnet in the vpc +func (infra *Infra) createVpcSubnet(options *CreateInfraOptions, v1 *vpcv1.VpcV1) (subnet *vpcv1.Subnet, err error) { + log.Log.WithName(options.InfraID).Info("Create VPC Subnet ...") + var startTime time.Time + vpcIdent := &vpcv1.VPCIdentity{CRN: &infra.VpcCrn} + resourceGroupIdent := &vpcv1.ResourceGroupIdentity{ID: &infra.ResourceGroupID} + subnetName := fmt.Sprintf("%s-%s", options.InfraID, vpcSubnetNameSuffix) + ipVersion := "ipv4" + zones, _, err := v1.ListRegionZones(&vpcv1.ListRegionZonesOptions{RegionName: &options.VpcRegion}) + if err != nil { + return + } + + addressPrefixL, _, err := v1.ListVPCAddressPrefixes(&vpcv1.ListVPCAddressPrefixesOptions{VPCID: &infra.VpcID}) + if err != nil { + return + } + + // loop through all zones in given region and get respective address prefix and try to create subnet + // if subnet creation fails in first zone, try in other zones until succeeds + for _, zone := range zones.Zones { + + zoneIdent := &vpcv1.ZoneIdentity{Name: zone.Name} + + var ipv4CidrBlock *string + for _, addressPrefix := range addressPrefixL.AddressPrefixes { + if *zoneIdent.Name == *addressPrefix.Zone.Name { + ipv4CidrBlock = addressPrefix.CIDR + break + } + } + + subnetProto := &vpcv1.SubnetPrototype{VPC: vpcIdent, + Name: &subnetName, + ResourceGroup: resourceGroupIdent, + Zone: zoneIdent, + IPVersion: &ipVersion, + Ipv4CIDRBlock: ipv4CidrBlock, + } + + startTime = time.Now() + subnet, _, err = v1.CreateSubnet(&vpcv1.CreateSubnetOptions{SubnetPrototype: subnetProto}) + if err != nil { + continue + } + break + } + + if subnet == nil { + err = fmt.Errorf("CreateSubnet returned nil") + return + } + + f := func() (cond bool, err error) { + + subnet, _, err = v1.GetSubnet(&vpcv1.GetSubnetOptions{ID: subnet.ID}) + if err != nil { + return + } + + if *subnet.Status == vpcAvailableState { + cond = true + return + } + return + } + + err = wait.PollImmediate(pollingInterval, vpcCreationTimeout, f) + + if !startTime.IsZero() { + infra.Stats.VpcSubnet.Duration.Duration = time.Since(startTime) + } + + return +} + +// setupPowerVSCloudConnection ... +// takes care of setting up cloud connection in powervs +func (infra *Infra) setupPowerVSCloudConnection(options *CreateInfraOptions, session *ibmpisession.IBMPISession) (err error) { + log.Log.WithName(options.InfraID).Info("Setting up PowerVS Cloud Connection ...") + client := instance.NewIBMPICloudConnectionClient(context.Background(), session, infra.PowerVSCloudInstanceID) + var cloudConnID string + if options.PowerVSCloudConnection != "" { + log.Log.WithName(options.InfraID).Info("Validating PowerVS Cloud Connection", "name", options.PowerVSCloudConnection) + cloudConnID, err = validateCloudConnectionByName(options.PowerVSCloudConnection, client) + if err != nil { + return + } + } else { + cloudConnID, err = infra.createCloudConnection(options, client) + if err != nil { + return + } + } + if cloudConnID != "" { + infra.PowerVSCloudConnectionID = cloudConnID + } + + if infra.PowerVSCloudConnectionID == "" { + err = fmt.Errorf("unable to setup powervs cloud connection") + return + } + + log.Log.WithName(options.InfraID).Info("PowerVS Cloud Connection Ready", "id", infra.PowerVSCloudConnectionID) + return +} + +// createCloudConnection ... +// creates a new cloud connection with the infra name or will return an existing cloud connection +func (infra *Infra) createCloudConnection(options *CreateInfraOptions, client *instance.IBMPICloudConnectionClient) (cloudConnID string, err error) { + cloudConnName := fmt.Sprintf("%s-%s", options.InfraID, cloudConnNameSuffix) + + // validating existing cloud connection with the infra + cloudConnID, err = validateCloudConnectionInPowerVSZone(cloudConnName, client) + if err != nil { + return + } else if cloudConnID != "" { + // if exists, use that and from func isCloudConnectionReady() make the connection to dhcp private network and vpc if not exists already + log.Log.WithName(options.InfraID).Info("Using existing PowerVS Cloud Connection", "name", cloudConnName) + return + } + + log.Log.WithName(options.InfraID).Info("Creating PowerVS Cloud Connection ...") + + var speed int64 = defaultCloudConnSpeed + var vpcL []*models.CloudConnectionVPC + vpcCrn := infra.VpcCrn + vpcL = append(vpcL, &models.CloudConnectionVPC{VpcID: &vpcCrn}) + + cloudConnectionEndpointVPC := models.CloudConnectionEndpointVPC{Enabled: true, Vpcs: vpcL} + + cloudConn, cloudConnRespAccepted, err := client.Create(&models.CloudConnectionCreate{Name: &cloudConnName, GlobalRouting: true, Speed: &speed, Vpc: &cloudConnectionEndpointVPC}) + + if err != nil { + return + } + if cloudConn != nil { + cloudConnID = *cloudConn.CloudConnectionID + } else if cloudConnRespAccepted != nil { + cloudConnID = *cloudConnRespAccepted.CloudConnectionID + } else { + err = fmt.Errorf("could not get cloud connection id") + return + } + + return +} + +// setupPowerVSDhcp ... +// takes care of setting up dhcp in powervs +func (infra *Infra) setupPowerVSDhcp(options *CreateInfraOptions, session *ibmpisession.IBMPISession) (err error) { + log.Log.WithName(infra.ID).Info("Setting up PowerVS DHCP ...") + client := instance.NewIBMPIDhcpClient(context.Background(), session, infra.PowerVSCloudInstanceID) + + var dhcpServer *models.DHCPServerDetail + + dhcpServers, err := client.GetAll() + if err != nil { + return + } + + // only one dhcp server is allowed per cloud instance + // if already a dhcp server existing in cloud instance use that instead of creating a new one + if len(dhcpServers) > 0 { + for _, dhcp := range dhcpServers { + log.Log.WithName(infra.ID).Info("Using existing DHCP server present in cloud instance") + dhcpServer = &models.DHCPServerDetail{ID: dhcp.ID, Status: dhcp.Status, Network: dhcp.Network} + break + } + } else { + log.Log.WithName(infra.ID).Info("Creating PowerVS DhcpServer...") + dhcpServer, err = infra.createPowerVSDhcp(options, client) + if err != nil { + return + } + } + + if dhcpServer != nil { + infra.PowerVSDhcpID = *dhcpServer.ID + if *dhcpServer.Status == dhcpServiceActiveState && dhcpServer.Network != nil { + infra.PowerVSDhcpSubnetID = *dhcpServer.Network.ID + } + infra.Stats.DhcpService.Status = *dhcpServer.Status + } + + if infra.PowerVSDhcpID == "" && infra.PowerVSDhcpSubnetID == "" { + return fmt.Errorf("unable to setup powervs dhcp server and private subnet") + } + + log.Log.WithName(infra.ID).Info("PowerVS DHCP Server and Private Subnet Ready", "dhcpServerId", infra.PowerVSDhcpID, "dhcpPrivateSubnetId", infra.PowerVSDhcpSubnetID) + return +} + +// createPowerVSDhcp ... +// creates a new dhcp server in powervs +func (infra *Infra) createPowerVSDhcp(options *CreateInfraOptions, client *instance.IBMPIDhcpClient) (dhcpServer *models.DHCPServerDetail, err error) { + startTime := time.Now() + dhcp, err := client.Create(&models.DHCPServerCreate{CloudConnectionID: infra.PowerVSCloudConnectionID}) + if err != nil { + return + } + + if dhcp == nil { + err = fmt.Errorf("created dhcp server is nil") + return + } + + f := func() (cond bool, err error) { + dhcpServer, err = client.Get(*dhcp.ID) + if err != nil { + return + } + + if dhcpServer != nil { + log.Log.WithName(infra.ID).Info("Waiting for DhcpServer to up", "id", *dhcpServer.ID, "status", *dhcpServer.Status) + if *dhcpServer.Status == dhcpServiceActiveState { + cond = true + return + } + + if *dhcpServer.Status == dhcpServiceErrorState { + err = fmt.Errorf("dhcp service is in error state") + return + } + } + + return + } + + err = wait.PollImmediate(pollingInterval, dhcpServerCreationTimeout, f) + + if dhcpServer != nil { + infra.Stats.DhcpService.Duration.Duration = time.Since(startTime) + } + return +} + +// isCloudConnectionReady ... +//make sure cloud connection is connected with dhcp server private network and vpc, and it is in established state +func (infra *Infra) isCloudConnectionReady(options *CreateInfraOptions, session *ibmpisession.IBMPISession) (err error) { + log.Log.WithName(infra.ID).Info("Making sure PowerVS Cloud Connection is ready ...") + client := instance.NewIBMPICloudConnectionClient(context.Background(), session, infra.PowerVSCloudInstanceID) + jobClient := instance.NewIBMPIJobClient(context.Background(), session, infra.PowerVSCloudInstanceID) + var cloudConn *models.CloudConnection + + startTime := time.Now() + cloudConn, err = client.Get(infra.PowerVSCloudConnectionID) + if err != nil { + return + } + + // To ensure vpc and dhcp private subnet is attached to cloud connection + cloudConnNwOk := false + cloudConnVpcOk := false + + if cloudConn != nil { + for _, nw := range cloudConn.Networks { + if *nw.NetworkID == infra.PowerVSDhcpSubnetID { + cloudConnNwOk = true + } + } + + for _, vpc := range cloudConn.Vpc.Vpcs { + if *vpc.VpcID == infra.VpcCrn { + cloudConnVpcOk = true + } + } + } + + if !cloudConnVpcOk { + log.Log.WithName(infra.ID).Info("Updating VPC to cloud connection") + cloudConnUpdateOpt := models.CloudConnectionUpdate{} + + var vpcL []*models.CloudConnectionVPC + vpcCrn := infra.VpcCrn + vpcL = append(vpcL, &models.CloudConnectionVPC{VpcID: &vpcCrn}) + + cloudConnUpdateOpt.Vpc = &models.CloudConnectionEndpointVPC{Enabled: true, Vpcs: vpcL} + + enableGR := true + cloudConnUpdateOpt.GlobalRouting = &enableGR + + _, job, err := client.Update(*cloudConn.CloudConnectionID, &cloudConnUpdateOpt) + if err != nil { + log.Log.WithName(infra.ID).Error(err, "error updating cloud connection with vpc") + return fmt.Errorf("error updating cloud connection with vpc %w", err) + } + err = monitorPowerVsJob(*job.ID, jobClient, infra.PowerVSCloudInstanceID, cloudConnUpdateTimeout) + if err != nil { + log.Log.WithName(infra.ID).Error(err, "error attaching cloud connection with vpc") + return fmt.Errorf("error attaching cloud connection with dhcp subnet %w", err) + } + } + + if !cloudConnNwOk { + log.Log.WithName(infra.ID).Info("Adding DHCP private network to cloud connection") + _, job, err := client.AddNetwork(*cloudConn.CloudConnectionID, infra.PowerVSDhcpSubnetID) + if err != nil { + log.Log.WithName(infra.ID).Error(err, "error attaching cloud connection with dhcp subnet") + return fmt.Errorf("error attaching cloud connection with dhcp subnet %w", err) + } + err = monitorPowerVsJob(*job.ID, jobClient, infra.PowerVSCloudInstanceID, cloudConnUpdateTimeout) + if err != nil { + log.Log.WithName(infra.ID).Error(err, "error attaching cloud connection with dhcp subnet") + return fmt.Errorf("error attaching cloud connection with dhcp subnet %w", err) + } + } + + f := func() (cond bool, err error) { + cloudConn, err = client.Get(infra.PowerVSCloudConnectionID) + if err != nil { + return + } + + if cloudConn != nil { + log.Log.WithName(infra.ID).Info("Waiting for Cloud Connection to up", "id", cloudConn.CloudConnectionID, "status", cloudConn.LinkStatus) + if *cloudConn.LinkStatus == cloudConnectionEstablishedState { + cond = true + return + } + } + + return + } + + err = wait.PollImmediate(pollingInterval, cloudConnEstablishedStateTimeout, f) + if cloudConn != nil { + infra.Stats.CloudConnState.Duration.Duration = time.Since(startTime) + infra.Stats.CloudConnState.Status = *cloudConn.LinkStatus + } + if err == nil { + log.Log.WithName(infra.ID).Info("PowerVS Cloud Connection ready") + return + } + + return +} diff --git a/cmd/infra/powervs/destroy.go b/cmd/infra/powervs/destroy.go new file mode 100644 index 00000000000..47f2f435137 --- /dev/null +++ b/cmd/infra/powervs/destroy.go @@ -0,0 +1,484 @@ +package powervs + +import ( + "context" + "encoding/json" + "fmt" + "io/ioutil" + "k8s.io/apimachinery/pkg/util/errors" + "strings" + "time" + + "github.com/spf13/cobra" + "k8s.io/apimachinery/pkg/util/wait" + + "github.com/IBM-Cloud/power-go-client/clients/instance" + "github.com/IBM-Cloud/power-go-client/ibmpisession" + "github.com/IBM/platform-services-go-sdk/resourcecontrollerv2" + "github.com/IBM/vpc-go-sdk/vpcv1" + + "github.com/openshift/hypershift/cmd/log" +) + +const ( + // Time duration for monitoring the resource readiness + cloudInstanceDeletionTimeout = time.Minute * 10 + powerVSResourceDeletionTimeout = time.Minute * 5 + dhcpServerDeletionTimeout = time.Minute * 10 + + // Resource desired states + powerVSCloudInstanceRemovedState = "removed" + powerVSJobCompletedState = "completed" + powerVSJobFailedState = "failed" + dhcpInstanceShutOffState = "SHUTOFF" +) + +type DestroyInfraOptions struct { + InfraID string + InfrastructureJson string + ResourceGroup string + PowerVSRegion string + PowerVSZone string + PowerVSCloudInstanceID string + PowerVSDhcpID string + PowerVSCloudConnection string + VpcRegion string + Vpc string + Debug bool +} + +func NewDestroyCommand() *cobra.Command { + cmd := &cobra.Command{ + Use: "powervs", + Short: "Destroys PowerVS infrastructure resources for a cluster", + SilenceUsage: true, + } + + opts := DestroyInfraOptions{} + + cmd.Flags().StringVar(&opts.InfraID, "infra-id", opts.InfraID, "Cluster ID with which to tag AWS resources (required)") + cmd.Flags().StringVar(&opts.InfrastructureJson, "infrastructure-json", opts.InfrastructureJson, "Result of ./hypershift infra create powervs") + cmd.Flags().StringVar(&opts.ResourceGroup, "resource-group", opts.ResourceGroup, "IBM Cloud Resource Group") + cmd.Flags().StringVar(&opts.VpcRegion, "vpc-region", opts.VpcRegion, "IBM Cloud VPC Infra Region") + cmd.Flags().StringVar(&opts.Vpc, "vpc", opts.Vpc, "IBM Cloud VPC") + cmd.Flags().StringVar(&opts.PowerVSRegion, "powervs-region", opts.PowerVSRegion, "PowerVS Region") + cmd.Flags().StringVar(&opts.PowerVSZone, "powervs-zone", opts.PowerVSZone, "IBM Cloud PowerVS Zone") + cmd.Flags().StringVar(&opts.PowerVSCloudConnection, "powervs-cloud-connection", opts.PowerVSCloudConnection, "IBM Cloud PowerVS Cloud Connection") + cmd.Flags().StringVar(&opts.PowerVSCloudInstanceID, "powervs-cloud-instance-id", opts.PowerVSCloudInstanceID, "IBM PowerVS Cloud Instance ID") + cmd.Flags().BoolVar(&opts.Debug, "debug", opts.Debug, "Enabling this will result in debug logs will be printed") + + cmd.MarkFlagRequired("resource-group") + cmd.MarkFlagRequired("infra-id") + cmd.MarkFlagRequired("powervs-region") + cmd.MarkFlagRequired("powervs-zone") + cmd.MarkFlagRequired("vpc-region") + + // these options are only for development and testing purpose, user can destroy these resources by passing these flags + cmd.Flags().MarkHidden("vpc") + cmd.Flags().MarkHidden("powervs-cloud-connection") + cmd.Flags().MarkHidden("powervs-cloud-instance-id") + + cmd.RunE = func(cmd *cobra.Command, args []string) error { + if err := opts.Run(cmd.Context()); err != nil { + log.Log.Error(err, "Failed to destroy infrastructure") + return err + } + log.Log.Info("Successfully destroyed infrastructure") + return nil + } + + return cmd +} + +func (options *DestroyInfraOptions) Run(ctx context.Context) (err error) { + var infra *Infra + if len(options.InfrastructureJson) > 0 { + rawInfra, err := ioutil.ReadFile(options.InfrastructureJson) + if err != nil { + return fmt.Errorf("failed to read infra json file: %w", err) + } + infra = &Infra{} + if err = json.Unmarshal(rawInfra, infra); err != nil { + return fmt.Errorf("failed to load infra json: %w", err) + } + } + err = options.DestroyInfra(infra) + if err != nil { + return err + } + return nil +} + +// DestroyInfra ... +// infra destruction orchestration +func (options *DestroyInfraOptions) DestroyInfra(infra *Infra) (err error) { + log.Log.WithName(options.InfraID).Info("Destroy Infra Started") + + // if IBMCLOUD_API_KEY is not set, infra cannot be set up. + if cloudApiKey == "" { + return fmt.Errorf("IBMCLOUD_API_KEY not set") + } + + resourceGroupID, err := getResourceGroupID(options.ResourceGroup) + if err != nil { + return err + } + + var powerVsCloudInstanceID string + + serviceID, servicePlanID, err := getServiceInfo(powerVSService, powerVSServicePlan) + if err != nil { + return err + } + + // getting the powervs cloud instance id + if infra != nil && infra.PowerVSCloudInstanceID != "" { + powerVsCloudInstanceID = infra.PowerVSCloudInstanceID + } else if options.PowerVSCloudInstanceID != "" { + _, err := validateCloudInstanceByID(options.PowerVSCloudInstanceID) + if err != nil { + return err + } + powerVsCloudInstanceID = options.PowerVSCloudInstanceID + } else { + cloudInstance, err := validateCloudInstanceByName(fmt.Sprintf("%s-%s", options.InfraID, cloudInstanceNameSuffix), resourceGroupID, options.PowerVSZone, serviceID, servicePlanID) + if err != nil { + return err + } + powerVsCloudInstanceID = *cloudInstance.GUID + } + + session, err := createPowerVSSession(options.PowerVSRegion, options.PowerVSZone, options.Debug) + if err != nil { + return err + } + + v1, err := createVpcService(options.VpcRegion, options.InfraID) + if err != nil { + return err + } + errL := make([]error, 0) + + err = destroyPowerVsCloudConnection(options, infra, powerVsCloudInstanceID, session) + if err != nil { + errL = append(errL, fmt.Errorf("error destroying powervs cloud connection: %w", err)) + log.Log.WithName(options.InfraID).Error(err, "error destroying powervs cloud connection") + } + + err = destroyVpcSubnet(options, infra, resourceGroupID, v1, options.InfraID) + if err != nil { + errL = append(errL, fmt.Errorf("error destroying vpc subnet: %w", err)) + log.Log.WithName(options.InfraID).Error(err, "error destroying vpc subnet") + } + + err = destroyVpc(options, infra, resourceGroupID, v1, options.InfraID) + if err != nil { + errL = append(errL, fmt.Errorf("error destroying vpc: %w", err)) + log.Log.WithName(options.InfraID).Error(err, "error destroying vpc") + } + + err = destroyPowerVsDhcpServer(infra, powerVsCloudInstanceID, session, options.InfraID) + if err != nil { + errL = append(errL, fmt.Errorf("error destroying powervs dhcp server: %w", err)) + log.Log.WithName(options.InfraID).Error(err, "error destroying powervs dhcp server") + } + + err = destroyPowerVsCloudInstance(powerVsCloudInstanceID, options.InfraID) + if err != nil { + errL = append(errL, fmt.Errorf("error destroying powervs cloud instance: %w", err)) + log.Log.WithName(options.InfraID).Error(err, "error destroying powervs cloud instance") + } + + log.Log.WithName(options.InfraID).Info("Destroy Infra Completed") + + if err := errors.NewAggregate(errL); err != nil { + return fmt.Errorf("error in destroying infra: %w", err) + } + + return +} + +// destroyPowerVsCloudInstance ... +// destroying powervs cloud instance +func destroyPowerVsCloudInstance(cloudInstanceID string, infraID string) (err error) { + rcv2, err := resourcecontrollerv2.NewResourceControllerV2(&resourcecontrollerv2.ResourceControllerV2Options{Authenticator: getIAMAuth()}) + if err != nil { + return + } + + for retry := 0; retry < 5; retry++ { + log.Log.WithName(infraID).Info("Deleting PowerVS cloud instance", "id", cloudInstanceID) + _, err = rcv2.DeleteResourceInstance(&resourcecontrollerv2.DeleteResourceInstanceOptions{ID: &cloudInstanceID}) + + if err != nil { + log.Log.Error(err, "error in deleting powervs cloud instance") + continue + } + + f := func() (cond bool, err error) { + resourceInst, resp, err := rcv2.GetResourceInstance(&resourcecontrollerv2.GetResourceInstanceOptions{ID: &cloudInstanceID}) + if err != nil { + log.Log.WithName(infraID).Error(err, "error in querying deleted cloud instance", "resp", resp.String()) + return + } + + if resourceInst != nil { + if *resourceInst.State == powerVSCloudInstanceRemovedState { + cond = true + return + } + + log.Log.WithName(infraID).Info("Waiting for PowerVS cloud instance deletion", "status", *resourceInst.State, "lastOp", resourceInst.LastOperation) + } + + return + } + + err = wait.PollImmediate(pollingInterval, cloudInstanceDeletionTimeout, f) + if err == nil { + break + } + log.Log.WithName(infraID).Info("Retrying cloud instance deletion ...") + } + return +} + +// monitorPowerVsJob ... +// monitoring the submitted deletion job +func monitorPowerVsJob(id string, client *instance.IBMPIJobClient, infraID string, timeout time.Duration) (err error) { + + f := func() (cond bool, err error) { + job, err := client.Get(id) + log.Log.WithName(infraID).Info("Waiting for PowerVS job to complete", "id", id, "status", job.Status.State, "operation_action", *job.Operation.Action, "operation_target", *job.Operation.Target) + if err != nil { + return + } + if *job.Status.State == powerVSJobCompletedState || *job.Status.State == powerVSJobFailedState { + cond = true + return + } + return + } + + return wait.PollImmediate(pollingInterval, timeout, f) +} + +// destroyPowerVsCloudConnection ... +// destroying powervs cloud connection +func destroyPowerVsCloudConnection(options *DestroyInfraOptions, infra *Infra, cloudInstanceID string, session *ibmpisession.IBMPISession) (err error) { + client := instance.NewIBMPICloudConnectionClient(context.Background(), session, cloudInstanceID) + jobClient := instance.NewIBMPIJobClient(context.Background(), session, cloudInstanceID) + + if infra != nil && infra.PowerVSCloudConnectionID != "" { + return deletePowerVsCloudConnection(options, infra.PowerVSCloudConnectionID, client, jobClient) + } + + cloudConnL, err := client.GetAll() + if err != nil || cloudConnL == nil { + return + } + + if len(cloudConnL.CloudConnections) < 1 { + return fmt.Errorf("no cloud connection available to delete in powervs") + } + var cloudConnName string + if options.Vpc != "" { + cloudConnName = options.PowerVSCloudConnection + } else { + cloudConnName = fmt.Sprintf("%s-%s", options.InfraID, cloudConnNameSuffix) + } + + for _, cloudConn := range cloudConnL.CloudConnections { + if *cloudConn.Name == cloudConnName { + return deletePowerVsCloudConnection(options, *cloudConn.CloudConnectionID, client, jobClient) + } + } + return +} + +func deletePowerVsCloudConnection(options *DestroyInfraOptions, id string, client *instance.IBMPICloudConnectionClient, jobClient *instance.IBMPIJobClient) (err error) { + log.Log.WithName(options.InfraID).Info("Deleting cloud connection", "id", id) + deleteJob, err := client.Delete(id) + if err != nil { + return err + } + if deleteJob == nil { + return fmt.Errorf("error while deleting cloud connection, delete job returned is nil") + } + return monitorPowerVsJob(*deleteJob.ID, jobClient, options.InfraID, powerVSResourceDeletionTimeout) +} + +// destroyPowerVsDhcpServer ... +// destroying powervs dhcp server +func destroyPowerVsDhcpServer(infra *Infra, cloudInstanceID string, session *ibmpisession.IBMPISession, infraID string) (err error) { + client := instance.NewIBMPIDhcpClient(context.Background(), session, cloudInstanceID) + if infra != nil && infra.PowerVSDhcpID != "" { + log.Log.WithName(infraID).Info("Deleting DHCP server", "id", infra.PowerVSDhcpID) + return client.Delete(infra.PowerVSDhcpID) + } + + dhcpServers, err := client.GetAll() + if err != nil { + return + } + + if dhcpServers == nil || len(dhcpServers) < 1 { + return fmt.Errorf("no dhcp servers available to delete in powervs") + } + + dhcpID := *dhcpServers[0].ID + log.Log.WithName(infraID).Info("Deleting DHCP server", "id", dhcpID) + err = client.Delete(dhcpID) + if err != nil { + return + } + + instanceClient := instance.NewIBMPIInstanceClient(context.Background(), session, cloudInstanceID) + + // TO-DO: need to replace the logic of waiting for dhcp service deletion by using jobReference. + // jobReference is not yet added in SDK + f := func() (cond bool, err error) { + dhcpInstance, err := instanceClient.Get(dhcpID) + if err != nil { + errMsg := err.Error() + // when instance becomes does not exist, infra destroy can proceed + if strings.Contains(errMsg, "pvm-instance does not exist") { + err = nil + cond = true + } + return + } + + if dhcpInstance == nil { + err = fmt.Errorf("dhcpInstance is nil") + return + } + + log.Log.WithName(infraID).Info("Waiting for DhcpServer to destroy", "id", *dhcpInstance.PvmInstanceID, "status", *dhcpInstance.Status) + if *dhcpInstance.Status == dhcpInstanceShutOffState || *dhcpInstance.Status == dhcpServiceErrorState { + cond = true + return + } + + return + } + + err = wait.PollImmediate(pollingInterval, dhcpServerDeletionTimeout, f) + + return +} + +// destroyVpc ... +// destroying vpc +func destroyVpc(options *DestroyInfraOptions, infra *Infra, resourceGroupID string, v1 *vpcv1.VpcV1, infraID string) (err error) { + if infra != nil && infra.VpcID != "" { + return deleteVpc(infra.VpcID, v1, infraID) + } + + f := func(start string) (isDone bool, nextUrl string, err error) { + vpcListOpt := vpcv1.ListVpcsOptions{ResourceGroupID: &resourceGroupID} + if start != "" { + vpcListOpt.Start = &start + } + + vpcL, _, err := v1.ListVpcs(&vpcListOpt) + if err != nil { + return + } + + if vpcL == nil || len(vpcL.Vpcs) <= 0 { + err = fmt.Errorf("no vpcs available") + return + } + + var vpcName string + if options.Vpc != "" { + vpcName = options.Vpc + } else { + vpcName = fmt.Sprintf("%s-%s", options.InfraID, vpcNameSuffix) + } + + for _, vpc := range vpcL.Vpcs { + if *vpc.Name == vpcName && strings.Contains(*vpc.CRN, options.VpcRegion) { + err = deleteVpc(*vpc.ID, v1, infraID) + isDone = true + return + } + } + if vpcL.Next != nil && *vpcL.Next.Href != "" { + nextUrl = *vpcL.Next.Href + return + } + isDone = true + return + } + + return pagingHelper(f) +} + +// deleteVpc ... +// deletes the vpc id passed +func deleteVpc(id string, v1 *vpcv1.VpcV1, infraID string) (err error) { + log.Log.WithName(infraID).Info("Deleting VPC", "id", id) + _, err = v1.DeleteVPC(&vpcv1.DeleteVPCOptions{ID: &id}) + return err +} + +// destroyVpcSubnet ... +// destroying vpc subnet +func destroyVpcSubnet(options *DestroyInfraOptions, infra *Infra, resourceGroupID string, v1 *vpcv1.VpcV1, infraID string) (err error) { + if infra != nil && infra.VpcSubnetID != "" { + return deleteVpcSubnet(infra.VpcSubnetID, v1, infraID) + } + + f := func(start string) (isDone bool, nextUrl string, err error) { + + listSubnetOpt := vpcv1.ListSubnetsOptions{ResourceGroupID: &resourceGroupID} + if start != "" { + listSubnetOpt.Start = &start + } + subnetL, _, err := v1.ListSubnets(&listSubnetOpt) + if err != nil { + return + } + + if subnetL == nil || len(subnetL.Subnets) <= 0 { + err = fmt.Errorf("no subnets available") + return + } + + var vpcName string + if options.Vpc != "" { + vpcName = options.Vpc + } else { + vpcName = fmt.Sprintf("%s-%s", options.InfraID, vpcNameSuffix) + } + + for _, subnet := range subnetL.Subnets { + if *subnet.VPC.Name == vpcName && strings.Contains(*subnet.Zone.Name, options.VpcRegion) { + err = deleteVpcSubnet(*subnet.ID, v1, infraID) + isDone = true + return + } + } + + // For paging over next set of resources getting the start token and passing it for next iteration + if subnetL.Next != nil && *subnetL.Next.Href != "" { + nextUrl = *subnetL.Next.Href + return + } + + isDone = true + return + } + + return pagingHelper(f) +} + +// deleteVpcSubnet ... +// deletes the subnet id passed +func deleteVpcSubnet(id string, v1 *vpcv1.VpcV1, infraID string) (err error) { + log.Log.WithName(infraID).Info("Deleting VPC subnet", "subnetId", id) + _, err = v1.DeleteSubnet(&vpcv1.DeleteSubnetOptions{ID: &id}) + return err +} diff --git a/cmd/infra/powervs/util.go b/cmd/infra/powervs/util.go new file mode 100644 index 00000000000..91c6c70c07c --- /dev/null +++ b/cmd/infra/powervs/util.go @@ -0,0 +1,54 @@ +package powervs + +import ( + "fmt" + "net/url" +) + +// getStartToken ... +// parses the given url string and gets the 'start' query param +func getStartToken(nextUrlS string) (start string, err error) { + nextUrl, err := url.Parse(nextUrlS) + if err != nil || nextUrl == nil { + err = fmt.Errorf("could not parse next url for getting next resources %w", err) + return + } + + start = nextUrl.Query().Get("start") + return +} + +// pagingHelper ... +// while listing resources, can use this to get the start token for getting the next set of resources for processing +// start token will get fetched from nextUrl returned by f and passed to the func f. +// f should take start as param and return three values isDone bool, nextUrl string, e error. +// isDone - represents no need to iterate for getting next set of resources. +// nextUrl - if nextUrl is present, will try to get the start token and pass it to f for next set of resource processing. +// e - if e is not nil, will break and return the error. +func pagingHelper(f func(string) (bool, string, error)) (err error) { + start := "" + for { + isDone, nextUrl, e := f(start) + + if e != nil { + err = e + break + } + + if isDone { + break + } + + // for paging over next set of resources getting the start token + if nextUrl != "" { + start, err = getStartToken(nextUrl) + if err != nil { + break + } + } else { + break + } + } + + return +} diff --git a/cmd/infra/powervs/validate.go b/cmd/infra/powervs/validate.go new file mode 100644 index 00000000000..ce4cabecbf2 --- /dev/null +++ b/cmd/infra/powervs/validate.go @@ -0,0 +1,191 @@ +package powervs + +import ( + "errors" + "fmt" + "github.com/IBM-Cloud/power-go-client/clients/instance" + "github.com/IBM/platform-services-go-sdk/resourcecontrollerv2" + "github.com/IBM/vpc-go-sdk/vpcv1" +) + +var ( + errorCCNotFound = errors.New("cloud connection not found") +) + +// validateCloudInstanceByID ... +// validates cloud instance's existence by id +func validateCloudInstanceByID(cloudInstanceID string) (resourceInstance *resourcecontrollerv2.ResourceInstance, err error) { + rcv2, err := resourcecontrollerv2.NewResourceControllerV2(&resourcecontrollerv2.ResourceControllerV2Options{Authenticator: getIAMAuth()}) + if err != nil { + return + } + + resourceInstance, _, err = rcv2.GetResourceInstance(&resourcecontrollerv2.GetResourceInstanceOptions{ID: &cloudInstanceID}) + if err != nil { + return + } + + if resourceInstance == nil { + err = fmt.Errorf("%s cloud instance not found", cloudInstanceID) + return + } + + if *resourceInstance.State != "active" { + err = fmt.Errorf("provided cloud instance id is not in active state, current state: %s", *resourceInstance.State) + return + } + + return +} + +// validateCloudInstanceByName ... +// validates cloud instance's existence by name +func validateCloudInstanceByName(cloudInstance string, resourceGroupID string, powerVsZone string, serviceID string, servicePlanID string) (resourceInstance *resourcecontrollerv2.ResourceInstance, err error) { + rcv2, err := resourcecontrollerv2.NewResourceControllerV2(&resourcecontrollerv2.ResourceControllerV2Options{Authenticator: getIAMAuth()}) + if err != nil { + return + } + + f := func(start string) (isDone bool, nextUrl string, err error) { + listResourceInstOpt := resourcecontrollerv2.ListResourceInstancesOptions{ + Name: &cloudInstance, + ResourceGroupID: &resourceGroupID, + ResourceID: &serviceID, + ResourcePlanID: &servicePlanID} + + if start != "" { + listResourceInstOpt.Start = &start + } + + resourceInstanceL, _, err := rcv2.ListResourceInstances(&listResourceInstOpt) + + if err != nil { + return + } + + for _, resourceIns := range resourceInstanceL.Resources { + if *resourceIns.Name == cloudInstance && *resourceIns.RegionID == powerVsZone { + resourceInstance = &resourceIns + isDone = true + return + } + } + + // For paging over next set of resources getting the start token + if resourceInstanceL.NextURL != nil && *resourceInstanceL.NextURL != "" { + nextUrl = *resourceInstanceL.NextURL + return + } + + isDone = true + return + } + + err = pagingHelper(f) + if err != nil { + return + } + + if resourceInstance == nil { + err = fmt.Errorf("%s cloud instance not found", cloudInstance) + return + } + + if *resourceInstance.State != "active" { + err = fmt.Errorf("provided cloud instance id is not in active state, current state: %s", *resourceInstance.State) + return + } + return +} + +// validateVpc ... +// validates vpc's existence by name +func validateVpc(vpcName string, resourceGroupID string, v1 *vpcv1.VpcV1) (vpc *vpcv1.VPC, err error) { + f := func(start string) (isDone bool, nextUrl string, err error) { + vpcListOpt := vpcv1.ListVpcsOptions{ResourceGroupID: &resourceGroupID} + if start != "" { + vpcListOpt.Start = &start + } + vpcList, _, err := v1.ListVpcs(&vpcListOpt) + if err != nil { + return + } + for _, v := range vpcList.Vpcs { + if *v.Name == vpcName { + vpc = &v + isDone = true + return + } + } + + if vpcList.Next != nil && *vpcList.Next.Href != "" { + nextUrl = *vpcList.Next.Href + return + } + + isDone = true + return + } + err = pagingHelper(f) + if err != nil { + return + } + + if vpc != nil { + return + } + err = fmt.Errorf("%s vpc not found", vpcName) + return +} + +// listAndGetCloudConnection ... helper func +// will list the cloud connection and return the matched cloud connection id and total cloud connection count +func listAndGetCloudConnection(cloudConnName string, client *instance.IBMPICloudConnectionClient) (cloudConnectionCount int, cloudConnID string, err error) { + cloudConnL, err := client.GetAll() + if err != nil { + return + } + + if cloudConnL == nil { + err = fmt.Errorf("cloud connection list returned is nil") + return + } + + cloudConnectionCount = len(cloudConnL.CloudConnections) + for _, cc := range cloudConnL.CloudConnections { + if cc != nil && *cc.Name == cloudConnName { + cloudConnID = *cc.CloudConnectionID + return + } + } + + err = errorCCNotFound + return +} + +// validateCloudConnectionByName ... +// validates cloud connection's existence by name +func validateCloudConnectionByName(name string, client *instance.IBMPICloudConnectionClient) (cloudConnID string, err error) { + _, cloudConnID, err = listAndGetCloudConnection(name, client) + return +} + +// validateCloudConnectionInPowerVSZone ... +// while creating a new cloud connection this func validates whether to create a new cloud connection +// with respect to powervs zone's existing cloud connections +func validateCloudConnectionInPowerVSZone(name string, client *instance.IBMPICloudConnectionClient) (cloudConnID string, err error) { + cloudConnCount, cloudConnID, err := listAndGetCloudConnection(name, client) + + if err != nil && err != errorCCNotFound { + err = fmt.Errorf("failed to list cloud connections %w", err) + return + } + + if cloudConnCount == 2 || (cloudConnCount == 1 && cloudConnID == "") { + err = fmt.Errorf("powervs zone has more than one cloud connection, make sure only one cloud connection present per powervs zone") + } else { + err = nil + } + + return +} diff --git a/cmd/install/assets/assets.go b/cmd/install/assets/assets.go index 143ffc1807b..ce792416e8e 100644 --- a/cmd/install/assets/assets.go +++ b/cmd/install/assets/assets.go @@ -34,7 +34,13 @@ var capiResources = map[string]string{ "cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsclusters.yaml": "v1beta1", "cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachines.yaml": "v1beta1", "cluster-api-provider-aws/infrastructure.cluster.x-k8s.io_awsmachinetemplates.yaml": "v1beta1", - "cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml": "v1alpha4", + "cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsclusters.yaml": "v1beta1", + "cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsmachines.yaml": "v1beta1", + "cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsimages.yaml": "v1beta1", + "cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsmachinetemplates.yaml": "v1beta1", + "cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml": "v1beta1", + "cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml": "v1beta1", + "cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml": "v1beta1", "hypershift-operator/hypershift.openshift.io_hostedcontrolplanes.yaml": "v1alpha1", "cluster-api-provider-kubevirt/infrastructure.cluster.x-k8s.io_kubevirtclusters.yaml": "v1alpha1", "cluster-api-provider-kubevirt/infrastructure.cluster.x-k8s.io_kubevirtmachines.yaml": "v1alpha1", diff --git a/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsclusters.yaml b/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsclusters.yaml index cfc9b795820..1cb2bdd7ebe 100644 --- a/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsclusters.yaml +++ b/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsclusters.yaml @@ -57,14 +57,17 @@ spec: properties: id: description: ID of resource + minLength: 1 type: string name: description: Name of resource + minLength: 1 type: string type: object serviceInstanceID: description: ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed + minLength: 1 type: string required: - network diff --git a/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsimages.yaml b/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsimages.yaml new file mode 100644 index 00000000000..6c9b396ac8f --- /dev/null +++ b/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsimages.yaml @@ -0,0 +1,160 @@ + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.5.0 + creationTimestamp: null + name: ibmpowervsimages.infrastructure.cluster.x-k8s.io +spec: + group: infrastructure.cluster.x-k8s.io + names: + kind: IBMPowerVSImage + listKind: IBMPowerVSImageList + plural: ibmpowervsimages + singular: ibmpowervsimage + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: PowerVS image state + jsonPath: .status.imageState + name: State + type: string + - description: Image is ready for IBM PowerVS instances + jsonPath: .status.ready + name: Ready + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: IBMPowerVSImage is the Schema for the ibmpowervsimages API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: IBMPowerVSImageSpec defines the desired state of IBMPowerVSImage + properties: + bucket: + description: Cloud Object Storage bucket name; bucket-name[/optional/folder] + type: string + clusterName: + description: ClusterName is the name of the Cluster this object belongs + to. + minLength: 1 + type: string + deletePolicy: + default: delete + description: DeletePolicy defines the policy used to identify images + to be preserved beyond the lifecycle of associated cluster. + enum: + - delete + - retain + type: string + object: + description: Cloud Object Storage image filename + type: string + region: + description: Cloud Object Storage region + type: string + serviceInstanceID: + description: ServiceInstanceID is the id of the power cloud instance + where the image will get imported + type: string + storageType: + default: tier1 + description: Type of storage, storage pool with the most available + space will be selected + enum: + - tier1 + - tier3 + type: string + required: + - bucket + - clusterName + - object + - region + - serviceInstanceID + type: object + status: + description: IBMPowerVSImageStatus defines the observed state of IBMPowerVSImage + properties: + conditions: + description: Conditions defines current service state of the IBMPowerVSImage. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + imageID: + description: ImageID is the id of the imported image + type: string + imageState: + description: ImageState is the status of the imported image + type: string + jobID: + description: JobID is the job ID of an import operation + type: string + ready: + description: Ready is true when the provider resource is ready. + type: boolean + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsmachines.yaml b/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsmachines.yaml index f16b585c531..97d504d8780 100644 --- a/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsmachines.yaml +++ b/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsmachines.yaml @@ -59,9 +59,21 @@ spec: properties: id: description: ID of resource + minLength: 1 type: string name: description: Name of resource + minLength: 1 + type: string + type: object + imageRef: + description: ImageRef is an optional reference to a provider-specific + resource that holds the details for provisioning the Image for a + Cluster. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' type: string type: object memory: @@ -73,9 +85,11 @@ spec: properties: id: description: ID of resource + minLength: 1 type: string name: description: Name of resource + minLength: 1 type: string type: object procType: @@ -92,6 +106,7 @@ spec: serviceInstanceID: description: ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed + minLength: 1 type: string sshKey: description: SSHKey is the name of the SSH key pair provided to the @@ -101,13 +116,8 @@ spec: description: SysType is the System type used to host the vsi type: string required: - - image - - memory - network - - procType - - processors - serviceInstanceID - - sysType type: object status: description: IBMPowerVSMachineStatus defines the observed state of IBMPowerVSMachine @@ -129,6 +139,81 @@ spec: - type type: object type: array + conditions: + description: Conditions defines current service state of the IBMPowerVSMachine. + items: + description: Condition defines an observation of a Cluster API resource + operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. This should be when the underlying condition changed. + If that is not known, then using the time when the API field + changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not this + field is considered a guaranteed API. This field may not be + empty. + type: string + severity: + description: Severity provides an explicit classification of + Reason code, so the users or machines can immediately understand + the current situation and act accordingly. The Severity field + MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be useful + (see .node.status.conditions), the ability to deconflict is + important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + failureMessage: + description: "FailureMessage will be set in the event that there is + a terminal problem reconciling the Machine and will contain a more + verbose string suitable for logging and human consumption. \n This + field should not be set for transitive errors that a controller + faces that are expected to be fixed automatically over time (like + service outages), but instead indicate that something is fundamentally + wrong with the Machine's spec or the configuration of the controller, + and that manual intervention is required. Examples of terminal errors + would be invalid combinations of settings in the spec, values that + are unsupported by the controller, or the responsible controller + itself being critically misconfigured. \n Any transient errors that + occur during the reconciliation of Machines can be added as events + to the Machine object and/or logged in the controller's output." + type: string + failureReason: + description: "FailureReason will be set in the event that there is + a terminal problem reconciling the Machine and will contain a succinct + value suitable for machine interpretation. \n This field should + not be set for transitive errors that a controller faces that are + expected to be fixed automatically over time (like service outages), + but instead indicate that something is fundamentally wrong with + the Machine's spec or the configuration of the controller, and that + manual intervention is required. Examples of terminal errors would + be invalid combinations of settings in the spec, values that are + unsupported by the controller, or the responsible controller itself + being critically misconfigured. \n Any transient errors that occur + during the reconciliation of Machines can be added as events to + the Machine object and/or logged in the controller's output." + type: string fault: description: Fault will report if any fault messages for the vsi type: string @@ -143,8 +228,12 @@ spec: ready: description: Ready is true when the provider resource is ready. type: boolean - required: - - instanceState + region: + description: Region specifies the Power VS Service instance region + type: string + zone: + description: Zone specifies the Power VS Service instance zone + type: string type: object type: object served: true diff --git a/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsmachinetemplates.yaml b/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsmachinetemplates.yaml index d7bca1c9a5d..2abf36cadae 100644 --- a/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsmachinetemplates.yaml +++ b/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmpowervsmachinetemplates.yaml @@ -52,9 +52,21 @@ spec: properties: id: description: ID of resource + minLength: 1 type: string name: description: Name of resource + minLength: 1 + type: string + type: object + imageRef: + description: ImageRef is an optional reference to a provider-specific + resource that holds the details for provisioning the Image + for a Cluster. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' type: string type: object memory: @@ -66,9 +78,11 @@ spec: properties: id: description: ID of resource + minLength: 1 type: string name: description: Name of resource + minLength: 1 type: string type: object procType: @@ -85,6 +99,7 @@ spec: serviceInstanceID: description: ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed + minLength: 1 type: string sshKey: description: SSHKey is the name of the SSH key pair provided @@ -94,13 +109,8 @@ spec: description: SysType is the System type used to host the vsi type: string required: - - image - - memory - network - - procType - - processors - serviceInstanceID - - sysType type: object required: - spec diff --git a/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml b/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml index a255172bead..f9c2b3759cb 100644 --- a/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml +++ b/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmvpcmachines.yaml @@ -80,7 +80,6 @@ spec: type: string required: - image - - profile - zone type: object status: diff --git a/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml b/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml index a139766a2d2..60f343de84b 100644 --- a/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml +++ b/cmd/install/assets/cluster-api-provider-ibmcloud/infrastructure.cluster.x-k8s.io_ibmvpcmachinetemplates.yaml @@ -87,7 +87,6 @@ spec: type: string required: - image - - profile - zone type: object required: diff --git a/cmd/install/assets/hypershift-operator/hypershift.openshift.io_hostedclusters.yaml b/cmd/install/assets/hypershift-operator/hypershift.openshift.io_hostedclusters.yaml index 04b7cce14f5..00340451bcb 100644 --- a/cmd/install/assets/hypershift-operator/hypershift.openshift.io_hostedclusters.yaml +++ b/cmd/install/assets/hypershift-operator/hypershift.openshift.io_hostedclusters.yaml @@ -654,6 +654,107 @@ spec: provider within IBM Cloud. type: string type: object + powervs: + description: IBMCloud defines IBMCloud specific settings for components + properties: + controlPlaneOperatorCreds: + description: "ControlPlaneOperatorCreds is a reference to + a secret containing cloud credentials with permissions matching + the control-plane-operator policy. The secret should have + exactly one key, `credentials`, whose value is an AWS credentials + file. \n TODO(dan): document the \"control plane operator + policy\"" + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + kubeCloudControllerCreds: + description: "KubeCloudControllerCreds is a reference to a + secret containing cloud credentials with permissions matching + the cloud controller policy. The secret should have exactly + one key, `credentials`, whose value is an AWS credentials + file. \n TODO(dan): document the \"cloud controller policy\"" + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + nodePoolManagementCreds: + description: "NodePoolManagementCreds is a reference to a + secret containing cloud credentials with permissions matching + the node pool management policy. The secret should have + exactly one key, `credentials`, whose value is an AWS credentials + file. \n TODO(dan): document the \"node pool management + policy\"" + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + region: + description: Region is the IBMCloud region in which the cluster + resides. This configures the OCP control plane cloud integrations, + and is used by NodePool to resolve the correct boot image + for a given release. + type: string + resourceGroup: + description: ResourceGroup is the IBMCloud Resource Group + in which the cluster resides. If not specified then default + resource group of the account will be used. + type: string + serviceInstanceID: + description: ServiceInstanceID is the ServiceInstance to use + for control plane cloud resources. + type: string + subnet: + description: Subnet is the subnet to use for control plane + cloud resources. + properties: + id: + description: ID of resource + type: string + name: + description: Name of resource + type: string + type: object + vpc: + description: VPC specifies IBM Cloud PowerVS Load Balancing + configuration for the control plane. + properties: + name: + description: Name for VPC to used for all the service + load balancer. + type: string + region: + description: Region is the IBMCloud region in which VPC + gets created, this VPC used for all the ingress traffic + into the OCP cluster. + type: string + subnet: + description: Subnet is the subnet to use for load balancer. + type: string + zone: + description: Zone is the availability zone where load + balancer cloud resources are created. + type: string + required: + - name + - region + type: object + zone: + description: Zone is the availability zone where control plane + cloud resources are created. + type: string + required: + - controlPlaneOperatorCreds + - kubeCloudControllerCreds + - nodePoolManagementCreds + - region + type: object type: description: Type is the type of infrastructure provider for the cluster. @@ -664,6 +765,7 @@ spec: - Agent - KubeVirt - Azure + - PowerVS type: string required: - type diff --git a/cmd/install/assets/hypershift-operator/hypershift.openshift.io_hostedcontrolplanes.yaml b/cmd/install/assets/hypershift-operator/hypershift.openshift.io_hostedcontrolplanes.yaml index d4e0cd18659..cafaf0c0558 100644 --- a/cmd/install/assets/hypershift-operator/hypershift.openshift.io_hostedcontrolplanes.yaml +++ b/cmd/install/assets/hypershift-operator/hypershift.openshift.io_hostedcontrolplanes.yaml @@ -562,6 +562,107 @@ spec: provider within IBM Cloud. type: string type: object + powervs: + description: IBMCloud defines IBMCloud specific settings for components + properties: + controlPlaneOperatorCreds: + description: "ControlPlaneOperatorCreds is a reference to + a secret containing cloud credentials with permissions matching + the control-plane-operator policy. The secret should have + exactly one key, `credentials`, whose value is an AWS credentials + file. \n TODO(dan): document the \"control plane operator + policy\"" + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + kubeCloudControllerCreds: + description: "KubeCloudControllerCreds is a reference to a + secret containing cloud credentials with permissions matching + the cloud controller policy. The secret should have exactly + one key, `credentials`, whose value is an AWS credentials + file. \n TODO(dan): document the \"cloud controller policy\"" + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + nodePoolManagementCreds: + description: "NodePoolManagementCreds is a reference to a + secret containing cloud credentials with permissions matching + the node pool management policy. The secret should have + exactly one key, `credentials`, whose value is an AWS credentials + file. \n TODO(dan): document the \"node pool management + policy\"" + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + region: + description: Region is the IBMCloud region in which the cluster + resides. This configures the OCP control plane cloud integrations, + and is used by NodePool to resolve the correct boot image + for a given release. + type: string + resourceGroup: + description: ResourceGroup is the IBMCloud Resource Group + in which the cluster resides. If not specified then default + resource group of the account will be used. + type: string + serviceInstanceID: + description: ServiceInstanceID is the ServiceInstance to use + for control plane cloud resources. + type: string + subnet: + description: Subnet is the subnet to use for control plane + cloud resources. + properties: + id: + description: ID of resource + type: string + name: + description: Name of resource + type: string + type: object + vpc: + description: VPC specifies IBM Cloud PowerVS Load Balancing + configuration for the control plane. + properties: + name: + description: Name for VPC to used for all the service + load balancer. + type: string + region: + description: Region is the IBMCloud region in which VPC + gets created, this VPC used for all the ingress traffic + into the OCP cluster. + type: string + subnet: + description: Subnet is the subnet to use for load balancer. + type: string + zone: + description: Zone is the availability zone where load + balancer cloud resources are created. + type: string + required: + - name + - region + type: object + zone: + description: Zone is the availability zone where control plane + cloud resources are created. + type: string + required: + - controlPlaneOperatorCreds + - kubeCloudControllerCreds + - nodePoolManagementCreds + - region + type: object type: description: Type is the type of infrastructure provider for the cluster. @@ -572,6 +673,7 @@ spec: - Agent - KubeVirt - Azure + - PowerVS type: string required: - type diff --git a/cmd/install/assets/hypershift-operator/hypershift.openshift.io_nodepools.yaml b/cmd/install/assets/hypershift-operator/hypershift.openshift.io_nodepools.yaml index a26b8fc56bb..f83b8c363c0 100644 --- a/cmd/install/assets/hypershift-operator/hypershift.openshift.io_nodepools.yaml +++ b/cmd/install/assets/hypershift-operator/hypershift.openshift.io_nodepools.yaml @@ -4775,6 +4775,59 @@ spec: type: object type: object type: object + powervs: + description: PowerVS specifies the configuration used when using + IBMCloud PowerVS platform. + properties: + deletePolicy: + description: DeletePolicy for the image + type: string + image: + description: Image used for deploying the nodes + properties: + id: + description: ID of resource + type: string + name: + description: Name of resource + type: string + type: object + memory: + description: Memory specifies the amount of memory specified + in GBs + type: string + procType: + description: ProcType (dedicated, shared, capped) + type: string + processors: + description: Processors specifies the number of processors + allocated + type: string + serviceInstanceID: + description: ServiceInstanceID is the ServiceInstance to use + for control plane cloud resources. + type: string + storageType: + description: StorageType for the image and nodes + type: string + subnet: + description: Subnet is the subnet to use for control plane + cloud resources. + properties: + id: + description: ID of resource + type: string + name: + description: Name of resource + type: string + type: object + sysType: + description: 'SysType used to host the instance(e.g: s922, + e980, e880)' + type: string + required: + - serviceInstanceID + type: object type: description: Type specifies the platform name. enum: @@ -4784,6 +4837,7 @@ spec: - Agent - KubeVirt - Azure + - PowerVS type: string required: - type diff --git a/docs/content/reference/api.md b/docs/content/reference/api.md index c7e1f12959a..ae3e5ebffff 100644 --- a/docs/content/reference/api.md +++ b/docs/content/reference/api.md @@ -4185,7 +4185,8 @@ Value must be one of: "Azure", "IBMCloud", "KubeVirt", -"None" +"None", +"PowerVS"

@@ -4256,6 +4257,20 @@ AzureNodePoolPlatform + + +powervs
+ + +PowerVSNodePoolPlatform + + + + +(Optional) +

PowerVS specifies the configuration used when using IBMCloud PowerVS platform.

+ + ###NodePoolSpec { #hypershift.openshift.io/v1alpha1.NodePoolSpec } @@ -4604,7 +4619,8 @@ Value must be one of: "Azure", "IBMCloud", "KubeVirt", -"None" +"None", +"PowerVS"

@@ -4662,6 +4678,20 @@ AzurePlatformSpec

Azure defines azure specific settings

+ + +powervs
+ + +PowerVSPlatformSpec + + + + +(Optional) +

IBMCloud defines IBMCloud specific settings for components

+ + ###PlatformType { #hypershift.openshift.io/v1alpha1.PlatformType } @@ -4698,8 +4728,398 @@ AzurePlatformSpec

"None"

NonePlatform represents user supplied (e.g. bare metal) infrastructure.

+

"PowerVS"

+

PowerVSPlatform represents PowerVS infrastructure.

+ +###PowerVSNodePoolPlatform { #hypershift.openshift.io/v1alpha1.PowerVSNodePoolPlatform } +

+(Appears on: +NodePoolPlatform) +

+

+

PowerVSNodePoolPlatform specifies the configuration of a NodePool when operating +on IBMCloud PowerVS platform.

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldDescription
+serviceInstanceID
+ +string + +
+

ServiceInstanceID is the ServiceInstance to use for control plane cloud resources.

+
+sysType
+ +string + +
+(Optional) +

SysType used to host the instance(e.g: s922, e980, e880)

+
+procType
+ +string + +
+(Optional) +

ProcType (dedicated, shared, capped)

+
+processors
+ +string + +
+(Optional) +

Processors specifies the number of processors allocated

+
+memory
+ +string + +
+(Optional) +

Memory specifies the amount of memory specified in GBs

+
+image
+ + +PowerVSResourceReference + + +
+(Optional) +

Image used for deploying the nodes

+
+storageType
+ +string + +
+(Optional) +

StorageType for the image and nodes

+
+subnet
+ + +PowerVSResourceReference + + +
+(Optional) +

Subnet is the subnet to use for control plane cloud resources.

+
+deletePolicy
+ +string + +
+(Optional) +

DeletePolicy for the image

+
+###PowerVSPlatformSpec { #hypershift.openshift.io/v1alpha1.PowerVSPlatformSpec } +

+(Appears on: +PlatformSpec) +

+

+

PowerVSPlatformSpec defines IBMCloud PowerVS specific settings for components

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FieldDescription
+resourceGroup
+ +string + +
+

ResourceGroup is the IBMCloud Resource Group in which the cluster resides. If not +specified then default resource group of the account will be used.

+
+region
+ +string + +
+

Region is the IBMCloud region in which the cluster resides. This configures the +OCP control plane cloud integrations, and is used by NodePool to resolve +the correct boot image for a given release.

+
+zone
+ +string + +
+

Zone is the availability zone where control plane cloud resources are +created.

+
+subnet
+ + +PowerVSResourceReference + + +
+(Optional) +

Subnet is the subnet to use for control plane cloud resources.

+
+serviceInstanceID
+ +string + +
+

ServiceInstanceID is the ServiceInstance to use for control plane cloud resources.

+
+vpc
+ + +PowerVSVPC + + +
+

VPC specifies IBM Cloud PowerVS Load Balancing configuration for the control +plane.

+
+kubeCloudControllerCreds
+ + +Kubernetes core/v1.LocalObjectReference + + +
+

KubeCloudControllerCreds is a reference to a secret containing cloud +credentials with permissions matching the cloud controller policy. The +secret should have exactly one key, credentials, whose value is an AWS +credentials file.

+

TODO(dan): document the “cloud controller policy”

+
+nodePoolManagementCreds
+ + +Kubernetes core/v1.LocalObjectReference + + +
+

NodePoolManagementCreds is a reference to a secret containing cloud +credentials with permissions matching the node pool management policy. The +secret should have exactly one key, credentials, whose value is an AWS +credentials file.

+

TODO(dan): document the “node pool management policy”

+
+controlPlaneOperatorCreds
+ + +Kubernetes core/v1.LocalObjectReference + + +
+

ControlPlaneOperatorCreds is a reference to a secret containing cloud +credentials with permissions matching the control-plane-operator policy. +The secret should have exactly one key, credentials, whose value is +an AWS credentials file.

+

TODO(dan): document the “control plane operator policy”

+
+###PowerVSResourceReference { #hypershift.openshift.io/v1alpha1.PowerVSResourceReference } +

+(Appears on: +PowerVSNodePoolPlatform, +PowerVSPlatformSpec) +

+

+

PowerVSResourceReference is a reference to a specific IBMCloud PowerVS resource by ID, or Name. +Only one of ID, or Name may be specified. Specifying more than one will result in +a validation error.

+

+ + + + + + + + + + + + + + + + + +
FieldDescription
+id
+ +string + +
+(Optional) +

ID of resource

+
+name
+ +string + +
+(Optional) +

Name of resource

+
+###PowerVSVPC { #hypershift.openshift.io/v1alpha1.PowerVSVPC } +

+(Appears on: +PowerVSPlatformSpec) +

+

+

PowerVSVPC specifies IBM Cloud PowerVS LoadBalancer configuration for the control +plane.

+

+ + + + + + + + + + + + + + + + + + + + + + + + + +
FieldDescription
+name
+ +string + +
+

Name for VPC to used for all the service load balancer.

+
+region
+ +string + +
+

Region is the IBMCloud region in which VPC gets created, this VPC used for all the ingress traffic +into the OCP cluster.

+
+zone
+ +string + +
+(Optional) +

Zone is the availability zone where load balancer cloud resources are +created.

+
+subnet
+ +string + +
+(Optional) +

Subnet is the subnet to use for load balancer.

+
###PublishingStrategyType { #hypershift.openshift.io/v1alpha1.PublishingStrategyType }

(Appears on: diff --git a/go.mod b/go.mod index 2ef8c6cec20..0e76fd8f632 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,11 @@ require ( github.com/Azure/azure-sdk-for-go v61.4.0+incompatible github.com/Azure/go-autorest/autorest v0.11.24 github.com/Azure/go-autorest/autorest/azure/auth v0.5.11 + github.com/IBM-Cloud/power-go-client v1.1.4 + github.com/IBM/go-sdk-core/v5 v5.9.2 + github.com/IBM/networking-go-sdk v0.28.0 + github.com/IBM/platform-services-go-sdk v0.22.8 + github.com/IBM/vpc-go-sdk v1.0.1 github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 github.com/aws/aws-sdk-go v1.40.56 github.com/blang/semver v3.5.1+incompatible @@ -18,9 +23,9 @@ require ( github.com/google/gofuzz v1.2.0 github.com/google/uuid v1.3.0 github.com/hashicorp/go-uuid v1.0.1 - github.com/onsi/gomega v1.17.0 + github.com/onsi/gomega v1.18.1 github.com/opencontainers/go-digest v1.0.0 - github.com/opencontainers/image-spec v1.0.1 + github.com/opencontainers/image-spec v1.0.2 github.com/openshift/api v0.0.0-20220124143425-d74727069f6f github.com/openshift/cluster-api-provider-agent/api v0.0.0-20220227135922-dd6353f609dc github.com/operator-framework/api v0.10.7 @@ -31,10 +36,10 @@ require ( github.com/prometheus/common v0.28.0 github.com/spf13/cobra v1.2.1 github.com/tombuildsstuff/giovanni v0.18.0 - github.com/vincent-petithory/dataurl v0.0.0-20191104211930-d1553a71de50 + github.com/vincent-petithory/dataurl v1.0.0 go.uber.org/zap v1.19.1 golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 - golang.org/x/net v0.0.0-20211209124913-491a49abca63 + golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac gopkg.in/square/go-jose.v2 v2.5.1 gopkg.in/yaml.v2 v2.4.0 @@ -49,12 +54,12 @@ require ( k8s.io/utils v0.0.0-20211116205334-6203023598ed kubevirt.io/api v0.0.0-20211117075245-c94ce62baf5a sigs.k8s.io/apiserver-network-proxy v0.0.24 - sigs.k8s.io/cluster-api v1.0.2 + sigs.k8s.io/cluster-api v1.1.3 sigs.k8s.io/cluster-api-provider-aws v1.1.0 sigs.k8s.io/cluster-api-provider-azure v1.1.1 - sigs.k8s.io/cluster-api-provider-ibmcloud v0.2.0-alpha.1 + sigs.k8s.io/cluster-api-provider-ibmcloud v0.2.0 sigs.k8s.io/cluster-api-provider-kubevirt v0.0.0-00010101000000-000000000000 - sigs.k8s.io/controller-runtime v0.11.0-beta.0.0.20211208212546-f236f0345ad2 + sigs.k8s.io/controller-runtime v0.11.1 sigs.k8s.io/yaml v1.3.0 ) @@ -68,6 +73,8 @@ require ( github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect github.com/Azure/go-autorest/logger v0.2.1 // indirect github.com/Azure/go-autorest/tracing v0.6.0 // indirect + github.com/PuerkitoBio/purell v1.1.1 // indirect + github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect @@ -81,7 +88,20 @@ require ( github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect github.com/evanphx/json-patch v4.12.0+incompatible // indirect github.com/fsnotify/fsnotify v1.5.1 // indirect - github.com/gobuffalo/flect v0.2.3 // indirect + github.com/go-openapi/analysis v0.21.2 // indirect + github.com/go-openapi/errors v0.20.2 // indirect + github.com/go-openapi/jsonpointer v0.19.5 // indirect + github.com/go-openapi/jsonreference v0.19.6 // indirect + github.com/go-openapi/loads v0.21.1 // indirect + github.com/go-openapi/runtime v0.23.0 // indirect + github.com/go-openapi/spec v0.20.4 // indirect + github.com/go-openapi/strfmt v0.21.2 // indirect + github.com/go-openapi/swag v0.21.1 // indirect + github.com/go-openapi/validate v0.20.3 // indirect + github.com/go-playground/locales v0.14.0 // indirect + github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/go-stack/stack v1.8.1 // indirect + github.com/gobuffalo/flect v0.2.4 // indirect github.com/gofrs/uuid v4.2.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.2.0 // indirect @@ -89,32 +109,42 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/googleapis/gnostic v0.5.5 // indirect github.com/gorilla/mux v1.8.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-retryablehttp v0.7.0 // indirect github.com/imdario/mergo v0.3.12 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect + github.com/josharian/intern v1.0.0 // indirect github.com/jpillora/backoff v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/leodido/go-urn v1.2.1 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect + github.com/mitchellh/mapstructure v1.4.3 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect + github.com/oklog/ulid v1.3.1 // indirect github.com/openshift/custom-resource-status v0.0.0-20200602122900-c002fd1547ca // indirect + github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pborman/uuid v1.2.0 // indirect github.com/prometheus/procfs v0.6.0 // indirect github.com/sirupsen/logrus v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect + go.mongodb.org/mongo-driver v1.8.3 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect - golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect - golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8 // indirect - golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect + golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect + golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.27.1 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + gopkg.in/go-playground/validator.v9 v9.31.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect k8s.io/klog/v2 v2.30.0 // indirect diff --git a/go.sum b/go.sum index c8c33e49638..36f51fb5860 100644 --- a/go.sum +++ b/go.sum @@ -118,14 +118,27 @@ github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUM github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/IBM-Cloud/bluemix-go v0.0.0-20200921095234-26d1d0148c62/go.mod h1:gPJbH1etcDj7qS/hBRiLuYW9CY0bRcostSKusa51xR0= -github.com/IBM-Cloud/power-go-client v1.0.78/go.mod h1:YRBsrY+n1+3xMd6HzfG0VATkXZqOQktK5Yvjx9x6ACc= -github.com/IBM/go-sdk-core/v5 v5.7.2/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc0XQUqRO9Jc= -github.com/IBM/go-sdk-core/v5 v5.9.0/go.mod h1:axE2JrRq79gIJTjKPBwV6gWHswvVptBjbcvvCPIxARM= -github.com/IBM/vpc-go-sdk v0.14.0/go.mod h1:mIUjxBs5viRWIiCqfO/W4HPJ7aC6M+26mR4p5gaVls8= +github.com/IBM-Cloud/power-go-client v1.1.4 h1:E1sve+j7k3xHD9VKsQCrJ5Eth6Ndt7BC0tkeFhRFjOQ= +github.com/IBM-Cloud/power-go-client v1.1.4/go.mod h1:YcAHrWuTvckGQYPLLReJ9ijcO/tQuRxAp2kCZ7fnnVk= +github.com/IBM/go-sdk-core/v4 v4.5.1/go.mod h1:lTUXbqIX6/aAbSCkP6q59+dyFsTwZAc0ewRS2vJWVbg= +github.com/IBM/go-sdk-core/v5 v5.2.0/go.mod h1:vyNdbFujJtdTj9HbihtvKwwS3k/GKSKpOx9ZIQ6MWDY= +github.com/IBM/go-sdk-core/v5 v5.8.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc0XQUqRO9Jc= +github.com/IBM/go-sdk-core/v5 v5.8.2/go.mod h1:axE2JrRq79gIJTjKPBwV6gWHswvVptBjbcvvCPIxARM= +github.com/IBM/go-sdk-core/v5 v5.9.1/go.mod h1:axE2JrRq79gIJTjKPBwV6gWHswvVptBjbcvvCPIxARM= +github.com/IBM/go-sdk-core/v5 v5.9.2 h1:QKB5JwhlZfRvFHqcOwMeu/Dis/Q7qCBxrQLhx04onMc= +github.com/IBM/go-sdk-core/v5 v5.9.2/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= +github.com/IBM/networking-go-sdk v0.28.0 h1:kdZnHb9SaVd/NgYFpOlXfXSA8Q/mASBGaiAECxVI2i4= +github.com/IBM/networking-go-sdk v0.28.0/go.mod h1:tVxXclpQs8nQJYPTr9ZPNC1voaPNQLy8iy/72oVfFtM= +github.com/IBM/platform-services-go-sdk v0.22.8 h1:vUyKpUpbsoxAYktMgUYVCoJLIz8M1cX1MXZ2rz8Tbto= +github.com/IBM/platform-services-go-sdk v0.22.8/go.mod h1:0moTvGSCdWiSKPmXejOpblpfya/VgDSeG+x9Tjxy+qI= +github.com/IBM/vpc-go-sdk v1.0.1 h1:D2cu4KRsM8Q8bLWz/uxp8m7nzUm33mcgDv1sD0w/E8M= +github.com/IBM/vpc-go-sdk v1.0.1/go.mod h1:bhd7r482lV30UJz46r2oRgYGawGEo+TuS41ZLIY65y0= github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd/go.mod h1:64YHyfSL2R96J44Nlwm39UHepQbyR5q10x7iYa1ks2E= github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ= github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE= +github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= @@ -142,6 +155,7 @@ github.com/Microsoft/hcsshim v0.8.9/go.mod h1:5692vkUqntj1idxauYlpoINNKeqCiG6Sg3 github.com/Microsoft/hcsshim v0.8.14/go.mod h1:NtVKoYxQuTLx6gEq0L96c9Ju4JbRJ4nY2ow3VK6a9Lg= github.com/Microsoft/hcsshim v0.8.15/go.mod h1:x38A4YbHbdxJtc0sF6oIz+RG0npwSCAvn69iY6URG00= github.com/Microsoft/hcsshim v0.8.16/go.mod h1:o5/SZqmR7x9JNKsW3pu+nqHm0MF8vbA+VxGOoXdC600= +github.com/Microsoft/hcsshim v0.8.23/go.mod h1:4zegtUJth7lAvFyc6cH2gGQ5B3OFQim01nnU2M8jKDg= github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5hlzMzRKMLyo42nCZ9oml8AdTlq/0cvIaBv6tK1RehU= github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= @@ -149,13 +163,16 @@ github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMo github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM= +github.com/ajeddeloh/go-json v0.0.0-20160803184958-73d058cf8437/go.mod h1:otnto4/Icqn88WCcM4bhIJNSgsh9VLBuspyyCfvof9c= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -185,6 +202,7 @@ github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aws/amazon-vpc-cni-k8s v1.9.3/go.mod h1:FHKQKIQ4ylokY3vV54uwFgME0BRIYCHoxgFtXFdUPYY= github.com/aws/aws-lambda-go v1.27.0/go.mod h1:jJmlefzPfGnckuHdXX7/80O3BvUUi12XOkbv4w9SGLU= +github.com/aws/aws-sdk-go v1.8.39/go.mod h1:ZRmQr0FajVIyZ4ZzBYKG5P3ZqPz9IHG41ZoMu1ADI3k= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.30.28/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= @@ -204,6 +222,7 @@ github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= +github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= @@ -229,6 +248,7 @@ github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chai2010/gettext-go v0.0.0-20160711120539-c6fed771bfd5/go.mod h1:/iP1qXHoty45bqomnu2LM+VVyAEdWN+vtSHGlQgyxbw= github.com/checkpoint-restore/go-criu/v4 v4.1.0/go.mod h1:xUQBLp4RLc5zJtWY++yjOoMoB5lihDt7fai+75m+rGw= +github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -236,6 +256,7 @@ github.com/cilium/ebpf v0.0.0-20200110133405-4032b1d8aae3/go.mod h1:MA5e5Lr8slmE github.com/cilium/ebpf v0.0.0-20200702112145-1c8d4c9ef775/go.mod h1:7cR51M8ViRLIdUjrmSXlK9pkrsDlLHbO8jiB8X8JnOc= github.com/cilium/ebpf v0.2.0/go.mod h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX2Qs= github.com/cilium/ebpf v0.4.0/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= +github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= github.com/clarketm/json v1.14.1 h1:43bkbTTKKdDx7crs3WHzkrnH6S1EvAF1VZrdFGMmmz4= github.com/clarketm/json v1.14.1/go.mod h1:ynr2LRfb0fQU34l07csRNBTcivjySLLiY1YzQqKVfdo= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -278,11 +299,13 @@ github.com/containerd/containerd v1.3.2/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMX github.com/containerd/containerd v1.4.0-beta.2.0.20200729163537-40b22ef07410/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= github.com/containerd/containerd v1.4.1/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= github.com/containerd/containerd v1.4.3/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= +github.com/containerd/containerd v1.4.9/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= github.com/containerd/containerd v1.5.0-beta.1/go.mod h1:5HfvG1V2FsKesEGQ17k5/T7V960Tmcumvqn8Mc+pCYQ= github.com/containerd/containerd v1.5.0-beta.3/go.mod h1:/wr9AVtEM7x9c+n0+stptlo/uBBoBORwEx6ardVcmKU= github.com/containerd/containerd v1.5.0-beta.4/go.mod h1:GmdgZd2zA2GYIBZ0w09ZvgqEq8EfBp/m3lcVZIvPHhI= github.com/containerd/containerd v1.5.0-rc.0/go.mod h1:V/IXoMqNGgBlabz3tHD2TWDoTJseu1FGOKuoA4nNb2s= github.com/containerd/containerd v1.5.2/go.mod h1:0DOxVqwDy2iZvrZp2JUx/E+hS0UNTVn7dJnIOwtYR4g= +github.com/containerd/containerd v1.5.9/go.mod h1:fvQqCfadDGga5HZyn3j4+dx56qj2I9YwBrlSdalvJYQ= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20190815185530-f2a389ac0a02/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20191127005431-f65d91d395eb/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= @@ -315,6 +338,7 @@ github.com/containerd/ttrpc v0.0.0-20190828172938-92c8520ef9f8/go.mod h1:PvCDdDG github.com/containerd/ttrpc v0.0.0-20191028202541-4f1b8fe65a5c/go.mod h1:LPm1u0xBw8r8NOKoOdNMeVHSawSsltak+Ihv+etqsE8= github.com/containerd/ttrpc v1.0.1/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= github.com/containerd/ttrpc v1.0.2/go.mod h1:UAxOpgT9ziI0gJrmKvgcZivgxOp8iFPSk8httJEt98Y= +github.com/containerd/ttrpc v1.1.0/go.mod h1:XX4ZTnoOId4HklF4edwc4DcqskFZuvXB1Evzy5KFQpQ= github.com/containerd/typeurl v0.0.0-20180627222232-a93fcdb778cd/go.mod h1:Cm3kwCdlkCfMSHURc+r6fwoGH6/F1hH3S4sg0rLFWPc= github.com/containerd/typeurl v0.0.0-20190911142611-5eb25027c9fd/go.mod h1:GeKYzf2pQcqv7tJ0AoCuuhtnqhva5LNU3U+OyKxxJpk= github.com/containerd/typeurl v1.0.1/go.mod h1:TB1hUtrpaiO88KEK56ijojHS1+NeF0izUACaJW2mdXg= @@ -335,8 +359,9 @@ github.com/containers/ocicrypt v1.1.0/go.mod h1:b8AOe0YR67uU8OqfVNcznfFpAzu3rdgU github.com/containers/ocicrypt v1.1.1/go.mod h1:Dm55fwWm1YZAjYRaJ94z2mfZikIyIN4B0oB3dj3jFxY= github.com/coredns/caddy v1.1.0 h1:ezvsPrT/tA/7pYDBZxu0cT0VmWk75AfIaf6GSYCNMf0= github.com/coredns/caddy v1.1.0/go.mod h1:A6ntJQlAWuQfFlsd9hvigKbo2WS0VUs2l1e2F+BawD4= -github.com/coredns/corefile-migration v1.0.13 h1:ld5RswmH1xjqBUEukw4QxC1PakLNNoVlsZEV8FGwoV8= github.com/coredns/corefile-migration v1.0.13/go.mod h1:XnhgULOEouimnzgn0t4WPuFDN2/PJQcTxdWKC5eXNGE= +github.com/coredns/corefile-migration v1.0.14 h1:Tz3WZhoj2NdP8drrQH86NgnCng+VrPjNeg2Oe1ALKag= +github.com/coredns/corefile-migration v1.0.14/go.mod h1:XnhgULOEouimnzgn0t4WPuFDN2/PJQcTxdWKC5eXNGE= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -346,13 +371,16 @@ github.com/coreos/go-iptables v0.4.5/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmeka github.com/coreos/go-iptables v0.5.0/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU= github.com/coreos/go-json v0.0.0-20170920214419-6a2fe990e083/go.mod h1:FmxyHfvrCFfCsXRylD4QQRlQmvzl+DG6iTHyEEykPfU= github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc= +github.com/coreos/go-semver v0.1.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20161114122254-48702e0da86b/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e h1:Wf6HqHfScWJN9/ZjdUKyjop4mf3Qdd+1TvvltAvM3m8= +github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU= +github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= @@ -399,6 +427,7 @@ github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BU github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v20.10.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v20.10.12+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-events v0.0.0-20170721190031-9461782956ad/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= @@ -413,6 +442,7 @@ github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNE github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/drone/envsubst/v2 v2.0.0-20210615175204-7bf45dbf5372/go.mod h1:esf2rsHFNlZlxsqsZDojNBcnNs5REqIvRrWRHqX0vEU= +github.com/drone/envsubst/v2 v2.0.0-20210730161058-179042472c46/go.mod h1:esf2rsHFNlZlxsqsZDojNBcnNs5REqIvRrWRHqX0vEU= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= @@ -446,9 +476,11 @@ github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwo github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/flatcar-linux/ignition v0.36.1/go.mod h1:0jS5n4AopgOdwgi7QDo5MFgkMx/fQUDYjuxlGJC1Txg= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= @@ -500,6 +532,8 @@ github.com/go-openapi/analysis v0.19.10/go.mod h1:qmhS3VNFxBlquFJ0RGoDtylO9y4pgT github.com/go-openapi/analysis v0.19.16/go.mod h1:GLInF007N83Ad3m8a/CbQ5TPzdnGT7workfHwuVjNVk= github.com/go-openapi/analysis v0.20.0/go.mod h1:BMchjvaHDykmRMsK40iPtvyOfFdMMxlOmQr9FBZk+Og= github.com/go-openapi/analysis v0.20.1/go.mod h1:BMchjvaHDykmRMsK40iPtvyOfFdMMxlOmQr9FBZk+Og= +github.com/go-openapi/analysis v0.21.2 h1:hXFrOYFHUAMQdu6zwAiKKJHJQ8kqZs1ux/ru1P1wLJU= +github.com/go-openapi/analysis v0.21.2/go.mod h1:HZwRk4RRisyG8vx2Oe6aqeSQcoxRp47Xkp3+K6q+LdY= github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.18.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= github.com/go-openapi/errors v0.19.2/go.mod h1:qX0BLWsyaKfvhluLejVpVNwNRdXZhEbTA4kxxpKBC94= @@ -509,11 +543,14 @@ github.com/go-openapi/errors v0.19.7/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpX github.com/go-openapi/errors v0.19.8/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.19.9/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/errors v0.20.1/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= +github.com/go-openapi/errors v0.20.2 h1:dxy7PGTqEh94zj2E3h1cUmQQWiM1+aeCROfAr02EmK8= +github.com/go-openapi/errors v0.20.2/go.mod h1:cM//ZKUKyO06HSwqAelJ5NsEMMcpa6VpXe8DOa1Mi1M= github.com/go-openapi/jsonpointer v0.0.0-20160704185906-46af16f9f7b1/go.mod h1:+35s3my2LFTysnkMfxsJBAMHj/DoqoB9knIWoYG/Vk0= github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.0.0-20160704190145-13c6e3589ad9/go.mod h1:W3Z9FmVs9qj+KR4zFKmDPGiLdk1D9Rlm7cyMvf57TTg= github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= @@ -521,6 +558,7 @@ github.com/go-openapi/jsonreference v0.18.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3Hfo github.com/go-openapi/jsonreference v0.19.2/go.mod h1:jMjeRr2HHw6nAVajTXJ4eiUwohSTlpa0o73RUL1owJc= github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= +github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs= github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= github.com/go-openapi/loads v0.18.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= @@ -534,13 +572,16 @@ github.com/go-openapi/loads v0.19.7/go.mod h1:brCsvE6j8mnbmGBh103PT/QLHfbyDxA4hs github.com/go-openapi/loads v0.20.0/go.mod h1:2LhKquiE513rN5xC6Aan6lYOSddlL8Mp20AW9kpviM4= github.com/go-openapi/loads v0.20.2/go.mod h1:hTVUotJ+UonAMMZsvakEgmWKgtulweO9vYP2bQYKA/o= github.com/go-openapi/loads v0.21.0/go.mod h1:rHYve9nZrQ4CJhyeIIFJINGCg1tQpx2yJrrNo8sf1ws= +github.com/go-openapi/loads v0.21.1 h1:Wb3nVZpdEzDTcly8S4HMkey6fjARRzb7iEaySimlDW0= +github.com/go-openapi/loads v0.21.1/go.mod h1:/DtAMXXneXFjbQMGEtbamCZb+4x7eGwkvZCvBmwUG+g= github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= github.com/go-openapi/runtime v0.19.0/go.mod h1:OwNfisksmmaZse4+gpV3Ne9AyMOlP1lt4sK4FXt0O64= github.com/go-openapi/runtime v0.19.4/go.mod h1:X277bwSUBxVlCYR3r7xgZZGKVvBd/29gLDlFGtJ8NL4= github.com/go-openapi/runtime v0.19.15/go.mod h1:dhGWCTKRXlAfGnQG0ONViOZpjfg0m2gUt9nTQPQZuoo= github.com/go-openapi/runtime v0.19.16/go.mod h1:5P9104EJgYcizotuXhEuUrzVc+j1RiSjahULvYmlv98= github.com/go-openapi/runtime v0.19.24/go.mod h1:Lm9YGCeecBnUUkFTxPC4s1+lwrkJ0pthx8YvyjCfkgk= -github.com/go-openapi/runtime v0.21.0/go.mod h1:aQg+kaIQEn+A2CRSY1TxbM8+sT9g2V3aLc1FbIAnbbs= +github.com/go-openapi/runtime v0.23.0 h1:HX6ET2sHCIvaKeDDQoU01CtO1ekg5EkekHSkLTtWXH0= +github.com/go-openapi/runtime v0.23.0/go.mod h1:aQg+kaIQEn+A2CRSY1TxbM8+sT9g2V3aLc1FbIAnbbs= github.com/go-openapi/spec v0.0.0-20160808142527-6aced65f8501/go.mod h1:J8+jY1nAiCcj+friV/PDoE1/3eeccG9LYBs0tYvLOWc= github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= github.com/go-openapi/spec v0.18.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= @@ -553,6 +594,7 @@ github.com/go-openapi/spec v0.19.15/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFu github.com/go-openapi/spec v0.20.0/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= github.com/go-openapi/spec v0.20.1/go.mod h1:93x7oh+d+FQsmsieroS4cmR3u0p/ywH649a3qwC9OsQ= github.com/go-openapi/spec v0.20.3/go.mod h1:gG4F8wdEDN+YPBMVnzE85Rbhf+Th2DTvA9nFPQ5AYEg= +github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M= github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= github.com/go-openapi/strfmt v0.18.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= @@ -561,11 +603,14 @@ github.com/go-openapi/strfmt v0.19.2/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6 github.com/go-openapi/strfmt v0.19.3/go.mod h1:0yX7dbo8mKIvc3XSKp7MNfxw4JytCfCD6+bY1AVL9LU= github.com/go-openapi/strfmt v0.19.4/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= github.com/go-openapi/strfmt v0.19.5/go.mod h1:eftuHTlB/dI8Uq8JJOyRlieZf+WkkxUuk0dgdHXr2Qk= +github.com/go-openapi/strfmt v0.19.10/go.mod h1:qBBipho+3EoIqn6YDI+4RnQEtj6jT/IdKm+PAlXxSUc= github.com/go-openapi/strfmt v0.19.11/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= github.com/go-openapi/strfmt v0.20.0/go.mod h1:UukAYgTaQfqJuAFlNxxMWNvMYiwiXtLsF2VwmoFtbtc= github.com/go-openapi/strfmt v0.20.2/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk= github.com/go-openapi/strfmt v0.21.0/go.mod h1:ZRQ409bWMj+SOgXofQAGTIo2Ebu72Gs+WaRADcS5iNg= github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= +github.com/go-openapi/strfmt v0.21.2 h1:5NDNgadiX1Vhemth/TH4gCGopWSTdDjxl60H3B7f+os= +github.com/go-openapi/strfmt v0.21.2/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dpr1UfpPtxFw+EFuQ41HhCWZfha5jSVRG7C7I= github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= github.com/go-openapi/swag v0.18.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= @@ -577,6 +622,8 @@ github.com/go-openapi/swag v0.19.12/go.mod h1:eFdyEBkTdoAf/9RXBvj4cr1nH7GD8Kzo5H github.com/go-openapi/swag v0.19.13/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/swag v0.19.14/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-openapi/swag v0.21.1 h1:wm0rhTb5z7qpJRHBdPOMuY4QjVUMbF6/kwoYeRAOrKU= +github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-openapi/validate v0.18.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2KDnRCRMUi7GTA= github.com/go-openapi/validate v0.19.3/go.mod h1:90Vh6jjkTn+OT1Eefm0ZixWNFjhtOH7vS9k0lo6zwJo= @@ -585,11 +632,18 @@ github.com/go-openapi/validate v0.19.10/go.mod h1:RKEZTUWDkxKQxN2jDT7ZnZi2bhZlbN github.com/go-openapi/validate v0.19.12/go.mod h1:Rzou8hA/CBw8donlS6WNEUQupNvUZ0waH08tGe6kAQ4= github.com/go-openapi/validate v0.19.15/go.mod h1:tbn/fdOwYHgrhPBzidZfJC2MIVvs9GA7monOmWBbeCI= github.com/go-openapi/validate v0.20.1/go.mod h1:b60iJT+xNNLfaQJUqLI7946tYiFEOuE9E4k54HpKcJ0= +github.com/go-openapi/validate v0.20.3 h1:GZPPhhKSZrE8HjB4eEkoYAZmoWA4+tCemSgINH1/vKw= github.com/go-openapi/validate v0.20.3/go.mod h1:goDdqVGiigM3jChcrYJxD2joalke3ZXeftD16byIjA4= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= +github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= github.com/gobuffalo/depgen v0.0.0-20190329151759-d478694a28d3/go.mod h1:3STtPUQYuzV0gBVOY3vy6CfMm/ljR4pABfrTeHNLHUY= @@ -600,8 +654,9 @@ github.com/gobuffalo/flect v0.1.0/go.mod h1:d2ehjJqGOH/Kjqcoz+F7jHTBbmDb38yXA598 github.com/gobuffalo/flect v0.1.1/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= github.com/gobuffalo/flect v0.1.3/go.mod h1:8JCgGVbRjJhVgD6399mQr4fx5rRfGKVzFjbj6RE/9UI= github.com/gobuffalo/flect v0.2.2/go.mod h1:vmkQwuZYhN5Pc4ljYQZzP+1sq+NEkK+lh20jmEmX3jc= -github.com/gobuffalo/flect v0.2.3 h1:f/ZukRnSNA/DUpSNDadko7Qc0PhGvsew35p/2tu+CRY= github.com/gobuffalo/flect v0.2.3/go.mod h1:vmkQwuZYhN5Pc4ljYQZzP+1sq+NEkK+lh20jmEmX3jc= +github.com/gobuffalo/flect v0.2.4 h1:BSYA8+T60cdyq+vynaSUjqSVI9mDEg9ZfQUXKmfjo4I= +github.com/gobuffalo/flect v0.2.4/go.mod h1:1ZyCLIbg0YD7sDkzvFdPoOydPtD8y9JQnrOROolUcM8= github.com/gobuffalo/genny v0.0.0-20190329151137-27723ad26ef9/go.mod h1:rWs4Z12d1Zbf19rlsn0nurr75KqhYp52EAGGxTbBhNk= github.com/gobuffalo/genny v0.0.0-20190403191548-3ca520ef0d9e/go.mod h1:80lIj3kVJWwOrXWWMRzzdhW3DsrdjILVil/SFKBzF28= github.com/gobuffalo/genny v0.1.0/go.mod h1:XidbUqzak3lHdS//TPu2OgiFB+51Ur5f7CSnXZ/JDvo= @@ -621,6 +676,7 @@ github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY9 github.com/goccy/go-yaml v1.8.1/go.mod h1:wS4gNoLalDSJxo/SpngzPQ2BN4uuZVLCmbM4S3vd4+Y= github.com/godbus/dbus v0.0.0-20151105175453-c7fdd8b5cd55/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/godbus/dbus v0.0.0-20180201030542-885f9cc04c9c/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= +github.com/godbus/dbus v0.0.0-20181025153459-66d97aec3384/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= github.com/godbus/dbus v0.0.0-20190422162347-ade71ed3457e/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -730,6 +786,7 @@ github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210122040257-d980be63207e/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210226084205-cbba55b83ad5/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= @@ -783,8 +840,10 @@ github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv github.com/hashicorp/go-azure-helpers v0.12.0 h1:7D0mFSyP3EfHu1ySubserIsnUWY87HMzzTWOB7ASwRU= github.com/hashicorp/go-azure-helpers v0.12.0/go.mod h1:Zc3v4DNeX6PDdy7NljlYpnrdac1++qNW0I4U+ofGwpg= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-hclog v0.12.0 h1:d4QkX8FRTYaKaCZBoXYY8zJX2BXjWxurN/GA2tkrmZM= github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= @@ -792,6 +851,8 @@ github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1: github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-retryablehttp v0.6.6/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-retryablehttp v0.7.0 h1:eu1EI/mbirUgP5C8hVsTNaGZreBDlYiwC1FZWkvQPQ4= github.com/hashicorp/go-retryablehttp v0.7.0/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= @@ -813,6 +874,8 @@ github.com/hashicorp/memberlist v0.2.2/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOn github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= github.com/hashicorp/serf v0.9.5/go.mod h1:UWDWwZeL5cuWDJdl0C6wrvrUwEqtQ4ZKBKKENpqIUyk= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -833,9 +896,11 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= +github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -881,6 +946,8 @@ github.com/kubevirt/containerized-data-importer-api v1.41.1-0.20211201033752-055 github.com/kubevirt/containerized-data-importer-api v1.41.1-0.20211201033752-05520fb9f18d/go.mod h1:Ty5GJ+6nKlpcBKjeebb/e6IrF8bNFgOus9hfuMjEt6A= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de/go.mod h1:zAbeS9B/r2mtpb6U+EI2rYA5OAXxsYw6wTamcNW+zcE= github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z9BP0jIOc= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= @@ -894,6 +961,8 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN github.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= github.com/mailru/easyjson v0.7.1/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs= github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= @@ -902,6 +971,7 @@ github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.9 h1:sqDoxXbdeALODt0DAeJCVp38ps9ZogZEAXjus69YV3U= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= @@ -909,6 +979,7 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= @@ -924,6 +995,8 @@ github.com/mikefarah/yq/v3 v3.0.0-20201202084205-8846255d1c37/go.mod h1:dYWq+UWo github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= +github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -938,7 +1011,11 @@ github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/mapstructure v1.4.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.4.3 h1:OVowDSCllw/YjdLkam3/sm7wEtOy59d8ndGgCcyj8cs= +github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= +github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/moby/sys/mountinfo v0.4.0/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= @@ -970,6 +1047,7 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA= @@ -989,6 +1067,8 @@ github.com/onsi/ginkgo v1.16.2/go.mod h1:CObGmKUOKaSC0RjmoAK7tKyn4Azo5P2IWuoMnvw github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.0.0 h1:CcuG/HvWNkkaqCUpJifQY8z7qEMBJya6aLPx6ftGyjQ= +github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/gomega v0.0.0-20151007035656-2152b45fa28a/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= @@ -1003,8 +1083,9 @@ github.com/onsi/gomega v1.12.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je4 github.com/onsi/gomega v1.14.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= github.com/onsi/gomega v1.15.0/go.mod h1:cIuvLEne0aoVhAgh/O6ac0Op8WWw9H6eYCriF+tEHG0= github.com/onsi/gomega v1.16.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE= +github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs= github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -1012,21 +1093,25 @@ github.com/opencontainers/go-digest v1.0.0-rc1.0.20180430190053-c9281466c8b2/go. github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc93/go.mod h1:3NOsor4w32B2tC0Zbl8Knk4Wg84SM2ImC1fxBuqJ/H0= +github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.1/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.2-0.20190207185410-29686dbc5559/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.3-0.20200929063507-e6143ca7d51d/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= github.com/opencontainers/selinux v1.6.0/go.mod h1:VVGKuOLlE7v4PJyT6h7mNWvq1rzqiriPsEqVhc+svHE= github.com/opencontainers/selinux v1.8.0/go.mod h1:RScLhm78qiWa2gbVCcGkC7tCGdgk3ogry1nUQF8Evvo= +github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= github.com/openshift/api v0.0.0-20220124143425-d74727069f6f h1:iOTv1WudhVm2UsoST+L+ZrA5A9w57h9vmQsdlBuqG6g= github.com/openshift/api v0.0.0-20220124143425-d74727069f6f/go.mod h1:F/eU6jgr6Q2VhMu1mSpMmygxAELd7+BUxs3NHZ25jV4= github.com/openshift/build-machinery-go v0.0.0-20211213093930-7e33a7eb4ce3/go.mod h1:b1BuldmJlbA/xYtdZvKi+7j5YGB44qJUJDZ9zwiNCfE= @@ -1037,11 +1122,13 @@ github.com/openshift/cluster-api-provider-kubevirt v0.0.0-20211223062810-ef64d5f github.com/openshift/custom-resource-status v0.0.0-20200602122900-c002fd1547ca h1:F1MEnOMwSrTA0YAkO0he9ip9w0JhYzI/iCB2mXmaSPg= github.com/openshift/custom-resource-status v0.0.0-20200602122900-c002fd1547ca/go.mod h1:GDjWl0tX6FNIj82vIxeudWeSx2Ff6nDZ8uJn0ohUFvo= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/operator-framework/api v0.10.7 h1:GlZJ6m+0WSVdSsSjTbhKKAvHXamWJXhwXHUhVwL8LBE= github.com/operator-framework/api v0.10.7/go.mod h1:PtQSNSuVrhSC6YE6JJJZv3nnZJc32osKX8FmFUZK05U= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pborman/uuid v0.0.0-20170612153648-e790cca94e6c/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34= github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -1133,7 +1220,10 @@ github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvW github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sigma/bdoor v0.0.0-20160202064022-babf2a4017b0/go.mod h1:WBu7REWbxC/s/J06jsk//d+9DOz9BbsmcIrimuGRFbs= +github.com/sigma/vmw-guestinfo v0.0.0-20160204083807-95dd4126d6e8/go.mod h1:JrRFFC0veyh0cibh0DAhriSY7/gV3kDdNaVUOmfx01U= github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= @@ -1145,9 +1235,11 @@ github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -1198,6 +1290,7 @@ github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= +github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -1211,10 +1304,11 @@ github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijb github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/urfave/cli/v2 v2.2.0/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= +github.com/valyala/fastjson v1.6.3/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= github.com/vincent-petithory/dataurl v0.0.0-20160330182126-9a301d65acbb/go.mod h1:FHafX5vmDzyP+1CQATJn7WFKc9CvnvxyvZy6I1MrG/U= -github.com/vincent-petithory/dataurl v0.0.0-20191104211930-d1553a71de50 h1:uxE3GYdXIOfhMv3unJKETJEhw78gvzuQqRX/rVirc2A= -github.com/vincent-petithory/dataurl v0.0.0-20191104211930-d1553a71de50/go.mod h1:FHafX5vmDzyP+1CQATJn7WFKc9CvnvxyvZy6I1MrG/U= +github.com/vincent-petithory/dataurl v1.0.0 h1:cXw+kPto8NLuJtlMsI152irrVw9fRDX8AbShPRpg2CI= +github.com/vincent-petithory/dataurl v1.0.0/go.mod h1:FHafX5vmDzyP+1CQATJn7WFKc9CvnvxyvZy6I1MrG/U= github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= github.com/vishvananda/netlink v1.1.1-0.20201029203352-d40f9887b852/go.mod h1:twkDnbuQxJYemMlGd4JFIcuhgX83tXhKS2B/PRMpOho= @@ -1268,12 +1362,15 @@ go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qL go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.3.0/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= go.mongodb.org/mongo-driver v1.3.4/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= +go.mongodb.org/mongo-driver v1.4.2/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= go.mongodb.org/mongo-driver v1.4.3/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= go.mongodb.org/mongo-driver v1.4.4/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= go.mongodb.org/mongo-driver v1.4.6/go.mod h1:WcMNYLx/IlOxLe6JRJiv2uXuCz6zBLndR4SoGjYphSc= go.mongodb.org/mongo-driver v1.5.1/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw= go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= +go.mongodb.org/mongo-driver v1.8.3 h1:TDKlTkGDKm9kkJVUOAXDK5/fkqKHJVwYQSpoRfB43R4= +go.mongodb.org/mongo-driver v1.8.3/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1334,6 +1431,7 @@ go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= go.uber.org/zap v1.19.0/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= go.uber.org/zap v1.19.1 h1:ue41HOKd1vGURxrmeKIgELGb3jPW9DMUDGtsinblHwI= go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI= +go4.org v0.0.0-20160314031811-03efcb870d84/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE= golang.org/x/arch v0.0.0-20180920145803-b19384d3c130/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8= golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1356,9 +1454,11 @@ golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3 golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= @@ -1475,8 +1575,9 @@ golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211005215030-d2e5035098b3/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211209124913-491a49abca63 h1:iocB37TsdFuN6IBRZ+ry36wrkoV51/tl5vOWqkcPGvY= golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk= +golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1492,8 +1593,9 @@ golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f h1:Qmd2pbz05z7z6lm0DrgQVVPuBm92jqujBKMHMOlOQEw= golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg= +golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1623,17 +1725,20 @@ golang.org/x/sys v0.0.0-20210817190340-bfb29a6856f2/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210820121016-41cdb8703e55/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8 h1:M69LAlWZCshgp0QSzyDcSsSIejIEeuaCVpmwcKwyLMk= golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b h1:9zKuko04nR4gjZ4+DNjHqRlAJqbJETHwiNKDqTfOjfE= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.1-0.20190321115727-fe223c5a2583/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -1908,8 +2013,10 @@ gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= +gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/go-playground/validator.v9 v9.30.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= +gopkg.in/go-playground/validator.v9 v9.31.0 h1:bmXmP2RSNtFES+bn4uYuHT7iJFJv7Vj+an+ZQdDaD1M= gopkg.in/go-playground/validator.v9 v9.31.0/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= gopkg.in/inf.v0 v0.9.0/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= @@ -2032,8 +2139,9 @@ k8s.io/client-go v0.23.1/go.mod h1:6QSI8fEuqD4zgFK0xbdwfB/PthBsIxCJMa3s17WlcO0= k8s.io/client-go v0.23.3 h1:23QYUmCQ/W6hW78xIwm3XqZrrKZM+LWDqW2zfo+szJs= k8s.io/client-go v0.23.3/go.mod h1:47oMd+YvAOqZM7pcQ6neJtBiFH7alOyfunYN48VsmwE= k8s.io/cluster-bootstrap v0.22.2/go.mod h1:ZkmQKprEqvrUccMnbRHISsMscA1dsQ8SffM9nHq6CgE= -k8s.io/cluster-bootstrap v0.23.0-alpha.4 h1:v39rrz4u4UQrWyAtvbFZu7d+W/kb6qW2wFQ7ZLNp4tk= k8s.io/cluster-bootstrap v0.23.0-alpha.4/go.mod h1:TBNp0QpdQY1Gh/nvjhI1mLjnppolN7w1TxUTh65Yt4k= +k8s.io/cluster-bootstrap v0.23.0 h1:8pZuuAWPoygewSNB4IddX3HBwXcQkPDXL/ca7GtGf4o= +k8s.io/cluster-bootstrap v0.23.0/go.mod h1:VltEnKWfrRTiKgOXp3ts3vh7yqNlH6KFKFflo9GtCBg= k8s.io/code-generator v0.0.0-20190717022600-77f3a1fe56bb/go.mod h1:cDx5jQmWH25Ff74daM7NVYty9JWw9dvIS9zT9eIubCY= k8s.io/code-generator v0.16.8/go.mod h1:wFdrXdVi/UC+xIfLi+4l9elsTT/uEF61IfcN2wOLULQ= k8s.io/code-generator v0.18.3/go.mod h1:TgNEVx9hCyPGpdtCWA34olQYLkh3ok9ar7XfSsr8b6c= @@ -2096,7 +2204,6 @@ k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAG k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE= k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw= k8s.io/kube-openapi v0.0.0-20210817084001-7fbd8d59e5b8/go.mod h1:foAE7XkrXQ1Qo2eWsW/iWksptrVdbl6t+vscSdmmGjk= -k8s.io/kube-openapi v0.0.0-20211110012726-3cc51fd1e909/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE= k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 h1:E3J9oCLlaobFUqsjG9DfKbP2BmgwBL2p7pn0A3dG9W4= k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65/go.mod h1:sX9MT8g7NVZM5lVL/j8QyCCJe8YSMW30QvGZWaCIDIk= k8s.io/kube-scheduler v0.23.1 h1:YdGM/eE/gp1uUnpK+w2J8PBiOX7xOB5qu857BeWyrFM= @@ -2140,18 +2247,19 @@ sigs.k8s.io/cluster-api-provider-aws v1.1.0 h1:b9Jkk6fGKW09DgnfEPnvkD/H+WomH4CRg sigs.k8s.io/cluster-api-provider-aws v1.1.0/go.mod h1:GtzEj1B+kQoxoxrAs3oMRs7FP8UiIZ9NDDT4mZgEttA= sigs.k8s.io/cluster-api-provider-azure v1.1.1 h1:IGhYRU5AA2/lFK/Iy6Y8T7MT3e0qibW3KRpn7dVCHNQ= sigs.k8s.io/cluster-api-provider-azure v1.1.1/go.mod h1:M2wBfdfq4SnndorQ9NENfrrSGaFAu/uKC8RrJPF4BtQ= -sigs.k8s.io/cluster-api-provider-ibmcloud v0.2.0-alpha.1 h1:6KbC3MoZMQRguEbxzFlpDvyMVW/aR72j+nF05DBuMxk= -sigs.k8s.io/cluster-api-provider-ibmcloud v0.2.0-alpha.1/go.mod h1:MeTP43FmpUpWNk/Rv4brIAIqaIuAR2nmjUifTlZaU9E= +sigs.k8s.io/cluster-api-provider-ibmcloud v0.2.0 h1:3QZUcqShsHei4BqDJPAjq7cllqp1BSrlvMjSdAQC9u4= +sigs.k8s.io/cluster-api-provider-ibmcloud v0.2.0/go.mod h1:GpeV52JzLqCUbZYoPEFo7YvdRS9x/fhdxEX5U+k3sXA= sigs.k8s.io/cluster-api/test v1.0.1-0.20211111175208-4cc2fce2111a/go.mod h1:VDgiTRAZTTC9mayIn7g6TJ3g77mYFGzis/jKDjj4Ho0= sigs.k8s.io/cluster-api/test v1.0.2/go.mod h1:D8eLfLrzKcPbm/TzYexoRJISaDleOGSpBrBvH0yVEuA= +sigs.k8s.io/cluster-api/test v1.1.3/go.mod h1:WpD3cv0ZyNt5aulQmA7HvQbu7TQ/Eb8OPbwayGxUazs= sigs.k8s.io/controller-runtime v0.6.3/go.mod h1:WlZNXcM0++oyaQt4B7C2lEE5JYRs8vJUzRP4N4JpdAY= sigs.k8s.io/controller-runtime v0.8.3/go.mod h1:U/l+DUopBc1ecfRZ5aviA9JDmGFQKvLf5YkZNx2e0sU= sigs.k8s.io/controller-runtime v0.10.0/go.mod h1:GCdh6kqV6IY4LK0JLwX0Zm6g233RtVGdb/f0+KSfprg= sigs.k8s.io/controller-runtime v0.10.2/go.mod h1:CQp8eyUQZ/Q7PJvnIrB6/hgfTC1kBkGylwsLgOQi1WY= sigs.k8s.io/controller-runtime v0.10.3/go.mod h1:CQp8eyUQZ/Q7PJvnIrB6/hgfTC1kBkGylwsLgOQi1WY= sigs.k8s.io/controller-runtime v0.11.0-beta.0.0.20211110210527-619e6b92dab9/go.mod h1:zbtXsL/EF7Jejm73ivV4QOuyM2kg13WCz3Up+Agc1gE= -sigs.k8s.io/controller-runtime v0.11.0-beta.0.0.20211208212546-f236f0345ad2 h1:+ReKrjTrd57mtAU19BJkxSAaWRIQkFlaWcO6dGFVP1g= -sigs.k8s.io/controller-runtime v0.11.0-beta.0.0.20211208212546-f236f0345ad2/go.mod h1:KKwLiTooNGu+JmLZGn9Sl3Gjmfj66eMbCQznLP5zcqA= +sigs.k8s.io/controller-runtime v0.11.1 h1:7YIHT2QnHJArj/dk9aUkYhfqfK5cIxPOX5gPECfdZLU= +sigs.k8s.io/controller-runtime v0.11.1/go.mod h1:KKwLiTooNGu+JmLZGn9Sl3Gjmfj66eMbCQznLP5zcqA= sigs.k8s.io/controller-tools v0.5.0/go.mod h1:JTsstrMpxs+9BUj6eGuAaEb6SDSPTeVtUyp0jmnAM/I= sigs.k8s.io/controller-tools v0.6.2/go.mod h1:oaeGpjXn6+ZSEIQkUe/+3I40PNiDYp9aeawbt3xTgJ8= sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 h1:fD1pz4yfdADVNfFmcP2aBEtudwUQ1AlLnRBALr33v3s= diff --git a/hack/app-sre/saas_template.yaml b/hack/app-sre/saas_template.yaml index 0a84bf96401..0d62581aea5 100644 --- a/hack/app-sre/saas_template.yaml +++ b/hack/app-sre/saas_template.yaml @@ -9805,6 +9805,8 @@ objects: annotations: controller-gen.kubebuilder.io/version: v0.5.0 creationTimestamp: null + labels: + cluster.x-k8s.io/v1beta1: v1beta1 name: ibmpowervsclusters.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io @@ -9858,14 +9860,17 @@ objects: properties: id: description: ID of resource + minLength: 1 type: string name: description: Name of resource + minLength: 1 type: string type: object serviceInstanceID: description: ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed + minLength: 1 type: string required: - network @@ -9899,6 +9904,170 @@ objects: annotations: controller-gen.kubebuilder.io/version: v0.5.0 creationTimestamp: null + labels: + cluster.x-k8s.io/v1beta1: v1beta1 + name: ibmpowervsimages.infrastructure.cluster.x-k8s.io + spec: + group: infrastructure.cluster.x-k8s.io + names: + kind: IBMPowerVSImage + listKind: IBMPowerVSImageList + plural: ibmpowervsimages + singular: ibmpowervsimage + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: PowerVS image state + jsonPath: .status.imageState + name: State + type: string + - description: Image is ready for IBM PowerVS instances + jsonPath: .status.ready + name: Ready + type: string + name: v1beta1 + schema: + openAPIV3Schema: + description: IBMPowerVSImage is the Schema for the ibmpowervsimages API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource + this object represents. Servers may infer this from the endpoint the + client submits requests to. Cannot be updated. In CamelCase. More + info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: IBMPowerVSImageSpec defines the desired state of IBMPowerVSImage + properties: + bucket: + description: Cloud Object Storage bucket name; bucket-name[/optional/folder] + type: string + clusterName: + description: ClusterName is the name of the Cluster this object + belongs to. + minLength: 1 + type: string + deletePolicy: + default: delete + description: DeletePolicy defines the policy used to identify images + to be preserved beyond the lifecycle of associated cluster. + enum: + - delete + - retain + type: string + object: + description: Cloud Object Storage image filename + type: string + region: + description: Cloud Object Storage region + type: string + serviceInstanceID: + description: ServiceInstanceID is the id of the power cloud instance + where the image will get imported + type: string + storageType: + default: tier1 + description: Type of storage, storage pool with the most available + space will be selected + enum: + - tier1 + - tier3 + type: string + required: + - bucket + - clusterName + - object + - region + - serviceInstanceID + type: object + status: + description: IBMPowerVSImageStatus defines the observed state of IBMPowerVSImage + properties: + conditions: + description: Conditions defines current service state of the IBMPowerVSImage. + items: + description: Condition defines an observation of a Cluster API + resource operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one + status to another. This should be when the underlying condition + changed. If that is not known, then using the time when + the API field changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not + this field is considered a guaranteed API. This field may + not be empty. + type: string + severity: + description: Severity provides an explicit classification + of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. The + Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, + Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict + is important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + imageID: + description: ImageID is the id of the imported image + type: string + imageState: + description: ImageState is the status of the imported image + type: string + jobID: + description: JobID is the job ID of an import operation + type: string + ready: + description: Ready is true when the provider resource is ready. + type: boolean + type: object + type: object + served: true + storage: true + subresources: + status: {} + status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] +- apiVersion: apiextensions.k8s.io/v1 + kind: CustomResourceDefinition + metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.5.0 + creationTimestamp: null + labels: + cluster.x-k8s.io/v1beta1: v1beta1 name: ibmpowervsmachines.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io @@ -9954,9 +10123,21 @@ objects: properties: id: description: ID of resource + minLength: 1 type: string name: description: Name of resource + minLength: 1 + type: string + type: object + imageRef: + description: ImageRef is an optional reference to a provider-specific + resource that holds the details for provisioning the Image for + a Cluster. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' type: string type: object memory: @@ -9968,9 +10149,11 @@ objects: properties: id: description: ID of resource + minLength: 1 type: string name: description: Name of resource + minLength: 1 type: string type: object procType: @@ -9987,6 +10170,7 @@ objects: serviceInstanceID: description: ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed + minLength: 1 type: string sshKey: description: SSHKey is the name of the SSH key pair provided to @@ -9996,13 +10180,8 @@ objects: description: SysType is the System type used to host the vsi type: string required: - - image - - memory - network - - procType - - processors - serviceInstanceID - - sysType type: object status: description: IBMPowerVSMachineStatus defines the observed state of IBMPowerVSMachine @@ -10024,6 +10203,84 @@ objects: - type type: object type: array + conditions: + description: Conditions defines current service state of the IBMPowerVSMachine. + items: + description: Condition defines an observation of a Cluster API + resource operational state. + properties: + lastTransitionTime: + description: Last time the condition transitioned from one + status to another. This should be when the underlying condition + changed. If that is not known, then using the time when + the API field changed is acceptable. + format: date-time + type: string + message: + description: A human readable message indicating details about + the transition. This field may be empty. + type: string + reason: + description: The reason for the condition's last transition + in CamelCase. The specific API may choose whether or not + this field is considered a guaranteed API. This field may + not be empty. + type: string + severity: + description: Severity provides an explicit classification + of Reason code, so the users or machines can immediately + understand the current situation and act accordingly. The + Severity field MUST be set only when Status=False. + type: string + status: + description: Status of the condition, one of True, False, + Unknown. + type: string + type: + description: Type of condition in CamelCase or in foo.example.com/CamelCase. + Many .condition.type values are consistent across resources + like Available, but because arbitrary conditions can be + useful (see .node.status.conditions), the ability to deconflict + is important. + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + failureMessage: + description: "FailureMessage will be set in the event that there + is a terminal problem reconciling the Machine and will contain + a more verbose string suitable for logging and human consumption. + \n This field should not be set for transitive errors that a controller + faces that are expected to be fixed automatically over time (like + service outages), but instead indicate that something is fundamentally + wrong with the Machine's spec or the configuration of the controller, + and that manual intervention is required. Examples of terminal + errors would be invalid combinations of settings in the spec, + values that are unsupported by the controller, or the responsible + controller itself being critically misconfigured. \n Any transient + errors that occur during the reconciliation of Machines can be + added as events to the Machine object and/or logged in the controller's + output." + type: string + failureReason: + description: "FailureReason will be set in the event that there + is a terminal problem reconciling the Machine and will contain + a succinct value suitable for machine interpretation. \n This + field should not be set for transitive errors that a controller + faces that are expected to be fixed automatically over time (like + service outages), but instead indicate that something is fundamentally + wrong with the Machine's spec or the configuration of the controller, + and that manual intervention is required. Examples of terminal + errors would be invalid combinations of settings in the spec, + values that are unsupported by the controller, or the responsible + controller itself being critically misconfigured. \n Any transient + errors that occur during the reconciliation of Machines can be + added as events to the Machine object and/or logged in the controller's + output." + type: string fault: description: Fault will report if any fault messages for the vsi type: string @@ -10038,8 +10295,12 @@ objects: ready: description: Ready is true when the provider resource is ready. type: boolean - required: - - instanceState + region: + description: Region specifies the Power VS Service instance region + type: string + zone: + description: Zone specifies the Power VS Service instance zone + type: string type: object type: object served: true @@ -10058,6 +10319,8 @@ objects: annotations: controller-gen.kubebuilder.io/version: v0.5.0 creationTimestamp: null + labels: + cluster.x-k8s.io/v1beta1: v1beta1 name: ibmpowervsmachinetemplates.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io @@ -10105,9 +10368,21 @@ objects: properties: id: description: ID of resource + minLength: 1 type: string name: description: Name of resource + minLength: 1 + type: string + type: object + imageRef: + description: ImageRef is an optional reference to a provider-specific + resource that holds the details for provisioning the Image + for a Cluster. + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' type: string type: object memory: @@ -10119,9 +10394,11 @@ objects: properties: id: description: ID of resource + minLength: 1 type: string name: description: Name of resource + minLength: 1 type: string type: object procType: @@ -10138,6 +10415,7 @@ objects: serviceInstanceID: description: ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed + minLength: 1 type: string sshKey: description: SSHKey is the name of the SSH key pair provided @@ -10148,13 +10426,8 @@ objects: vsi type: string required: - - image - - memory - network - - procType - - processors - serviceInstanceID - - sysType type: object required: - spec @@ -10182,7 +10455,7 @@ objects: controller-gen.kubebuilder.io/version: v0.5.0 creationTimestamp: null labels: - cluster.x-k8s.io/v1beta1: v1alpha4 + cluster.x-k8s.io/v1beta1: v1beta1 name: ibmvpcclusters.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io @@ -10324,6 +10597,8 @@ objects: annotations: controller-gen.kubebuilder.io/version: v0.5.0 creationTimestamp: null + labels: + cluster.x-k8s.io/v1beta1: v1beta1 name: ibmvpcmachines.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io @@ -10400,7 +10675,6 @@ objects: type: string required: - image - - profile - zone type: object status: @@ -10451,6 +10725,8 @@ objects: annotations: controller-gen.kubebuilder.io/version: v0.5.0 creationTimestamp: null + labels: + cluster.x-k8s.io/v1beta1: v1beta1 name: ibmvpcmachinetemplates.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io @@ -10534,7 +10810,6 @@ objects: type: string required: - image - - profile - zone type: object required: @@ -20288,6 +20563,109 @@ objects: provider within IBM Cloud. type: string type: object + powervs: + description: IBMCloud defines IBMCloud specific settings for + components + properties: + controlPlaneOperatorCreds: + description: "ControlPlaneOperatorCreds is a reference to + a secret containing cloud credentials with permissions + matching the control-plane-operator policy. The secret + should have exactly one key, `credentials`, whose value + is an AWS credentials file. \n TODO(dan): document the + \"control plane operator policy\"" + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + kubeCloudControllerCreds: + description: "KubeCloudControllerCreds is a reference to + a secret containing cloud credentials with permissions + matching the cloud controller policy. The secret should + have exactly one key, `credentials`, whose value is an + AWS credentials file. \n TODO(dan): document the \"cloud + controller policy\"" + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + nodePoolManagementCreds: + description: "NodePoolManagementCreds is a reference to + a secret containing cloud credentials with permissions + matching the node pool management policy. The secret should + have exactly one key, `credentials`, whose value is an + AWS credentials file. \n TODO(dan): document the \"node + pool management policy\"" + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + region: + description: Region is the IBMCloud region in which the + cluster resides. This configures the OCP control plane + cloud integrations, and is used by NodePool to resolve + the correct boot image for a given release. + type: string + resourceGroup: + description: ResourceGroup is the IBMCloud Resource Group + in which the cluster resides. If not specified then default + resource group of the account will be used. + type: string + serviceInstanceID: + description: ServiceInstanceID is the ServiceInstance to + use for control plane cloud resources. + type: string + subnet: + description: Subnet is the subnet to use for control plane + cloud resources. + properties: + id: + description: ID of resource + type: string + name: + description: Name of resource + type: string + type: object + vpc: + description: VPC specifies IBM Cloud PowerVS Load Balancing + configuration for the control plane. + properties: + name: + description: Name for VPC to used for all the service + load balancer. + type: string + region: + description: Region is the IBMCloud region in which + VPC gets created, this VPC used for all the ingress + traffic into the OCP cluster. + type: string + subnet: + description: Subnet is the subnet to use for load balancer. + type: string + zone: + description: Zone is the availability zone where load + balancer cloud resources are created. + type: string + required: + - name + - region + type: object + zone: + description: Zone is the availability zone where control + plane cloud resources are created. + type: string + required: + - controlPlaneOperatorCreds + - kubeCloudControllerCreds + - nodePoolManagementCreds + - region + type: object type: description: Type is the type of infrastructure provider for the cluster. @@ -20298,6 +20676,7 @@ objects: - Agent - KubeVirt - Azure + - PowerVS type: string required: - type @@ -21406,6 +21785,109 @@ objects: provider within IBM Cloud. type: string type: object + powervs: + description: IBMCloud defines IBMCloud specific settings for + components + properties: + controlPlaneOperatorCreds: + description: "ControlPlaneOperatorCreds is a reference to + a secret containing cloud credentials with permissions + matching the control-plane-operator policy. The secret + should have exactly one key, `credentials`, whose value + is an AWS credentials file. \n TODO(dan): document the + \"control plane operator policy\"" + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + kubeCloudControllerCreds: + description: "KubeCloudControllerCreds is a reference to + a secret containing cloud credentials with permissions + matching the cloud controller policy. The secret should + have exactly one key, `credentials`, whose value is an + AWS credentials file. \n TODO(dan): document the \"cloud + controller policy\"" + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + nodePoolManagementCreds: + description: "NodePoolManagementCreds is a reference to + a secret containing cloud credentials with permissions + matching the node pool management policy. The secret should + have exactly one key, `credentials`, whose value is an + AWS credentials file. \n TODO(dan): document the \"node + pool management policy\"" + properties: + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + TODO: Add other useful fields. apiVersion, kind, uid?' + type: string + type: object + region: + description: Region is the IBMCloud region in which the + cluster resides. This configures the OCP control plane + cloud integrations, and is used by NodePool to resolve + the correct boot image for a given release. + type: string + resourceGroup: + description: ResourceGroup is the IBMCloud Resource Group + in which the cluster resides. If not specified then default + resource group of the account will be used. + type: string + serviceInstanceID: + description: ServiceInstanceID is the ServiceInstance to + use for control plane cloud resources. + type: string + subnet: + description: Subnet is the subnet to use for control plane + cloud resources. + properties: + id: + description: ID of resource + type: string + name: + description: Name of resource + type: string + type: object + vpc: + description: VPC specifies IBM Cloud PowerVS Load Balancing + configuration for the control plane. + properties: + name: + description: Name for VPC to used for all the service + load balancer. + type: string + region: + description: Region is the IBMCloud region in which + VPC gets created, this VPC used for all the ingress + traffic into the OCP cluster. + type: string + subnet: + description: Subnet is the subnet to use for load balancer. + type: string + zone: + description: Zone is the availability zone where load + balancer cloud resources are created. + type: string + required: + - name + - region + type: object + zone: + description: Zone is the availability zone where control + plane cloud resources are created. + type: string + required: + - controlPlaneOperatorCreds + - kubeCloudControllerCreds + - nodePoolManagementCreds + - region + type: object type: description: Type is the type of infrastructure provider for the cluster. @@ -21416,6 +21898,7 @@ objects: - Agent - KubeVirt - Azure + - PowerVS type: string required: - type @@ -26864,6 +27347,59 @@ objects: type: object type: object type: object + powervs: + description: PowerVS specifies the configuration used when using + IBMCloud PowerVS platform. + properties: + deletePolicy: + description: DeletePolicy for the image + type: string + image: + description: Image used for deploying the nodes + properties: + id: + description: ID of resource + type: string + name: + description: Name of resource + type: string + type: object + memory: + description: Memory specifies the amount of memory specified + in GBs + type: string + procType: + description: ProcType (dedicated, shared, capped) + type: string + processors: + description: Processors specifies the number of processors + allocated + type: string + serviceInstanceID: + description: ServiceInstanceID is the ServiceInstance to + use for control plane cloud resources. + type: string + storageType: + description: StorageType for the image and nodes + type: string + subnet: + description: Subnet is the subnet to use for control plane + cloud resources. + properties: + id: + description: ID of resource + type: string + name: + description: Name of resource + type: string + type: object + sysType: + description: 'SysType used to host the instance(e.g: s922, + e980, e880)' + type: string + required: + - serviceInstanceID + type: object type: description: Type specifies the platform name. enum: @@ -26873,6 +27409,7 @@ objects: - Agent - KubeVirt - Azure + - PowerVS type: string required: - type diff --git a/hypershift-operator/controllers/hostedcluster/internal/platform/platform.go b/hypershift-operator/controllers/hostedcluster/internal/platform/platform.go index 5b09d867657..b6c4b5871ee 100644 --- a/hypershift-operator/controllers/hostedcluster/internal/platform/platform.go +++ b/hypershift-operator/controllers/hostedcluster/internal/platform/platform.go @@ -11,6 +11,7 @@ import ( "github.com/openshift/hypershift/hypershift-operator/controllers/hostedcluster/internal/platform/ibmcloud" "github.com/openshift/hypershift/hypershift-operator/controllers/hostedcluster/internal/platform/kubevirt" "github.com/openshift/hypershift/hypershift-operator/controllers/hostedcluster/internal/platform/none" + "github.com/openshift/hypershift/hypershift-operator/controllers/hostedcluster/internal/platform/powervs" "github.com/openshift/hypershift/support/upsert" appsv1 "k8s.io/api/apps/v1" rbacv1 "k8s.io/api/rbac/v1" @@ -71,6 +72,8 @@ func GetPlatform(hcluster *hyperv1.HostedCluster, controlplaneOperatorImage stri platform = &kubevirt.Kubevirt{} case hyperv1.AzurePlatform: platform = &azure.Azure{} + case hyperv1.PowerVSPlatform: + platform = &powervs.PowerVS{} default: return nil, fmt.Errorf("unsupported platform: %s", hcluster.Spec.Platform.Type) } diff --git a/hypershift-operator/controllers/hostedcluster/internal/platform/powervs/powervs.go b/hypershift-operator/controllers/hostedcluster/internal/platform/powervs/powervs.go new file mode 100644 index 00000000000..ef2287af3d7 --- /dev/null +++ b/hypershift-operator/controllers/hostedcluster/internal/platform/powervs/powervs.go @@ -0,0 +1,295 @@ +package powervs + +import ( + "context" + "fmt" + + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + rbacv1 "k8s.io/api/rbac/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" + k8sutilspointer "k8s.io/utils/pointer" + capiibmv1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" + capiv1 "sigs.k8s.io/cluster-api/api/v1beta1" + "sigs.k8s.io/controller-runtime/pkg/client" + + configv1 "github.com/openshift/api/config/v1" + hyperv1 "github.com/openshift/hypershift/api/v1alpha1" + "github.com/openshift/hypershift/support/upsert" +) + +const ( + // TODO(mkumatag): Move to OpenShift built image + imageCAPIBM = "k8s.gcr.io/capi-ibmcloud/cluster-api-ibmcloud-controller:v0.2.0" +) + +type PowerVS struct { +} + +func (p PowerVS) DeleteCredentials(ctx context.Context, c client.Client, hcluster *hyperv1.HostedCluster, controlPlaneNamespace string) error { + //TODO(mkumatag): implement me + return nil +} + +func (p PowerVS) ReconcileCAPIInfraCR(ctx context.Context, c client.Client, createOrUpdate upsert.CreateOrUpdateFN, + hcluster *hyperv1.HostedCluster, + controlPlaneNamespace string, + apiEndpoint hyperv1.APIEndpoint) (client.Object, error) { + if hcluster.Spec.Platform.IBMCloud != nil && hcluster.Spec.Platform.IBMCloud.ProviderType == configv1.IBMCloudProviderTypeUPI { + return nil, nil + } + ibmCluster := &capiibmv1.IBMPowerVSCluster{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: controlPlaneNamespace, + Name: hcluster.Name, + }, + } + + ibmCluster.Spec.ServiceInstanceID = hcluster.Spec.Platform.PowerVS.ServiceInstanceID + + _, err := createOrUpdate(ctx, c, ibmCluster, func() error { + ibmCluster.Annotations = map[string]string{ + capiv1.ManagedByAnnotation: "external", + } + + // Set the values for upper level controller + ibmCluster.Status.Ready = true + ibmCluster.Spec.ControlPlaneEndpoint = capiv1.APIEndpoint{ + Host: apiEndpoint.Host, + Port: apiEndpoint.Port, + } + return nil + }) + if err != nil { + return nil, err + } + // reconciliation strips TypeMeta. We repopulate the static values since they are necessary for + // downstream reconciliation of the CAPI Cluster resource. + ibmCluster.TypeMeta = metav1.TypeMeta{ + Kind: "IBMPowerVSCluster", + APIVersion: capiibmv1.GroupVersion.String(), + } + return ibmCluster, nil +} + +func (p PowerVS) CAPIProviderDeploymentSpec(hcluster *hyperv1.HostedCluster, _ *hyperv1.HostedControlPlane) (*appsv1.DeploymentSpec, error) { + defaultMode := int32(420) + deploymentSpec := &appsv1.DeploymentSpec{ + Template: corev1.PodTemplateSpec{ + Spec: corev1.PodSpec{ + TerminationGracePeriodSeconds: k8sutilspointer.Int64Ptr(10), + Tolerations: []corev1.Toleration{ + { + Key: "node-role.kubernetes.io/master", + Effect: corev1.TaintEffectNoSchedule, + }, + }, + Volumes: []corev1.Volume{ + { + Name: "capi-webhooks-tls", + VolumeSource: corev1.VolumeSource{ + Secret: &corev1.SecretVolumeSource{ + DefaultMode: &defaultMode, + SecretName: "capi-webhooks-tls", + }, + }, + }, + { + Name: "credentials", + VolumeSource: corev1.VolumeSource{ + Secret: &corev1.SecretVolumeSource{ + SecretName: hcluster.Spec.Platform.PowerVS.NodePoolManagementCreds.Name, + }, + }, + }, + { + Name: "svc-kubeconfig", + VolumeSource: corev1.VolumeSource{ + Secret: &corev1.SecretVolumeSource{ + DefaultMode: &defaultMode, + SecretName: "service-network-admin-kubeconfig", + }, + }, + }, + { + Name: "token", + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{ + Medium: corev1.StorageMediumMemory, + }, + }, + }, + }, + Containers: []corev1.Container{ + { + Name: "manager", + Image: imageCAPIBM, + ImagePullPolicy: corev1.PullAlways, + VolumeMounts: []corev1.VolumeMount{ + { + Name: "credentials", + MountPath: "/home/.ibmcloud", + }, + { + Name: "capi-webhooks-tls", + ReadOnly: true, + MountPath: "/tmp/k8s-webhook-server/serving-certs", + }, + { + Name: "token", + MountPath: "/var/run/secrets/openshift/serviceaccount", + }, + }, + Env: []corev1.EnvVar{ + { + Name: "MY_NAMESPACE", + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + FieldPath: "metadata.namespace", + }, + }, + }, + { + Name: "IBM_CREDENTIALS_FILE", + Value: "/home/.ibmcloud/ibm-credentials.env", + }, + }, + Command: []string{"/manager"}, + Args: []string{"--namespace", "$(MY_NAMESPACE)", + "--alsologtostderr", + "--v=4", + "--leader-elect=true", + }, + Ports: []corev1.ContainerPort{ + { + Name: "healthz", + ContainerPort: 9440, + Protocol: corev1.ProtocolTCP, + }, + }, + LivenessProbe: &corev1.Probe{ + ProbeHandler: corev1.ProbeHandler{ + HTTPGet: &corev1.HTTPGetAction{ + Path: "/healthz", + Port: intstr.FromString("healthz"), + }, + }, + }, + ReadinessProbe: &corev1.Probe{ + ProbeHandler: corev1.ProbeHandler{ + HTTPGet: &corev1.HTTPGetAction{ + Path: "/readyz", + Port: intstr.FromString("healthz"), + }, + }, + }, + }, + }, + }, + }, + } + return deploymentSpec, nil +} + +func (p PowerVS) ReconcileCredentials(ctx context.Context, c client.Client, createOrUpdate upsert.CreateOrUpdateFN, + hcluster *hyperv1.HostedCluster, + controlPlaneNamespace string) error { + // Reconcile the platform provider cloud controller credentials secret by resolving + // the reference from the HostedCluster and syncing the secret in the control + // plane namespace. + var src corev1.Secret + if err := c.Get(ctx, client.ObjectKey{Namespace: hcluster.GetNamespace(), Name: hcluster.Spec.Platform.PowerVS.KubeCloudControllerCreds.Name}, &src); err != nil { + return fmt.Errorf("failed to get cloud controller provider creds %s: %w", hcluster.Spec.Platform.PowerVS.KubeCloudControllerCreds.Name, err) + } + dest := &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: controlPlaneNamespace, + Name: src.Name, + }, + } + _, err := createOrUpdate(ctx, c, dest, func() error { + srcData, srcHasData := src.Data["ibm-credentials.env"] + if !srcHasData { + return fmt.Errorf("hostedcluster cloud controller provider credentials secret %q must have a credentials key", src.Name) + } + dest.Type = corev1.SecretTypeOpaque + if dest.Data == nil { + dest.Data = map[string][]byte{} + } + dest.Data["ibm-credentials.env"] = srcData + return nil + }) + if err != nil { + return fmt.Errorf("failed to reconcile cloud controller provider creds: %w", err) + } + + // Reconcile the platform provider node pool management credentials secret by + // resolving the reference from the HostedCluster and syncing the secret in + // the control plane namespace. + err = c.Get(ctx, client.ObjectKey{Namespace: hcluster.GetNamespace(), Name: hcluster.Spec.Platform.PowerVS.NodePoolManagementCreds.Name}, &src) + if err != nil { + return fmt.Errorf("failed to get node pool provider creds %s: %w", hcluster.Spec.Platform.PowerVS.NodePoolManagementCreds.Name, err) + } + dest = &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: controlPlaneNamespace, + Name: src.Name, + }, + } + _, err = createOrUpdate(ctx, c, dest, func() error { + srcData, srcHasData := src.Data["ibm-credentials.env"] + if !srcHasData { + return fmt.Errorf("node pool provider credentials secret %q is missing credentials key", src.Name) + } + dest.Type = corev1.SecretTypeOpaque + if dest.Data == nil { + dest.Data = map[string][]byte{} + } + dest.Data["ibm-credentials.env"] = srcData + return nil + }) + if err != nil { + return fmt.Errorf("failed to reconcile node pool provider creds: %w", err) + } + + // Reconcile the platform provider node pool management credentials secret by + // resolving the reference from the HostedCluster and syncing the secret in + // the control plane namespace. + err = c.Get(ctx, client.ObjectKey{Namespace: hcluster.GetNamespace(), Name: hcluster.Spec.Platform.PowerVS.ControlPlaneOperatorCreds.Name}, &src) + if err != nil { + return fmt.Errorf("failed to get control plane operator provider creds %s: %w", hcluster.Spec.Platform.PowerVS.ControlPlaneOperatorCreds.Name, err) + } + dest = &corev1.Secret{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: controlPlaneNamespace, + Name: src.Name, + }, + } + _, err = createOrUpdate(ctx, c, dest, func() error { + srcData, srcHasData := src.Data["ibm-credentials.env"] + if !srcHasData { + return fmt.Errorf("control plane operator provider credentials secret %q is missing credentials key", src.Name) + } + dest.Type = corev1.SecretTypeOpaque + if dest.Data == nil { + dest.Data = map[string][]byte{} + } + dest.Data["ibm-credentials.env"] = srcData + return nil + }) + if err != nil { + return fmt.Errorf("failed to reconcile control plane operator provider creds: %w", err) + } + return nil +} + +func (PowerVS) ReconcileSecretEncryption(ctx context.Context, c client.Client, createOrUpdate upsert.CreateOrUpdateFN, + hcluster *hyperv1.HostedCluster, + controlPlaneNamespace string) error { + return nil +} + +func (PowerVS) CAPIProviderPolicyRules() []rbacv1.PolicyRule { + return nil +} diff --git a/hypershift-operator/controllers/nodepool/nodepool_controller.go b/hypershift-operator/controllers/nodepool/nodepool_controller.go index 7222d4f341c..120d8de8a0d 100644 --- a/hypershift-operator/controllers/nodepool/nodepool_controller.go +++ b/hypershift-operator/controllers/nodepool/nodepool_controller.go @@ -42,6 +42,7 @@ import ( k8sutilspointer "k8s.io/utils/pointer" capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" capiazure "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" + capipowervs "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" capikubevirt "sigs.k8s.io/cluster-api-provider-kubevirt/api/v1alpha1" capiv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/util" @@ -342,6 +343,19 @@ func (r *NodePoolReconciler) reconcile(ctx context.Context, hcluster *hyperv1.Ho }) return ctrl.Result{}, fmt.Errorf("couldn't discover an AMI for release image: %w", err) } + } else if nodePool.Spec.Platform.Type == hyperv1.PowerVSPlatform { + powervsImage, _, err := getPowerVSImage(nodePool, hcluster.Spec.Platform.PowerVS.Region, releaseImage) + if err != nil { + setStatusCondition(&nodePool.Status.Conditions, hyperv1.NodePoolCondition{ + Type: hyperv1.NodePoolValidAMIConditionType, + Status: corev1.ConditionFalse, + Reason: hyperv1.NodePoolValidationFailedConditionReason, + Message: fmt.Sprintf("Couldn't discover an PowerVS Image for release image %q: %s", nodePool.Spec.Release.Image, err.Error()), + ObservedGeneration: nodePool.Generation, + }) + return ctrl.Result{}, fmt.Errorf("couldn't discover an AMI for release image: %w", err) + } + ami = powervsImage.Release } setStatusCondition(&nodePool.Status.Conditions, hyperv1.NodePoolCondition{ Type: hyperv1.NodePoolValidAMIConditionType, @@ -501,6 +515,27 @@ func (r *NodePoolReconciler) reconcile(ctx context.Context, hcluster *hyperv1.Ho return ctrl.Result{}, nil } + // Reconcile PowerVSImage only for the PowerVS platform + if nodePool.Spec.Platform.Type == hyperv1.PowerVSPlatform { + powervsImage, region, err := getPowerVSImage(nodePool, hcluster.Spec.Platform.PowerVS.Region, releaseImage) + if err != nil { + return ctrl.Result{}, err + } + + // Reconcile (Platform)MachineTemplate. + image, mutateImage, _, err := ibmPowerVSImageBuilder(hcluster, nodePool, infraID, region, powervsImage) + if err != nil { + return ctrl.Result{}, err + } + if result, err := r.CreateOrUpdate(ctx, r.Client, image, func() error { + return mutateImage(image) + }); err != nil { + return ctrl.Result{}, err + } else { + log.Info("Reconciled Machine template", "result", result) + } + } + // Reconcile (Platform)MachineTemplate. template, mutateTemplate, machineTemplateSpecJSON, err := machineTemplateBuilders(hcluster, nodePool, infraID, ami) if err != nil { @@ -1434,6 +1469,19 @@ func machineTemplateBuilders(hcluster *hyperv1.HostedCluster, nodePool *hyperv1. o.Annotations[nodePoolAnnotation] = client.ObjectKeyFromObject(nodePool).String() return nil } + + case hyperv1.PowerVSPlatform: + template = &capipowervs.IBMPowerVSMachineTemplate{} + machineTemplateSpec = ibmPowerVSMachineTemplateSpec(nodePool, ami) + mutateTemplate = func(object client.Object) error { + o, _ := object.(*capipowervs.IBMPowerVSMachineTemplate) + o.Spec = *machineTemplateSpec.(*capipowervs.IBMPowerVSMachineTemplateSpec) + if o.Annotations == nil { + o.Annotations = make(map[string]string) + } + o.Annotations[nodePoolAnnotation] = client.ObjectKeyFromObject(nodePool).String() + return nil + } default: // TODO(alberto): Consider signal in a condition. return nil, nil, "", fmt.Errorf("unsupported platform type: %s", nodePool.Spec.Platform.Type) diff --git a/hypershift-operator/controllers/nodepool/powervs.go b/hypershift-operator/controllers/nodepool/powervs.go new file mode 100644 index 00000000000..e9e920a78cf --- /dev/null +++ b/hypershift-operator/controllers/nodepool/powervs.go @@ -0,0 +1,122 @@ +package nodepool + +import ( + "fmt" + hyperv1 "github.com/openshift/hypershift/api/v1alpha1" + "github.com/openshift/hypershift/hypershift-operator/controllers/manifests" + "github.com/openshift/hypershift/support/releaseinfo" + v1 "k8s.io/api/core/v1" + capipowervs "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" + capiv1 "sigs.k8s.io/cluster-api/api/v1beta1" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +const ( + defaultCOSRegion = "us-south" +) + +// getImageRegion returns the nearest region os IBM COS bucket for the RHCOS images +func getImageRegion(region string) string { + switch region { + case "dal", "us-south": + return "us-south" + case "eu-de": + return "eu-de" + case "lon": + return "eu-gb" + case "osa": + return "jp-osa" + case "syd": + return "au-syd" + case "sao": + return "br-sao" + case "tor": + return "ca-tor" + case "tok": + return "jp-tok" + case "us-east": + return "us-east" + default: + return defaultCOSRegion + } +} + +func ibmPowerVSMachineTemplateSpec(nodePool *hyperv1.NodePool, ami string) *capipowervs.IBMPowerVSMachineTemplateSpec { + var image *capipowervs.IBMPowerVSResourceReference + var imageRef *v1.LocalObjectReference + if nodePool.Spec.Platform.PowerVS.Image != nil { + image = &capipowervs.IBMPowerVSResourceReference{ + ID: nodePool.Spec.Platform.PowerVS.Image.ID, + Name: nodePool.Spec.Platform.PowerVS.Image.Name, + } + } else { + imageRef = &v1.LocalObjectReference{ + Name: ami, + } + } + subnet := capipowervs.IBMPowerVSResourceReference{} + if nodePool.Spec.Platform.PowerVS.Subnet != nil { + subnet.ID = nodePool.Spec.Platform.PowerVS.Subnet.ID + subnet.Name = nodePool.Spec.Platform.PowerVS.Subnet.Name + } + return &capipowervs.IBMPowerVSMachineTemplateSpec{ + Template: capipowervs.IBMPowerVSMachineTemplateResource{ + Spec: capipowervs.IBMPowerVSMachineSpec{ + ServiceInstanceID: nodePool.Spec.Platform.PowerVS.ServiceInstanceID, + Image: image, + ImageRef: imageRef, + Network: subnet, + SysType: nodePool.Spec.Platform.PowerVS.SysType, + ProcType: nodePool.Spec.Platform.PowerVS.ProcType, + Processors: nodePool.Spec.Platform.PowerVS.Processors, + Memory: nodePool.Spec.Platform.PowerVS.Memory, + }, + }, + } +} + +func ibmPowerVSImageSpec(powervsClusterName, region string, img *releaseinfo.CoreOSPowerVSImage, nodePool *hyperv1.NodePool) *capipowervs.IBMPowerVSImageSpec { + image := &capipowervs.IBMPowerVSImageSpec{ + ClusterName: powervsClusterName, + ServiceInstanceID: nodePool.Spec.Platform.PowerVS.ServiceInstanceID, + Bucket: &img.Bucket, + Object: &img.Object, + Region: ®ion, + StorageType: nodePool.Spec.Platform.PowerVS.StorageType, + DeletePolicy: nodePool.Spec.Platform.PowerVS.DeletePolicy, + } + return image +} + +func getPowerVSImage(pool *hyperv1.NodePool, region string, releaseImage *releaseinfo.ReleaseImage) (*releaseinfo.CoreOSPowerVSImage, string, error) { + arch, foundArch := releaseImage.StreamMetadata.Architectures["ppc64le"] + if !foundArch { + return nil, "", fmt.Errorf("couldn't find OS metadata for architecture %q", "ppc64le") + } + + COSRegion := getImageRegion(region) + + regionData, hasRegionData := arch.Images.PowerVS.Regions[COSRegion] + if !hasRegionData { + return nil, "", fmt.Errorf("couldn't find PowerVS image for region %q", COSRegion) + } + return ®ionData, COSRegion, nil +} + +func ibmPowerVSImageBuilder(hcluster *hyperv1.HostedCluster, nodePool *hyperv1.NodePool, infraID, region string, img *releaseinfo.CoreOSPowerVSImage) (client.Object, func(object client.Object) error, string, error) { + image := &capipowervs.IBMPowerVSImage{} + imageSpec := ibmPowerVSImageSpec(hcluster.Name, region, img, nodePool) + mutateImage := func(object client.Object) error { + o, _ := object.(*capipowervs.IBMPowerVSImage) + o.Spec = *imageSpec + if o.Annotations == nil { + o.Annotations = make(map[string]string) + } + o.Annotations[nodePoolAnnotation] = client.ObjectKeyFromObject(nodePool).String() + o.Annotations[capiv1.ClusterLabelName] = infraID + return nil + } + image.SetNamespace(manifests.HostedControlPlaneNamespace(hcluster.Namespace, hcluster.Name).Name) + image.SetName(img.Release) + return image, mutateImage, "", nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/LICENSE b/vendor/github.com/IBM-Cloud/power-go-client/LICENSE new file mode 100644 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-clonevolumes.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-clonevolumes.go new file mode 100644 index 00000000000..c72b4d0d1fb --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-clonevolumes.go @@ -0,0 +1,142 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/errors" + + "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/p_cloud_volumes" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPICloneVolumeClient ... +type IBMPICloneVolumeClient struct { + IBMPIClient +} + +// NewIBMPICloneVolumeClient ... +func NewIBMPICloneVolumeClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPICloneVolumeClient { + return &IBMPICloneVolumeClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +//Create a clone volume using V2 of the API - This creates a clone +func (f *IBMPICloneVolumeClient) Create(body *models.VolumesCloneAsyncRequest) (*models.CloneTaskReference, error) { + params := p_cloud_volumes.NewPcloudV2VolumesClonePostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + resp, err := f.session.Power.PCloudVolumes.PcloudV2VolumesClonePost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.CreateCloneOperationFailed, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to perform the create clone operation") + } + return resp.Payload, nil +} + +// Get status of a clone request +func (f *IBMPICloneVolumeClient) Get(cloneTaskID string) (*models.CloneTaskStatus, error) { + params := p_cloud_volumes.NewPcloudV2VolumesClonetasksGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithCloneTaskID(cloneTaskID) + resp, err := f.session.Power.PCloudVolumes.PcloudV2VolumesClonetasksGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to get the clone task %s status for the cloud instance %s with error %w", cloneTaskID, f.cloudInstanceID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get the clone task %s status for the cloud instance %s", cloneTaskID, f.cloudInstanceID) + } + return resp.Payload, nil +} + +// Create a volume clone V2 Version = This is the prepare operation +func (f *IBMPICloneVolumeClient) CreateV2Clone(body *models.VolumesCloneCreate) (*models.VolumesClone, error) { + params := p_cloud_volumes.NewPcloudV2VolumesclonePostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + resp, err := f.session.Power.PCloudVolumes.PcloudV2VolumesclonePost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.PrepareCloneOperationFailed, *body.Name, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to prepare the clone operation") + } + return resp.Payload, nil +} + +// Get a list of volume-clones request for a cloud instance +func (f *IBMPICloneVolumeClient) GetV2Clones(queryFilter string) (*models.VolumesClones, error) { + params := p_cloud_volumes.NewPcloudV2VolumescloneGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithFilter(&queryFilter) + resp, err := f.session.Power.PCloudVolumes.PcloudV2VolumescloneGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to get the volumes-clones for the cloud instance %s with error %w", f.cloudInstanceID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get the volumes-clones for the cloud instance %s", f.cloudInstanceID) + } + return resp.Payload, nil +} + +// Delete a volume- clone request +func (f *IBMPICloneVolumeClient) DeleteClone(id string) error { + params := p_cloud_volumes.NewPcloudV2VolumescloneDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVolumesCloneID(id) + _, err := f.session.Power.PCloudVolumes.PcloudV2VolumescloneDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf(errors.DeleteCloneOperationFailed, err) + } + return nil +} + +// Initiate the start clone request +func (f *IBMPICloneVolumeClient) StartClone(volumesCloneID string) (*models.VolumesClone, error) { + params := p_cloud_volumes.NewPcloudV2VolumescloneStartPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVolumesCloneID(volumesCloneID) + resp, err := f.session.Power.PCloudVolumes.PcloudV2VolumescloneStartPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.StartCloneOperationFailed, volumesCloneID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to start the clone operation for volume-clone %s", volumesCloneID) + } + return resp.Payload, nil +} + +// Initiate the execute action for a clone +func (f *IBMPICloneVolumeClient) PrepareClone(volumesCloneID string) (*models.VolumesClone, error) { + params := p_cloud_volumes.NewPcloudV2VolumescloneExecutePostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVolumesCloneID(volumesCloneID) + resp, err := f.session.Power.PCloudVolumes.PcloudV2VolumescloneExecutePost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.PrepareCloneOperationFailed, volumesCloneID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to prepare the clone operation for %s", volumesCloneID) + } + return resp.Payload, nil +} + +// Get V2Clone Task Status +func (f *IBMPICloneVolumeClient) GetV2CloneStatus(cloneName string) (*models.VolumesCloneDetail, error) { + params := p_cloud_volumes.NewPcloudV2VolumescloneGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVolumesCloneID(cloneName) + resp, err := f.session.Power.PCloudVolumes.PcloudV2VolumescloneGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.GetCloneOperationFailed, cloneName, f.cloudInstanceID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get the volumes-clone %s for the cloud instance %s", cloneName, f.cloudInstanceID) + } + return resp.Payload, nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-cloud-connection.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-cloud-connection.go new file mode 100644 index 00000000000..d1846123d25 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-cloud-connection.go @@ -0,0 +1,164 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/errors" + "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/p_cloud_cloud_connections" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPICloudConnectionClient ... +type IBMPICloudConnectionClient struct { + IBMPIClient +} + +// NewIBMPICloudConnectionClient ... +func NewIBMPICloudConnectionClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPICloudConnectionClient { + return &IBMPICloudConnectionClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Create a Cloud Connection +func (f *IBMPICloudConnectionClient) Create(body *models.CloudConnectionCreate) (*models.CloudConnection, *models.CloudConnectionCreateResponse, error) { + params := p_cloud_cloud_connections.NewPcloudCloudconnectionsPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + postok, postcreated, postaccepted, err := f.session.Power.PCloudCloudConnections.PcloudCloudconnectionsPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, nil, fmt.Errorf(errors.CreateCloudConnectionOperationFailed, f.cloudInstanceID, err) + } + if postok != nil && postok.Payload != nil { + return postok.Payload, nil, nil + } + if postcreated != nil && postcreated.Payload != nil { + return postcreated.Payload, nil, nil + } + if postaccepted != nil && postaccepted.Payload != nil { + return nil, postaccepted.Payload, nil + } + return nil, nil, fmt.Errorf("failed to Create Cloud Connection") +} + +// Get ... +func (f *IBMPICloudConnectionClient) Get(id string) (*models.CloudConnection, error) { + params := p_cloud_cloud_connections.NewPcloudCloudconnectionsGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithCloudConnectionID(id) + resp, err := f.session.Power.PCloudCloudConnections.PcloudCloudconnectionsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.GetCloudConnectionOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to perform Get Cloud Connections Operation for cloudconnectionid %s", id) + } + return resp.Payload, nil +} + +// GetAll .. +func (f *IBMPICloudConnectionClient) GetAll() (*models.CloudConnections, error) { + params := p_cloud_cloud_connections.NewPcloudCloudconnectionsGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudCloudConnections.PcloudCloudconnectionsGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get all Cloud Connections: %w", err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all Cloud Connections") + } + return resp.Payload, nil +} + +// Update a cloud Connection +func (f *IBMPICloudConnectionClient) Update(id string, body *models.CloudConnectionUpdate) (*models.CloudConnection, *models.JobReference, error) { + params := p_cloud_cloud_connections.NewPcloudCloudconnectionsPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithCloudConnectionID(id). + WithBody(body) + putok, putaccepted, err := f.session.Power.PCloudCloudConnections.PcloudCloudconnectionsPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, nil, fmt.Errorf(errors.UpdateCloudConnectionOperationFailed, id, err) + } + if putok != nil && putok.Payload != nil { + return putok.Payload, nil, nil + } + if putaccepted != nil && putaccepted.Payload != nil { + return nil, putaccepted.Payload, nil + } + return nil, nil, fmt.Errorf("failed to Update Cloud Connection %s", id) +} + +// Delete a Cloud Connection +func (f *IBMPICloudConnectionClient) Delete(id string) (*models.JobReference, error) { + params := p_cloud_cloud_connections.NewPcloudCloudconnectionsDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithCloudConnectionID(id) + _, delaccepted, err := f.session.Power.PCloudCloudConnections.PcloudCloudconnectionsDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.DeleteCloudConnectionOperationFailed, id, err) + } + if delaccepted != nil && delaccepted.Payload != nil { + return delaccepted.Payload, nil + } + return nil, nil +} + +// AddNetwork to a cloud connection +func (f *IBMPICloudConnectionClient) AddNetwork(id, networkID string) (*models.CloudConnection, *models.JobReference, error) { + params := p_cloud_cloud_connections.NewPcloudCloudconnectionsNetworksPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithCloudConnectionID(id). + WithNetworkID(networkID) + respok, respAccepted, err := f.session.Power.PCloudCloudConnections.PcloudCloudconnectionsNetworksPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, nil, fmt.Errorf("failed to Add Network %s to Cloud Connection %s: %w", networkID, id, err) + } + if respok != nil && respok.Payload != nil { + return respok.Payload, nil, nil + } + if respAccepted != nil && respAccepted.Payload != nil { + return nil, respAccepted.Payload, nil + } + return nil, nil, nil +} + +// DeleteNetwork Deletes a network from a cloud connection +func (f *IBMPICloudConnectionClient) DeleteNetwork(id, networkID string) (*models.CloudConnection, *models.JobReference, error) { + params := p_cloud_cloud_connections.NewPcloudCloudconnectionsNetworksDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithCloudConnectionID(id). + WithNetworkID(networkID) + respok, respAccepted, err := f.session.Power.PCloudCloudConnections.PcloudCloudconnectionsNetworksDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, nil, fmt.Errorf("failed to Delete Network %s from Cloud Connection %s: %w", networkID, id, err) + } + if respok != nil && respok.Payload != nil { + return respok.Payload, nil, nil + } + if respAccepted != nil && respAccepted.Payload != nil { + return nil, respAccepted.Payload, nil + } + return nil, nil, nil +} + +// get VPCs for a cloud instance +func (f *IBMPICloudConnectionClient) GetVPC() (*models.CloudConnectionVirtualPrivateClouds, error) { + params := p_cloud_cloud_connections.NewPcloudCloudconnectionsVirtualprivatecloudsGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + + resp, err := f.session.Power.PCloudCloudConnections.PcloudCloudconnectionsVirtualprivatecloudsGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to perform the get vpc operation: %w", err) + } + if resp.Payload == nil { + return nil, fmt.Errorf("failed to perform the get vpc operation") + } + return resp.Payload, nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-cloud-instance.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-cloud-instance.go new file mode 100644 index 00000000000..45a0c8238da --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-cloud-instance.go @@ -0,0 +1,67 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/errors" + "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/p_cloud_instances" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPICloudInstanceClient ... +type IBMPICloudInstanceClient struct { + IBMPIClient +} + +// NewIBMPICloudInstanceClient ... +func NewIBMPICloudInstanceClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPICloudInstanceClient { + return &IBMPICloudInstanceClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Get information about a cloud instance +func (f *IBMPICloudInstanceClient) Get(id string) (*models.CloudInstance, error) { + params := p_cloud_instances.NewPcloudCloudinstancesGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(id) + resp, err := f.session.Power.PCloudInstances.PcloudCloudinstancesGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.GetCloudInstanceOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Cloud Instance %s", id) + } + return resp.Payload, nil +} + +// Update a cloud instance +func (f *IBMPICloudInstanceClient) Update(id string, body *models.CloudInstanceUpdate) (*models.CloudInstance, error) { + params := p_cloud_instances.NewPcloudCloudinstancesPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). + WithCloudInstanceID(id).WithBody(body) + resp, err := f.session.Power.PCloudInstances.PcloudCloudinstancesPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.UpdateCloudInstanceOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to update the Cloud instance %s", id) + } + return resp.Payload, nil +} + +// Delete a Cloud instance +func (f *IBMPICloudInstanceClient) Delete(id string) error { + params := p_cloud_instances.NewPcloudCloudinstancesDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(id) + _, err := f.session.Power.PCloudInstances.PcloudCloudinstancesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf(errors.DeleteCloudInstanceOperationFailed, id, err) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-dhcp.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-dhcp.go new file mode 100644 index 00000000000..b3e7a0d6ed0 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-dhcp.go @@ -0,0 +1,82 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/errors" + "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/p_cloud_service_d_h_c_p" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// NewIBMPIDhcpClient ... +type IBMPIDhcpClient struct { + IBMPIClient +} + +// NewIBMPIDhcpClient ... +func NewIBMPIDhcpClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIDhcpClient { + return &IBMPIDhcpClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Create +func (f *IBMPIDhcpClient) Create(body *models.DHCPServerCreate) (*models.DHCPServer, error) { + params := p_cloud_service_d_h_c_p.NewPcloudDhcpPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + postaccepted, err := f.session.Power.PCloudServicedhcp.PcloudDhcpPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.CreateDchpOperationFailed, f.cloudInstanceID, err) + } + if postaccepted != nil && postaccepted.Payload != nil { + return postaccepted.Payload, nil + } + return nil, fmt.Errorf("failed to Create DHCP") +} + +// Get +func (f *IBMPIDhcpClient) Get(id string) (*models.DHCPServerDetail, error) { + params := p_cloud_service_d_h_c_p.NewPcloudDhcpGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithDhcpID(id) + resp, err := f.session.Power.PCloudServicedhcp.PcloudDhcpGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.GetDhcpOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get DHCP %s", id) + } + return resp.Payload, nil +} + +// GetAll +func (f *IBMPIDhcpClient) GetAll() (models.DHCPServers, error) { + params := p_cloud_service_d_h_c_p.NewPcloudDhcpGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudServicedhcp.PcloudDhcpGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get all DHCP servers: %w", err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all DHCP servers") + } + return resp.Payload, nil +} + +// Delete +func (f *IBMPIDhcpClient) Delete(id string) error { + params := p_cloud_service_d_h_c_p.NewPcloudDhcpDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithDhcpID(id) + _, err := f.session.Power.PCloudServicedhcp.PcloudDhcpDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf(errors.DeleteDhcpOperationFailed, id, err) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-helper.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-helper.go new file mode 100644 index 00000000000..4b75a757551 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-helper.go @@ -0,0 +1,27 @@ +package instance + +import ( + "context" + + "github.com/IBM-Cloud/power-go-client/ibmpisession" +) + +/* +Helper methods that will be used by the client classes +*/ + +// IBMPIHelperClient ... +type IBMPIClient struct { + session *ibmpisession.IBMPISession + cloudInstanceID string + ctx context.Context +} + +// NewIBMPIClient ... +func NewIBMPIClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIClient { + return &IBMPIClient{ + session: sess, + cloudInstanceID: cloudInstanceID, + ctx: ctx, + } +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-image.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-image.go new file mode 100644 index 00000000000..a6063fe61f0 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-image.go @@ -0,0 +1,218 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/errors" + + "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/p_cloud_images" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +//IBMPIImageClient ... +type IBMPIImageClient struct { + IBMPIClient +} + +// NewIBMPIImageClient ... +func NewIBMPIImageClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIImageClient { + return &IBMPIImageClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Get PI Image +func (f *IBMPIImageClient) Get(id string) (*models.Image, error) { + params := p_cloud_images.NewPcloudCloudinstancesImagesGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithImageID(id) + resp, err := f.session.Power.PCloudImages.PcloudCloudinstancesImagesGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.GetImageOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to perform Get Image Operation for image %s", id) + } + return resp.Payload, nil +} + +// GetAll Images that are imported into Power Instance +func (f *IBMPIImageClient) GetAll() (*models.Images, error) { + params := p_cloud_images.NewPcloudCloudinstancesImagesGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudImages.PcloudCloudinstancesImagesGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get all PI Images of the PVM instance %s : %w", f.cloudInstanceID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all PI Images of the PVM instance %s", f.cloudInstanceID) + } + return resp.Payload, nil +} + +// Create the stock image +func (f *IBMPIImageClient) Create(body *models.CreateImage) (*models.Image, error) { + if len(*body.Source) == 0 { + defaultSource := "root-project" + body.Source = &defaultSource + } + params := p_cloud_images.NewPcloudCloudinstancesImagesPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + respok, respcreated, err := f.session.Power.PCloudImages.PcloudCloudinstancesImagesPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.CreateImageOperationFailed, f.cloudInstanceID, err) + } + if respok != nil && respok.Payload != nil { + return respok.Payload, nil + } + if respcreated != nil && respcreated.Payload != nil { + return respcreated.Payload, nil + } + return nil, fmt.Errorf("failed to perform Create Image Operation for cloud instance %s", f.cloudInstanceID) +} + +// Import the image +func (f *IBMPIImageClient) CreateCosImage(body *models.CreateCosImageImportJob) (imageJob *models.JobReference, err error) { + params := p_cloud_images.NewPcloudV1CloudinstancesCosimagesPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + resp, err := f.session.Power.PCloudImages.PcloudV1CloudinstancesCosimagesPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to perform Create COS Image Operation for cloud instance %s with error %w", f.cloudInstanceID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to perform Create COS Image Operation for cloud instance %s", f.cloudInstanceID) + } + return resp.Payload, nil +} + +// Export an image +func (f *IBMPIImageClient) ExportImage(id string, body *models.ExportImage) (*models.JobReference, error) { + params := p_cloud_images.NewPcloudV2ImagesExportPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithImageID(id).WithBody(body) + resp, err := f.session.Power.PCloudImages.PcloudV2ImagesExportPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Export COS Image for image id %s with error %w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Export COS Image for image id %s", id) + } + return resp.Payload, nil +} + +// Delete ... +func (f *IBMPIImageClient) Delete(id string) error { + params := p_cloud_images.NewPcloudCloudinstancesImagesDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithImageID(id) + _, err := f.session.Power.PCloudImages.PcloudCloudinstancesImagesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to Delete PI Image %s: %w", id, err) + } + return nil +} + +// GetStockImages ... +func (f *IBMPIImageClient) GetStockImage(id string) (*models.Image, error) { + params := p_cloud_images.NewPcloudCloudinstancesStockimagesGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithImageID(id) + resp, err := f.session.Power.PCloudImages.PcloudCloudinstancesStockimagesGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get PI Stock Image %s for cloud instance %s: %w", id, f.cloudInstanceID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get PI Stock Image %s for cloud instance %s", id, f.cloudInstanceID) + } + return resp.Payload, nil +} + +// Get StockImage +func (f *IBMPIImageClient) GetAllStockImages(includeSAP bool, includeVTl bool) (*models.Images, error) { + params := p_cloud_images.NewPcloudCloudinstancesStockimagesGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID). + WithSap(&includeSAP). + WithVtl(&includeVTl) + resp, err := f.session.Power.PCloudImages.PcloudCloudinstancesStockimagesGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to get Stock Images with (SAP=%t, VTL=%t) for cloud instance %s: %w", includeSAP, includeVTl, f.cloudInstanceID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get Stock Images with (SAP=%t, VTL=%t) for cloud instance %s", includeSAP, includeVTl, f.cloudInstanceID) + } + return resp.Payload, nil +} + +// GetAllStockSAPImages returns all stock SAP images. No Other images are included +func (f *IBMPIImageClient) GetAllStockSAPImages() (*models.Images, error) { + // get stock images. include all available SAP images + images, err := f.GetAllStockImages(true, false) + if err != nil { + return nil, err + } + + // select SAP images + sapImages := new(models.Images) + for _, image := range images.Images { + if image.Specifications.ImageType == "stock-sap" { + sapImages.Images = append(sapImages.Images, image) + } + } + return sapImages, nil +} + +// GetAllStockVTLImages returns all VTL images. No Other images are included +func (f *IBMPIImageClient) GetAllStockVTLImages() (*models.Images, error) { + // get stock images. include all available stock VTL images + images, err := f.GetAllStockImages(false, true) + if err != nil { + return nil, err + } + + // select VTL images + vtlImages := new(models.Images) + for _, image := range images.Images { + if image.Specifications.ImageType == "stock-vtl" { + vtlImages.Images = append(vtlImages.Images, image) + } + } + return vtlImages, nil +} + +// IsVtlImage returns true if image is a VTL images +func (f *IBMPIImageClient) IsVTLImage(imageId string) (bool, error) { + images := new(models.Images) + + // get all stock vtl images + stockVTLImages, err := f.GetAllStockVTLImages() + if err != nil { + return false, err + } + images.Images = append(images.Images, stockVTLImages.Images...) + + // get all images + cloudInstanceImages, err := f.GetAll() + if err != nil { + return false, err + } + images.Images = append(images.Images, cloudInstanceImages.Images...) + + // search for image in list of all images + for _, image := range images.Images { + if imageId == *image.ImageID { + if image.Specifications.ImageType == "stock-vtl" { + return true, nil + } else { + return false, fmt.Errorf("image with id: %s is not a VTL image", imageId) + } + } + } + return false, fmt.Errorf("image with id: %s is not a VTL image", imageId) +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-instance.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-instance.go new file mode 100644 index 00000000000..c73f8bcee24 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-instance.go @@ -0,0 +1,285 @@ +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/p_cloud_p_vm_instances" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPIInstanceClient ... +type IBMPIInstanceClient struct { + IBMPIClient +} + +// NewIBMPIInstanceClient ... +func NewIBMPIInstanceClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIInstanceClient { + return &IBMPIInstanceClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +//Get information about a single pvm only +func (f *IBMPIInstanceClient) Get(id string) (*models.PVMInstance, error) { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get PVM Instance %s :%w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get PVM Instance %s", id) + } + return resp.Payload, nil +} + +// GetAll Information about all the PVM Instances for a Client +func (f *IBMPIInstanceClient) GetAll() (*models.PVMInstances, error) { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get all PVM Instances of Power Instance %s :%w", f.cloudInstanceID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all PVM Instances of Power Instance %s", f.cloudInstanceID) + } + return resp.Payload, nil +} + +//Create ... +func (f *IBMPIInstanceClient) Create(body *models.PVMInstanceCreate) (*models.PVMInstanceList, error) { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + postok, postcreated, postAccepted, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Create PVM Instance :%w", err) + } + if postok != nil && len(postok.Payload) > 0 { + return &postok.Payload, nil + } + if postcreated != nil && len(postcreated.Payload) > 0 { + return &postcreated.Payload, nil + } + if postAccepted != nil && len(postAccepted.Payload) > 0 { + return &postAccepted.Payload, nil + } + return nil, fmt.Errorf("failed to Create PVM Instance") +} + +// Delete PVM Instances +func (f *IBMPIInstanceClient) Delete(id string) error { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id) + _, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to Delete PVM Instance %s :%w", id, err) + } + return nil +} + +// Update PVM Instances +func (f *IBMPIInstanceClient) Update(id string, body *models.PVMInstanceUpdate) (*models.PVMInstanceUpdateResponse, error) { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id).WithBody(body) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Update PVM Instance %s :%w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Update PVM Instance %s", id) + } + return resp.Payload, nil +} + +// Action PVM Instances Operations +func (f *IBMPIInstanceClient) Action(id string, body *models.PVMInstanceAction) error { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesActionPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). + WithBody(body) + _, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesActionPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to perform Action on PVM Instance %s :%w", id, err) + } + return nil + +} + +// PostConsoleURL Generate the Console URL +func (f *IBMPIInstanceClient) PostConsoleURL(id string) (*models.PVMInstanceConsole, error) { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesConsolePostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id) + postok, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesConsolePost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Generate the Console URL PVM Instance %s :%w", id, err) + } + if postok == nil || postok.Payload == nil { + return nil, fmt.Errorf("failed to Generate the Console URL PVM Instance %s", id) + } + return postok.Payload, nil +} + +// List the available console languages for an instance +func (f *IBMPIInstanceClient) GetConsoleLanguages(id string) (*models.ConsoleLanguages, error) { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesConsoleGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesConsoleGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get Console Languages for PVM Instance %s :%w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Console Languages for PVM Instance %s", id) + } + return resp.Payload, nil +} + +// List the available console languages for an instance +func (f *IBMPIInstanceClient) UpdateConsoleLanguage(id string, body *models.ConsoleLanguage) (*models.ConsoleLanguage, error) { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesConsolePutParams(). + WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). + WithBody(body) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesConsolePut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Update Console Language for PVM Instance %s :%w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Update Console Language for PVM Instance %s", id) + } + return resp.Payload, nil +} + +// CaptureInstanceToImageCatalog Captures an instance +func (f *IBMPIInstanceClient) CaptureInstanceToImageCatalog(id string, body *models.PVMInstanceCapture) error { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesCapturePostParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). + WithBody(body) + _, _, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesCapturePost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to Capture the PVM Instance %s: %w", id, err) + } + return nil + +} + +//CaptureInstanceToImageCatalog Captures V2 +func (f *IBMPIInstanceClient) CaptureInstanceToImageCatalogV2(id string, body *models.PVMInstanceCapture) (*models.JobReference, error) { + params := p_cloud_p_vm_instances.NewPcloudV2PvminstancesCapturePostParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). + WithBody(body) + resp, err := f.session.Power.PCloudpVMInstances.PcloudV2PvminstancesCapturePost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Capture the PVM Instance %s: %w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Capture the PVM Instance %s", id) + } + return resp.Payload, nil +} + +// CreatePvmSnapShot Create a snapshot of the instance +func (f *IBMPIInstanceClient) CreatePvmSnapShot(id string, body *models.SnapshotCreate) (*models.SnapshotCreateResponse, error) { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesSnapshotsPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). + WithBody(body) + snapshotpostaccepted, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesSnapshotsPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Create the snapshot for the pvminstance %s: %w", id, err) + } + if snapshotpostaccepted == nil || snapshotpostaccepted.Payload == nil { + return nil, fmt.Errorf("failed to Create the snapshot for the pvminstance %s", id) + } + return snapshotpostaccepted.Payload, nil +} + +// CreateClone ... +func (f *IBMPIInstanceClient) CreateClone(id string, body *models.PVMInstanceClone) (*models.PVMInstance, error) { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesClonePostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). + WithBody(body) + clonePost, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesClonePost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to create the clone of the pvm instance %s: %w", id, err) + } + if clonePost == nil || clonePost.Payload == nil { + return nil, fmt.Errorf("failed to create the clone of the pvm instance %s", id) + } + return clonePost.Payload, nil +} + +// GetSnapShotVM Get information about the snapshots for a vm +func (f *IBMPIInstanceClient) GetSnapShotVM(id string) (*models.Snapshots, error) { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesSnapshotsGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesSnapshotsGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get the snapshot for the pvminstance %s: %w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get the snapshot for the pvminstance %s", id) + } + return resp.Payload, nil + +} + +// RestoreSnapShotVM Restore a snapshot +func (f *IBMPIInstanceClient) RestoreSnapShotVM(id, snapshotid, restoreAction string, body *models.SnapshotRestore) (*models.Snapshot, error) { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesSnapshotsRestorePostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). + WithSnapshotID(snapshotid).WithRestoreFailAction(&restoreAction). + WithBody(body) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesSnapshotsRestorePost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to restrore the snapshot for the pvminstance %s: %w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to restrore the snapshot for the pvminstance %s", id) + } + return resp.Payload, nil +} + +// AddNetwork Add a network to the instance +func (f *IBMPIInstanceClient) AddNetwork(id string, body *models.PVMInstanceAddNetwork) (*models.PVMInstanceNetwork, error) { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesNetworksPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). + WithBody(body) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesNetworksPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to attach the network to the pvminstanceid %s: %w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to attach the network to the pvminstanceid %s", id) + } + return resp.Payload, nil +} + +// Delete a network from an instance +func (f *IBMPIInstanceClient) DeleteNetwork(id string, body *models.PVMInstanceRemoveNetwork) error { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesNetworksDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). + WithBody(body) + _, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesNetworksDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to delete the network to the pvminstanceid %s: %w", id, err) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-job.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-job.go new file mode 100644 index 00000000000..e3eddb65f18 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-job.go @@ -0,0 +1,67 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/errors" + "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/p_cloud_jobs" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPIJobClient ... +type IBMPIJobClient struct { + IBMPIClient +} + +// NewIBMPIJobClient ... +func NewIBMPIJobClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIJobClient { + return &IBMPIJobClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Get information about a job +func (f *IBMPIJobClient) Get(id string) (*models.Job, error) { + params := p_cloud_jobs.NewPcloudCloudinstancesJobsGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithJobID(id) + resp, err := f.session.Power.PCloudJobs.PcloudCloudinstancesJobsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.GetJobOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to perform get Job operation for job id %s", id) + } + return resp.Payload, nil +} + +// Gell all jobs +func (f *IBMPIJobClient) GetAll() (*models.Jobs, error) { + params := p_cloud_jobs.NewPcloudCloudinstancesJobsGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudJobs.PcloudCloudinstancesJobsGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.GetAllJobsOperationFailed, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to perform get all jobs") + } + return resp.Payload, nil +} + +// Delete a job +func (f *IBMPIJobClient) Delete(id string) error { + params := p_cloud_jobs.NewPcloudCloudinstancesJobsDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithJobID(id) + _, err := f.session.Power.PCloudJobs.PcloudCloudinstancesJobsDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf(errors.DeleteJobsOperationFailed, id, err) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-key.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-key.go new file mode 100644 index 00000000000..2c236ae4819 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-key.go @@ -0,0 +1,89 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/errors" + "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/p_cloud_tenants_ssh_keys" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPIKeyClient ... +type IBMPIKeyClient struct { + IBMPIClient +} + +// NewIBMPIKeyClient ... +func NewIBMPIKeyClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIKeyClient { + return &IBMPIKeyClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Get Key... +func (f *IBMPIKeyClient) Get(id string) (*models.SSHKey, error) { + var tenantid = f.session.Options.UserAccount + params := p_cloud_tenants_ssh_keys.NewPcloudTenantsSshkeysGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithTenantID(tenantid).WithSshkeyName(id) + resp, err := f.session.Power.PCloudTenantsSSHKeys.PcloudTenantsSshkeysGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.GetPIKeyOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get PI Key %s", id) + } + return resp.Payload, nil +} + +// GetAll Information about all the PVM Instances for a Client +func (f *IBMPIKeyClient) GetAll() (*models.SSHKeys, error) { + var tenantid = f.session.Options.UserAccount + params := p_cloud_tenants_ssh_keys.NewPcloudTenantsSshkeysGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithTenantID(tenantid) + resp, err := f.session.Power.PCloudTenantsSSHKeys.PcloudTenantsSshkeysGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get all PI Keys: %w", err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all PI Keys") + } + return resp.Payload, nil +} + +// Create PI Key ... +func (f *IBMPIKeyClient) Create(body *models.SSHKey) (*models.SSHKey, error) { + var tenantid = f.session.Options.UserAccount + params := p_cloud_tenants_ssh_keys.NewPcloudTenantsSshkeysPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithTenantID(tenantid).WithBody(body) + postok, postcreated, err := f.session.Power.PCloudTenantsSSHKeys.PcloudTenantsSshkeysPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.CreatePIKeyOperationFailed, 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 PI Key") +} + +// Delete ... +func (f *IBMPIKeyClient) Delete(id string) error { + var tenantid = f.session.Options.UserAccount + params := p_cloud_tenants_ssh_keys.NewPcloudTenantsSshkeysDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithTenantID(tenantid).WithSshkeyName(id) + _, err := f.session.Power.PCloudTenantsSSHKeys.PcloudTenantsSshkeysDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf(errors.DeletePIKeyOperationFailed, id, err) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-network.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-network.go new file mode 100644 index 00000000000..5871a504fcb --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-network.go @@ -0,0 +1,194 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/errors" + "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/p_cloud_networks" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPINetworkClient ... +type IBMPINetworkClient struct { + IBMPIClient +} + +// NewIBMPINetworkClient ... +func NewIBMPINetworkClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPINetworkClient { + return &IBMPINetworkClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Get ... +func (f *IBMPINetworkClient) Get(id string) (*models.Network, error) { + params := p_cloud_networks.NewPcloudNetworksGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithNetworkID(id) + resp, err := f.session.Power.PCloudNetworks.PcloudNetworksGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.GetNetworkOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Network %s", id) + } + return resp.Payload, nil +} + +// Get All +func (f *IBMPINetworkClient) GetAll() (*models.Networks, error) { + params := p_cloud_networks.NewPcloudNetworksGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudNetworks.PcloudNetworksGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get Network for cloud instance %s with error %w", f.cloudInstanceID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Network for cloud instance %s", f.cloudInstanceID) + } + return resp.Payload, nil +} + +// Create ... +func (f *IBMPINetworkClient) Create(body *models.NetworkCreate) (*models.Network, error) { + params := p_cloud_networks.NewPcloudNetworksPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + postok, postcreated, err := f.session.Power.PCloudNetworks.PcloudNetworksPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.CreateNetworkOperationFailed, body.Name, 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 perform Create Network Operation for Network %s", body.Name) +} + +// Update ... +func (f *IBMPINetworkClient) Update(id string, body *models.NetworkUpdate) (*models.Network, error) { + params := p_cloud_networks.NewPcloudNetworksPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithNetworkID(id). + WithBody(body) + resp, err := f.session.Power.PCloudNetworks.PcloudNetworksPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to perform Update Network Operation for Network %s with error %w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to perform Update Network Operation for Network %s", id) + } + return resp.Payload, nil +} + +// GetPublic ... +func (f *IBMPINetworkClient) GetAllPublic() (*models.Networks, error) { + filterQuery := "type=\"pub-vlan\"" + params := p_cloud_networks.NewPcloudNetworksGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithFilter(&filterQuery) + resp, err := f.session.Power.PCloudNetworks.PcloudNetworksGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get all Public Networks for cloud instance %s: %w", f.cloudInstanceID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all Public Networks for cloud instance %s", f.cloudInstanceID) + } + return resp.Payload, nil +} + +// Delete ... +func (f *IBMPINetworkClient) Delete(id string) error { + params := p_cloud_networks.NewPcloudNetworksDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithNetworkID(id) + _, err := f.session.Power.PCloudNetworks.PcloudNetworksDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to Delete PI Network %s: %w", id, err) + } + return nil +} + +//GetAllPorts ... +func (f *IBMPINetworkClient) GetAllPorts(id string) (*models.NetworkPorts, error) { + params := p_cloud_networks.NewPcloudNetworksPortsGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithNetworkID(id) + resp, err := f.session.Power.PCloudNetworks.PcloudNetworksPortsGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get all Network Ports for Network %s: %w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all Network Ports for Network %s", id) + } + return resp.Payload, nil +} + +// GetPort ... +func (f *IBMPINetworkClient) GetPort(id string, networkPortID string) (*models.NetworkPort, error) { + params := p_cloud_networks.NewPcloudNetworksPortsGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithNetworkID(id). + WithPortID(networkPortID) + resp, err := f.session.Power.PCloudNetworks.PcloudNetworksPortsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + + if err != nil { + return nil, fmt.Errorf("failed to Get PI Network Port %s for Network %s: %w", networkPortID, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get PI Network Port %s for Network %s", networkPortID, id) + } + return resp.Payload, nil +} + +// CreatePort ... +func (f *IBMPINetworkClient) CreatePort(id string, body *models.NetworkPortCreate) (*models.NetworkPort, error) { + params := p_cloud_networks.NewPcloudNetworksPortsPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithNetworkID(id). + WithBody(body) + resp, err := f.session.Power.PCloudNetworks.PcloudNetworksPortsPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.CreateNetworkPortOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to perform Create Network Port Operation for Network %s", id) + } + return resp.Payload, nil +} + +// DeletePort ... +func (f *IBMPINetworkClient) DeletePort(id string, networkPortID string) error { + params := p_cloud_networks.NewPcloudNetworksPortsDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithNetworkID(id). + WithPortID(networkPortID) + _, err := f.session.Power.PCloudNetworks.PcloudNetworksPortsDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to delete the network port %s for network %s with error %w", networkPortID, id, err) + } + return nil +} + +//UpdatePort with the PVM Instance +func (f *IBMPINetworkClient) UpdatePort(id, networkPortID string, body *models.NetworkPortUpdate) (*models.NetworkPort, error) { + params := p_cloud_networks.NewPcloudNetworksPortsPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithNetworkID(id). + WithPortID(networkPortID).WithBody(body) + resp, err := f.session.Power.PCloudNetworks.PcloudNetworksPortsPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to update the port %s and Network %s with error %w", networkPortID, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to update the port %s and Network %s", networkPortID, id) + } + return resp.Payload, nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-placement-groups.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-placement-groups.go new file mode 100644 index 00000000000..34ab6eeb306 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-placement-groups.go @@ -0,0 +1,114 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/errors" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups" + + "github.com/IBM-Cloud/power-go-client/helpers" + "github.com/IBM-Cloud/power-go-client/ibmpisession" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +//IBMPIPlacementGroupClient ... +type IBMPIPlacementGroupClient struct { + IBMPIClient +} + +// NewIBMPIPlacementGroupClient ... +func NewIBMPIPlacementGroupClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIPlacementGroupClient { + return &IBMPIPlacementGroupClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Get PI Placementgroup +func (f *IBMPIPlacementGroupClient) Get(id string) (*models.PlacementGroup, error) { + params := p_cloud_placement_groups.NewPcloudPlacementgroupsGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPlacementGroupID(id) + resp, err := f.session.Power.PCloudPlacementGroups.PcloudPlacementgroupsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.GetPlacementGroupOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Placement Group %s", id) + } + return resp.Payload, nil +} + +// Get All placement groups +func (f *IBMPIPlacementGroupClient) GetAll() (*models.PlacementGroups, error) { + params := p_cloud_placement_groups.NewPcloudPlacementgroupsGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudPlacementGroups.PcloudPlacementgroupsGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get All Placement Groups: %w", err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all Placement Groups") + } + return resp.Payload, nil +} + +// Create the placement group +func (f *IBMPIPlacementGroupClient) Create(body *models.PlacementGroupCreate) (*models.PlacementGroup, error) { + params := p_cloud_placement_groups.NewPcloudPlacementgroupsPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + postok, err := f.session.Power.PCloudPlacementGroups.PcloudPlacementgroupsPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.CreatePlacementGroupOperationFailed, f.cloudInstanceID, err) + } + if postok == nil || postok.Payload == nil { + return nil, fmt.Errorf("failed to Create Placement Group") + } + return postok.Payload, nil +} + +// Delete Placement Group +func (f *IBMPIPlacementGroupClient) Delete(id string) error { + params := p_cloud_placement_groups.NewPcloudPlacementgroupsDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPlacementGroupID(id) + _, err := f.session.Power.PCloudPlacementGroups.PcloudPlacementgroupsDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf(errors.DeletePlacementGroupOperationFailed, id, err) + } + return nil +} + +// Adding a member to a Placement Group +func (f *IBMPIPlacementGroupClient) AddMember(id string, body *models.PlacementGroupServer) (*models.PlacementGroup, error) { + params := p_cloud_placement_groups.NewPcloudPlacementgroupsMembersPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPlacementGroupID(id). + WithBody(body) + postok, err := f.session.Power.PCloudPlacementGroups.PcloudPlacementgroupsMembersPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.AddMemberPlacementGroupOperationFailed, *body.ID, id, err) + } + if postok == nil || postok.Payload == nil { + return nil, fmt.Errorf("failed to Add Member for instance %s and placement group %s", *body.ID, id) + } + return postok.Payload, nil +} + +// Delete Member from Placement Group +func (f *IBMPIPlacementGroupClient) DeleteMember(id string, body *models.PlacementGroupServer) (*models.PlacementGroup, error) { + params := p_cloud_placement_groups.NewPcloudPlacementgroupsMembersDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPlacementGroupID(id). + WithBody(body) + delok, err := f.session.Power.PCloudPlacementGroups.PcloudPlacementgroupsMembersDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.DeleteMemberPlacementGroupOperationFailed, *body.ID, id, err) + } + if delok == nil || delok.Payload == nil { + return nil, fmt.Errorf("failed to Delete Member for instance %s and placement group %s", *body.ID, id) + } + return delok.Payload, nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-sap-instance.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-sap-instance.go new file mode 100644 index 00000000000..da2c17e85fe --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-sap-instance.go @@ -0,0 +1,74 @@ +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/p_cloud_s_a_p" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPISAPInstanceClient ... +type IBMPISAPInstanceClient struct { + IBMPIClient +} + +// NewIBMPISAPInstanceClient ... +func NewIBMPISAPInstanceClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPISAPInstanceClient { + return &IBMPISAPInstanceClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Create a SAP instance +func (f *IBMPISAPInstanceClient) Create(body *models.SAPCreate) (*models.PVMInstanceList, error) { + params := p_cloud_s_a_p.NewPcloudSapPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + postok, postcreated, postAccepted, err := f.session.Power.PCloudsap.PcloudSapPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Create SAP Instance: %w", err) + } + if postok != nil && len(postok.Payload) > 0 { + return &postok.Payload, nil + } + if postcreated != nil && len(postcreated.Payload) > 0 { + return &postcreated.Payload, nil + } + if postAccepted != nil && len(postAccepted.Payload) > 0 { + return &postAccepted.Payload, nil + } + return nil, fmt.Errorf("failed to Create SAP Instance") +} + +// Get SAP Profile +func (f *IBMPISAPInstanceClient) GetSAPProfile(id string) (*models.SAPProfile, error) { + params := p_cloud_s_a_p.NewPcloudSapGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithSapProfileID(id) + resp, err := f.session.Power.PCloudsap.PcloudSapGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to get sap profile %s : %w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get sap profile %s", id) + } + return resp.Payload, nil +} + +// GetAll SAP Profiles +func (f *IBMPISAPInstanceClient) GetAllSAPProfiles(cloudInstanceID string) (*models.SAPProfiles, error) { + params := p_cloud_s_a_p.NewPcloudSapGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudsap.PcloudSapGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to get all sap profiles for power instance %s: %w", cloudInstanceID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get all sap profiles for power instance %s", cloudInstanceID) + } + return resp.Payload, nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-snapshot.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-snapshot.go new file mode 100644 index 00000000000..3c3c5830c5a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-snapshot.go @@ -0,0 +1,98 @@ +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/p_cloud_p_vm_instances" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPISnapshotClient ... +type IBMPISnapshotClient struct { + IBMPIClient +} + +// NewIBMPISnapshotClient ... +func NewIBMPISnapshotClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPISnapshotClient { + return &IBMPISnapshotClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +//Get information about a single snapshot only +func (f *IBMPISnapshotClient) Get(id string) (*models.Snapshot, error) { + params := p_cloud_snapshots.NewPcloudCloudinstancesSnapshotsGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithSnapshotID(id) + resp, err := f.session.Power.PCloudSnapshots.PcloudCloudinstancesSnapshotsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get PI Snapshot %s: %w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get PI Snapshot %s", id) + } + return resp.Payload, nil +} + +// Delete ... +func (f *IBMPISnapshotClient) Delete(id string) error { + params := p_cloud_snapshots.NewPcloudCloudinstancesSnapshotsDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithSnapshotID(id) + _, err := f.session.Power.PCloudSnapshots.PcloudCloudinstancesSnapshotsDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to Delete PI Snapshot %s: %w", id, err) + } + return nil +} + +// Update ... +func (f *IBMPISnapshotClient) Update(id string, body *models.SnapshotUpdate) (models.Object, error) { + params := p_cloud_snapshots.NewPcloudCloudinstancesSnapshotsPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithSnapshotID(id). + WithBody(body) + resp, err := f.session.Power.PCloudSnapshots.PcloudCloudinstancesSnapshotsPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Update PI Snapshot %s: %w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Update PI Snapshot %s", id) + } + return resp.Payload, nil +} + +// GetAll snapshots +func (f *IBMPISnapshotClient) GetAll() (*models.Snapshots, error) { + params := p_cloud_snapshots.NewPcloudCloudinstancesSnapshotsGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudSnapshots.PcloudCloudinstancesSnapshotsGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get all PI Snapshots: %w", err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all PI Snapshots") + } + return resp.Payload, nil +} + +// Create or Restore a Snapshot +func (f *IBMPISnapshotClient) Create(instanceID, snapshotID, restoreFailAction string) (*models.Snapshot, error) { + params := p_cloud_p_vm_instances.NewPcloudPvminstancesSnapshotsRestorePostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(instanceID). + WithSnapshotID(snapshotID).WithRestoreFailAction(&restoreFailAction) + resp, err := f.session.Power.PCloudpVMInstances.PcloudPvminstancesSnapshotsRestorePost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to restore PI Snapshot %s of the instance %s: %w", snapshotID, instanceID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to restore PI Snapshot %s of the instance %s", snapshotID, instanceID) + } + return resp.Payload, nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-storage-capacity.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-storage-capacity.go new file mode 100644 index 00000000000..59efabd664a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-storage-capacity.go @@ -0,0 +1,83 @@ +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/p_cloud_storage_capacity" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPIStorageCapacityClient .. +type IBMPIStorageCapacityClient struct { + IBMPIClient +} + +// NewIBMPIStorageCapacityClient ... +func NewIBMPIStorageCapacityClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIStorageCapacityClient { + return &IBMPIStorageCapacityClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +//Storage capacity for all available storage pools in a region +func (f *IBMPIStorageCapacityClient) GetAllStoragePoolsCapacity() (*models.StoragePoolsCapacity, error) { + params := p_cloud_storage_capacity.NewPcloudStoragecapacityPoolsGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudStorageCapacity.PcloudStoragecapacityPoolsGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to get the capacity for all storage pools: %w", err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get the capacity for all storage pools") + } + return resp.Payload, nil +} + +// Storage capacity for a storage pool in a region +func (f *IBMPIStorageCapacityClient) GetStoragePoolCapacity(storagePool string) (*models.StoragePoolCapacity, error) { + params := p_cloud_storage_capacity.NewPcloudStoragecapacityPoolsGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithStoragePoolName(storagePool) + resp, err := f.session.Power.PCloudStorageCapacity.PcloudStoragecapacityPoolsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to get the capacity for storage pool %s: %w", storagePool, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get the capacity for storage pool %s", storagePool) + } + return resp.Payload, nil +} + +// Storage capacity for a storage type in a region +func (f *IBMPIStorageCapacityClient) GetStorageTypeCapacity(storageType string) (*models.StorageTypeCapacity, error) { + params := p_cloud_storage_capacity.NewPcloudStoragecapacityTypesGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithStorageTypeName(storageType) + resp, err := f.session.Power.PCloudStorageCapacity.PcloudStoragecapacityTypesGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to get the capacity for storage type %s: %w", storageType, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get the capacity for storage type %s", storageType) + } + return resp.Payload, nil +} + +// Storage capacity for all available storage types in a region +func (f *IBMPIStorageCapacityClient) GetAllStorageTypesCapacity() (*models.StorageTypesCapacity, error) { + params := p_cloud_storage_capacity.NewPcloudStoragecapacityTypesGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudStorageCapacity.PcloudStoragecapacityTypesGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to get the capacity for all storage types %w", err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get the capacity for all storage types") + } + return resp.Payload, nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-system-pools.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-system-pools.go new file mode 100644 index 00000000000..c7abdd673a7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-system-pools.go @@ -0,0 +1,40 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/errors" + "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/p_cloud_system_pools" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPISystemPoolClient ... +type IBMPISystemPoolClient struct { + IBMPIClient +} + +// NewIBMPISystemPoolClient ... +func NewIBMPISystemPoolClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPISystemPoolClient { + return &IBMPISystemPoolClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +//Get the System Pools +func (f *IBMPISystemPoolClient) Get(id string) (models.SystemPools, error) { + params := p_cloud_system_pools.NewPcloudSystempoolsGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(id) + resp, err := f.session.Power.PCloudSystemPools.PcloudSystempoolsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.GetSystemPoolsOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to perform Get System Pools Operation for cloud instance id %s", id) + } + return resp.Payload, nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-tasks.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-tasks.go new file mode 100644 index 00000000000..569d8379ab4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-tasks.go @@ -0,0 +1,47 @@ +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/p_cloud_tasks" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPITaskClient ... +type IBMPITaskClient struct { + IBMPIClient +} + +// NewIBMPITaskClient ... +func NewIBMPITaskClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPITaskClient { + return &IBMPITaskClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Get ... +func (f *IBMPITaskClient) Get(id string) (*models.Task, error) { + params := p_cloud_tasks.NewPcloudTasksGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithTaskID(id) + resp, err := f.session.Power.PCloudTasks.PcloudTasksGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get the task %s: %w", id, err) + } + return resp.Payload, nil +} + +// Delete ... +func (f *IBMPITaskClient) Delete(id string) error { + params := p_cloud_tasks.NewPcloudTasksDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithTaskID(id) + _, err := f.session.Power.PCloudTasks.PcloudTasksDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to delete the task id ... %w", err) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-tenant.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-tenant.go new file mode 100644 index 00000000000..e16875e9447 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-tenant.go @@ -0,0 +1,53 @@ +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/p_cloud_tenants" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPITenantClient ... +type IBMPITenantClient struct { + IBMPIClient +} + +// NewIBMPITenantClient ... +func NewIBMPITenantClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPITenantClient { + return &IBMPITenantClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Get .. +func (f *IBMPITenantClient) Get(tenantid string) (*models.Tenant, error) { + params := p_cloud_tenants.NewPcloudTenantsGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithTenantID(tenantid) + resp, err := f.session.Power.PCloudTenants.PcloudTenantsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to get tenant %s with error %w", tenantid, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get tenant %s", tenantid) + } + return resp.Payload, nil +} + +// Get .. +func (f *IBMPITenantClient) GetSelfTenant() (*models.Tenant, error) { + params := p_cloud_tenants.NewPcloudTenantsGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithTenantID(f.session.Options.UserAccount) + resp, err := f.session.Power.PCloudTenants.PcloudTenantsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to get self tenant with error %w", err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get self tenant") + } + return resp.Payload, nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-volume.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-volume.go new file mode 100644 index 00000000000..0e6d9f75cfe --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-volume.go @@ -0,0 +1,214 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/errors" + + "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/p_cloud_volumes" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPIVolumeClient .. +type IBMPIVolumeClient struct { + IBMPIClient +} + +// NewIBMPIVolumeClient ... +func NewIBMPIVolumeClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIVolumeClient { + return &IBMPIVolumeClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +//Get information about a single volume only +func (f *IBMPIVolumeClient) Get(id string) (*models.Volume, error) { + params := p_cloud_volumes.NewPcloudCloudinstancesVolumesGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVolumeID(id) + resp, err := f.session.Power.PCloudVolumes.PcloudCloudinstancesVolumesGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.GetVolumeOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Volume %s", id) + } + return resp.Payload, nil +} + +// GetAll volumes +func (f *IBMPIVolumeClient) GetAll() (*models.Volumes, error) { + params := p_cloud_volumes.NewPcloudCloudinstancesVolumesGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudVolumes.PcloudCloudinstancesVolumesGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get all Volumes for Cloud Instance %s: %w", f.cloudInstanceID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all Volumes for Cloud Instance %s", f.cloudInstanceID) + } + return resp.Payload, nil +} + +// GetAll volumes +func (f *IBMPIVolumeClient) GetAllAffinityVolumes(affinity string) (*models.Volumes, error) { + params := p_cloud_volumes.NewPcloudCloudinstancesVolumesGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithAffinity(&affinity) + resp, err := f.session.Power.PCloudVolumes.PcloudCloudinstancesVolumesGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get all Volumes with affinity %s for Cloud Instance %s: %w", affinity, f.cloudInstanceID, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all Volumes with affinity %s for Cloud Instance %s", affinity, f.cloudInstanceID) + } + return resp.Payload, nil +} + +//CreateVolumeV2 ... +func (f *IBMPIVolumeClient) CreateVolumeV2(body *models.MultiVolumesCreate) (*models.Volumes, error) { + params := p_cloud_volumes.NewPcloudV2VolumesPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + resp, err := f.session.Power.PCloudVolumes.PcloudV2VolumesPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.CreateVolumeV2OperationFailed, *body.Name, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Create Volume v2") + } + return resp.Payload, nil +} + +// CreateVolume ... +func (f *IBMPIVolumeClient) CreateVolume(body *models.CreateDataVolume) (*models.Volume, error) { + params := p_cloud_volumes.NewPcloudCloudinstancesVolumesPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + resp, err := f.session.Power.PCloudVolumes.PcloudCloudinstancesVolumesPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.CreateVolumeOperationFailed, *body.Name, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Create Volume") + } + return resp.Payload, nil +} + +// UpdateVolume ... +func (f *IBMPIVolumeClient) UpdateVolume(id string, body *models.UpdateVolume) (*models.Volume, error) { + params := p_cloud_volumes.NewPcloudCloudinstancesVolumesPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVolumeID(id). + WithBody(body) + resp, err := f.session.Power.PCloudVolumes.PcloudCloudinstancesVolumesPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.UpdateVolumeOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Update Volume %s", id) + } + return resp.Payload, nil +} + +// DeleteVolume ... +func (f *IBMPIVolumeClient) DeleteVolume(id string) error { + params := p_cloud_volumes.NewPcloudCloudinstancesVolumesDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVolumeID(id) + _, err := f.session.Power.PCloudVolumes.PcloudCloudinstancesVolumesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf(errors.DeleteVolumeOperationFailed, id, err) + } + return nil +} + +// Attach a volume +func (f *IBMPIVolumeClient) Attach(id, volumename string) error { + params := p_cloud_volumes.NewPcloudPvminstancesVolumesPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). + WithVolumeID(volumename) + _, err := f.session.Power.PCloudVolumes.PcloudPvminstancesVolumesPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf(errors.AttachVolumeOperationFailed, volumename, err) + } + return nil +} + +//Detach a volume +func (f *IBMPIVolumeClient) Detach(id, volumename string) error { + params := p_cloud_volumes.NewPcloudPvminstancesVolumesDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). + WithVolumeID(volumename) + _, err := f.session.Power.PCloudVolumes.PcloudPvminstancesVolumesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf(errors.DetachVolumeOperationFailed, volumename, err) + } + return nil +} + +// GetAll volumes part of an instance +func (f *IBMPIVolumeClient) GetAllInstanceVolumes(id string) (*models.Volumes, error) { + params := p_cloud_volumes.NewPcloudPvminstancesVolumesGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id) + resp, err := f.session.Power.PCloudVolumes.PcloudPvminstancesVolumesGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get all Volumes for PI Instance %s: %w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all Volumes for PI Instance %s", id) + } + return resp.Payload, nil +} + +// SetBootVolume as the boot volume - PUT Operation +func (f *IBMPIVolumeClient) SetBootVolume(id, volumename string) error { + params := p_cloud_volumes.NewPcloudPvminstancesVolumesSetbootPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). + WithVolumeID(volumename) + _, err := f.session.Power.PCloudVolumes.PcloudPvminstancesVolumesSetbootPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to set the boot volume %s for instance %s", volumename, id) + } + return nil +} + +// CheckVolumeAttach if the volume is attached to the instance +func (f *IBMPIVolumeClient) CheckVolumeAttach(id, volumeID string) (*models.Volume, error) { + params := p_cloud_volumes.NewPcloudPvminstancesVolumesGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). + WithVolumeID(volumeID) + resp, err := f.session.Power.PCloudVolumes.PcloudPvminstancesVolumesGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to validate that the volume %s is attached to the pvminstance %s: %w", volumeID, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to validate that the volume %s is attached to the pvminstance %s", volumeID, id) + } + return resp.Payload, nil +} + +// UpdateVolumeAttach if the volume is attached to the instance +func (f *IBMPIVolumeClient) UpdateVolumeAttach(id, volumeID string, body *models.PVMInstanceVolumeUpdate) error { + params := p_cloud_volumes.NewPcloudPvminstancesVolumesPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id). + WithVolumeID(volumeID).WithBody(body) + resp, err := f.session.Power.PCloudVolumes.PcloudPvminstancesVolumesPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf("failed to validate that the volume %s is attached to the pvminstance %s: %w", volumeID, id, err) + } + if resp == nil || resp.Payload == nil { + return fmt.Errorf("failed to validate that the volume %s is attached to the pvminstance %s", volumeID, id) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-vpn-policy.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-vpn-policy.go new file mode 100644 index 00000000000..1a6ed1771b5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-vpn-policy.go @@ -0,0 +1,175 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/errors" + "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/p_cloud_v_p_n_policies" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPIVpnPolicyClient ... +type IBMPIVpnPolicyClient struct { + IBMPIClient +} + +// IBMPIVpnPolicyClient ... +func NewIBMPIVpnPolicyClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIVpnPolicyClient { + return &IBMPIVpnPolicyClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// IKE Policies + +// Get information about a IKE Policy +func (f *IBMPIVpnPolicyClient) GetIKEPolicy(id string) (*models.IKEPolicy, error) { + params := p_cloud_v_p_n_policies.NewPcloudIkepoliciesGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithIkePolicyID(id) + resp, err := f.session.Power.PCloudvpnPolicies.PcloudIkepoliciesGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.GetVPNPolicyOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get ike policy for policy id %s", id) + } + return resp.Payload, nil +} + +// Create a IKE Policy +func (f *IBMPIVpnPolicyClient) CreateIKEPolicy(body *models.IKEPolicyCreate) (*models.IKEPolicy, error) { + params := p_cloud_v_p_n_policies.NewPcloudIkepoliciesPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + postok, err := f.session.Power.PCloudvpnPolicies.PcloudIkepoliciesPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.CreateVPNPolicyOperationFailed, f.cloudInstanceID, err) + } + if postok != nil && postok.Payload != nil { + return postok.Payload, nil + } + return nil, fmt.Errorf("failed to Create VPN Policy") +} + +// Update a IKE Policy +func (f *IBMPIVpnPolicyClient) UpdateIKEPolicy(id string, body *models.IKEPolicyUpdate) (*models.IKEPolicy, error) { + params := p_cloud_v_p_n_policies.NewPcloudIkepoliciesPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithIkePolicyID(id). + WithBody(body) + putok, err := f.session.Power.PCloudvpnPolicies.PcloudIkepoliciesPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.UpdateVPNPolicyOperationFailed, id, err) + } + if putok != nil && putok.Payload != nil { + return putok.Payload, nil + } + return nil, fmt.Errorf("failed to Update VPN Policy") +} + +// Get all IKE Policies +func (f *IBMPIVpnPolicyClient) GetAllIKEPolicies() (*models.IKEPolicies, error) { + params := p_cloud_v_p_n_policies.NewPcloudIkepoliciesGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudvpnPolicies.PcloudIkepoliciesGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to get all ike policies: %w", err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get all ike policies") + } + return resp.Payload, nil +} + +// Delete a IKE Policy +func (f *IBMPIVpnPolicyClient) DeleteIKEPolicy(id string) error { + params := p_cloud_v_p_n_policies.NewPcloudIkepoliciesDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithIkePolicyID(id) + _, err := f.session.Power.PCloudvpnPolicies.PcloudIkepoliciesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf(errors.DeleteVPNPolicyOperationFailed, id, err) + } + return nil +} + +// IPSec Policies + +// Get information about a IPSec Policy +func (f *IBMPIVpnPolicyClient) GetIPSecPolicy(id string) (*models.IPSecPolicy, error) { + params := p_cloud_v_p_n_policies.NewPcloudIpsecpoliciesGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithIpsecPolicyID(id) + resp, err := f.session.Power.PCloudvpnPolicies.PcloudIpsecpoliciesGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.GetVPNPolicyOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get ipsec policy for policy id %s", id) + } + return resp.Payload, nil +} + +// Create a IPSec Policy +func (f *IBMPIVpnPolicyClient) CreateIPSecPolicy(body *models.IPSecPolicyCreate) (*models.IPSecPolicy, error) { + params := p_cloud_v_p_n_policies.NewPcloudIpsecpoliciesPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + postok, err := f.session.Power.PCloudvpnPolicies.PcloudIpsecpoliciesPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.CreateVPNPolicyOperationFailed, f.cloudInstanceID, err) + } + if postok != nil && postok.Payload != nil { + return postok.Payload, nil + } + return nil, fmt.Errorf("failed to Create VPN Policy") +} + +// Update a IPSec Policy +func (f *IBMPIVpnPolicyClient) UpdateIPSecPolicy(id string, body *models.IPSecPolicyUpdate) (*models.IPSecPolicy, error) { + params := p_cloud_v_p_n_policies.NewPcloudIpsecpoliciesPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithIpsecPolicyID(id). + WithBody(body) + putok, err := f.session.Power.PCloudvpnPolicies.PcloudIpsecpoliciesPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.UpdateVPNPolicyOperationFailed, id, err) + } + if putok != nil && putok.Payload != nil { + return putok.Payload, nil + } + return nil, fmt.Errorf("failed to Update VPN Policy") +} + +// Get all IPSec Policies +func (f *IBMPIVpnPolicyClient) GetAllIPSecPolicies() (*models.IPSecPolicies, error) { + params := p_cloud_v_p_n_policies.NewPcloudIpsecpoliciesGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudvpnPolicies.PcloudIpsecpoliciesGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to get all ipsec policies: %w", err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to get all ipsec policies") + } + return resp.Payload, nil +} + +// Delete a IPSec Policy +func (f *IBMPIVpnPolicyClient) DeleteIPSecPolicy(id string) error { + params := p_cloud_v_p_n_policies.NewPcloudIpsecpoliciesDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithIpsecPolicyID(id) + _, err := f.session.Power.PCloudvpnPolicies.PcloudIpsecpoliciesDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return fmt.Errorf(errors.DeleteVPNPolicyOperationFailed, id, err) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-vpn.go b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-vpn.go new file mode 100644 index 00000000000..5b2e8b64c68 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/clients/instance/ibm-pi-vpn.go @@ -0,0 +1,195 @@ +package instance + +import ( + "context" + "fmt" + + "github.com/IBM-Cloud/power-go-client/errors" + "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/p_cloud_v_p_n_connections" + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// IBMPIVpnConnectionClient ... +type IBMPIVpnConnectionClient struct { + IBMPIClient +} + +// NewIBMPIVpnConnectionClient ... +func NewIBMPIVpnConnectionClient(ctx context.Context, sess *ibmpisession.IBMPISession, cloudInstanceID string) *IBMPIVpnConnectionClient { + return &IBMPIVpnConnectionClient{ + *NewIBMPIClient(ctx, sess, cloudInstanceID), + } +} + +// Get information about a VPN connection +func (f *IBMPIVpnConnectionClient) Get(id string) (*models.VPNConnection, error) { + params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.GetVPNConnectionOperationFailed, id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get VPN Connection %s", id) + } + return resp.Payload, nil +} + +// Create a VPN connection +func (f *IBMPIVpnConnectionClient) Create(body *models.VPNConnectionCreate) (*models.VPNConnectionCreateResponse, error) { + params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsPostParams(). + WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithBody(body) + postaccepted, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsPost(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.CreateVPNConnectionOperationFailed, f.cloudInstanceID, err) + } + if postaccepted != nil && postaccepted.Payload != nil { + return postaccepted.Payload, nil + } + return nil, fmt.Errorf("failed to Create VPN Connection") +} + +// Update a VPN connection +func (f *IBMPIVpnConnectionClient) Update(id string, body *models.VPNConnectionUpdate) (*models.VPNConnection, error) { + params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id). + WithBody(body) + putok, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.UpdateVPNConnectionOperationFailed, id, err) + } + if putok != nil && putok.Payload != nil { + return putok.Payload, nil + } + return nil, fmt.Errorf("failed to Update VPN Connection %s", id) +} + +// Get all VPN connections +func (f *IBMPIVpnConnectionClient) GetAll() (*models.VPNConnections, error) { + params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsGetallParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsGetall(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get all VPN Connections: %w", err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get all VPN Connections") + } + return resp.Payload, nil +} + +// Delete a VPN connection +func (f *IBMPIVpnConnectionClient) Delete(id string) (*models.JobReference, error) { + params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id) + delaccepted, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf(errors.DeleteVPNConnectionOperationFailed, id, err) + } + if delaccepted != nil && delaccepted.Payload != nil { + return delaccepted.Payload, nil + } + return nil, nil +} + +// Network get +func (f *IBMPIVpnConnectionClient) GetNetwork(id string) (*models.NetworkIDs, error) { + params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsNetworksGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsNetworksGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get Networks for VPN Connection %s: %w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Networks for VPN Connection %s", id) + } + return resp.Payload, nil +} + +// Network attach +func (f *IBMPIVpnConnectionClient) AddNetwork(id, networkID string) (*models.JobReference, error) { + params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsNetworksPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id). + WithBody(&models.NetworkID{NetworkID: &networkID}) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsNetworksPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Add Network %s to VPN Connection %s: %w", networkID, id, err) + } + if resp != nil && resp.Payload != nil { + return resp.Payload, nil + } + return nil, nil +} + +// Network detach +func (f *IBMPIVpnConnectionClient) DeleteNetwork(id, networkID string) (*models.JobReference, error) { + params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsNetworksDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id). + WithBody(&models.NetworkID{NetworkID: &networkID}) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsNetworksDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Delete Network %s from VPN Connection %s: %w", networkID, id, err) + } + if resp != nil && resp.Payload != nil { + return resp.Payload, nil + } + return nil, nil +} + +// Subnet get +func (f *IBMPIVpnConnectionClient) GetSubnet(id string) (*models.PeerSubnets, error) { + params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsPeersubnetsGetParams(). + WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsPeersubnetsGet(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Get Subnets from VPN Connection %s: %w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Get Subnets from VPN Connection %s", id) + } + return resp.Payload, nil +} + +// Subnet attach +func (f *IBMPIVpnConnectionClient) AddSubnet(id, subnet string) (*models.PeerSubnets, error) { + params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsPeersubnetsPutParams(). + WithContext(f.ctx).WithTimeout(helpers.PIUpdateTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id). + WithBody(&models.PeerSubnetUpdate{Cidr: &subnet}) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsPeersubnetsPut(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Add Subnets to VPN Connection %s: %w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Add Subnets to VPN Connection %s", id) + } + return resp.Payload, nil +} + +// Subnet detach +func (f *IBMPIVpnConnectionClient) DeleteSubnet(id, subnet string) (*models.PeerSubnets, error) { + params := p_cloud_v_p_n_connections.NewPcloudVpnconnectionsPeersubnetsDeleteParams(). + WithContext(f.ctx).WithTimeout(helpers.PIDeleteTimeOut). + WithCloudInstanceID(f.cloudInstanceID).WithVpnConnectionID(id). + WithBody(&models.PeerSubnetUpdate{Cidr: &subnet}) + resp, err := f.session.Power.PCloudvpnConnections.PcloudVpnconnectionsPeersubnetsDelete(params, f.session.AuthInfo(f.cloudInstanceID)) + if err != nil { + return nil, fmt.Errorf("failed to Delete Subnet from VPN Connection %s: %w", id, err) + } + if resp == nil || resp.Payload == nil { + return nil, fmt.Errorf("failed to Delete Subnet from VPN Connection %s", id) + } + return resp.Payload, nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/errors/errors.go b/vendor/github.com/IBM-Cloud/power-go-client/errors/errors.go new file mode 100644 index 00000000000..2bf443cd96e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/errors/errors.go @@ -0,0 +1,167 @@ +package errors + +import ( + "encoding/json" + "errors" + "reflect" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// start of Placementgroup Messages + +const GetPlacementGroupOperationFailed = "failed to perform Get Placement Group Operation for placement group %s with error %w" +const CreatePlacementGroupOperationFailed = "failed to perform Create Placement Group Operation for cloud instance %s with error %w" +const DeletePlacementGroupOperationFailed = "failed to perform Delete Placement Group Operation for placement group %s with error %w" +const AddMemberPlacementGroupOperationFailed = "failed to perform Add Member Operation for instance %s and placement group %s with error %w" +const DeleteMemberPlacementGroupOperationFailed = "failed to perform Delete Member Operation for instance %s and placement group %s with error %w" + +// start of Cloud Connection Messages + +const GetCloudConnectionOperationFailed = "failed to perform Get Cloud Connections Operation for cloudconnectionid %s with error %w" +const CreateCloudConnectionOperationFailed = "failed to perform Create Cloud Connection Operation for cloud instance %s with error %w" +const UpdateCloudConnectionOperationFailed = "failed to perform Update Cloud Connection Operation for cloudconnectionid %s with error %w" +const DeleteCloudConnectionOperationFailed = "failed to perform Delete Cloud Connection Operation for cloudconnectionid %s with error %w" + +// start of VPN Connection Messages + +const GetVPNConnectionOperationFailed = "failed to perform Get VPN Connection Operation for id %s with error %w" +const CreateVPNConnectionOperationFailed = "failed to perform Create VPN Connection Operation for cloud instance %s with error %w" +const UpdateVPNConnectionOperationFailed = "failed to perform Update VPN Connection Operation for id %s with error %w" +const DeleteVPNConnectionOperationFailed = "failed to perform Delete VPN Connection Operation for id %s with error %w" + +// start of VPN Policy Messages + +const GetVPNPolicyOperationFailed = "failed to perform Get VPN Policy Operation for Policy id %s with error %w" +const CreateVPNPolicyOperationFailed = "failed to perform Create VPN Policy Operation for cloud instance %s with error %w" +const UpdateVPNPolicyOperationFailed = "failed to perform Update VPN Policy Operation for Policy id %s with error %w" +const DeleteVPNPolicyOperationFailed = "failed to perform Delete VPN Policy Operation for Policy id %s with error %w" + +// start of Job Messages +const GetJobOperationFailed = "failed to perform get Job operation for job id %s with error %w" +const GetAllJobsOperationFailed = "failed to perform get all jobs operation with error %w" +const DeleteJobsOperationFailed = "failed to perform delete Job operation for job id %s with error %w" + +// start of DHCP Messages +const GetDhcpOperationFailed = "failed to perform Get DHCP Operation for dhcp id %s with error %w" +const CreateDchpOperationFailed = "failed to perform Create DHCP Operation for cloud instance %s with error %w" +const DeleteDhcpOperationFailed = "failed to perform Delete DHCP Operation for dhcp id %s with error %w" + +// start of System-Pools Messages +const GetSystemPoolsOperationFailed = "failed to perform Get System Pools Operation for cloud instance %s with error %w" + +// start of Image Messages + +const GetImageOperationFailed = "failed to perform Get Image Operation for image %s with error %w" +const CreateImageOperationFailed = "failed to perform Create Image Operation for cloud instance %s with error %w" + +// Start of Network Messages +const GetNetworkOperationFailed = "failed to perform Get Network Operation for Network id %s with error %w" +const CreateNetworkOperationFailed = "failed to perform Create Network Operation for Network %s with error %w" +const CreateNetworkPortOperationFailed = "failed to perform Create Network Port Operation for Network %s with error %w" + +// start of Volume Messages +const DeleteVolumeOperationFailed = "failed to perform Delete Volume Operation for volume %s with error %w" +const UpdateVolumeOperationFailed = "failed to perform Update Volume Operation for volume %s with error %w" +const GetVolumeOperationFailed = "failed to perform the Get Volume Operation for volume %s with error %w" +const CreateVolumeOperationFailed = "failed to perform the Create volume Operation for volume %s with error %w" +const CreateVolumeV2OperationFailed = "failed to perform the Create volume Operation V2 for volume %s with error %w" +const AttachVolumeOperationFailed = "failed to perform the Attach volume Operation for volume %s with error %w" +const DetachVolumeOperationFailed = "failed to perform the Detach volume Operation for volume %s with error %w" + +// start of Clone Messages +const StartCloneOperationFailed = "failed to start the clone operation for volumes-clone %s with error %w" +const PrepareCloneOperationFailed = "failed to prepare the clone operation for volumes-clone %s with error %w" +const DeleteCloneOperationFailed = "failed to perform delete clone operation %w" +const GetCloneOperationFailed = "failed to get the volumes-clone %s for the cloud instance %s with error %w" +const CreateCloneOperationFailed = "failed to perform the create clone operation %w" + +// start of Cloud Instance Messages +const GetCloudInstanceOperationFailed = "failed to Get Cloud Instance %s with error %w" +const UpdateCloudInstanceOperationFailed = "failed to update the Cloud instance %s with error %w" +const DeleteCloudInstanceOperationFailed = "failed to delete the Cloud instance %s with error %w" + +// start of PI Key Messages +const GetPIKeyOperationFailed = "failed to Get PI Key %s with error %w" +const CreatePIKeyOperationFailed = "failed to Create PI Key with error %w" +const DeletePIKeyOperationFailed = "failed to Delete PI Key %s with error %w" + +// ErrorTarget ... +type ErrorTarget struct { + Name string + Type string +} + +// SingleError ... +type SingleError struct { + Code string + Message string + MoreInfo string + Target ErrorTarget +} + +// PowerError ... +type Error struct { + Payload *models.Error +} + +func (e Error) Error() string { + b, _ := json.Marshal(e.Payload) + return string(b) +} + +// ToError ... +func ToError(err error) error { + if err == nil { + return nil + } + + // check if its ours + kind := reflect.TypeOf(err).Kind() + if kind != reflect.Ptr { + return err + } + + // next follow pointer + errstruct := reflect.TypeOf(err).Elem() + if errstruct.Kind() != reflect.Struct { + return err + } + + n := errstruct.NumField() + found := false + for i := 0; i < n; i++ { + if errstruct.Field(i).Name == "Payload" { + found = true + break + } + } + + if !found { + return err + } + + // check if a payload field exists + payloadValue := reflect.ValueOf(err).Elem().FieldByName("Payload") + if payloadValue.Interface() == nil { + return err + } + + payloadIntf := payloadValue.Elem().Interface() + payload, parsed := payloadIntf.(models.Error) + if !parsed { + return err + } + + var reterr = Error{ + Payload: &payload, + } + + return reterr +} + +// Retrieve wrapped error from err. +// When does not contain wrapped error returns nil. +func Unwrap(err error) error { + return errors.Unwrap(err) +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/helpers/constants.go b/vendor/github.com/IBM-Cloud/power-go-client/helpers/constants.go new file mode 100644 index 00000000000..8daa7f1befe --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/helpers/constants.go @@ -0,0 +1,251 @@ +package helpers + +import "time" + +const ( + // IBM PI Instance + + PIInstanceName = "pi_instance_name" + PIInstanceDate = "pi_creation_date" + PIInstanceSSHKeyName = "pi_key_pair_name" + PIInstanceImageId = "pi_image_id" + PIInstanceProcessors = "pi_processors" + PIInstanceProcType = "pi_proc_type" + PIInstanceMemory = "pi_memory" + PIInstanceSystemType = "pi_sys_type" + PIInstanceId = "pi_instance_id" + PIInstanceDiskSize = "pi_disk_size" + PIInstanceStatus = "pi_instance_status" + PIInstanceMinProc = "pi_minproc" + PIInstanceVolumeIds = "pi_volume_ids" + PIInstanceNetworkIds = "pi_network_ids" + PIInstancePublicNetwork = "pi_public_network" + PIInstanceMigratable = "pi_migratable" + PICloudInstanceId = "pi_cloud_instance_id" + PICloudInstanceSubnetName = "pi_cloud_instance_subnet_name" + PIInstanceMimMem = "pi_minmem" + PIInstanceMaxProc = "pi_maxproc" + PIInstanceMaxMem = "pi_maxmem" + PIInstanceReboot = "pi_reboot" + PITenantId = "pi_tenant_id" + PIVirtualCoresAssigned = "pi_virtual_cores_assigned" + PIVirtualCoresMax = "pi_virtual_cores_max" + PIVirtualCoresMin = "pi_virtual_cores_min" + PIInstancePVMNetwork = "pi_instance_pvm_network" + PIInstanceStorageType = "pi_storage_type" + PIInstanceStorageConnection = "pi_storage_connection" + PIInstanceStoragePool = "pi_instance_storage_pool" + PIInstanceStorageAffinityPool = "pi_instance_storage_affinity_pool" + PIInstanceLicenseRepositoryCapacity = "pi_license_repository_capacity" + + PIInstanceHealthStatus = "pi_health_status" + PIInstanceReplicants = "pi_replicants" + PIInstanceReplicationPolicy = "pi_replication_policy" + PIInstanceReplicationScheme = "pi_replication_scheme" + PIInstanceProgress = "pi_progress" + PIInstanceUserData = "pi_user_data" + PIInstancePinPolicy = "pi_pin_policy" + + // IBM PI Volume + PIVolumeName = "pi_volume_name" + PIVolumeSize = "pi_volume_size" + PIVolumeType = "pi_volume_type" + PIVolumeShareable = "pi_volume_shareable" + PIVolumeId = "pi_volume_id" + PIVolumeStatus = "pi_volume_status" + PIVolumeWWN = "pi_volume_wwn" + PIVolumeDeleteOnTerminate = "pi_volume_delete_on_terminate" + PIVolumeCreateDate = "pi_volume_create_date" + PIVolumeLastUpdate = "pi_last_updated_date" + PIVolumePool = "pi_volume_pool" + PIAffinityPolicy = "pi_volume_affinity_policy" + PIAffinityVolume = "pi_volume_affinity" + PIAffinityInstance = "pi_volume_affinity_instance" + PIAffinityDiskCount = "pi_volume_disk_count" + PIStoragePoolValue = "pi_storage_pool_type" + PIStoragePoolName = "pi_storage_pool_name" + + // IBM PI Snapshots + + PISnapshot = "pi_snap_shot_id" + PISnapshotName = "pi_snap_shot_name" + PISnapshotStatus = "pi_snap_shot_status" + PISnapshotAction = "pi_snap_shot_action" + PISnapshotComplete = "pi_snap_shot_complete" + + // IBM PI SAP Profile + + PISAPProfileID = "pi_sap_profile_id" + PISAPProfile = "pi_sap_profile" + PISAPProfileMemory = "pi_sap_profile_memory" + PISAPProfileCertified = "pi_sap_profile_certified" + PISAPProfileType = "pi_sap_profile_type" + PISAPProfileCores = "pi_sap_profile_cores" + + // IBM PI Clone Volume + PIVolumeCloneStatus = "pi_volume_clone_status" + PIVolumeClonePercent = "pi_volume_clone_percent" + PIVolumeCloneFailure = "pi_volume_clone_failure" + + // IBM PI Image + + PIImageName = "pi_image_name" + PIImageId = "pi_image_id" + PIImageAccessKey = "pi_image_access_key" + PIImageSecretKey = "pi_image_secret_key" + PIImageSource = "pi_image_source" + PIImageBucketName = "pi_image_bucket_name" + PIImageBucketAccess = "pi_image_bucket_access" + PIImageBucketFileName = "pi_image_bucket_file_name" + PIImageBucketRegion = "pi_image_bucket_region" + PIImageStorageAffinity = "pi_image_storage_affinity" + PIImageStoragePool = "pi_image_storage_pool" + PIImageStorageType = "pi_image_storage_type" + PIImageCopyID = "pi_image_copy_id" + PIImagePath = "pi_image_path" + PIImageOsType = "pi_image_os_type" + + // IBM PI Key + + PIKeyName = "pi_key_name" + PIKey = "pi_ssh_key" + PIKeyDate = "pi_creation_date" + PIKeyId = "pi_key_id" + + // IBM PI Network + + PINetworkReady = "ready" + PINetworkID = "pi_networkid" + PINetworkName = "pi_network_name" + PINetworkCidr = "pi_cidr" + PINetworkDNS = "pi_dns" + PINetworkType = "pi_network_type" + PINetworkGateway = "pi_gateway" + PINetworkIPAddressRange = "pi_ipaddress_range" + PINetworkVlanId = "pi_vlan_id" + PINetworkProvisioning = "build" + PINetworkJumbo = "pi_network_jumbo" + PINetworkPortDescription = "pi_network_port_description" + PINetworkPortIPAddress = "pi_network_port_ipaddress" + PINetworkPortMacAddress = "pi_network_port_macaddress" + PINetworkPortStatus = "pi_network_port_status" + PINetworkPortPortID = "pi_network_port_portid" + + // IBM PI Operations + PIInstanceOperationType = "pi_operation" + PIInstanceOperationProgress = "pi_progress" + PIInstanceOperationStatus = "pi_status" + PIInstanceOperationServerName = "pi_instance_name" + + // IBM PI Volume Attach + PIVolumeAttachName = "pi_volume_attach_name" + PIVolumeAllowableAttachStatus = "in-use" + PIVolumeAttachStatus = "status" + PowerVolumeAttachDeleting = "deleting" + PowerVolumeAttachProvisioning = "creating" + PowerVolumeAttachProvisioningDone = "available" + + // IBM PI Instance Capture + PIInstanceCaptureName = "pi_capture_name" + PIInstanceCaptureDestination = "pi_capture_destination" + PIInstanceCaptureVolumeIds = "pi_capture_volume_ids" + PIInstanceCaptureCloudStorageImagePath = "pi_capture_storage_image_path" + PIInstanceCaptureCloudStorageRegion = "pi_capture_cloud_storage_region" + PIInstanceCaptureCloudStorageAccessKey = "pi_capture_cloud_storage_access_key" + PIInstanceCaptureCloudStorageSecretKey = "pi_capture_cloud_storage_secret_key" + + // IBM PI Cloud Connections + + PICloudConnectionName = "pi_cloud_connection_name" + PICloudConnectionStatus = "pi_cloud_connection_status" + PICloudConnectionMetered = "pi_cloud_connection_metered" + PICloudConnectionUserIPAddress = "pi_cloud_connection_user_ip_address" + PICloudConnectionIBMIPAddress = "pi_cloud_connection_ibm_ip_address" + PICloudConnectionSpeed = "pi_cloud_connection_speed" + PICloudConnectionPort = "pi_cloud_connection_port" + PICloudConnectionGlobalRouting = "pi_cloud_connection_global_routing" + PICloudConnectionId = "pi_cloud_connection_id" + //PICloudConnectionClassic = "pi_cloud_connection_classic" + PICloudConnectionClassicEnabled = "pi_cloud_connection_classic_enabled" + PICloudConnectionClassicGreCidr = "pi_cloud_connection_gre_cidr" + PICloudConnectionClassicGreDest = "pi_cloud_connection_gre_destination_address" + PICloudConnectionClassicGreSource = "pi_cloud_connection_gre_source_address" + PICloudConnectionNetworks = "pi_cloud_connection_networks" + //PICloudConnectionVPC = "pi_cloud_connection_vpc" + PICloudConnectionVPCEnabled = "pi_cloud_connection_vpc_enabled" + PICloudConnectionVPCCRNs = "pi_cloud_connection_vpc_crns" + PICloudConnectionVPCName = "pi_cloud_connection_vpc_name" + + // IBM PI VPN Connections + + PIVPNConnectionName = "pi_vpn_connection_name" + PIVPNConnectionId = "pi_vpn_connection_id" + PIVPNIKEPolicyId = "pi_ike_policy_id" + PIVPNIPSecPolicyId = "pi_ipsec_policy_id" + PIVPNConnectionLocalGatewayAddress = "pi_local_gateway_address" + PIVPNConnectionMode = "pi_vpn_connection_mode" + PIVPNConnectionNetworks = "pi_networks" + PIVPNConnectionPeerGatewayAddress = "pi_peer_gateway_address" + PIVPNConnectionPeerSubnets = "pi_peer_subnets" + PIVPNConnectionStatus = "pi_vpn_connection_status" + PIVPNConnectionVpnGatewayAddress = "pi_gateway_address" + PIVPNConnectionDeadPeerDetection = "pi_dead_peer_detections" + PIVPNConnectionDeadPeerDetectionAction = "pi_dead_peer_detections_action" + PIVPNConnectionDeadPeerDetectionInterval = "pi_dead_peer_detections_interval" + PIVPNConnectionDeadPeerDetectionThreshold = "pi_dead_peer_detections_threshold" + + // IBM PI VPN Policy + PIVPNPolicyId = "pi_policy_id" + PIVPNPolicyName = "pi_policy_name" + PIVPNPolicyDhGroup = "pi_policy_dh_group" + PIVPNPolicyEncryption = "pi_policy_encryption" + PIVPNPolicyKeyLifetime = "pi_policy_key_lifetime" + PIVPNPolicyPresharedKey = "pi_policy_preshared_key" + PIVPNPolicyVersion = "pi_policy_version" + PIVPNPolicyAuthentication = "pi_policy_authentication" + PIVPNPolicyPFS = "pi_policy_pfs" + + JobStatusQueued = "queued" + JobStatusReadyForProcessing = "readyForProcessing" + JobStatusInProgress = "inProgress" + JobStatusCompleted = "completed" + JobStatusFailed = "failed" + JobStatusRunning = "running" + JobStatusWaiting = "waiting" + + // IBM PI DHCP + PIDhcpId = "pi_dhcp_id" + PIDhcpStatus = "pi_dhcp_status" + PIDhcpNetwork = "pi_dhcp_network" + PIDhcpLeases = "pi_dhcp_leases" + PIDhcpInstanceIp = "pi_dhcp_instance_ip" + PIDhcpInstanceMac = "pi_dhcp_instance_mac" + + // IBM PI Placement Groups + + PIPlacementGroupName = "pi_placement_group_name" + PIPlacementGroupPolicy = "pi_placement_group_policy" + PIPlacementGroupID = "pi_placement_group_id" + + // Status For all the resources + + PIVolumeDeleting = "deleting" + PIVolumeDeleted = "done" + PIVolumeProvisioning = "creating" + PIVolumeProvisioningDone = "available" + PIInstanceAvailable = "ACTIVE" + PIInstanceHealthOk = "OK" + PIInstanceHealthWarning = "WARNING" + PIInstanceBuilding = "BUILD" + PIInstanceDeleting = "DELETING" + PIInstanceNotFound = "Not Found" + PIImageQueStatus = "queued" + PIImageActiveStatus = "active" + + //Timeout values for Power VS - + + PICreateTimeOut = 5 * time.Minute + PIUpdateTimeOut = 5 * time.Minute + PIDeleteTimeOut = 3 * time.Minute + PIGetTimeOut = 2 * time.Minute +) diff --git a/vendor/github.com/IBM-Cloud/power-go-client/helpers/env.go b/vendor/github.com/IBM-Cloud/power-go-client/helpers/env.go new file mode 100644 index 00000000000..ede87cc0c7f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/helpers/env.go @@ -0,0 +1,18 @@ +package helpers + +import "os" + +//EnvFallBack ... +func EnvFallBack(envs []string, defaultValue string) string { + for _, k := range envs { + if v := os.Getenv(k); v != "" { + return v + } + } + return defaultValue +} + +// GetPowerEndPoint +func GetPowerEndPoint() string { + return EnvFallBack([]string{"IBMCLOUD_POWER_API_ENDPOINT"}, "") +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/ibmpisession/logger.go b/vendor/github.com/IBM-Cloud/power-go-client/ibmpisession/logger.go new file mode 100644 index 00000000000..454d456a31d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/ibmpisession/logger.go @@ -0,0 +1,81 @@ +package ibmpisession + +import ( + "fmt" + "os" + "reflect" + "regexp" + + "github.com/go-openapi/runtime/logger" +) + +var _ logger.Logger = &IBMPILogger{} + +type IBMPILogger struct{} + +func (IBMPILogger) Printf(format string, args ...interface{}) { + if len(format) == 0 || format[len(format)-1] != '\n' { + format += "\n" + } + fmt.Fprintf(os.Stderr, format, args...) +} + +func (IBMPILogger) Debugf(format string, args ...interface{}) { + if len(format) == 0 || format[len(format)-1] != '\n' { + format += "\n" + } + fmt.Fprintf(os.Stderr, format, sanatizeArgs(args)...) +} + +func sanatizeArgs(args []interface{}) (out []interface{}) { + for _, arg := range args { + if reflect.TypeOf(arg).String() == "string" { + arg = sanitize(fmt.Sprintf("%s", arg)) + } + out = append(out, arg) + } + return +} + +func sanitize(input string) string { + re := regexp.MustCompile(`(?m)^Authorization: .*`) + sanitized := re.ReplaceAllString(input, "Authorization: "+privateDataPlaceholder()) + + re = regexp.MustCompile(`(?m)^X-Auth-Token: .*`) + sanitized = re.ReplaceAllString(sanitized, "X-Auth-Token: "+privateDataPlaceholder()) + + re = regexp.MustCompile(`(?m)^X-Auth-Refresh-Token: .*`) + sanitized = re.ReplaceAllString(sanitized, "X-Auth-Refresh-Token: "+privateDataPlaceholder()) + + re = regexp.MustCompile(`(?m)^X-Auth-Uaa-Token: .*`) + sanitized = re.ReplaceAllString(sanitized, "X-Auth-Uaa-Token: "+privateDataPlaceholder()) + + re = regexp.MustCompile(`(?m)^X-Auth-User-Token: .*`) + sanitized = re.ReplaceAllString(sanitized, "X-Auth-User-Token: "+privateDataPlaceholder()) + + re = regexp.MustCompile(`password=[^&]*&`) + sanitized = re.ReplaceAllString(sanitized, "password="+privateDataPlaceholder()+"&") + + re = regexp.MustCompile(`refresh_token=[^&]*&`) + sanitized = re.ReplaceAllString(sanitized, "refresh_token="+privateDataPlaceholder()+"&") + + re = regexp.MustCompile(`apikey=[^&]*&`) + sanitized = re.ReplaceAllString(sanitized, "apikey="+privateDataPlaceholder()+"&") + + sanitized = sanitizeJSON("token", sanitized) + sanitized = sanitizeJSON("password", sanitized) + sanitized = sanitizeJSON("apikey", sanitized) + sanitized = sanitizeJSON("passcode", sanitized) + + return sanitized +} + +func sanitizeJSON(propertySubstring string, json string) string { + regex := regexp.MustCompile(fmt.Sprintf(`(?i)"([^"]*%s[^"]*)":\s*"[^\,]*"`, propertySubstring)) + return regex.ReplaceAllString(json, fmt.Sprintf(`"$1":"%s"`, privateDataPlaceholder())) +} + +// privateDataPlaceholder returns the text to replace the sentive data. +func privateDataPlaceholder() string { + return "[PRIVATE DATA HIDDEN]" +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/ibmpisession/session.go b/vendor/github.com/IBM-Cloud/power-go-client/ibmpisession/session.go new file mode 100644 index 00000000000..c7e40201191 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/ibmpisession/session.go @@ -0,0 +1,121 @@ +package ibmpisession + +import ( + "fmt" + "strings" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/helpers" + "github.com/IBM-Cloud/power-go-client/power/client" + "github.com/IBM/go-sdk-core/v5/core" +) + +// IBMPISession ... +type IBMPISession struct { + CRNFormat string + Power *client.PowerIaasAPI + Options *IBMPIOptions +} + +// PIOptions +type IBMPIOptions struct { + // The authenticator implementation to be used by the + // service instance to authenticate outbound requests + // Required + Authenticator core.Authenticator + + // Enable/Disable http transport debugging log + Debug bool + + // Region of the Power Cloud Service Instance + // For generating the default endpoint + // Required when URL or env `IBMCLOUD_POWER_API_ENDPOINT` is not set + Region string + + // Power Virtual Server host or URL endpoint + // This will be used instead of generating the default host + // eg: dal.power-iaas.cloud.ibm.com + // Required when Region is not provided + URL string + + // Account id of the Power Cloud Service Instance + // It will be part of the CRN string + // Required + UserAccount string + + // Zone of the Power Cloud Service Instance + // It will be part of the CRN string + // Required + Zone string +} + +// Create a IBMPISession +func NewIBMPISession(o *IBMPIOptions) (*IBMPISession, error) { + if core.IsNil(o) { + return nil, fmt.Errorf("options is required") + } + + if core.IsNil(o.Authenticator) { + return nil, fmt.Errorf("option Authenticator is required") + } + + if o.UserAccount == "" { + return nil, fmt.Errorf("option UserAccount is required") + } + + if o.Zone == "" { + return nil, fmt.Errorf("option Zone is required") + } + + var serviceURL string + if o.URL != "" { + serviceURL = o.URL + } else { + // If URL is not set check in env + serviceURL = helpers.GetPowerEndPoint() + if serviceURL == "" { + // Generate default endpoint with Region + if o.Region != "" { + serviceURL = o.Region + ".power-iaas.cloud.ibm.com" + } else { + return nil, fmt.Errorf("atleast one of Region or URL is required") + } + } + } + + // We need just the server host from the URL + var host, scheme string + if strings.HasPrefix(serviceURL, "https://") { + scheme = SCHEME_HTTPS + host = strings.TrimPrefix(serviceURL, "https://") + } else if strings.HasPrefix(serviceURL, "http://") { + scheme = SCHEME_HTTP + host = strings.TrimPrefix(serviceURL, "http://") + } else { + // by default we use "https" + scheme = SCHEME_HTTPS + host = serviceURL + } + + return &IBMPISession{ + CRNFormat: crnBuilder(o.UserAccount, o.Zone, host), + Options: o, + Power: getPIClient(o.Debug, host, scheme), + }, nil +} + +// authInfo ... +func (s *IBMPISession) AuthInfo(cloudInstanceID string) runtime.ClientAuthInfoWriter { + return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { + auth, err := fetchAuthorizationData(s.Options.Authenticator) + if err != nil { + return err + } + if err := r.SetHeaderParam("Authorization", auth); err != nil { + return err + } + return r.SetHeaderParam("CRN", fmt.Sprintf(s.CRNFormat, cloudInstanceID)) + }) +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/ibmpisession/utils.go b/vendor/github.com/IBM-Cloud/power-go-client/ibmpisession/utils.go new file mode 100644 index 00000000000..7e9bcb2df1c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/ibmpisession/utils.go @@ -0,0 +1,74 @@ +package ibmpisession + +import ( + "bytes" + "crypto/tls" + "encoding/json" + "fmt" + "io" + "net/http" + "strings" + + "github.com/IBM-Cloud/power-go-client/power/client" + "github.com/IBM/go-sdk-core/v5/core" + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" +) + +const ( + SCHEME_HTTPS = "https" + SCHEME_HTTP = "http" +) + +// fetchAuthorizationData Fetch Authorization token using the Authenticator +func fetchAuthorizationData(a core.Authenticator) (string, error) { + req := &http.Request{ + Header: make(http.Header), + } + if err := a.Authenticate(req); err != nil { + return "", err + } + return req.Header.Get("Authorization"), nil +} + +// crnBuilder Return string format to create CRN using the cloud instance id +// The result string will have crn data with a string placeholder to set the cloud instance id +// Usage: +// `crn := fmt.Sprintf(crnBuilder(useraccount, regionZone, host), )` +func crnBuilder(useraccount, zone, host string) string { + var service string + if strings.Contains(host, ".power-iaas.cloud.ibm.com") { + service = "bluemix" + } else { + service = "staging" + } + crn := fmt.Sprintf("crn:v1:%s:public:power-iaas:%s:a/%s:", service, zone, useraccount) + return crn + "%s::" +} + +func powerJSONConsumer() runtime.Consumer { + return runtime.ConsumerFunc(func(reader io.Reader, data interface{}) error { + buf := new(bytes.Buffer) + _, err := buf.ReadFrom(reader) + if err != nil { + return err + } + b := buf.Bytes() + dec := json.NewDecoder(bytes.NewReader(b)) + dec.UseNumber() // preserve number formats + return dec.Decode(data) + }) +} + +// getPIClient generates a PowerIaas client +func getPIClient(debug bool, host string, scheme string) *client.PowerIaasAPI { + http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: false} + if scheme == "" { + scheme = SCHEME_HTTPS + } + transport := httptransport.New(host, "/", []string{scheme}) + transport.Debug = debug + transport.SetLogger(IBMPILogger{}) + transport.Consumers[runtime.JSONMime] = powerJSONConsumer() + return client.New(transport, nil) +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/authentication_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/authentication_client.go new file mode 100644 index 00000000000..2e9c3f96bf2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/authentication_client.go @@ -0,0 +1,442 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new authentication API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for authentication API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceBrokerAuthCallback(params *ServiceBrokerAuthCallbackParams, opts ...ClientOption) (*ServiceBrokerAuthCallbackOK, error) + + ServiceBrokerAuthDeviceCodePost(params *ServiceBrokerAuthDeviceCodePostParams, opts ...ClientOption) (*ServiceBrokerAuthDeviceCodePostOK, error) + + ServiceBrokerAuthDeviceTokenPost(params *ServiceBrokerAuthDeviceTokenPostParams, opts ...ClientOption) (*ServiceBrokerAuthDeviceTokenPostOK, error) + + ServiceBrokerAuthInfoToken(params *ServiceBrokerAuthInfoTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerAuthInfoTokenOK, error) + + ServiceBrokerAuthInfoUser(params *ServiceBrokerAuthInfoUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerAuthInfoUserOK, error) + + ServiceBrokerAuthLogin(params *ServiceBrokerAuthLoginParams, opts ...ClientOption) (*ServiceBrokerAuthLoginOK, error) + + ServiceBrokerAuthLogout(params *ServiceBrokerAuthLogoutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerAuthLogoutOK, error) + + ServiceBrokerAuthRegistration(params *ServiceBrokerAuthRegistrationParams, opts ...ClientOption) (*ServiceBrokerAuthRegistrationOK, error) + + ServiceBrokerAuthRegistrationCallback(params *ServiceBrokerAuthRegistrationCallbackParams, opts ...ClientOption) (*ServiceBrokerAuthRegistrationCallbackOK, error) + + ServiceBrokerAuthTokenPost(params *ServiceBrokerAuthTokenPostParams, opts ...ClientOption) (*ServiceBrokerAuthTokenPostOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + ServiceBrokerAuthCallback returns an access token and set cookie +*/ +func (a *Client) ServiceBrokerAuthCallback(params *ServiceBrokerAuthCallbackParams, opts ...ClientOption) (*ServiceBrokerAuthCallbackOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerAuthCallbackParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.auth.callback", + Method: "GET", + PathPattern: "/auth/v1/callback", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerAuthCallbackReader{formats: a.formats}, + 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.(*ServiceBrokerAuthCallbackOK) + 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 serviceBroker.auth.callback: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerAuthDeviceCodePost requests a authorization device code +*/ +func (a *Client) ServiceBrokerAuthDeviceCodePost(params *ServiceBrokerAuthDeviceCodePostParams, opts ...ClientOption) (*ServiceBrokerAuthDeviceCodePostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerAuthDeviceCodePostParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.auth.device.code.post", + Method: "POST", + PathPattern: "/auth/v1/device/code", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerAuthDeviceCodePostReader{formats: a.formats}, + 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.(*ServiceBrokerAuthDeviceCodePostOK) + 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 serviceBroker.auth.device.code.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerAuthDeviceTokenPost polls for authorization device token +*/ +func (a *Client) ServiceBrokerAuthDeviceTokenPost(params *ServiceBrokerAuthDeviceTokenPostParams, opts ...ClientOption) (*ServiceBrokerAuthDeviceTokenPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerAuthDeviceTokenPostParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.auth.device.token.post", + Method: "POST", + PathPattern: "/auth/v1/device/token", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerAuthDeviceTokenPostReader{formats: a.formats}, + 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.(*ServiceBrokerAuthDeviceTokenPostOK) + 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 serviceBroker.auth.device.token.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerAuthInfoToken information about current access token +*/ +func (a *Client) ServiceBrokerAuthInfoToken(params *ServiceBrokerAuthInfoTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerAuthInfoTokenOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerAuthInfoTokenParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.auth.info.token", + Method: "GET", + PathPattern: "/auth/v1/info/token", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerAuthInfoTokenReader{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.(*ServiceBrokerAuthInfoTokenOK) + 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 serviceBroker.auth.info.token: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerAuthInfoUser information about current user +*/ +func (a *Client) ServiceBrokerAuthInfoUser(params *ServiceBrokerAuthInfoUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerAuthInfoUserOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerAuthInfoUserParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.auth.info.user", + Method: "GET", + PathPattern: "/auth/v1/info/user", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerAuthInfoUserReader{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.(*ServiceBrokerAuthInfoUserOK) + 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 serviceBroker.auth.info.user: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerAuthLogin logins +*/ +func (a *Client) ServiceBrokerAuthLogin(params *ServiceBrokerAuthLoginParams, opts ...ClientOption) (*ServiceBrokerAuthLoginOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerAuthLoginParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.auth.login", + Method: "GET", + PathPattern: "/auth/v1/login", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerAuthLoginReader{formats: a.formats}, + 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.(*ServiceBrokerAuthLoginOK) + 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 serviceBroker.auth.login: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerAuthLogout logouts +*/ +func (a *Client) ServiceBrokerAuthLogout(params *ServiceBrokerAuthLogoutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerAuthLogoutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerAuthLogoutParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.auth.logout", + Method: "GET", + PathPattern: "/auth/v1/logout", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerAuthLogoutReader{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.(*ServiceBrokerAuthLogoutOK) + 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 serviceBroker.auth.logout: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerAuthRegistration registrations of a new tenant and login +*/ +func (a *Client) ServiceBrokerAuthRegistration(params *ServiceBrokerAuthRegistrationParams, opts ...ClientOption) (*ServiceBrokerAuthRegistrationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerAuthRegistrationParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.auth.registration", + Method: "GET", + PathPattern: "/auth/v1/registration", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerAuthRegistrationReader{formats: a.formats}, + 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.(*ServiceBrokerAuthRegistrationOK) + 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 serviceBroker.auth.registration: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerAuthRegistrationCallback associates the user with a tenant and returns an access token +*/ +func (a *Client) ServiceBrokerAuthRegistrationCallback(params *ServiceBrokerAuthRegistrationCallbackParams, opts ...ClientOption) (*ServiceBrokerAuthRegistrationCallbackOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerAuthRegistrationCallbackParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.auth.registration.callback", + Method: "GET", + PathPattern: "/auth/v1/callback-registration", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerAuthRegistrationCallbackReader{formats: a.formats}, + 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.(*ServiceBrokerAuthRegistrationCallbackOK) + 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 serviceBroker.auth.registration.callback: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerAuthTokenPost requests a new token from a refresh token +*/ +func (a *Client) ServiceBrokerAuthTokenPost(params *ServiceBrokerAuthTokenPostParams, opts ...ClientOption) (*ServiceBrokerAuthTokenPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerAuthTokenPostParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.auth.token.post", + Method: "POST", + PathPattern: "/auth/v1/token", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerAuthTokenPostReader{formats: a.formats}, + 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.(*ServiceBrokerAuthTokenPostOK) + 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 serviceBroker.auth.token.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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_callback_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_callback_parameters.go new file mode 100644 index 00000000000..7c2aaa3c94a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_callback_parameters.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// 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" +) + +// NewServiceBrokerAuthCallbackParams creates a new ServiceBrokerAuthCallbackParams 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 NewServiceBrokerAuthCallbackParams() *ServiceBrokerAuthCallbackParams { + return &ServiceBrokerAuthCallbackParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerAuthCallbackParamsWithTimeout creates a new ServiceBrokerAuthCallbackParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerAuthCallbackParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthCallbackParams { + return &ServiceBrokerAuthCallbackParams{ + timeout: timeout, + } +} + +// NewServiceBrokerAuthCallbackParamsWithContext creates a new ServiceBrokerAuthCallbackParams object +// with the ability to set a context for a request. +func NewServiceBrokerAuthCallbackParamsWithContext(ctx context.Context) *ServiceBrokerAuthCallbackParams { + return &ServiceBrokerAuthCallbackParams{ + Context: ctx, + } +} + +// NewServiceBrokerAuthCallbackParamsWithHTTPClient creates a new ServiceBrokerAuthCallbackParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerAuthCallbackParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthCallbackParams { + return &ServiceBrokerAuthCallbackParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerAuthCallbackParams contains all the parameters to send to the API endpoint + for the service broker auth callback operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerAuthCallbackParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker auth callback params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthCallbackParams) WithDefaults() *ServiceBrokerAuthCallbackParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth callback params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthCallbackParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker auth callback params +func (o *ServiceBrokerAuthCallbackParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthCallbackParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker auth callback params +func (o *ServiceBrokerAuthCallbackParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker auth callback params +func (o *ServiceBrokerAuthCallbackParams) WithContext(ctx context.Context) *ServiceBrokerAuthCallbackParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker auth callback params +func (o *ServiceBrokerAuthCallbackParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker auth callback params +func (o *ServiceBrokerAuthCallbackParams) WithHTTPClient(client *http.Client) *ServiceBrokerAuthCallbackParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker auth callback params +func (o *ServiceBrokerAuthCallbackParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerAuthCallbackParams) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_callback_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_callback_responses.go new file mode 100644 index 00000000000..b48acc24a3e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_callback_responses.go @@ -0,0 +1,143 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerAuthCallbackReader is a Reader for the ServiceBrokerAuthCallback structure. +type ServiceBrokerAuthCallbackReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerAuthCallbackReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerAuthCallbackOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewServiceBrokerAuthCallbackUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewServiceBrokerAuthCallbackInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerAuthCallbackOK creates a ServiceBrokerAuthCallbackOK with default headers values +func NewServiceBrokerAuthCallbackOK() *ServiceBrokerAuthCallbackOK { + return &ServiceBrokerAuthCallbackOK{} +} + +/* ServiceBrokerAuthCallbackOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerAuthCallbackOK struct { + Payload *models.AccessToken +} + +func (o *ServiceBrokerAuthCallbackOK) Error() string { + return fmt.Sprintf("[GET /auth/v1/callback][%d] serviceBrokerAuthCallbackOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerAuthCallbackOK) GetPayload() *models.AccessToken { + return o.Payload +} + +func (o *ServiceBrokerAuthCallbackOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AccessToken) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerAuthCallbackUnauthorized creates a ServiceBrokerAuthCallbackUnauthorized with default headers values +func NewServiceBrokerAuthCallbackUnauthorized() *ServiceBrokerAuthCallbackUnauthorized { + return &ServiceBrokerAuthCallbackUnauthorized{} +} + +/* ServiceBrokerAuthCallbackUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type ServiceBrokerAuthCallbackUnauthorized struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthCallbackUnauthorized) Error() string { + return fmt.Sprintf("[GET /auth/v1/callback][%d] serviceBrokerAuthCallbackUnauthorized %+v", 401, o.Payload) +} +func (o *ServiceBrokerAuthCallbackUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthCallbackUnauthorized) 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 +} + +// NewServiceBrokerAuthCallbackInternalServerError creates a ServiceBrokerAuthCallbackInternalServerError with default headers values +func NewServiceBrokerAuthCallbackInternalServerError() *ServiceBrokerAuthCallbackInternalServerError { + return &ServiceBrokerAuthCallbackInternalServerError{} +} + +/* ServiceBrokerAuthCallbackInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerAuthCallbackInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthCallbackInternalServerError) Error() string { + return fmt.Sprintf("[GET /auth/v1/callback][%d] serviceBrokerAuthCallbackInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerAuthCallbackInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthCallbackInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_device_code_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_device_code_post_parameters.go new file mode 100644 index 00000000000..ad621b60a2e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_device_code_post_parameters.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// 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" +) + +// NewServiceBrokerAuthDeviceCodePostParams creates a new ServiceBrokerAuthDeviceCodePostParams 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 NewServiceBrokerAuthDeviceCodePostParams() *ServiceBrokerAuthDeviceCodePostParams { + return &ServiceBrokerAuthDeviceCodePostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerAuthDeviceCodePostParamsWithTimeout creates a new ServiceBrokerAuthDeviceCodePostParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerAuthDeviceCodePostParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthDeviceCodePostParams { + return &ServiceBrokerAuthDeviceCodePostParams{ + timeout: timeout, + } +} + +// NewServiceBrokerAuthDeviceCodePostParamsWithContext creates a new ServiceBrokerAuthDeviceCodePostParams object +// with the ability to set a context for a request. +func NewServiceBrokerAuthDeviceCodePostParamsWithContext(ctx context.Context) *ServiceBrokerAuthDeviceCodePostParams { + return &ServiceBrokerAuthDeviceCodePostParams{ + Context: ctx, + } +} + +// NewServiceBrokerAuthDeviceCodePostParamsWithHTTPClient creates a new ServiceBrokerAuthDeviceCodePostParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerAuthDeviceCodePostParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthDeviceCodePostParams { + return &ServiceBrokerAuthDeviceCodePostParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerAuthDeviceCodePostParams contains all the parameters to send to the API endpoint + for the service broker auth device code post operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerAuthDeviceCodePostParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker auth device code post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthDeviceCodePostParams) WithDefaults() *ServiceBrokerAuthDeviceCodePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth device code post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthDeviceCodePostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker auth device code post params +func (o *ServiceBrokerAuthDeviceCodePostParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthDeviceCodePostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker auth device code post params +func (o *ServiceBrokerAuthDeviceCodePostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker auth device code post params +func (o *ServiceBrokerAuthDeviceCodePostParams) WithContext(ctx context.Context) *ServiceBrokerAuthDeviceCodePostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker auth device code post params +func (o *ServiceBrokerAuthDeviceCodePostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker auth device code post params +func (o *ServiceBrokerAuthDeviceCodePostParams) WithHTTPClient(client *http.Client) *ServiceBrokerAuthDeviceCodePostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker auth device code post params +func (o *ServiceBrokerAuthDeviceCodePostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerAuthDeviceCodePostParams) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_device_code_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_device_code_post_responses.go new file mode 100644 index 00000000000..b0d31f0b39c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_device_code_post_responses.go @@ -0,0 +1,143 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerAuthDeviceCodePostReader is a Reader for the ServiceBrokerAuthDeviceCodePost structure. +type ServiceBrokerAuthDeviceCodePostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerAuthDeviceCodePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerAuthDeviceCodePostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 403: + result := NewServiceBrokerAuthDeviceCodePostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewServiceBrokerAuthDeviceCodePostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerAuthDeviceCodePostOK creates a ServiceBrokerAuthDeviceCodePostOK with default headers values +func NewServiceBrokerAuthDeviceCodePostOK() *ServiceBrokerAuthDeviceCodePostOK { + return &ServiceBrokerAuthDeviceCodePostOK{} +} + +/* ServiceBrokerAuthDeviceCodePostOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerAuthDeviceCodePostOK struct { + Payload *models.DeviceCode +} + +func (o *ServiceBrokerAuthDeviceCodePostOK) Error() string { + return fmt.Sprintf("[POST /auth/v1/device/code][%d] serviceBrokerAuthDeviceCodePostOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerAuthDeviceCodePostOK) GetPayload() *models.DeviceCode { + return o.Payload +} + +func (o *ServiceBrokerAuthDeviceCodePostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DeviceCode) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerAuthDeviceCodePostForbidden creates a ServiceBrokerAuthDeviceCodePostForbidden with default headers values +func NewServiceBrokerAuthDeviceCodePostForbidden() *ServiceBrokerAuthDeviceCodePostForbidden { + return &ServiceBrokerAuthDeviceCodePostForbidden{} +} + +/* ServiceBrokerAuthDeviceCodePostForbidden describes a response with status code 403, with default header values. + +Quota exceeded +*/ +type ServiceBrokerAuthDeviceCodePostForbidden struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthDeviceCodePostForbidden) Error() string { + return fmt.Sprintf("[POST /auth/v1/device/code][%d] serviceBrokerAuthDeviceCodePostForbidden %+v", 403, o.Payload) +} +func (o *ServiceBrokerAuthDeviceCodePostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthDeviceCodePostForbidden) 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 +} + +// NewServiceBrokerAuthDeviceCodePostInternalServerError creates a ServiceBrokerAuthDeviceCodePostInternalServerError with default headers values +func NewServiceBrokerAuthDeviceCodePostInternalServerError() *ServiceBrokerAuthDeviceCodePostInternalServerError { + return &ServiceBrokerAuthDeviceCodePostInternalServerError{} +} + +/* ServiceBrokerAuthDeviceCodePostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerAuthDeviceCodePostInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthDeviceCodePostInternalServerError) Error() string { + return fmt.Sprintf("[POST /auth/v1/device/code][%d] serviceBrokerAuthDeviceCodePostInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerAuthDeviceCodePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthDeviceCodePostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_device_token_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_device_token_post_parameters.go new file mode 100644 index 00000000000..ab928c9a224 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_device_token_post_parameters.go @@ -0,0 +1,147 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// 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" +) + +// NewServiceBrokerAuthDeviceTokenPostParams creates a new ServiceBrokerAuthDeviceTokenPostParams 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 NewServiceBrokerAuthDeviceTokenPostParams() *ServiceBrokerAuthDeviceTokenPostParams { + return &ServiceBrokerAuthDeviceTokenPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerAuthDeviceTokenPostParamsWithTimeout creates a new ServiceBrokerAuthDeviceTokenPostParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerAuthDeviceTokenPostParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthDeviceTokenPostParams { + return &ServiceBrokerAuthDeviceTokenPostParams{ + timeout: timeout, + } +} + +// NewServiceBrokerAuthDeviceTokenPostParamsWithContext creates a new ServiceBrokerAuthDeviceTokenPostParams object +// with the ability to set a context for a request. +func NewServiceBrokerAuthDeviceTokenPostParamsWithContext(ctx context.Context) *ServiceBrokerAuthDeviceTokenPostParams { + return &ServiceBrokerAuthDeviceTokenPostParams{ + Context: ctx, + } +} + +// NewServiceBrokerAuthDeviceTokenPostParamsWithHTTPClient creates a new ServiceBrokerAuthDeviceTokenPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerAuthDeviceTokenPostParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthDeviceTokenPostParams { + return &ServiceBrokerAuthDeviceTokenPostParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerAuthDeviceTokenPostParams contains all the parameters to send to the API endpoint + for the service broker auth device token post operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerAuthDeviceTokenPostParams struct { + + /* Body. + + Parameters for polling authorization device code + */ + Body ServiceBrokerAuthDeviceTokenPostBody + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker auth device token post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthDeviceTokenPostParams) WithDefaults() *ServiceBrokerAuthDeviceTokenPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth device token post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthDeviceTokenPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker auth device token post params +func (o *ServiceBrokerAuthDeviceTokenPostParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthDeviceTokenPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker auth device token post params +func (o *ServiceBrokerAuthDeviceTokenPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker auth device token post params +func (o *ServiceBrokerAuthDeviceTokenPostParams) WithContext(ctx context.Context) *ServiceBrokerAuthDeviceTokenPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker auth device token post params +func (o *ServiceBrokerAuthDeviceTokenPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker auth device token post params +func (o *ServiceBrokerAuthDeviceTokenPostParams) WithHTTPClient(client *http.Client) *ServiceBrokerAuthDeviceTokenPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker auth device token post params +func (o *ServiceBrokerAuthDeviceTokenPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the service broker auth device token post params +func (o *ServiceBrokerAuthDeviceTokenPostParams) WithBody(body ServiceBrokerAuthDeviceTokenPostBody) *ServiceBrokerAuthDeviceTokenPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the service broker auth device token post params +func (o *ServiceBrokerAuthDeviceTokenPostParams) SetBody(body ServiceBrokerAuthDeviceTokenPostBody) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerAuthDeviceTokenPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_device_token_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_device_token_post_responses.go new file mode 100644 index 00000000000..f9579f5c6c4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_device_token_post_responses.go @@ -0,0 +1,258 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerAuthDeviceTokenPostReader is a Reader for the ServiceBrokerAuthDeviceTokenPost structure. +type ServiceBrokerAuthDeviceTokenPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerAuthDeviceTokenPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerAuthDeviceTokenPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceBrokerAuthDeviceTokenPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewServiceBrokerAuthDeviceTokenPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 429: + result := NewServiceBrokerAuthDeviceTokenPostTooManyRequests() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewServiceBrokerAuthDeviceTokenPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerAuthDeviceTokenPostOK creates a ServiceBrokerAuthDeviceTokenPostOK with default headers values +func NewServiceBrokerAuthDeviceTokenPostOK() *ServiceBrokerAuthDeviceTokenPostOK { + return &ServiceBrokerAuthDeviceTokenPostOK{} +} + +/* ServiceBrokerAuthDeviceTokenPostOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerAuthDeviceTokenPostOK struct { + Payload *models.Token +} + +func (o *ServiceBrokerAuthDeviceTokenPostOK) Error() string { + return fmt.Sprintf("[POST /auth/v1/device/token][%d] serviceBrokerAuthDeviceTokenPostOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerAuthDeviceTokenPostOK) GetPayload() *models.Token { + return o.Payload +} + +func (o *ServiceBrokerAuthDeviceTokenPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Token) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerAuthDeviceTokenPostBadRequest creates a ServiceBrokerAuthDeviceTokenPostBadRequest with default headers values +func NewServiceBrokerAuthDeviceTokenPostBadRequest() *ServiceBrokerAuthDeviceTokenPostBadRequest { + return &ServiceBrokerAuthDeviceTokenPostBadRequest{} +} + +/* ServiceBrokerAuthDeviceTokenPostBadRequest describes a response with status code 400, with default header values. + +Authorization pending +*/ +type ServiceBrokerAuthDeviceTokenPostBadRequest struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthDeviceTokenPostBadRequest) Error() string { + return fmt.Sprintf("[POST /auth/v1/device/token][%d] serviceBrokerAuthDeviceTokenPostBadRequest %+v", 400, o.Payload) +} +func (o *ServiceBrokerAuthDeviceTokenPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthDeviceTokenPostBadRequest) 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 +} + +// NewServiceBrokerAuthDeviceTokenPostForbidden creates a ServiceBrokerAuthDeviceTokenPostForbidden with default headers values +func NewServiceBrokerAuthDeviceTokenPostForbidden() *ServiceBrokerAuthDeviceTokenPostForbidden { + return &ServiceBrokerAuthDeviceTokenPostForbidden{} +} + +/* ServiceBrokerAuthDeviceTokenPostForbidden describes a response with status code 403, with default header values. + +User refused grant +*/ +type ServiceBrokerAuthDeviceTokenPostForbidden struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthDeviceTokenPostForbidden) Error() string { + return fmt.Sprintf("[POST /auth/v1/device/token][%d] serviceBrokerAuthDeviceTokenPostForbidden %+v", 403, o.Payload) +} +func (o *ServiceBrokerAuthDeviceTokenPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthDeviceTokenPostForbidden) 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 +} + +// NewServiceBrokerAuthDeviceTokenPostTooManyRequests creates a ServiceBrokerAuthDeviceTokenPostTooManyRequests with default headers values +func NewServiceBrokerAuthDeviceTokenPostTooManyRequests() *ServiceBrokerAuthDeviceTokenPostTooManyRequests { + return &ServiceBrokerAuthDeviceTokenPostTooManyRequests{} +} + +/* ServiceBrokerAuthDeviceTokenPostTooManyRequests describes a response with status code 429, with default header values. + +Polling too frequently +*/ +type ServiceBrokerAuthDeviceTokenPostTooManyRequests struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthDeviceTokenPostTooManyRequests) Error() string { + return fmt.Sprintf("[POST /auth/v1/device/token][%d] serviceBrokerAuthDeviceTokenPostTooManyRequests %+v", 429, o.Payload) +} +func (o *ServiceBrokerAuthDeviceTokenPostTooManyRequests) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthDeviceTokenPostTooManyRequests) 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 +} + +// NewServiceBrokerAuthDeviceTokenPostInternalServerError creates a ServiceBrokerAuthDeviceTokenPostInternalServerError with default headers values +func NewServiceBrokerAuthDeviceTokenPostInternalServerError() *ServiceBrokerAuthDeviceTokenPostInternalServerError { + return &ServiceBrokerAuthDeviceTokenPostInternalServerError{} +} + +/* ServiceBrokerAuthDeviceTokenPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerAuthDeviceTokenPostInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthDeviceTokenPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /auth/v1/device/token][%d] serviceBrokerAuthDeviceTokenPostInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerAuthDeviceTokenPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthDeviceTokenPostInternalServerError) 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 +} + +/*ServiceBrokerAuthDeviceTokenPostBody service broker auth device token post body +swagger:model ServiceBrokerAuthDeviceTokenPostBody +*/ +type ServiceBrokerAuthDeviceTokenPostBody struct { + + // The deviceCode that the authorization server returned + DeviceCode string `json:"deviceCode,omitempty"` +} + +// Validate validates this service broker auth device token post body +func (o *ServiceBrokerAuthDeviceTokenPostBody) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this service broker auth device token post body based on context it is used +func (o *ServiceBrokerAuthDeviceTokenPostBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *ServiceBrokerAuthDeviceTokenPostBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *ServiceBrokerAuthDeviceTokenPostBody) UnmarshalBinary(b []byte) error { + var res ServiceBrokerAuthDeviceTokenPostBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_info_token_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_info_token_parameters.go new file mode 100644 index 00000000000..8bd091b80af --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_info_token_parameters.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// 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" +) + +// NewServiceBrokerAuthInfoTokenParams creates a new ServiceBrokerAuthInfoTokenParams 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 NewServiceBrokerAuthInfoTokenParams() *ServiceBrokerAuthInfoTokenParams { + return &ServiceBrokerAuthInfoTokenParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerAuthInfoTokenParamsWithTimeout creates a new ServiceBrokerAuthInfoTokenParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerAuthInfoTokenParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthInfoTokenParams { + return &ServiceBrokerAuthInfoTokenParams{ + timeout: timeout, + } +} + +// NewServiceBrokerAuthInfoTokenParamsWithContext creates a new ServiceBrokerAuthInfoTokenParams object +// with the ability to set a context for a request. +func NewServiceBrokerAuthInfoTokenParamsWithContext(ctx context.Context) *ServiceBrokerAuthInfoTokenParams { + return &ServiceBrokerAuthInfoTokenParams{ + Context: ctx, + } +} + +// NewServiceBrokerAuthInfoTokenParamsWithHTTPClient creates a new ServiceBrokerAuthInfoTokenParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerAuthInfoTokenParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthInfoTokenParams { + return &ServiceBrokerAuthInfoTokenParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerAuthInfoTokenParams contains all the parameters to send to the API endpoint + for the service broker auth info token operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerAuthInfoTokenParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker auth info token params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthInfoTokenParams) WithDefaults() *ServiceBrokerAuthInfoTokenParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth info token params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthInfoTokenParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker auth info token params +func (o *ServiceBrokerAuthInfoTokenParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthInfoTokenParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker auth info token params +func (o *ServiceBrokerAuthInfoTokenParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker auth info token params +func (o *ServiceBrokerAuthInfoTokenParams) WithContext(ctx context.Context) *ServiceBrokerAuthInfoTokenParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker auth info token params +func (o *ServiceBrokerAuthInfoTokenParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker auth info token params +func (o *ServiceBrokerAuthInfoTokenParams) WithHTTPClient(client *http.Client) *ServiceBrokerAuthInfoTokenParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker auth info token params +func (o *ServiceBrokerAuthInfoTokenParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerAuthInfoTokenParams) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_info_token_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_info_token_responses.go new file mode 100644 index 00000000000..5c38010ddb9 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_info_token_responses.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerAuthInfoTokenReader is a Reader for the ServiceBrokerAuthInfoToken structure. +type ServiceBrokerAuthInfoTokenReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerAuthInfoTokenReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerAuthInfoTokenOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 500: + result := NewServiceBrokerAuthInfoTokenInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerAuthInfoTokenOK creates a ServiceBrokerAuthInfoTokenOK with default headers values +func NewServiceBrokerAuthInfoTokenOK() *ServiceBrokerAuthInfoTokenOK { + return &ServiceBrokerAuthInfoTokenOK{} +} + +/* ServiceBrokerAuthInfoTokenOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerAuthInfoTokenOK struct { + Payload *models.TokenExtra +} + +func (o *ServiceBrokerAuthInfoTokenOK) Error() string { + return fmt.Sprintf("[GET /auth/v1/info/token][%d] serviceBrokerAuthInfoTokenOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerAuthInfoTokenOK) GetPayload() *models.TokenExtra { + return o.Payload +} + +func (o *ServiceBrokerAuthInfoTokenOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.TokenExtra) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerAuthInfoTokenInternalServerError creates a ServiceBrokerAuthInfoTokenInternalServerError with default headers values +func NewServiceBrokerAuthInfoTokenInternalServerError() *ServiceBrokerAuthInfoTokenInternalServerError { + return &ServiceBrokerAuthInfoTokenInternalServerError{} +} + +/* ServiceBrokerAuthInfoTokenInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerAuthInfoTokenInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthInfoTokenInternalServerError) Error() string { + return fmt.Sprintf("[GET /auth/v1/info/token][%d] serviceBrokerAuthInfoTokenInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerAuthInfoTokenInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthInfoTokenInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_info_user_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_info_user_parameters.go new file mode 100644 index 00000000000..400cfced998 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_info_user_parameters.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// 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" +) + +// NewServiceBrokerAuthInfoUserParams creates a new ServiceBrokerAuthInfoUserParams 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 NewServiceBrokerAuthInfoUserParams() *ServiceBrokerAuthInfoUserParams { + return &ServiceBrokerAuthInfoUserParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerAuthInfoUserParamsWithTimeout creates a new ServiceBrokerAuthInfoUserParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerAuthInfoUserParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthInfoUserParams { + return &ServiceBrokerAuthInfoUserParams{ + timeout: timeout, + } +} + +// NewServiceBrokerAuthInfoUserParamsWithContext creates a new ServiceBrokerAuthInfoUserParams object +// with the ability to set a context for a request. +func NewServiceBrokerAuthInfoUserParamsWithContext(ctx context.Context) *ServiceBrokerAuthInfoUserParams { + return &ServiceBrokerAuthInfoUserParams{ + Context: ctx, + } +} + +// NewServiceBrokerAuthInfoUserParamsWithHTTPClient creates a new ServiceBrokerAuthInfoUserParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerAuthInfoUserParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthInfoUserParams { + return &ServiceBrokerAuthInfoUserParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerAuthInfoUserParams contains all the parameters to send to the API endpoint + for the service broker auth info user operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerAuthInfoUserParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker auth info user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthInfoUserParams) WithDefaults() *ServiceBrokerAuthInfoUserParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth info user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthInfoUserParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker auth info user params +func (o *ServiceBrokerAuthInfoUserParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthInfoUserParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker auth info user params +func (o *ServiceBrokerAuthInfoUserParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker auth info user params +func (o *ServiceBrokerAuthInfoUserParams) WithContext(ctx context.Context) *ServiceBrokerAuthInfoUserParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker auth info user params +func (o *ServiceBrokerAuthInfoUserParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker auth info user params +func (o *ServiceBrokerAuthInfoUserParams) WithHTTPClient(client *http.Client) *ServiceBrokerAuthInfoUserParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker auth info user params +func (o *ServiceBrokerAuthInfoUserParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerAuthInfoUserParams) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_info_user_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_info_user_responses.go new file mode 100644 index 00000000000..c8a412dff77 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_info_user_responses.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerAuthInfoUserReader is a Reader for the ServiceBrokerAuthInfoUser structure. +type ServiceBrokerAuthInfoUserReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerAuthInfoUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerAuthInfoUserOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 500: + result := NewServiceBrokerAuthInfoUserInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerAuthInfoUserOK creates a ServiceBrokerAuthInfoUserOK with default headers values +func NewServiceBrokerAuthInfoUserOK() *ServiceBrokerAuthInfoUserOK { + return &ServiceBrokerAuthInfoUserOK{} +} + +/* ServiceBrokerAuthInfoUserOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerAuthInfoUserOK struct { + Payload *models.UserInfo +} + +func (o *ServiceBrokerAuthInfoUserOK) Error() string { + return fmt.Sprintf("[GET /auth/v1/info/user][%d] serviceBrokerAuthInfoUserOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerAuthInfoUserOK) GetPayload() *models.UserInfo { + return o.Payload +} + +func (o *ServiceBrokerAuthInfoUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.UserInfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerAuthInfoUserInternalServerError creates a ServiceBrokerAuthInfoUserInternalServerError with default headers values +func NewServiceBrokerAuthInfoUserInternalServerError() *ServiceBrokerAuthInfoUserInternalServerError { + return &ServiceBrokerAuthInfoUserInternalServerError{} +} + +/* ServiceBrokerAuthInfoUserInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerAuthInfoUserInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthInfoUserInternalServerError) Error() string { + return fmt.Sprintf("[GET /auth/v1/info/user][%d] serviceBrokerAuthInfoUserInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerAuthInfoUserInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthInfoUserInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_login_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_login_parameters.go new file mode 100644 index 00000000000..821c5a04197 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_login_parameters.go @@ -0,0 +1,242 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// 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" +) + +// NewServiceBrokerAuthLoginParams creates a new ServiceBrokerAuthLoginParams 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 NewServiceBrokerAuthLoginParams() *ServiceBrokerAuthLoginParams { + return &ServiceBrokerAuthLoginParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerAuthLoginParamsWithTimeout creates a new ServiceBrokerAuthLoginParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerAuthLoginParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthLoginParams { + return &ServiceBrokerAuthLoginParams{ + timeout: timeout, + } +} + +// NewServiceBrokerAuthLoginParamsWithContext creates a new ServiceBrokerAuthLoginParams object +// with the ability to set a context for a request. +func NewServiceBrokerAuthLoginParamsWithContext(ctx context.Context) *ServiceBrokerAuthLoginParams { + return &ServiceBrokerAuthLoginParams{ + Context: ctx, + } +} + +// NewServiceBrokerAuthLoginParamsWithHTTPClient creates a new ServiceBrokerAuthLoginParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerAuthLoginParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthLoginParams { + return &ServiceBrokerAuthLoginParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerAuthLoginParams contains all the parameters to send to the API endpoint + for the service broker auth login operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerAuthLoginParams struct { + + /* AccessType. + + Determines if a refresh token is returned + + Default: "online" + */ + AccessType *string + + /* RedirectURL. + + The URL to redirect to after login/registration + */ + RedirectURL *string + + /* UserID. + + The user id of the user + */ + UserID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker auth login params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthLoginParams) WithDefaults() *ServiceBrokerAuthLoginParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth login params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthLoginParams) SetDefaults() { + var ( + accessTypeDefault = string("online") + ) + + val := ServiceBrokerAuthLoginParams{ + AccessType: &accessTypeDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the service broker auth login params +func (o *ServiceBrokerAuthLoginParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthLoginParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker auth login params +func (o *ServiceBrokerAuthLoginParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker auth login params +func (o *ServiceBrokerAuthLoginParams) WithContext(ctx context.Context) *ServiceBrokerAuthLoginParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker auth login params +func (o *ServiceBrokerAuthLoginParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker auth login params +func (o *ServiceBrokerAuthLoginParams) WithHTTPClient(client *http.Client) *ServiceBrokerAuthLoginParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker auth login params +func (o *ServiceBrokerAuthLoginParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccessType adds the accessType to the service broker auth login params +func (o *ServiceBrokerAuthLoginParams) WithAccessType(accessType *string) *ServiceBrokerAuthLoginParams { + o.SetAccessType(accessType) + return o +} + +// SetAccessType adds the accessType to the service broker auth login params +func (o *ServiceBrokerAuthLoginParams) SetAccessType(accessType *string) { + o.AccessType = accessType +} + +// WithRedirectURL adds the redirectURL to the service broker auth login params +func (o *ServiceBrokerAuthLoginParams) WithRedirectURL(redirectURL *string) *ServiceBrokerAuthLoginParams { + o.SetRedirectURL(redirectURL) + return o +} + +// SetRedirectURL adds the redirectUrl to the service broker auth login params +func (o *ServiceBrokerAuthLoginParams) SetRedirectURL(redirectURL *string) { + o.RedirectURL = redirectURL +} + +// WithUserID adds the userID to the service broker auth login params +func (o *ServiceBrokerAuthLoginParams) WithUserID(userID *string) *ServiceBrokerAuthLoginParams { + o.SetUserID(userID) + return o +} + +// SetUserID adds the userId to the service broker auth login params +func (o *ServiceBrokerAuthLoginParams) SetUserID(userID *string) { + o.UserID = userID +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerAuthLoginParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.AccessType != nil { + + // query param access_type + var qrAccessType string + + if o.AccessType != nil { + qrAccessType = *o.AccessType + } + qAccessType := qrAccessType + if qAccessType != "" { + + if err := r.SetQueryParam("access_type", qAccessType); err != nil { + return err + } + } + } + + if o.RedirectURL != nil { + + // query param redirect_url + var qrRedirectURL string + + if o.RedirectURL != nil { + qrRedirectURL = *o.RedirectURL + } + qRedirectURL := qrRedirectURL + if qRedirectURL != "" { + + if err := r.SetQueryParam("redirect_url", qRedirectURL); err != nil { + return err + } + } + } + + if o.UserID != nil { + + // query param user_id + var qrUserID string + + if o.UserID != nil { + qrUserID = *o.UserID + } + qUserID := qrUserID + if qUserID != "" { + + if err := r.SetQueryParam("user_id", qUserID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_login_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_login_responses.go new file mode 100644 index 00000000000..0372c622fbb --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_login_responses.go @@ -0,0 +1,143 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerAuthLoginReader is a Reader for the ServiceBrokerAuthLogin structure. +type ServiceBrokerAuthLoginReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerAuthLoginReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerAuthLoginOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewServiceBrokerAuthLoginUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewServiceBrokerAuthLoginInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerAuthLoginOK creates a ServiceBrokerAuthLoginOK with default headers values +func NewServiceBrokerAuthLoginOK() *ServiceBrokerAuthLoginOK { + return &ServiceBrokerAuthLoginOK{} +} + +/* ServiceBrokerAuthLoginOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerAuthLoginOK struct { + Payload *models.AccessToken +} + +func (o *ServiceBrokerAuthLoginOK) Error() string { + return fmt.Sprintf("[GET /auth/v1/login][%d] serviceBrokerAuthLoginOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerAuthLoginOK) GetPayload() *models.AccessToken { + return o.Payload +} + +func (o *ServiceBrokerAuthLoginOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AccessToken) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerAuthLoginUnauthorized creates a ServiceBrokerAuthLoginUnauthorized with default headers values +func NewServiceBrokerAuthLoginUnauthorized() *ServiceBrokerAuthLoginUnauthorized { + return &ServiceBrokerAuthLoginUnauthorized{} +} + +/* ServiceBrokerAuthLoginUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type ServiceBrokerAuthLoginUnauthorized struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthLoginUnauthorized) Error() string { + return fmt.Sprintf("[GET /auth/v1/login][%d] serviceBrokerAuthLoginUnauthorized %+v", 401, o.Payload) +} +func (o *ServiceBrokerAuthLoginUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthLoginUnauthorized) 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 +} + +// NewServiceBrokerAuthLoginInternalServerError creates a ServiceBrokerAuthLoginInternalServerError with default headers values +func NewServiceBrokerAuthLoginInternalServerError() *ServiceBrokerAuthLoginInternalServerError { + return &ServiceBrokerAuthLoginInternalServerError{} +} + +/* ServiceBrokerAuthLoginInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerAuthLoginInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthLoginInternalServerError) Error() string { + return fmt.Sprintf("[GET /auth/v1/login][%d] serviceBrokerAuthLoginInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerAuthLoginInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthLoginInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_logout_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_logout_parameters.go new file mode 100644 index 00000000000..dd227cda394 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_logout_parameters.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// 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" +) + +// NewServiceBrokerAuthLogoutParams creates a new ServiceBrokerAuthLogoutParams 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 NewServiceBrokerAuthLogoutParams() *ServiceBrokerAuthLogoutParams { + return &ServiceBrokerAuthLogoutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerAuthLogoutParamsWithTimeout creates a new ServiceBrokerAuthLogoutParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerAuthLogoutParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthLogoutParams { + return &ServiceBrokerAuthLogoutParams{ + timeout: timeout, + } +} + +// NewServiceBrokerAuthLogoutParamsWithContext creates a new ServiceBrokerAuthLogoutParams object +// with the ability to set a context for a request. +func NewServiceBrokerAuthLogoutParamsWithContext(ctx context.Context) *ServiceBrokerAuthLogoutParams { + return &ServiceBrokerAuthLogoutParams{ + Context: ctx, + } +} + +// NewServiceBrokerAuthLogoutParamsWithHTTPClient creates a new ServiceBrokerAuthLogoutParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerAuthLogoutParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthLogoutParams { + return &ServiceBrokerAuthLogoutParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerAuthLogoutParams contains all the parameters to send to the API endpoint + for the service broker auth logout operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerAuthLogoutParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker auth logout params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthLogoutParams) WithDefaults() *ServiceBrokerAuthLogoutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth logout params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthLogoutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker auth logout params +func (o *ServiceBrokerAuthLogoutParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthLogoutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker auth logout params +func (o *ServiceBrokerAuthLogoutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker auth logout params +func (o *ServiceBrokerAuthLogoutParams) WithContext(ctx context.Context) *ServiceBrokerAuthLogoutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker auth logout params +func (o *ServiceBrokerAuthLogoutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker auth logout params +func (o *ServiceBrokerAuthLogoutParams) WithHTTPClient(client *http.Client) *ServiceBrokerAuthLogoutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker auth logout params +func (o *ServiceBrokerAuthLogoutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerAuthLogoutParams) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_logout_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_logout_responses.go new file mode 100644 index 00000000000..6907da0111c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_logout_responses.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerAuthLogoutReader is a Reader for the ServiceBrokerAuthLogout structure. +type ServiceBrokerAuthLogoutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerAuthLogoutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerAuthLogoutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 500: + result := NewServiceBrokerAuthLogoutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerAuthLogoutOK creates a ServiceBrokerAuthLogoutOK with default headers values +func NewServiceBrokerAuthLogoutOK() *ServiceBrokerAuthLogoutOK { + return &ServiceBrokerAuthLogoutOK{} +} + +/* ServiceBrokerAuthLogoutOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerAuthLogoutOK struct { + Payload models.Object +} + +func (o *ServiceBrokerAuthLogoutOK) Error() string { + return fmt.Sprintf("[GET /auth/v1/logout][%d] serviceBrokerAuthLogoutOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerAuthLogoutOK) GetPayload() models.Object { + return o.Payload +} + +func (o *ServiceBrokerAuthLogoutOK) 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 +} + +// NewServiceBrokerAuthLogoutInternalServerError creates a ServiceBrokerAuthLogoutInternalServerError with default headers values +func NewServiceBrokerAuthLogoutInternalServerError() *ServiceBrokerAuthLogoutInternalServerError { + return &ServiceBrokerAuthLogoutInternalServerError{} +} + +/* ServiceBrokerAuthLogoutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerAuthLogoutInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthLogoutInternalServerError) Error() string { + return fmt.Sprintf("[GET /auth/v1/logout][%d] serviceBrokerAuthLogoutInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerAuthLogoutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthLogoutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_registration_callback_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_registration_callback_parameters.go new file mode 100644 index 00000000000..0aceb5313bc --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_registration_callback_parameters.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// 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" +) + +// NewServiceBrokerAuthRegistrationCallbackParams creates a new ServiceBrokerAuthRegistrationCallbackParams 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 NewServiceBrokerAuthRegistrationCallbackParams() *ServiceBrokerAuthRegistrationCallbackParams { + return &ServiceBrokerAuthRegistrationCallbackParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerAuthRegistrationCallbackParamsWithTimeout creates a new ServiceBrokerAuthRegistrationCallbackParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerAuthRegistrationCallbackParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthRegistrationCallbackParams { + return &ServiceBrokerAuthRegistrationCallbackParams{ + timeout: timeout, + } +} + +// NewServiceBrokerAuthRegistrationCallbackParamsWithContext creates a new ServiceBrokerAuthRegistrationCallbackParams object +// with the ability to set a context for a request. +func NewServiceBrokerAuthRegistrationCallbackParamsWithContext(ctx context.Context) *ServiceBrokerAuthRegistrationCallbackParams { + return &ServiceBrokerAuthRegistrationCallbackParams{ + Context: ctx, + } +} + +// NewServiceBrokerAuthRegistrationCallbackParamsWithHTTPClient creates a new ServiceBrokerAuthRegistrationCallbackParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerAuthRegistrationCallbackParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthRegistrationCallbackParams { + return &ServiceBrokerAuthRegistrationCallbackParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerAuthRegistrationCallbackParams contains all the parameters to send to the API endpoint + for the service broker auth registration callback operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerAuthRegistrationCallbackParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker auth registration callback params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthRegistrationCallbackParams) WithDefaults() *ServiceBrokerAuthRegistrationCallbackParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth registration callback params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthRegistrationCallbackParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker auth registration callback params +func (o *ServiceBrokerAuthRegistrationCallbackParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthRegistrationCallbackParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker auth registration callback params +func (o *ServiceBrokerAuthRegistrationCallbackParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker auth registration callback params +func (o *ServiceBrokerAuthRegistrationCallbackParams) WithContext(ctx context.Context) *ServiceBrokerAuthRegistrationCallbackParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker auth registration callback params +func (o *ServiceBrokerAuthRegistrationCallbackParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker auth registration callback params +func (o *ServiceBrokerAuthRegistrationCallbackParams) WithHTTPClient(client *http.Client) *ServiceBrokerAuthRegistrationCallbackParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker auth registration callback params +func (o *ServiceBrokerAuthRegistrationCallbackParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerAuthRegistrationCallbackParams) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_registration_callback_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_registration_callback_responses.go new file mode 100644 index 00000000000..bc09a80543e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_registration_callback_responses.go @@ -0,0 +1,143 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerAuthRegistrationCallbackReader is a Reader for the ServiceBrokerAuthRegistrationCallback structure. +type ServiceBrokerAuthRegistrationCallbackReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerAuthRegistrationCallbackReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerAuthRegistrationCallbackOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewServiceBrokerAuthRegistrationCallbackUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewServiceBrokerAuthRegistrationCallbackInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerAuthRegistrationCallbackOK creates a ServiceBrokerAuthRegistrationCallbackOK with default headers values +func NewServiceBrokerAuthRegistrationCallbackOK() *ServiceBrokerAuthRegistrationCallbackOK { + return &ServiceBrokerAuthRegistrationCallbackOK{} +} + +/* ServiceBrokerAuthRegistrationCallbackOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerAuthRegistrationCallbackOK struct { + Payload *models.AccessToken +} + +func (o *ServiceBrokerAuthRegistrationCallbackOK) Error() string { + return fmt.Sprintf("[GET /auth/v1/callback-registration][%d] serviceBrokerAuthRegistrationCallbackOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerAuthRegistrationCallbackOK) GetPayload() *models.AccessToken { + return o.Payload +} + +func (o *ServiceBrokerAuthRegistrationCallbackOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AccessToken) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerAuthRegistrationCallbackUnauthorized creates a ServiceBrokerAuthRegistrationCallbackUnauthorized with default headers values +func NewServiceBrokerAuthRegistrationCallbackUnauthorized() *ServiceBrokerAuthRegistrationCallbackUnauthorized { + return &ServiceBrokerAuthRegistrationCallbackUnauthorized{} +} + +/* ServiceBrokerAuthRegistrationCallbackUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type ServiceBrokerAuthRegistrationCallbackUnauthorized struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthRegistrationCallbackUnauthorized) Error() string { + return fmt.Sprintf("[GET /auth/v1/callback-registration][%d] serviceBrokerAuthRegistrationCallbackUnauthorized %+v", 401, o.Payload) +} +func (o *ServiceBrokerAuthRegistrationCallbackUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthRegistrationCallbackUnauthorized) 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 +} + +// NewServiceBrokerAuthRegistrationCallbackInternalServerError creates a ServiceBrokerAuthRegistrationCallbackInternalServerError with default headers values +func NewServiceBrokerAuthRegistrationCallbackInternalServerError() *ServiceBrokerAuthRegistrationCallbackInternalServerError { + return &ServiceBrokerAuthRegistrationCallbackInternalServerError{} +} + +/* ServiceBrokerAuthRegistrationCallbackInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerAuthRegistrationCallbackInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthRegistrationCallbackInternalServerError) Error() string { + return fmt.Sprintf("[GET /auth/v1/callback-registration][%d] serviceBrokerAuthRegistrationCallbackInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerAuthRegistrationCallbackInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthRegistrationCallbackInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_registration_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_registration_parameters.go new file mode 100644 index 00000000000..3a49c00a2e0 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_registration_parameters.go @@ -0,0 +1,315 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// 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/go-openapi/swag" +) + +// NewServiceBrokerAuthRegistrationParams creates a new ServiceBrokerAuthRegistrationParams 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 NewServiceBrokerAuthRegistrationParams() *ServiceBrokerAuthRegistrationParams { + return &ServiceBrokerAuthRegistrationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerAuthRegistrationParamsWithTimeout creates a new ServiceBrokerAuthRegistrationParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerAuthRegistrationParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthRegistrationParams { + return &ServiceBrokerAuthRegistrationParams{ + timeout: timeout, + } +} + +// NewServiceBrokerAuthRegistrationParamsWithContext creates a new ServiceBrokerAuthRegistrationParams object +// with the ability to set a context for a request. +func NewServiceBrokerAuthRegistrationParamsWithContext(ctx context.Context) *ServiceBrokerAuthRegistrationParams { + return &ServiceBrokerAuthRegistrationParams{ + Context: ctx, + } +} + +// NewServiceBrokerAuthRegistrationParamsWithHTTPClient creates a new ServiceBrokerAuthRegistrationParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerAuthRegistrationParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthRegistrationParams { + return &ServiceBrokerAuthRegistrationParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerAuthRegistrationParams contains all the parameters to send to the API endpoint + for the service broker auth registration operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerAuthRegistrationParams struct { + + /* EntitlementID. + + Entitlement ID of for this tenant + */ + EntitlementID string + + /* Icn. + + IBM Customer Number (ICN) for this tenant + */ + Icn string + + /* Plan. + + Plan for this tenant and entitlement + */ + Plan string + + /* RedirectURL. + + The URL to redirect to after login/registration + */ + RedirectURL *string + + /* Regions. + + An array of regions matching the number of cloud-instances in the plan + */ + Regions []string + + /* TenantID. + + Tenant ID of a pcloud tenant + */ + TenantID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker auth registration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthRegistrationParams) WithDefaults() *ServiceBrokerAuthRegistrationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth registration params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthRegistrationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthRegistrationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) WithContext(ctx context.Context) *ServiceBrokerAuthRegistrationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) WithHTTPClient(client *http.Client) *ServiceBrokerAuthRegistrationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithEntitlementID adds the entitlementID to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) WithEntitlementID(entitlementID string) *ServiceBrokerAuthRegistrationParams { + o.SetEntitlementID(entitlementID) + return o +} + +// SetEntitlementID adds the entitlementId to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) SetEntitlementID(entitlementID string) { + o.EntitlementID = entitlementID +} + +// WithIcn adds the icn to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) WithIcn(icn string) *ServiceBrokerAuthRegistrationParams { + o.SetIcn(icn) + return o +} + +// SetIcn adds the icn to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) SetIcn(icn string) { + o.Icn = icn +} + +// WithPlan adds the plan to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) WithPlan(plan string) *ServiceBrokerAuthRegistrationParams { + o.SetPlan(plan) + return o +} + +// SetPlan adds the plan to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) SetPlan(plan string) { + o.Plan = plan +} + +// WithRedirectURL adds the redirectURL to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) WithRedirectURL(redirectURL *string) *ServiceBrokerAuthRegistrationParams { + o.SetRedirectURL(redirectURL) + return o +} + +// SetRedirectURL adds the redirectUrl to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) SetRedirectURL(redirectURL *string) { + o.RedirectURL = redirectURL +} + +// WithRegions adds the regions to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) WithRegions(regions []string) *ServiceBrokerAuthRegistrationParams { + o.SetRegions(regions) + return o +} + +// SetRegions adds the regions to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) SetRegions(regions []string) { + o.Regions = regions +} + +// WithTenantID adds the tenantID to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) WithTenantID(tenantID string) *ServiceBrokerAuthRegistrationParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the service broker auth registration params +func (o *ServiceBrokerAuthRegistrationParams) SetTenantID(tenantID string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerAuthRegistrationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param entitlement_id + qrEntitlementID := o.EntitlementID + qEntitlementID := qrEntitlementID + if qEntitlementID != "" { + + if err := r.SetQueryParam("entitlement_id", qEntitlementID); err != nil { + return err + } + } + + // query param icn + qrIcn := o.Icn + qIcn := qrIcn + if qIcn != "" { + + if err := r.SetQueryParam("icn", qIcn); err != nil { + return err + } + } + + // query param plan + qrPlan := o.Plan + qPlan := qrPlan + if qPlan != "" { + + if err := r.SetQueryParam("plan", qPlan); err != nil { + return err + } + } + + if o.RedirectURL != nil { + + // query param redirect_url + var qrRedirectURL string + + if o.RedirectURL != nil { + qrRedirectURL = *o.RedirectURL + } + qRedirectURL := qrRedirectURL + if qRedirectURL != "" { + + if err := r.SetQueryParam("redirect_url", qRedirectURL); err != nil { + return err + } + } + } + + if o.Regions != nil { + + // binding items for regions + joinedRegions := o.bindParamRegions(reg) + + // query array param regions + if err := r.SetQueryParam("regions", joinedRegions...); err != nil { + return err + } + } + + // query param tenant_id + qrTenantID := o.TenantID + qTenantID := qrTenantID + if qTenantID != "" { + + if err := r.SetQueryParam("tenant_id", qTenantID); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamServiceBrokerAuthRegistration binds the parameter regions +func (o *ServiceBrokerAuthRegistrationParams) bindParamRegions(formats strfmt.Registry) []string { + regionsIR := o.Regions + + var regionsIC []string + for _, regionsIIR := range regionsIR { // explode []string + + regionsIIV := regionsIIR // string as string + regionsIC = append(regionsIC, regionsIIV) + } + + // items.CollectionFormat: "" + regionsIS := swag.JoinByFormat(regionsIC, "") + + return regionsIS +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_registration_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_registration_responses.go new file mode 100644 index 00000000000..7ccbe10af14 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_registration_responses.go @@ -0,0 +1,143 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerAuthRegistrationReader is a Reader for the ServiceBrokerAuthRegistration structure. +type ServiceBrokerAuthRegistrationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerAuthRegistrationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerAuthRegistrationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewServiceBrokerAuthRegistrationUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewServiceBrokerAuthRegistrationInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerAuthRegistrationOK creates a ServiceBrokerAuthRegistrationOK with default headers values +func NewServiceBrokerAuthRegistrationOK() *ServiceBrokerAuthRegistrationOK { + return &ServiceBrokerAuthRegistrationOK{} +} + +/* ServiceBrokerAuthRegistrationOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerAuthRegistrationOK struct { + Payload *models.AccessToken +} + +func (o *ServiceBrokerAuthRegistrationOK) Error() string { + return fmt.Sprintf("[GET /auth/v1/registration][%d] serviceBrokerAuthRegistrationOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerAuthRegistrationOK) GetPayload() *models.AccessToken { + return o.Payload +} + +func (o *ServiceBrokerAuthRegistrationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AccessToken) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerAuthRegistrationUnauthorized creates a ServiceBrokerAuthRegistrationUnauthorized with default headers values +func NewServiceBrokerAuthRegistrationUnauthorized() *ServiceBrokerAuthRegistrationUnauthorized { + return &ServiceBrokerAuthRegistrationUnauthorized{} +} + +/* ServiceBrokerAuthRegistrationUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type ServiceBrokerAuthRegistrationUnauthorized struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthRegistrationUnauthorized) Error() string { + return fmt.Sprintf("[GET /auth/v1/registration][%d] serviceBrokerAuthRegistrationUnauthorized %+v", 401, o.Payload) +} +func (o *ServiceBrokerAuthRegistrationUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthRegistrationUnauthorized) 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 +} + +// NewServiceBrokerAuthRegistrationInternalServerError creates a ServiceBrokerAuthRegistrationInternalServerError with default headers values +func NewServiceBrokerAuthRegistrationInternalServerError() *ServiceBrokerAuthRegistrationInternalServerError { + return &ServiceBrokerAuthRegistrationInternalServerError{} +} + +/* ServiceBrokerAuthRegistrationInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerAuthRegistrationInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthRegistrationInternalServerError) Error() string { + return fmt.Sprintf("[GET /auth/v1/registration][%d] serviceBrokerAuthRegistrationInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerAuthRegistrationInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthRegistrationInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_token_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_token_post_parameters.go new file mode 100644 index 00000000000..7c77f5ac72a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_token_post_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// 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" +) + +// NewServiceBrokerAuthTokenPostParams creates a new ServiceBrokerAuthTokenPostParams 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 NewServiceBrokerAuthTokenPostParams() *ServiceBrokerAuthTokenPostParams { + return &ServiceBrokerAuthTokenPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerAuthTokenPostParamsWithTimeout creates a new ServiceBrokerAuthTokenPostParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerAuthTokenPostParamsWithTimeout(timeout time.Duration) *ServiceBrokerAuthTokenPostParams { + return &ServiceBrokerAuthTokenPostParams{ + timeout: timeout, + } +} + +// NewServiceBrokerAuthTokenPostParamsWithContext creates a new ServiceBrokerAuthTokenPostParams object +// with the ability to set a context for a request. +func NewServiceBrokerAuthTokenPostParamsWithContext(ctx context.Context) *ServiceBrokerAuthTokenPostParams { + return &ServiceBrokerAuthTokenPostParams{ + Context: ctx, + } +} + +// NewServiceBrokerAuthTokenPostParamsWithHTTPClient creates a new ServiceBrokerAuthTokenPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerAuthTokenPostParamsWithHTTPClient(client *http.Client) *ServiceBrokerAuthTokenPostParams { + return &ServiceBrokerAuthTokenPostParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerAuthTokenPostParams contains all the parameters to send to the API endpoint + for the service broker auth token post operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerAuthTokenPostParams struct { + + /* Body. + + Parameters for requesting a new Token from a Refresh Token + */ + Body *models.TokenRequest + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker auth token post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthTokenPostParams) WithDefaults() *ServiceBrokerAuthTokenPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker auth token post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerAuthTokenPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker auth token post params +func (o *ServiceBrokerAuthTokenPostParams) WithTimeout(timeout time.Duration) *ServiceBrokerAuthTokenPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker auth token post params +func (o *ServiceBrokerAuthTokenPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker auth token post params +func (o *ServiceBrokerAuthTokenPostParams) WithContext(ctx context.Context) *ServiceBrokerAuthTokenPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker auth token post params +func (o *ServiceBrokerAuthTokenPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker auth token post params +func (o *ServiceBrokerAuthTokenPostParams) WithHTTPClient(client *http.Client) *ServiceBrokerAuthTokenPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker auth token post params +func (o *ServiceBrokerAuthTokenPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the service broker auth token post params +func (o *ServiceBrokerAuthTokenPostParams) WithBody(body *models.TokenRequest) *ServiceBrokerAuthTokenPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the service broker auth token post params +func (o *ServiceBrokerAuthTokenPostParams) SetBody(body *models.TokenRequest) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerAuthTokenPostParams) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_token_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_token_post_responses.go new file mode 100644 index 00000000000..72087200a26 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/authentication/service_broker_auth_token_post_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package authentication + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerAuthTokenPostReader is a Reader for the ServiceBrokerAuthTokenPost structure. +type ServiceBrokerAuthTokenPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerAuthTokenPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerAuthTokenPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceBrokerAuthTokenPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewServiceBrokerAuthTokenPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 429: + result := NewServiceBrokerAuthTokenPostTooManyRequests() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewServiceBrokerAuthTokenPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerAuthTokenPostOK creates a ServiceBrokerAuthTokenPostOK with default headers values +func NewServiceBrokerAuthTokenPostOK() *ServiceBrokerAuthTokenPostOK { + return &ServiceBrokerAuthTokenPostOK{} +} + +/* ServiceBrokerAuthTokenPostOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerAuthTokenPostOK struct { + Payload *models.Token +} + +func (o *ServiceBrokerAuthTokenPostOK) Error() string { + return fmt.Sprintf("[POST /auth/v1/token][%d] serviceBrokerAuthTokenPostOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerAuthTokenPostOK) GetPayload() *models.Token { + return o.Payload +} + +func (o *ServiceBrokerAuthTokenPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Token) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerAuthTokenPostBadRequest creates a ServiceBrokerAuthTokenPostBadRequest with default headers values +func NewServiceBrokerAuthTokenPostBadRequest() *ServiceBrokerAuthTokenPostBadRequest { + return &ServiceBrokerAuthTokenPostBadRequest{} +} + +/* ServiceBrokerAuthTokenPostBadRequest describes a response with status code 400, with default header values. + +Authorization pending +*/ +type ServiceBrokerAuthTokenPostBadRequest struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthTokenPostBadRequest) Error() string { + return fmt.Sprintf("[POST /auth/v1/token][%d] serviceBrokerAuthTokenPostBadRequest %+v", 400, o.Payload) +} +func (o *ServiceBrokerAuthTokenPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthTokenPostBadRequest) 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 +} + +// NewServiceBrokerAuthTokenPostForbidden creates a ServiceBrokerAuthTokenPostForbidden with default headers values +func NewServiceBrokerAuthTokenPostForbidden() *ServiceBrokerAuthTokenPostForbidden { + return &ServiceBrokerAuthTokenPostForbidden{} +} + +/* ServiceBrokerAuthTokenPostForbidden describes a response with status code 403, with default header values. + +User refused grant +*/ +type ServiceBrokerAuthTokenPostForbidden struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthTokenPostForbidden) Error() string { + return fmt.Sprintf("[POST /auth/v1/token][%d] serviceBrokerAuthTokenPostForbidden %+v", 403, o.Payload) +} +func (o *ServiceBrokerAuthTokenPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthTokenPostForbidden) 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 +} + +// NewServiceBrokerAuthTokenPostTooManyRequests creates a ServiceBrokerAuthTokenPostTooManyRequests with default headers values +func NewServiceBrokerAuthTokenPostTooManyRequests() *ServiceBrokerAuthTokenPostTooManyRequests { + return &ServiceBrokerAuthTokenPostTooManyRequests{} +} + +/* ServiceBrokerAuthTokenPostTooManyRequests describes a response with status code 429, with default header values. + +Polling too frequently +*/ +type ServiceBrokerAuthTokenPostTooManyRequests struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthTokenPostTooManyRequests) Error() string { + return fmt.Sprintf("[POST /auth/v1/token][%d] serviceBrokerAuthTokenPostTooManyRequests %+v", 429, o.Payload) +} +func (o *ServiceBrokerAuthTokenPostTooManyRequests) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthTokenPostTooManyRequests) 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 +} + +// NewServiceBrokerAuthTokenPostInternalServerError creates a ServiceBrokerAuthTokenPostInternalServerError with default headers values +func NewServiceBrokerAuthTokenPostInternalServerError() *ServiceBrokerAuthTokenPostInternalServerError { + return &ServiceBrokerAuthTokenPostInternalServerError{} +} + +/* ServiceBrokerAuthTokenPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerAuthTokenPostInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerAuthTokenPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /auth/v1/token][%d] serviceBrokerAuthTokenPostInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerAuthTokenPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerAuthTokenPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances/bluemix_service_instance_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances/bluemix_service_instance_get_parameters.go new file mode 100644 index 00000000000..185400b277b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances/bluemix_service_instance_get_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package bluemix_service_instances + +// 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" +) + +// NewBluemixServiceInstanceGetParams creates a new BluemixServiceInstanceGetParams 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 NewBluemixServiceInstanceGetParams() *BluemixServiceInstanceGetParams { + return &BluemixServiceInstanceGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewBluemixServiceInstanceGetParamsWithTimeout creates a new BluemixServiceInstanceGetParams object +// with the ability to set a timeout on a request. +func NewBluemixServiceInstanceGetParamsWithTimeout(timeout time.Duration) *BluemixServiceInstanceGetParams { + return &BluemixServiceInstanceGetParams{ + timeout: timeout, + } +} + +// NewBluemixServiceInstanceGetParamsWithContext creates a new BluemixServiceInstanceGetParams object +// with the ability to set a context for a request. +func NewBluemixServiceInstanceGetParamsWithContext(ctx context.Context) *BluemixServiceInstanceGetParams { + return &BluemixServiceInstanceGetParams{ + Context: ctx, + } +} + +// NewBluemixServiceInstanceGetParamsWithHTTPClient creates a new BluemixServiceInstanceGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewBluemixServiceInstanceGetParamsWithHTTPClient(client *http.Client) *BluemixServiceInstanceGetParams { + return &BluemixServiceInstanceGetParams{ + HTTPClient: client, + } +} + +/* BluemixServiceInstanceGetParams contains all the parameters to send to the API endpoint + for the bluemix service instance get operation. + + Typically these are written to a http.Request. +*/ +type BluemixServiceInstanceGetParams struct { + + /* InstanceID. + + instance id of instance to provision + */ + InstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the bluemix service instance get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BluemixServiceInstanceGetParams) WithDefaults() *BluemixServiceInstanceGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the bluemix service instance get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BluemixServiceInstanceGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the bluemix service instance get params +func (o *BluemixServiceInstanceGetParams) WithTimeout(timeout time.Duration) *BluemixServiceInstanceGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the bluemix service instance get params +func (o *BluemixServiceInstanceGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the bluemix service instance get params +func (o *BluemixServiceInstanceGetParams) WithContext(ctx context.Context) *BluemixServiceInstanceGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the bluemix service instance get params +func (o *BluemixServiceInstanceGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the bluemix service instance get params +func (o *BluemixServiceInstanceGetParams) WithHTTPClient(client *http.Client) *BluemixServiceInstanceGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the bluemix service instance get params +func (o *BluemixServiceInstanceGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithInstanceID adds the instanceID to the bluemix service instance get params +func (o *BluemixServiceInstanceGetParams) WithInstanceID(instanceID string) *BluemixServiceInstanceGetParams { + o.SetInstanceID(instanceID) + return o +} + +// SetInstanceID adds the instanceId to the bluemix service instance get params +func (o *BluemixServiceInstanceGetParams) SetInstanceID(instanceID string) { + o.InstanceID = instanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *BluemixServiceInstanceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param instance_id + if err := r.SetPathParam("instance_id", o.InstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances/bluemix_service_instance_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances/bluemix_service_instance_get_responses.go new file mode 100644 index 00000000000..0fe5b096e30 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances/bluemix_service_instance_get_responses.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package bluemix_service_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// BluemixServiceInstanceGetReader is a Reader for the BluemixServiceInstanceGet structure. +type BluemixServiceInstanceGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *BluemixServiceInstanceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewBluemixServiceInstanceGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewBluemixServiceInstanceGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewBluemixServiceInstanceGetOK creates a BluemixServiceInstanceGetOK with default headers values +func NewBluemixServiceInstanceGetOK() *BluemixServiceInstanceGetOK { + return &BluemixServiceInstanceGetOK{} +} + +/* BluemixServiceInstanceGetOK describes a response with status code 200, with default header values. + +OK +*/ +type BluemixServiceInstanceGetOK struct { + Payload *models.ServiceInstance +} + +func (o *BluemixServiceInstanceGetOK) Error() string { + return fmt.Sprintf("[GET /bluemix_v1/service_instances/{instance_id}][%d] bluemixServiceInstanceGetOK %+v", 200, o.Payload) +} +func (o *BluemixServiceInstanceGetOK) GetPayload() *models.ServiceInstance { + return o.Payload +} + +func (o *BluemixServiceInstanceGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceInstance) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewBluemixServiceInstanceGetBadRequest creates a BluemixServiceInstanceGetBadRequest with default headers values +func NewBluemixServiceInstanceGetBadRequest() *BluemixServiceInstanceGetBadRequest { + return &BluemixServiceInstanceGetBadRequest{} +} + +/* BluemixServiceInstanceGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type BluemixServiceInstanceGetBadRequest struct { + Payload *models.Error +} + +func (o *BluemixServiceInstanceGetBadRequest) Error() string { + return fmt.Sprintf("[GET /bluemix_v1/service_instances/{instance_id}][%d] bluemixServiceInstanceGetBadRequest %+v", 400, o.Payload) +} +func (o *BluemixServiceInstanceGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *BluemixServiceInstanceGetBadRequest) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances/bluemix_service_instance_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances/bluemix_service_instance_put_parameters.go new file mode 100644 index 00000000000..7bc989beb97 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances/bluemix_service_instance_put_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package bluemix_service_instances + +// 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" +) + +// NewBluemixServiceInstancePutParams creates a new BluemixServiceInstancePutParams 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 NewBluemixServiceInstancePutParams() *BluemixServiceInstancePutParams { + return &BluemixServiceInstancePutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewBluemixServiceInstancePutParamsWithTimeout creates a new BluemixServiceInstancePutParams object +// with the ability to set a timeout on a request. +func NewBluemixServiceInstancePutParamsWithTimeout(timeout time.Duration) *BluemixServiceInstancePutParams { + return &BluemixServiceInstancePutParams{ + timeout: timeout, + } +} + +// NewBluemixServiceInstancePutParamsWithContext creates a new BluemixServiceInstancePutParams object +// with the ability to set a context for a request. +func NewBluemixServiceInstancePutParamsWithContext(ctx context.Context) *BluemixServiceInstancePutParams { + return &BluemixServiceInstancePutParams{ + Context: ctx, + } +} + +// NewBluemixServiceInstancePutParamsWithHTTPClient creates a new BluemixServiceInstancePutParams object +// with the ability to set a custom HTTPClient for a request. +func NewBluemixServiceInstancePutParamsWithHTTPClient(client *http.Client) *BluemixServiceInstancePutParams { + return &BluemixServiceInstancePutParams{ + HTTPClient: client, + } +} + +/* BluemixServiceInstancePutParams contains all the parameters to send to the API endpoint + for the bluemix service instance put operation. + + Typically these are written to a http.Request. +*/ +type BluemixServiceInstancePutParams struct { + + /* Body. + + parameters for the requested state of a provisioned service + */ + Body *models.ServiceInstanceRequest + + /* InstanceID. + + instance id of instance to provision + */ + InstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the bluemix service instance put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BluemixServiceInstancePutParams) WithDefaults() *BluemixServiceInstancePutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the bluemix service instance put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BluemixServiceInstancePutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the bluemix service instance put params +func (o *BluemixServiceInstancePutParams) WithTimeout(timeout time.Duration) *BluemixServiceInstancePutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the bluemix service instance put params +func (o *BluemixServiceInstancePutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the bluemix service instance put params +func (o *BluemixServiceInstancePutParams) WithContext(ctx context.Context) *BluemixServiceInstancePutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the bluemix service instance put params +func (o *BluemixServiceInstancePutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the bluemix service instance put params +func (o *BluemixServiceInstancePutParams) WithHTTPClient(client *http.Client) *BluemixServiceInstancePutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the bluemix service instance put params +func (o *BluemixServiceInstancePutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the bluemix service instance put params +func (o *BluemixServiceInstancePutParams) WithBody(body *models.ServiceInstanceRequest) *BluemixServiceInstancePutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the bluemix service instance put params +func (o *BluemixServiceInstancePutParams) SetBody(body *models.ServiceInstanceRequest) { + o.Body = body +} + +// WithInstanceID adds the instanceID to the bluemix service instance put params +func (o *BluemixServiceInstancePutParams) WithInstanceID(instanceID string) *BluemixServiceInstancePutParams { + o.SetInstanceID(instanceID) + return o +} + +// SetInstanceID adds the instanceId to the bluemix service instance put params +func (o *BluemixServiceInstancePutParams) SetInstanceID(instanceID string) { + o.InstanceID = instanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *BluemixServiceInstancePutParams) 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 instance_id + if err := r.SetPathParam("instance_id", o.InstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances/bluemix_service_instance_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances/bluemix_service_instance_put_responses.go new file mode 100644 index 00000000000..d35787f1805 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances/bluemix_service_instance_put_responses.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package bluemix_service_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// BluemixServiceInstancePutReader is a Reader for the BluemixServiceInstancePut structure. +type BluemixServiceInstancePutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *BluemixServiceInstancePutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewBluemixServiceInstancePutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewBluemixServiceInstancePutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewBluemixServiceInstancePutOK creates a BluemixServiceInstancePutOK with default headers values +func NewBluemixServiceInstancePutOK() *BluemixServiceInstancePutOK { + return &BluemixServiceInstancePutOK{} +} + +/* BluemixServiceInstancePutOK describes a response with status code 200, with default header values. + +OK +*/ +type BluemixServiceInstancePutOK struct { + Payload *models.ServiceInstance +} + +func (o *BluemixServiceInstancePutOK) Error() string { + return fmt.Sprintf("[PUT /bluemix_v1/service_instances/{instance_id}][%d] bluemixServiceInstancePutOK %+v", 200, o.Payload) +} +func (o *BluemixServiceInstancePutOK) GetPayload() *models.ServiceInstance { + return o.Payload +} + +func (o *BluemixServiceInstancePutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceInstance) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewBluemixServiceInstancePutBadRequest creates a BluemixServiceInstancePutBadRequest with default headers values +func NewBluemixServiceInstancePutBadRequest() *BluemixServiceInstancePutBadRequest { + return &BluemixServiceInstancePutBadRequest{} +} + +/* BluemixServiceInstancePutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type BluemixServiceInstancePutBadRequest struct { + Payload *models.Error +} + +func (o *BluemixServiceInstancePutBadRequest) Error() string { + return fmt.Sprintf("[PUT /bluemix_v1/service_instances/{instance_id}][%d] bluemixServiceInstancePutBadRequest %+v", 400, o.Payload) +} +func (o *BluemixServiceInstancePutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *BluemixServiceInstancePutBadRequest) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances/bluemix_service_instances_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances/bluemix_service_instances_client.go new file mode 100644 index 00000000000..d0cb0758c4a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances/bluemix_service_instances_client.go @@ -0,0 +1,121 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package bluemix_service_instances + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new bluemix service instances API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for bluemix service instances API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + BluemixServiceInstanceGet(params *BluemixServiceInstanceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BluemixServiceInstanceGetOK, error) + + BluemixServiceInstancePut(params *BluemixServiceInstancePutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BluemixServiceInstancePutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + BluemixServiceInstanceGet gets the current state information associated with the service instance +*/ +func (a *Client) BluemixServiceInstanceGet(params *BluemixServiceInstanceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BluemixServiceInstanceGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewBluemixServiceInstanceGetParams() + } + op := &runtime.ClientOperation{ + ID: "bluemix.serviceInstance.get", + Method: "GET", + PathPattern: "/bluemix_v1/service_instances/{instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &BluemixServiceInstanceGetReader{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.(*BluemixServiceInstanceGetOK) + 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 bluemix.serviceInstance.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + BluemixServiceInstancePut updates disable or enable the state of a provisioned service instance +*/ +func (a *Client) BluemixServiceInstancePut(params *BluemixServiceInstancePutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BluemixServiceInstancePutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewBluemixServiceInstancePutParams() + } + op := &runtime.ClientOperation{ + ID: "bluemix.serviceInstance.put", + Method: "PUT", + PathPattern: "/bluemix_v1/service_instances/{instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &BluemixServiceInstancePutReader{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.(*BluemixServiceInstancePutOK) + 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 bluemix.serviceInstance.put: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/catalog/catalog_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/catalog/catalog_client.go new file mode 100644 index 00000000000..265b7dfec29 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/catalog/catalog_client.go @@ -0,0 +1,80 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package catalog + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new catalog API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for catalog API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + CatalogGet(params *CatalogGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CatalogGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + CatalogGet gets the catalog of services that the service broker offers +*/ +func (a *Client) CatalogGet(params *CatalogGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CatalogGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCatalogGetParams() + } + op := &runtime.ClientOperation{ + ID: "catalog.get", + Method: "GET", + PathPattern: "/v2/catalog", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &CatalogGetReader{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.(*CatalogGetOK) + 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 catalog.get: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/catalog/catalog_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/catalog/catalog_get_parameters.go new file mode 100644 index 00000000000..5f11d0a1ac5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/catalog/catalog_get_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package catalog + +// 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" +) + +// NewCatalogGetParams creates a new CatalogGetParams 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 NewCatalogGetParams() *CatalogGetParams { + return &CatalogGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewCatalogGetParamsWithTimeout creates a new CatalogGetParams object +// with the ability to set a timeout on a request. +func NewCatalogGetParamsWithTimeout(timeout time.Duration) *CatalogGetParams { + return &CatalogGetParams{ + timeout: timeout, + } +} + +// NewCatalogGetParamsWithContext creates a new CatalogGetParams object +// with the ability to set a context for a request. +func NewCatalogGetParamsWithContext(ctx context.Context) *CatalogGetParams { + return &CatalogGetParams{ + Context: ctx, + } +} + +// NewCatalogGetParamsWithHTTPClient creates a new CatalogGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewCatalogGetParamsWithHTTPClient(client *http.Client) *CatalogGetParams { + return &CatalogGetParams{ + HTTPClient: client, + } +} + +/* CatalogGetParams contains all the parameters to send to the API endpoint + for the catalog get operation. + + Typically these are written to a http.Request. +*/ +type CatalogGetParams struct { + + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use + */ + XBrokerAPIVersion string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the catalog get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CatalogGetParams) WithDefaults() *CatalogGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the catalog get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CatalogGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the catalog get params +func (o *CatalogGetParams) WithTimeout(timeout time.Duration) *CatalogGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the catalog get params +func (o *CatalogGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the catalog get params +func (o *CatalogGetParams) WithContext(ctx context.Context) *CatalogGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the catalog get params +func (o *CatalogGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the catalog get params +func (o *CatalogGetParams) WithHTTPClient(client *http.Client) *CatalogGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the catalog get params +func (o *CatalogGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithXBrokerAPIVersion adds the xBrokerAPIVersion to the catalog get params +func (o *CatalogGetParams) WithXBrokerAPIVersion(xBrokerAPIVersion string) *CatalogGetParams { + o.SetXBrokerAPIVersion(xBrokerAPIVersion) + return o +} + +// SetXBrokerAPIVersion adds the xBrokerApiVersion to the catalog get params +func (o *CatalogGetParams) SetXBrokerAPIVersion(xBrokerAPIVersion string) { + o.XBrokerAPIVersion = xBrokerAPIVersion +} + +// WriteToRequest writes these params to a swagger request +func (o *CatalogGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // header param X-Broker-API-Version + if err := r.SetHeaderParam("X-Broker-API-Version", o.XBrokerAPIVersion); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/catalog/catalog_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/catalog/catalog_get_responses.go new file mode 100644 index 00000000000..448d665f886 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/catalog/catalog_get_responses.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package catalog + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// CatalogGetReader is a Reader for the CatalogGet structure. +type CatalogGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CatalogGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCatalogGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewCatalogGetOK creates a CatalogGetOK with default headers values +func NewCatalogGetOK() *CatalogGetOK { + return &CatalogGetOK{} +} + +/* CatalogGetOK describes a response with status code 200, with default header values. + +catalog response +*/ +type CatalogGetOK struct { + Payload *models.Catalog +} + +func (o *CatalogGetOK) Error() string { + return fmt.Sprintf("[GET /v2/catalog][%d] catalogGetOK %+v", 200, o.Payload) +} +func (o *CatalogGetOK) GetPayload() *models.Catalog { + return o.Payload +} + +func (o *CatalogGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Catalog) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/hardware_platforms/hardware_platforms_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/hardware_platforms/hardware_platforms_client.go new file mode 100644 index 00000000000..0cb215ec15d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/hardware_platforms/hardware_platforms_client.go @@ -0,0 +1,79 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hardware_platforms + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new hardware platforms API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for hardware platforms API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceBrokerHardwareplatformsGet(params *ServiceBrokerHardwareplatformsGetParams, opts ...ClientOption) (*ServiceBrokerHardwareplatformsGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + ServiceBrokerHardwareplatformsGet availables hardware statistics and limits +*/ +func (a *Client) ServiceBrokerHardwareplatformsGet(params *ServiceBrokerHardwareplatformsGetParams, opts ...ClientOption) (*ServiceBrokerHardwareplatformsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerHardwareplatformsGetParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.hardwareplatforms.get", + Method: "GET", + PathPattern: "/broker/v1/hardware-platforms", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerHardwareplatformsGetReader{formats: a.formats}, + 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.(*ServiceBrokerHardwareplatformsGetOK) + 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 serviceBroker.hardwareplatforms.get: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/hardware_platforms/service_broker_hardwareplatforms_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/hardware_platforms/service_broker_hardwareplatforms_get_parameters.go new file mode 100644 index 00000000000..53c6aee7321 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/hardware_platforms/service_broker_hardwareplatforms_get_parameters.go @@ -0,0 +1,161 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hardware_platforms + +// 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" +) + +// NewServiceBrokerHardwareplatformsGetParams creates a new ServiceBrokerHardwareplatformsGetParams 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 NewServiceBrokerHardwareplatformsGetParams() *ServiceBrokerHardwareplatformsGetParams { + return &ServiceBrokerHardwareplatformsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerHardwareplatformsGetParamsWithTimeout creates a new ServiceBrokerHardwareplatformsGetParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerHardwareplatformsGetParamsWithTimeout(timeout time.Duration) *ServiceBrokerHardwareplatformsGetParams { + return &ServiceBrokerHardwareplatformsGetParams{ + timeout: timeout, + } +} + +// NewServiceBrokerHardwareplatformsGetParamsWithContext creates a new ServiceBrokerHardwareplatformsGetParams object +// with the ability to set a context for a request. +func NewServiceBrokerHardwareplatformsGetParamsWithContext(ctx context.Context) *ServiceBrokerHardwareplatformsGetParams { + return &ServiceBrokerHardwareplatformsGetParams{ + Context: ctx, + } +} + +// NewServiceBrokerHardwareplatformsGetParamsWithHTTPClient creates a new ServiceBrokerHardwareplatformsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerHardwareplatformsGetParamsWithHTTPClient(client *http.Client) *ServiceBrokerHardwareplatformsGetParams { + return &ServiceBrokerHardwareplatformsGetParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerHardwareplatformsGetParams contains all the parameters to send to the API endpoint + for the service broker hardwareplatforms get operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerHardwareplatformsGetParams struct { + + /* RegionZone. + + The region zone of the cloud instance + */ + RegionZone *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker hardwareplatforms get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerHardwareplatformsGetParams) WithDefaults() *ServiceBrokerHardwareplatformsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker hardwareplatforms get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerHardwareplatformsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker hardwareplatforms get params +func (o *ServiceBrokerHardwareplatformsGetParams) WithTimeout(timeout time.Duration) *ServiceBrokerHardwareplatformsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker hardwareplatforms get params +func (o *ServiceBrokerHardwareplatformsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker hardwareplatforms get params +func (o *ServiceBrokerHardwareplatformsGetParams) WithContext(ctx context.Context) *ServiceBrokerHardwareplatformsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker hardwareplatforms get params +func (o *ServiceBrokerHardwareplatformsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker hardwareplatforms get params +func (o *ServiceBrokerHardwareplatformsGetParams) WithHTTPClient(client *http.Client) *ServiceBrokerHardwareplatformsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker hardwareplatforms get params +func (o *ServiceBrokerHardwareplatformsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRegionZone adds the regionZone to the service broker hardwareplatforms get params +func (o *ServiceBrokerHardwareplatformsGetParams) WithRegionZone(regionZone *string) *ServiceBrokerHardwareplatformsGetParams { + o.SetRegionZone(regionZone) + return o +} + +// SetRegionZone adds the regionZone to the service broker hardwareplatforms get params +func (o *ServiceBrokerHardwareplatformsGetParams) SetRegionZone(regionZone *string) { + o.RegionZone = regionZone +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerHardwareplatformsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.RegionZone != nil { + + // query param regionZone + var qrRegionZone string + + if o.RegionZone != nil { + qrRegionZone = *o.RegionZone + } + qRegionZone := qrRegionZone + if qRegionZone != "" { + + if err := r.SetQueryParam("regionZone", qRegionZone); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/hardware_platforms/service_broker_hardwareplatforms_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/hardware_platforms/service_broker_hardwareplatforms_get_responses.go new file mode 100644 index 00000000000..41e79c37ccc --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/hardware_platforms/service_broker_hardwareplatforms_get_responses.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package hardware_platforms + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerHardwareplatformsGetReader is a Reader for the ServiceBrokerHardwareplatformsGet structure. +type ServiceBrokerHardwareplatformsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerHardwareplatformsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerHardwareplatformsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 500: + result := NewServiceBrokerHardwareplatformsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerHardwareplatformsGetOK creates a ServiceBrokerHardwareplatformsGetOK with default headers values +func NewServiceBrokerHardwareplatformsGetOK() *ServiceBrokerHardwareplatformsGetOK { + return &ServiceBrokerHardwareplatformsGetOK{} +} + +/* ServiceBrokerHardwareplatformsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerHardwareplatformsGetOK struct { + Payload models.HardwarePlatforms +} + +func (o *ServiceBrokerHardwareplatformsGetOK) Error() string { + return fmt.Sprintf("[GET /broker/v1/hardware-platforms][%d] serviceBrokerHardwareplatformsGetOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerHardwareplatformsGetOK) GetPayload() models.HardwarePlatforms { + return o.Payload +} + +func (o *ServiceBrokerHardwareplatformsGetOK) 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 +} + +// NewServiceBrokerHardwareplatformsGetInternalServerError creates a ServiceBrokerHardwareplatformsGetInternalServerError with default headers values +func NewServiceBrokerHardwareplatformsGetInternalServerError() *ServiceBrokerHardwareplatformsGetInternalServerError { + return &ServiceBrokerHardwareplatformsGetInternalServerError{} +} + +/* ServiceBrokerHardwareplatformsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerHardwareplatformsGetInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerHardwareplatformsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /broker/v1/hardware-platforms][%d] serviceBrokerHardwareplatformsGetInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerHardwareplatformsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerHardwareplatformsGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/iaas_service_broker_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/iaas_service_broker_client.go new file mode 100644 index 00000000000..fee72986f6b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/iaas_service_broker_client.go @@ -0,0 +1,200 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package iaas_service_broker + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new iaas service broker API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for iaas service broker API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceBrokerHealth(params *ServiceBrokerHealthParams, opts ...ClientOption) (*ServiceBrokerHealthOK, error) + + ServiceBrokerHealthHead(params *ServiceBrokerHealthHeadParams, opts ...ClientOption) (*ServiceBrokerHealthHeadOK, error) + + ServiceBrokerTestTimeout(params *ServiceBrokerTestTimeoutParams, opts ...ClientOption) (*ServiceBrokerTestTimeoutOK, error) + + ServiceBrokerVersion(params *ServiceBrokerVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerVersionOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + ServiceBrokerHealth gets current server health +*/ +func (a *Client) ServiceBrokerHealth(params *ServiceBrokerHealthParams, opts ...ClientOption) (*ServiceBrokerHealthOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerHealthParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.health", + Method: "GET", + PathPattern: "/broker/v1/health", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerHealthReader{formats: a.formats}, + 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.(*ServiceBrokerHealthOK) + 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 serviceBroker.health: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerHealthHead gets current server health +*/ +func (a *Client) ServiceBrokerHealthHead(params *ServiceBrokerHealthHeadParams, opts ...ClientOption) (*ServiceBrokerHealthHeadOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerHealthHeadParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.health.head", + Method: "HEAD", + PathPattern: "/broker/v1/health", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerHealthHeadReader{formats: a.formats}, + 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.(*ServiceBrokerHealthHeadOK) + 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 serviceBroker.health.head: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerTestTimeout gets current server version +*/ +func (a *Client) ServiceBrokerTestTimeout(params *ServiceBrokerTestTimeoutParams, opts ...ClientOption) (*ServiceBrokerTestTimeoutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerTestTimeoutParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.test.timeout", + Method: "GET", + PathPattern: "/broker/v1/test/timeout", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerTestTimeoutReader{formats: a.formats}, + 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.(*ServiceBrokerTestTimeoutOK) + 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 serviceBroker.test.timeout: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerVersion gets current server version +*/ +func (a *Client) ServiceBrokerVersion(params *ServiceBrokerVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerVersionOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerVersionParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.version", + Method: "GET", + PathPattern: "/broker/v1/version", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerVersionReader{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.(*ServiceBrokerVersionOK) + 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 serviceBroker.version: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_health_head_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_health_head_parameters.go new file mode 100644 index 00000000000..04086695929 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_health_head_parameters.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package iaas_service_broker + +// 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" +) + +// NewServiceBrokerHealthHeadParams creates a new ServiceBrokerHealthHeadParams 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 NewServiceBrokerHealthHeadParams() *ServiceBrokerHealthHeadParams { + return &ServiceBrokerHealthHeadParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerHealthHeadParamsWithTimeout creates a new ServiceBrokerHealthHeadParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerHealthHeadParamsWithTimeout(timeout time.Duration) *ServiceBrokerHealthHeadParams { + return &ServiceBrokerHealthHeadParams{ + timeout: timeout, + } +} + +// NewServiceBrokerHealthHeadParamsWithContext creates a new ServiceBrokerHealthHeadParams object +// with the ability to set a context for a request. +func NewServiceBrokerHealthHeadParamsWithContext(ctx context.Context) *ServiceBrokerHealthHeadParams { + return &ServiceBrokerHealthHeadParams{ + Context: ctx, + } +} + +// NewServiceBrokerHealthHeadParamsWithHTTPClient creates a new ServiceBrokerHealthHeadParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerHealthHeadParamsWithHTTPClient(client *http.Client) *ServiceBrokerHealthHeadParams { + return &ServiceBrokerHealthHeadParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerHealthHeadParams contains all the parameters to send to the API endpoint + for the service broker health head operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerHealthHeadParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker health head params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerHealthHeadParams) WithDefaults() *ServiceBrokerHealthHeadParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker health head params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerHealthHeadParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker health head params +func (o *ServiceBrokerHealthHeadParams) WithTimeout(timeout time.Duration) *ServiceBrokerHealthHeadParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker health head params +func (o *ServiceBrokerHealthHeadParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker health head params +func (o *ServiceBrokerHealthHeadParams) WithContext(ctx context.Context) *ServiceBrokerHealthHeadParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker health head params +func (o *ServiceBrokerHealthHeadParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker health head params +func (o *ServiceBrokerHealthHeadParams) WithHTTPClient(client *http.Client) *ServiceBrokerHealthHeadParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker health head params +func (o *ServiceBrokerHealthHeadParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerHealthHeadParams) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_health_head_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_health_head_responses.go new file mode 100644 index 00000000000..3af3bd54575 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_health_head_responses.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package iaas_service_broker + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerHealthHeadReader is a Reader for the ServiceBrokerHealthHead structure. +type ServiceBrokerHealthHeadReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerHealthHeadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerHealthHeadOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceBrokerHealthHeadBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerHealthHeadOK creates a ServiceBrokerHealthHeadOK with default headers values +func NewServiceBrokerHealthHeadOK() *ServiceBrokerHealthHeadOK { + return &ServiceBrokerHealthHeadOK{} +} + +/* ServiceBrokerHealthHeadOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerHealthHeadOK struct { + Payload *models.Health +} + +func (o *ServiceBrokerHealthHeadOK) Error() string { + return fmt.Sprintf("[HEAD /broker/v1/health][%d] serviceBrokerHealthHeadOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerHealthHeadOK) GetPayload() *models.Health { + return o.Payload +} + +func (o *ServiceBrokerHealthHeadOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Health) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerHealthHeadBadRequest creates a ServiceBrokerHealthHeadBadRequest with default headers values +func NewServiceBrokerHealthHeadBadRequest() *ServiceBrokerHealthHeadBadRequest { + return &ServiceBrokerHealthHeadBadRequest{} +} + +/* ServiceBrokerHealthHeadBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ServiceBrokerHealthHeadBadRequest struct { + Payload *models.Error +} + +func (o *ServiceBrokerHealthHeadBadRequest) Error() string { + return fmt.Sprintf("[HEAD /broker/v1/health][%d] serviceBrokerHealthHeadBadRequest %+v", 400, o.Payload) +} +func (o *ServiceBrokerHealthHeadBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerHealthHeadBadRequest) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_health_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_health_parameters.go new file mode 100644 index 00000000000..bed2ea2fcab --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_health_parameters.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package iaas_service_broker + +// 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" +) + +// NewServiceBrokerHealthParams creates a new ServiceBrokerHealthParams 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 NewServiceBrokerHealthParams() *ServiceBrokerHealthParams { + return &ServiceBrokerHealthParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerHealthParamsWithTimeout creates a new ServiceBrokerHealthParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerHealthParamsWithTimeout(timeout time.Duration) *ServiceBrokerHealthParams { + return &ServiceBrokerHealthParams{ + timeout: timeout, + } +} + +// NewServiceBrokerHealthParamsWithContext creates a new ServiceBrokerHealthParams object +// with the ability to set a context for a request. +func NewServiceBrokerHealthParamsWithContext(ctx context.Context) *ServiceBrokerHealthParams { + return &ServiceBrokerHealthParams{ + Context: ctx, + } +} + +// NewServiceBrokerHealthParamsWithHTTPClient creates a new ServiceBrokerHealthParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerHealthParamsWithHTTPClient(client *http.Client) *ServiceBrokerHealthParams { + return &ServiceBrokerHealthParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerHealthParams contains all the parameters to send to the API endpoint + for the service broker health operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerHealthParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker health params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerHealthParams) WithDefaults() *ServiceBrokerHealthParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker health params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerHealthParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker health params +func (o *ServiceBrokerHealthParams) WithTimeout(timeout time.Duration) *ServiceBrokerHealthParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker health params +func (o *ServiceBrokerHealthParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker health params +func (o *ServiceBrokerHealthParams) WithContext(ctx context.Context) *ServiceBrokerHealthParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker health params +func (o *ServiceBrokerHealthParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker health params +func (o *ServiceBrokerHealthParams) WithHTTPClient(client *http.Client) *ServiceBrokerHealthParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker health params +func (o *ServiceBrokerHealthParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerHealthParams) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_health_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_health_responses.go new file mode 100644 index 00000000000..9ad3dd6b5d9 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_health_responses.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package iaas_service_broker + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerHealthReader is a Reader for the ServiceBrokerHealth structure. +type ServiceBrokerHealthReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerHealthReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerHealthOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceBrokerHealthBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerHealthOK creates a ServiceBrokerHealthOK with default headers values +func NewServiceBrokerHealthOK() *ServiceBrokerHealthOK { + return &ServiceBrokerHealthOK{} +} + +/* ServiceBrokerHealthOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerHealthOK struct { + Payload *models.Health +} + +func (o *ServiceBrokerHealthOK) Error() string { + return fmt.Sprintf("[GET /broker/v1/health][%d] serviceBrokerHealthOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerHealthOK) GetPayload() *models.Health { + return o.Payload +} + +func (o *ServiceBrokerHealthOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Health) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerHealthBadRequest creates a ServiceBrokerHealthBadRequest with default headers values +func NewServiceBrokerHealthBadRequest() *ServiceBrokerHealthBadRequest { + return &ServiceBrokerHealthBadRequest{} +} + +/* ServiceBrokerHealthBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ServiceBrokerHealthBadRequest struct { + Payload *models.Error +} + +func (o *ServiceBrokerHealthBadRequest) Error() string { + return fmt.Sprintf("[GET /broker/v1/health][%d] serviceBrokerHealthBadRequest %+v", 400, o.Payload) +} +func (o *ServiceBrokerHealthBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerHealthBadRequest) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_test_timeout_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_test_timeout_parameters.go new file mode 100644 index 00000000000..aec4dc2a330 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_test_timeout_parameters.go @@ -0,0 +1,155 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package iaas_service_broker + +// 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/go-openapi/swag" +) + +// NewServiceBrokerTestTimeoutParams creates a new ServiceBrokerTestTimeoutParams 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 NewServiceBrokerTestTimeoutParams() *ServiceBrokerTestTimeoutParams { + return &ServiceBrokerTestTimeoutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerTestTimeoutParamsWithTimeout creates a new ServiceBrokerTestTimeoutParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerTestTimeoutParamsWithTimeout(timeout time.Duration) *ServiceBrokerTestTimeoutParams { + return &ServiceBrokerTestTimeoutParams{ + timeout: timeout, + } +} + +// NewServiceBrokerTestTimeoutParamsWithContext creates a new ServiceBrokerTestTimeoutParams object +// with the ability to set a context for a request. +func NewServiceBrokerTestTimeoutParamsWithContext(ctx context.Context) *ServiceBrokerTestTimeoutParams { + return &ServiceBrokerTestTimeoutParams{ + Context: ctx, + } +} + +// NewServiceBrokerTestTimeoutParamsWithHTTPClient creates a new ServiceBrokerTestTimeoutParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerTestTimeoutParamsWithHTTPClient(client *http.Client) *ServiceBrokerTestTimeoutParams { + return &ServiceBrokerTestTimeoutParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerTestTimeoutParams contains all the parameters to send to the API endpoint + for the service broker test timeout operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerTestTimeoutParams struct { + + /* T. + + seconds + */ + T int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker test timeout params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerTestTimeoutParams) WithDefaults() *ServiceBrokerTestTimeoutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker test timeout params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerTestTimeoutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker test timeout params +func (o *ServiceBrokerTestTimeoutParams) WithTimeout(timeout time.Duration) *ServiceBrokerTestTimeoutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker test timeout params +func (o *ServiceBrokerTestTimeoutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker test timeout params +func (o *ServiceBrokerTestTimeoutParams) WithContext(ctx context.Context) *ServiceBrokerTestTimeoutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker test timeout params +func (o *ServiceBrokerTestTimeoutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker test timeout params +func (o *ServiceBrokerTestTimeoutParams) WithHTTPClient(client *http.Client) *ServiceBrokerTestTimeoutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker test timeout params +func (o *ServiceBrokerTestTimeoutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithT adds the t to the service broker test timeout params +func (o *ServiceBrokerTestTimeoutParams) WithT(t int64) *ServiceBrokerTestTimeoutParams { + o.SetT(t) + return o +} + +// SetT adds the t to the service broker test timeout params +func (o *ServiceBrokerTestTimeoutParams) SetT(t int64) { + o.T = t +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerTestTimeoutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param t + qrT := o.T + qT := swag.FormatInt64(qrT) + if qT != "" { + + if err := r.SetQueryParam("t", qT); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_test_timeout_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_test_timeout_responses.go new file mode 100644 index 00000000000..4aee22ea56b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_test_timeout_responses.go @@ -0,0 +1,65 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package iaas_service_broker + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerTestTimeoutReader is a Reader for the ServiceBrokerTestTimeout structure. +type ServiceBrokerTestTimeoutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerTestTimeoutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerTestTimeoutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerTestTimeoutOK creates a ServiceBrokerTestTimeoutOK with default headers values +func NewServiceBrokerTestTimeoutOK() *ServiceBrokerTestTimeoutOK { + return &ServiceBrokerTestTimeoutOK{} +} + +/* ServiceBrokerTestTimeoutOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerTestTimeoutOK struct { + Payload models.Object +} + +func (o *ServiceBrokerTestTimeoutOK) Error() string { + return fmt.Sprintf("[GET /broker/v1/test/timeout][%d] serviceBrokerTestTimeoutOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerTestTimeoutOK) GetPayload() models.Object { + return o.Payload +} + +func (o *ServiceBrokerTestTimeoutOK) 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 +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_version_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_version_parameters.go new file mode 100644 index 00000000000..6afbe895cfe --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_version_parameters.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package iaas_service_broker + +// 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" +) + +// NewServiceBrokerVersionParams creates a new ServiceBrokerVersionParams 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 NewServiceBrokerVersionParams() *ServiceBrokerVersionParams { + return &ServiceBrokerVersionParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerVersionParamsWithTimeout creates a new ServiceBrokerVersionParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerVersionParamsWithTimeout(timeout time.Duration) *ServiceBrokerVersionParams { + return &ServiceBrokerVersionParams{ + timeout: timeout, + } +} + +// NewServiceBrokerVersionParamsWithContext creates a new ServiceBrokerVersionParams object +// with the ability to set a context for a request. +func NewServiceBrokerVersionParamsWithContext(ctx context.Context) *ServiceBrokerVersionParams { + return &ServiceBrokerVersionParams{ + Context: ctx, + } +} + +// NewServiceBrokerVersionParamsWithHTTPClient creates a new ServiceBrokerVersionParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerVersionParamsWithHTTPClient(client *http.Client) *ServiceBrokerVersionParams { + return &ServiceBrokerVersionParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerVersionParams contains all the parameters to send to the API endpoint + for the service broker version operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerVersionParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker version params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerVersionParams) WithDefaults() *ServiceBrokerVersionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker version params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerVersionParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker version params +func (o *ServiceBrokerVersionParams) WithTimeout(timeout time.Duration) *ServiceBrokerVersionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker version params +func (o *ServiceBrokerVersionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker version params +func (o *ServiceBrokerVersionParams) WithContext(ctx context.Context) *ServiceBrokerVersionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker version params +func (o *ServiceBrokerVersionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker version params +func (o *ServiceBrokerVersionParams) WithHTTPClient(client *http.Client) *ServiceBrokerVersionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker version params +func (o *ServiceBrokerVersionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerVersionParams) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_version_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_version_responses.go new file mode 100644 index 00000000000..85c8fc176c3 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker/service_broker_version_responses.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package iaas_service_broker + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerVersionReader is a Reader for the ServiceBrokerVersion structure. +type ServiceBrokerVersionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerVersionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerVersionOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceBrokerVersionBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerVersionOK creates a ServiceBrokerVersionOK with default headers values +func NewServiceBrokerVersionOK() *ServiceBrokerVersionOK { + return &ServiceBrokerVersionOK{} +} + +/* ServiceBrokerVersionOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerVersionOK struct { + Payload *models.Version +} + +func (o *ServiceBrokerVersionOK) Error() string { + return fmt.Sprintf("[GET /broker/v1/version][%d] serviceBrokerVersionOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerVersionOK) GetPayload() *models.Version { + return o.Payload +} + +func (o *ServiceBrokerVersionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Version) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerVersionBadRequest creates a ServiceBrokerVersionBadRequest with default headers values +func NewServiceBrokerVersionBadRequest() *ServiceBrokerVersionBadRequest { + return &ServiceBrokerVersionBadRequest{} +} + +/* ServiceBrokerVersionBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ServiceBrokerVersionBadRequest struct { + Payload *models.Error +} + +func (o *ServiceBrokerVersionBadRequest) Error() string { + return fmt.Sprintf("[GET /broker/v1/version][%d] serviceBrokerVersionBadRequest %+v", 400, o.Payload) +} +func (o *ServiceBrokerVersionBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerVersionBadRequest) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_storage_regions_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_storage_regions_client.go new file mode 100644 index 00000000000..eb44b6d75aa --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_storage_regions_client.go @@ -0,0 +1,244 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package internal_storage_regions + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new internal storage regions API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for internal storage regions API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + InternalV1StorageRegionsStoragePoolsGet(params *InternalV1StorageRegionsStoragePoolsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsStoragePoolsGetOK, error) + + InternalV1StorageRegionsStoragePoolsGetall(params *InternalV1StorageRegionsStoragePoolsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsStoragePoolsGetallOK, error) + + InternalV1StorageRegionsStoragePoolsPut(params *InternalV1StorageRegionsStoragePoolsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsStoragePoolsPutOK, error) + + InternalV1StorageRegionsThresholdsGet(params *InternalV1StorageRegionsThresholdsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsThresholdsGetOK, error) + + InternalV1StorageRegionsThresholdsPut(params *InternalV1StorageRegionsThresholdsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsThresholdsPutAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + InternalV1StorageRegionsStoragePoolsGet gets the settings for given pool name +*/ +func (a *Client) InternalV1StorageRegionsStoragePoolsGet(params *InternalV1StorageRegionsStoragePoolsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsStoragePoolsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInternalV1StorageRegionsStoragePoolsGetParams() + } + op := &runtime.ClientOperation{ + ID: "internal.v1.storage.regions.storage-pools.get", + Method: "GET", + PathPattern: "/internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &InternalV1StorageRegionsStoragePoolsGetReader{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.(*InternalV1StorageRegionsStoragePoolsGetOK) + 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 internal.v1.storage.regions.storage-pools.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + InternalV1StorageRegionsStoragePoolsGetall gets the current storage pools settings for a region zone +*/ +func (a *Client) InternalV1StorageRegionsStoragePoolsGetall(params *InternalV1StorageRegionsStoragePoolsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsStoragePoolsGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInternalV1StorageRegionsStoragePoolsGetallParams() + } + op := &runtime.ClientOperation{ + ID: "internal.v1.storage.regions.storage-pools.getall", + Method: "GET", + PathPattern: "/internal/v1/storage/regions/{region_zone_id}/storage-pools", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &InternalV1StorageRegionsStoragePoolsGetallReader{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.(*InternalV1StorageRegionsStoragePoolsGetallOK) + 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 internal.v1.storage.regions.storage-pools.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + InternalV1StorageRegionsStoragePoolsPut updates the settings for given pool name +*/ +func (a *Client) InternalV1StorageRegionsStoragePoolsPut(params *InternalV1StorageRegionsStoragePoolsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsStoragePoolsPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInternalV1StorageRegionsStoragePoolsPutParams() + } + op := &runtime.ClientOperation{ + ID: "internal.v1.storage.regions.storage-pools.put", + Method: "PUT", + PathPattern: "/internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &InternalV1StorageRegionsStoragePoolsPutReader{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.(*InternalV1StorageRegionsStoragePoolsPutOK) + 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 internal.v1.storage.regions.storage-pools.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + InternalV1StorageRegionsThresholdsGet gets the current default threshold settings for a region zone +*/ +func (a *Client) InternalV1StorageRegionsThresholdsGet(params *InternalV1StorageRegionsThresholdsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsThresholdsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInternalV1StorageRegionsThresholdsGetParams() + } + op := &runtime.ClientOperation{ + ID: "internal.v1.storage.regions.thresholds.get", + Method: "GET", + PathPattern: "/internal/v1/storage/regions/{region_zone_id}/thresholds", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &InternalV1StorageRegionsThresholdsGetReader{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.(*InternalV1StorageRegionsThresholdsGetOK) + 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 internal.v1.storage.regions.thresholds.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + InternalV1StorageRegionsThresholdsPut updates a default threshold setting for a region zone +*/ +func (a *Client) InternalV1StorageRegionsThresholdsPut(params *InternalV1StorageRegionsThresholdsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InternalV1StorageRegionsThresholdsPutAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInternalV1StorageRegionsThresholdsPutParams() + } + op := &runtime.ClientOperation{ + ID: "internal.v1.storage.regions.thresholds.put", + Method: "PUT", + PathPattern: "/internal/v1/storage/regions/{region_zone_id}/thresholds", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &InternalV1StorageRegionsThresholdsPutReader{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.(*InternalV1StorageRegionsThresholdsPutAccepted) + 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 internal.v1.storage.regions.thresholds.put: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_get_parameters.go new file mode 100644 index 00000000000..7f5c37e4b22 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package internal_storage_regions + +// 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" +) + +// NewInternalV1StorageRegionsStoragePoolsGetParams creates a new InternalV1StorageRegionsStoragePoolsGetParams 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 NewInternalV1StorageRegionsStoragePoolsGetParams() *InternalV1StorageRegionsStoragePoolsGetParams { + return &InternalV1StorageRegionsStoragePoolsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewInternalV1StorageRegionsStoragePoolsGetParamsWithTimeout creates a new InternalV1StorageRegionsStoragePoolsGetParams object +// with the ability to set a timeout on a request. +func NewInternalV1StorageRegionsStoragePoolsGetParamsWithTimeout(timeout time.Duration) *InternalV1StorageRegionsStoragePoolsGetParams { + return &InternalV1StorageRegionsStoragePoolsGetParams{ + timeout: timeout, + } +} + +// NewInternalV1StorageRegionsStoragePoolsGetParamsWithContext creates a new InternalV1StorageRegionsStoragePoolsGetParams object +// with the ability to set a context for a request. +func NewInternalV1StorageRegionsStoragePoolsGetParamsWithContext(ctx context.Context) *InternalV1StorageRegionsStoragePoolsGetParams { + return &InternalV1StorageRegionsStoragePoolsGetParams{ + Context: ctx, + } +} + +// NewInternalV1StorageRegionsStoragePoolsGetParamsWithHTTPClient creates a new InternalV1StorageRegionsStoragePoolsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewInternalV1StorageRegionsStoragePoolsGetParamsWithHTTPClient(client *http.Client) *InternalV1StorageRegionsStoragePoolsGetParams { + return &InternalV1StorageRegionsStoragePoolsGetParams{ + HTTPClient: client, + } +} + +/* InternalV1StorageRegionsStoragePoolsGetParams contains all the parameters to send to the API endpoint + for the internal v1 storage regions storage pools get operation. + + Typically these are written to a http.Request. +*/ +type InternalV1StorageRegionsStoragePoolsGetParams struct { + + /* RegionZoneID. + + ID of a Power Cloud Region Zone + */ + RegionZoneID string + + /* StoragePoolName. + + Storage pool name + */ + StoragePoolName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the internal v1 storage regions storage pools get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsStoragePoolsGetParams) WithDefaults() *InternalV1StorageRegionsStoragePoolsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the internal v1 storage regions storage pools get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsStoragePoolsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the internal v1 storage regions storage pools get params +func (o *InternalV1StorageRegionsStoragePoolsGetParams) WithTimeout(timeout time.Duration) *InternalV1StorageRegionsStoragePoolsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the internal v1 storage regions storage pools get params +func (o *InternalV1StorageRegionsStoragePoolsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the internal v1 storage regions storage pools get params +func (o *InternalV1StorageRegionsStoragePoolsGetParams) WithContext(ctx context.Context) *InternalV1StorageRegionsStoragePoolsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the internal v1 storage regions storage pools get params +func (o *InternalV1StorageRegionsStoragePoolsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the internal v1 storage regions storage pools get params +func (o *InternalV1StorageRegionsStoragePoolsGetParams) WithHTTPClient(client *http.Client) *InternalV1StorageRegionsStoragePoolsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the internal v1 storage regions storage pools get params +func (o *InternalV1StorageRegionsStoragePoolsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRegionZoneID adds the regionZoneID to the internal v1 storage regions storage pools get params +func (o *InternalV1StorageRegionsStoragePoolsGetParams) WithRegionZoneID(regionZoneID string) *InternalV1StorageRegionsStoragePoolsGetParams { + o.SetRegionZoneID(regionZoneID) + return o +} + +// SetRegionZoneID adds the regionZoneId to the internal v1 storage regions storage pools get params +func (o *InternalV1StorageRegionsStoragePoolsGetParams) SetRegionZoneID(regionZoneID string) { + o.RegionZoneID = regionZoneID +} + +// WithStoragePoolName adds the storagePoolName to the internal v1 storage regions storage pools get params +func (o *InternalV1StorageRegionsStoragePoolsGetParams) WithStoragePoolName(storagePoolName string) *InternalV1StorageRegionsStoragePoolsGetParams { + o.SetStoragePoolName(storagePoolName) + return o +} + +// SetStoragePoolName adds the storagePoolName to the internal v1 storage regions storage pools get params +func (o *InternalV1StorageRegionsStoragePoolsGetParams) SetStoragePoolName(storagePoolName string) { + o.StoragePoolName = storagePoolName +} + +// WriteToRequest writes these params to a swagger request +func (o *InternalV1StorageRegionsStoragePoolsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param region_zone_id + if err := r.SetPathParam("region_zone_id", o.RegionZoneID); err != nil { + return err + } + + // path param storage_pool_name + if err := r.SetPathParam("storage_pool_name", o.StoragePoolName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_get_responses.go new file mode 100644 index 00000000000..4cb42f88364 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_get_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package internal_storage_regions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// InternalV1StorageRegionsStoragePoolsGetReader is a Reader for the InternalV1StorageRegionsStoragePoolsGet structure. +type InternalV1StorageRegionsStoragePoolsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InternalV1StorageRegionsStoragePoolsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInternalV1StorageRegionsStoragePoolsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewInternalV1StorageRegionsStoragePoolsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewInternalV1StorageRegionsStoragePoolsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewInternalV1StorageRegionsStoragePoolsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewInternalV1StorageRegionsStoragePoolsGetOK creates a InternalV1StorageRegionsStoragePoolsGetOK with default headers values +func NewInternalV1StorageRegionsStoragePoolsGetOK() *InternalV1StorageRegionsStoragePoolsGetOK { + return &InternalV1StorageRegionsStoragePoolsGetOK{} +} + +/* InternalV1StorageRegionsStoragePoolsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type InternalV1StorageRegionsStoragePoolsGetOK struct { + Payload models.StoragePools +} + +func (o *InternalV1StorageRegionsStoragePoolsGetOK) Error() string { + return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsGetOK %+v", 200, o.Payload) +} +func (o *InternalV1StorageRegionsStoragePoolsGetOK) GetPayload() models.StoragePools { + return o.Payload +} + +func (o *InternalV1StorageRegionsStoragePoolsGetOK) 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 +} + +// NewInternalV1StorageRegionsStoragePoolsGetUnauthorized creates a InternalV1StorageRegionsStoragePoolsGetUnauthorized with default headers values +func NewInternalV1StorageRegionsStoragePoolsGetUnauthorized() *InternalV1StorageRegionsStoragePoolsGetUnauthorized { + return &InternalV1StorageRegionsStoragePoolsGetUnauthorized{} +} + +/* InternalV1StorageRegionsStoragePoolsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type InternalV1StorageRegionsStoragePoolsGetUnauthorized struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsStoragePoolsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsGetUnauthorized %+v", 401, o.Payload) +} +func (o *InternalV1StorageRegionsStoragePoolsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsStoragePoolsGetUnauthorized) 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 +} + +// NewInternalV1StorageRegionsStoragePoolsGetNotFound creates a InternalV1StorageRegionsStoragePoolsGetNotFound with default headers values +func NewInternalV1StorageRegionsStoragePoolsGetNotFound() *InternalV1StorageRegionsStoragePoolsGetNotFound { + return &InternalV1StorageRegionsStoragePoolsGetNotFound{} +} + +/* InternalV1StorageRegionsStoragePoolsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type InternalV1StorageRegionsStoragePoolsGetNotFound struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsStoragePoolsGetNotFound) Error() string { + return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsGetNotFound %+v", 404, o.Payload) +} +func (o *InternalV1StorageRegionsStoragePoolsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsStoragePoolsGetNotFound) 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 +} + +// NewInternalV1StorageRegionsStoragePoolsGetInternalServerError creates a InternalV1StorageRegionsStoragePoolsGetInternalServerError with default headers values +func NewInternalV1StorageRegionsStoragePoolsGetInternalServerError() *InternalV1StorageRegionsStoragePoolsGetInternalServerError { + return &InternalV1StorageRegionsStoragePoolsGetInternalServerError{} +} + +/* InternalV1StorageRegionsStoragePoolsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type InternalV1StorageRegionsStoragePoolsGetInternalServerError struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsStoragePoolsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsGetInternalServerError %+v", 500, o.Payload) +} +func (o *InternalV1StorageRegionsStoragePoolsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsStoragePoolsGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_getall_parameters.go new file mode 100644 index 00000000000..cda5153c50b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_getall_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package internal_storage_regions + +// 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" +) + +// NewInternalV1StorageRegionsStoragePoolsGetallParams creates a new InternalV1StorageRegionsStoragePoolsGetallParams 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 NewInternalV1StorageRegionsStoragePoolsGetallParams() *InternalV1StorageRegionsStoragePoolsGetallParams { + return &InternalV1StorageRegionsStoragePoolsGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewInternalV1StorageRegionsStoragePoolsGetallParamsWithTimeout creates a new InternalV1StorageRegionsStoragePoolsGetallParams object +// with the ability to set a timeout on a request. +func NewInternalV1StorageRegionsStoragePoolsGetallParamsWithTimeout(timeout time.Duration) *InternalV1StorageRegionsStoragePoolsGetallParams { + return &InternalV1StorageRegionsStoragePoolsGetallParams{ + timeout: timeout, + } +} + +// NewInternalV1StorageRegionsStoragePoolsGetallParamsWithContext creates a new InternalV1StorageRegionsStoragePoolsGetallParams object +// with the ability to set a context for a request. +func NewInternalV1StorageRegionsStoragePoolsGetallParamsWithContext(ctx context.Context) *InternalV1StorageRegionsStoragePoolsGetallParams { + return &InternalV1StorageRegionsStoragePoolsGetallParams{ + Context: ctx, + } +} + +// NewInternalV1StorageRegionsStoragePoolsGetallParamsWithHTTPClient creates a new InternalV1StorageRegionsStoragePoolsGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewInternalV1StorageRegionsStoragePoolsGetallParamsWithHTTPClient(client *http.Client) *InternalV1StorageRegionsStoragePoolsGetallParams { + return &InternalV1StorageRegionsStoragePoolsGetallParams{ + HTTPClient: client, + } +} + +/* InternalV1StorageRegionsStoragePoolsGetallParams contains all the parameters to send to the API endpoint + for the internal v1 storage regions storage pools getall operation. + + Typically these are written to a http.Request. +*/ +type InternalV1StorageRegionsStoragePoolsGetallParams struct { + + /* RegionZoneID. + + ID of a Power Cloud Region Zone + */ + RegionZoneID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the internal v1 storage regions storage pools getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsStoragePoolsGetallParams) WithDefaults() *InternalV1StorageRegionsStoragePoolsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the internal v1 storage regions storage pools getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsStoragePoolsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the internal v1 storage regions storage pools getall params +func (o *InternalV1StorageRegionsStoragePoolsGetallParams) WithTimeout(timeout time.Duration) *InternalV1StorageRegionsStoragePoolsGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the internal v1 storage regions storage pools getall params +func (o *InternalV1StorageRegionsStoragePoolsGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the internal v1 storage regions storage pools getall params +func (o *InternalV1StorageRegionsStoragePoolsGetallParams) WithContext(ctx context.Context) *InternalV1StorageRegionsStoragePoolsGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the internal v1 storage regions storage pools getall params +func (o *InternalV1StorageRegionsStoragePoolsGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the internal v1 storage regions storage pools getall params +func (o *InternalV1StorageRegionsStoragePoolsGetallParams) WithHTTPClient(client *http.Client) *InternalV1StorageRegionsStoragePoolsGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the internal v1 storage regions storage pools getall params +func (o *InternalV1StorageRegionsStoragePoolsGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRegionZoneID adds the regionZoneID to the internal v1 storage regions storage pools getall params +func (o *InternalV1StorageRegionsStoragePoolsGetallParams) WithRegionZoneID(regionZoneID string) *InternalV1StorageRegionsStoragePoolsGetallParams { + o.SetRegionZoneID(regionZoneID) + return o +} + +// SetRegionZoneID adds the regionZoneId to the internal v1 storage regions storage pools getall params +func (o *InternalV1StorageRegionsStoragePoolsGetallParams) SetRegionZoneID(regionZoneID string) { + o.RegionZoneID = regionZoneID +} + +// WriteToRequest writes these params to a swagger request +func (o *InternalV1StorageRegionsStoragePoolsGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param region_zone_id + if err := r.SetPathParam("region_zone_id", o.RegionZoneID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_getall_responses.go new file mode 100644 index 00000000000..1c654e2d53a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_getall_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package internal_storage_regions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// InternalV1StorageRegionsStoragePoolsGetallReader is a Reader for the InternalV1StorageRegionsStoragePoolsGetall structure. +type InternalV1StorageRegionsStoragePoolsGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InternalV1StorageRegionsStoragePoolsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInternalV1StorageRegionsStoragePoolsGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewInternalV1StorageRegionsStoragePoolsGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewInternalV1StorageRegionsStoragePoolsGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewInternalV1StorageRegionsStoragePoolsGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewInternalV1StorageRegionsStoragePoolsGetallOK creates a InternalV1StorageRegionsStoragePoolsGetallOK with default headers values +func NewInternalV1StorageRegionsStoragePoolsGetallOK() *InternalV1StorageRegionsStoragePoolsGetallOK { + return &InternalV1StorageRegionsStoragePoolsGetallOK{} +} + +/* InternalV1StorageRegionsStoragePoolsGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type InternalV1StorageRegionsStoragePoolsGetallOK struct { + Payload models.StoragePools +} + +func (o *InternalV1StorageRegionsStoragePoolsGetallOK) Error() string { + return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools][%d] internalV1StorageRegionsStoragePoolsGetallOK %+v", 200, o.Payload) +} +func (o *InternalV1StorageRegionsStoragePoolsGetallOK) GetPayload() models.StoragePools { + return o.Payload +} + +func (o *InternalV1StorageRegionsStoragePoolsGetallOK) 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 +} + +// NewInternalV1StorageRegionsStoragePoolsGetallUnauthorized creates a InternalV1StorageRegionsStoragePoolsGetallUnauthorized with default headers values +func NewInternalV1StorageRegionsStoragePoolsGetallUnauthorized() *InternalV1StorageRegionsStoragePoolsGetallUnauthorized { + return &InternalV1StorageRegionsStoragePoolsGetallUnauthorized{} +} + +/* InternalV1StorageRegionsStoragePoolsGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type InternalV1StorageRegionsStoragePoolsGetallUnauthorized struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsStoragePoolsGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools][%d] internalV1StorageRegionsStoragePoolsGetallUnauthorized %+v", 401, o.Payload) +} +func (o *InternalV1StorageRegionsStoragePoolsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsStoragePoolsGetallUnauthorized) 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 +} + +// NewInternalV1StorageRegionsStoragePoolsGetallNotFound creates a InternalV1StorageRegionsStoragePoolsGetallNotFound with default headers values +func NewInternalV1StorageRegionsStoragePoolsGetallNotFound() *InternalV1StorageRegionsStoragePoolsGetallNotFound { + return &InternalV1StorageRegionsStoragePoolsGetallNotFound{} +} + +/* InternalV1StorageRegionsStoragePoolsGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type InternalV1StorageRegionsStoragePoolsGetallNotFound struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsStoragePoolsGetallNotFound) Error() string { + return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools][%d] internalV1StorageRegionsStoragePoolsGetallNotFound %+v", 404, o.Payload) +} +func (o *InternalV1StorageRegionsStoragePoolsGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsStoragePoolsGetallNotFound) 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 +} + +// NewInternalV1StorageRegionsStoragePoolsGetallInternalServerError creates a InternalV1StorageRegionsStoragePoolsGetallInternalServerError with default headers values +func NewInternalV1StorageRegionsStoragePoolsGetallInternalServerError() *InternalV1StorageRegionsStoragePoolsGetallInternalServerError { + return &InternalV1StorageRegionsStoragePoolsGetallInternalServerError{} +} + +/* InternalV1StorageRegionsStoragePoolsGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type InternalV1StorageRegionsStoragePoolsGetallInternalServerError struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsStoragePoolsGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/storage-pools][%d] internalV1StorageRegionsStoragePoolsGetallInternalServerError %+v", 500, o.Payload) +} +func (o *InternalV1StorageRegionsStoragePoolsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsStoragePoolsGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_put_parameters.go new file mode 100644 index 00000000000..624f961b4c7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_put_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package internal_storage_regions + +// 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" +) + +// NewInternalV1StorageRegionsStoragePoolsPutParams creates a new InternalV1StorageRegionsStoragePoolsPutParams 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 NewInternalV1StorageRegionsStoragePoolsPutParams() *InternalV1StorageRegionsStoragePoolsPutParams { + return &InternalV1StorageRegionsStoragePoolsPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewInternalV1StorageRegionsStoragePoolsPutParamsWithTimeout creates a new InternalV1StorageRegionsStoragePoolsPutParams object +// with the ability to set a timeout on a request. +func NewInternalV1StorageRegionsStoragePoolsPutParamsWithTimeout(timeout time.Duration) *InternalV1StorageRegionsStoragePoolsPutParams { + return &InternalV1StorageRegionsStoragePoolsPutParams{ + timeout: timeout, + } +} + +// NewInternalV1StorageRegionsStoragePoolsPutParamsWithContext creates a new InternalV1StorageRegionsStoragePoolsPutParams object +// with the ability to set a context for a request. +func NewInternalV1StorageRegionsStoragePoolsPutParamsWithContext(ctx context.Context) *InternalV1StorageRegionsStoragePoolsPutParams { + return &InternalV1StorageRegionsStoragePoolsPutParams{ + Context: ctx, + } +} + +// NewInternalV1StorageRegionsStoragePoolsPutParamsWithHTTPClient creates a new InternalV1StorageRegionsStoragePoolsPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewInternalV1StorageRegionsStoragePoolsPutParamsWithHTTPClient(client *http.Client) *InternalV1StorageRegionsStoragePoolsPutParams { + return &InternalV1StorageRegionsStoragePoolsPutParams{ + HTTPClient: client, + } +} + +/* InternalV1StorageRegionsStoragePoolsPutParams contains all the parameters to send to the API endpoint + for the internal v1 storage regions storage pools put operation. + + Typically these are written to a http.Request. +*/ +type InternalV1StorageRegionsStoragePoolsPutParams struct { + + /* Body. + + Parameters for updating a storage pool + */ + Body *models.UpdateStoragePool + + /* RegionZoneID. + + ID of a Power Cloud Region Zone + */ + RegionZoneID string + + /* StoragePoolName. + + Storage pool name + */ + StoragePoolName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the internal v1 storage regions storage pools put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsStoragePoolsPutParams) WithDefaults() *InternalV1StorageRegionsStoragePoolsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the internal v1 storage regions storage pools put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsStoragePoolsPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the internal v1 storage regions storage pools put params +func (o *InternalV1StorageRegionsStoragePoolsPutParams) WithTimeout(timeout time.Duration) *InternalV1StorageRegionsStoragePoolsPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the internal v1 storage regions storage pools put params +func (o *InternalV1StorageRegionsStoragePoolsPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the internal v1 storage regions storage pools put params +func (o *InternalV1StorageRegionsStoragePoolsPutParams) WithContext(ctx context.Context) *InternalV1StorageRegionsStoragePoolsPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the internal v1 storage regions storage pools put params +func (o *InternalV1StorageRegionsStoragePoolsPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the internal v1 storage regions storage pools put params +func (o *InternalV1StorageRegionsStoragePoolsPutParams) WithHTTPClient(client *http.Client) *InternalV1StorageRegionsStoragePoolsPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the internal v1 storage regions storage pools put params +func (o *InternalV1StorageRegionsStoragePoolsPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the internal v1 storage regions storage pools put params +func (o *InternalV1StorageRegionsStoragePoolsPutParams) WithBody(body *models.UpdateStoragePool) *InternalV1StorageRegionsStoragePoolsPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the internal v1 storage regions storage pools put params +func (o *InternalV1StorageRegionsStoragePoolsPutParams) SetBody(body *models.UpdateStoragePool) { + o.Body = body +} + +// WithRegionZoneID adds the regionZoneID to the internal v1 storage regions storage pools put params +func (o *InternalV1StorageRegionsStoragePoolsPutParams) WithRegionZoneID(regionZoneID string) *InternalV1StorageRegionsStoragePoolsPutParams { + o.SetRegionZoneID(regionZoneID) + return o +} + +// SetRegionZoneID adds the regionZoneId to the internal v1 storage regions storage pools put params +func (o *InternalV1StorageRegionsStoragePoolsPutParams) SetRegionZoneID(regionZoneID string) { + o.RegionZoneID = regionZoneID +} + +// WithStoragePoolName adds the storagePoolName to the internal v1 storage regions storage pools put params +func (o *InternalV1StorageRegionsStoragePoolsPutParams) WithStoragePoolName(storagePoolName string) *InternalV1StorageRegionsStoragePoolsPutParams { + o.SetStoragePoolName(storagePoolName) + return o +} + +// SetStoragePoolName adds the storagePoolName to the internal v1 storage regions storage pools put params +func (o *InternalV1StorageRegionsStoragePoolsPutParams) SetStoragePoolName(storagePoolName string) { + o.StoragePoolName = storagePoolName +} + +// WriteToRequest writes these params to a swagger request +func (o *InternalV1StorageRegionsStoragePoolsPutParams) 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 region_zone_id + if err := r.SetPathParam("region_zone_id", o.RegionZoneID); err != nil { + return err + } + + // path param storage_pool_name + if err := r.SetPathParam("storage_pool_name", o.StoragePoolName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_put_responses.go new file mode 100644 index 00000000000..f36b6457212 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_storage_pools_put_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package internal_storage_regions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// InternalV1StorageRegionsStoragePoolsPutReader is a Reader for the InternalV1StorageRegionsStoragePoolsPut structure. +type InternalV1StorageRegionsStoragePoolsPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InternalV1StorageRegionsStoragePoolsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInternalV1StorageRegionsStoragePoolsPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewInternalV1StorageRegionsStoragePoolsPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewInternalV1StorageRegionsStoragePoolsPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewInternalV1StorageRegionsStoragePoolsPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewInternalV1StorageRegionsStoragePoolsPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewInternalV1StorageRegionsStoragePoolsPutOK creates a InternalV1StorageRegionsStoragePoolsPutOK with default headers values +func NewInternalV1StorageRegionsStoragePoolsPutOK() *InternalV1StorageRegionsStoragePoolsPutOK { + return &InternalV1StorageRegionsStoragePoolsPutOK{} +} + +/* InternalV1StorageRegionsStoragePoolsPutOK describes a response with status code 200, with default header values. + +OK +*/ +type InternalV1StorageRegionsStoragePoolsPutOK struct { + Payload *models.StoragePool +} + +func (o *InternalV1StorageRegionsStoragePoolsPutOK) Error() string { + return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsPutOK %+v", 200, o.Payload) +} +func (o *InternalV1StorageRegionsStoragePoolsPutOK) GetPayload() *models.StoragePool { + return o.Payload +} + +func (o *InternalV1StorageRegionsStoragePoolsPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.StoragePool) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInternalV1StorageRegionsStoragePoolsPutBadRequest creates a InternalV1StorageRegionsStoragePoolsPutBadRequest with default headers values +func NewInternalV1StorageRegionsStoragePoolsPutBadRequest() *InternalV1StorageRegionsStoragePoolsPutBadRequest { + return &InternalV1StorageRegionsStoragePoolsPutBadRequest{} +} + +/* InternalV1StorageRegionsStoragePoolsPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type InternalV1StorageRegionsStoragePoolsPutBadRequest struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsStoragePoolsPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsPutBadRequest %+v", 400, o.Payload) +} +func (o *InternalV1StorageRegionsStoragePoolsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsStoragePoolsPutBadRequest) 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 +} + +// NewInternalV1StorageRegionsStoragePoolsPutUnauthorized creates a InternalV1StorageRegionsStoragePoolsPutUnauthorized with default headers values +func NewInternalV1StorageRegionsStoragePoolsPutUnauthorized() *InternalV1StorageRegionsStoragePoolsPutUnauthorized { + return &InternalV1StorageRegionsStoragePoolsPutUnauthorized{} +} + +/* InternalV1StorageRegionsStoragePoolsPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type InternalV1StorageRegionsStoragePoolsPutUnauthorized struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsStoragePoolsPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsPutUnauthorized %+v", 401, o.Payload) +} +func (o *InternalV1StorageRegionsStoragePoolsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsStoragePoolsPutUnauthorized) 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 +} + +// NewInternalV1StorageRegionsStoragePoolsPutNotFound creates a InternalV1StorageRegionsStoragePoolsPutNotFound with default headers values +func NewInternalV1StorageRegionsStoragePoolsPutNotFound() *InternalV1StorageRegionsStoragePoolsPutNotFound { + return &InternalV1StorageRegionsStoragePoolsPutNotFound{} +} + +/* InternalV1StorageRegionsStoragePoolsPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type InternalV1StorageRegionsStoragePoolsPutNotFound struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsStoragePoolsPutNotFound) Error() string { + return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsPutNotFound %+v", 404, o.Payload) +} +func (o *InternalV1StorageRegionsStoragePoolsPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsStoragePoolsPutNotFound) 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 +} + +// NewInternalV1StorageRegionsStoragePoolsPutInternalServerError creates a InternalV1StorageRegionsStoragePoolsPutInternalServerError with default headers values +func NewInternalV1StorageRegionsStoragePoolsPutInternalServerError() *InternalV1StorageRegionsStoragePoolsPutInternalServerError { + return &InternalV1StorageRegionsStoragePoolsPutInternalServerError{} +} + +/* InternalV1StorageRegionsStoragePoolsPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type InternalV1StorageRegionsStoragePoolsPutInternalServerError struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsStoragePoolsPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/storage-pools/{storage_pool_name}][%d] internalV1StorageRegionsStoragePoolsPutInternalServerError %+v", 500, o.Payload) +} +func (o *InternalV1StorageRegionsStoragePoolsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsStoragePoolsPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_get_parameters.go new file mode 100644 index 00000000000..c60d4fea48a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_get_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package internal_storage_regions + +// 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" +) + +// NewInternalV1StorageRegionsThresholdsGetParams creates a new InternalV1StorageRegionsThresholdsGetParams 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 NewInternalV1StorageRegionsThresholdsGetParams() *InternalV1StorageRegionsThresholdsGetParams { + return &InternalV1StorageRegionsThresholdsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewInternalV1StorageRegionsThresholdsGetParamsWithTimeout creates a new InternalV1StorageRegionsThresholdsGetParams object +// with the ability to set a timeout on a request. +func NewInternalV1StorageRegionsThresholdsGetParamsWithTimeout(timeout time.Duration) *InternalV1StorageRegionsThresholdsGetParams { + return &InternalV1StorageRegionsThresholdsGetParams{ + timeout: timeout, + } +} + +// NewInternalV1StorageRegionsThresholdsGetParamsWithContext creates a new InternalV1StorageRegionsThresholdsGetParams object +// with the ability to set a context for a request. +func NewInternalV1StorageRegionsThresholdsGetParamsWithContext(ctx context.Context) *InternalV1StorageRegionsThresholdsGetParams { + return &InternalV1StorageRegionsThresholdsGetParams{ + Context: ctx, + } +} + +// NewInternalV1StorageRegionsThresholdsGetParamsWithHTTPClient creates a new InternalV1StorageRegionsThresholdsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewInternalV1StorageRegionsThresholdsGetParamsWithHTTPClient(client *http.Client) *InternalV1StorageRegionsThresholdsGetParams { + return &InternalV1StorageRegionsThresholdsGetParams{ + HTTPClient: client, + } +} + +/* InternalV1StorageRegionsThresholdsGetParams contains all the parameters to send to the API endpoint + for the internal v1 storage regions thresholds get operation. + + Typically these are written to a http.Request. +*/ +type InternalV1StorageRegionsThresholdsGetParams struct { + + /* RegionZoneID. + + ID of a Power Cloud Region Zone + */ + RegionZoneID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the internal v1 storage regions thresholds get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsThresholdsGetParams) WithDefaults() *InternalV1StorageRegionsThresholdsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the internal v1 storage regions thresholds get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsThresholdsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the internal v1 storage regions thresholds get params +func (o *InternalV1StorageRegionsThresholdsGetParams) WithTimeout(timeout time.Duration) *InternalV1StorageRegionsThresholdsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the internal v1 storage regions thresholds get params +func (o *InternalV1StorageRegionsThresholdsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the internal v1 storage regions thresholds get params +func (o *InternalV1StorageRegionsThresholdsGetParams) WithContext(ctx context.Context) *InternalV1StorageRegionsThresholdsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the internal v1 storage regions thresholds get params +func (o *InternalV1StorageRegionsThresholdsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the internal v1 storage regions thresholds get params +func (o *InternalV1StorageRegionsThresholdsGetParams) WithHTTPClient(client *http.Client) *InternalV1StorageRegionsThresholdsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the internal v1 storage regions thresholds get params +func (o *InternalV1StorageRegionsThresholdsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRegionZoneID adds the regionZoneID to the internal v1 storage regions thresholds get params +func (o *InternalV1StorageRegionsThresholdsGetParams) WithRegionZoneID(regionZoneID string) *InternalV1StorageRegionsThresholdsGetParams { + o.SetRegionZoneID(regionZoneID) + return o +} + +// SetRegionZoneID adds the regionZoneId to the internal v1 storage regions thresholds get params +func (o *InternalV1StorageRegionsThresholdsGetParams) SetRegionZoneID(regionZoneID string) { + o.RegionZoneID = regionZoneID +} + +// WriteToRequest writes these params to a swagger request +func (o *InternalV1StorageRegionsThresholdsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param region_zone_id + if err := r.SetPathParam("region_zone_id", o.RegionZoneID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_get_responses.go new file mode 100644 index 00000000000..87dbb71ea4d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_get_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package internal_storage_regions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// InternalV1StorageRegionsThresholdsGetReader is a Reader for the InternalV1StorageRegionsThresholdsGet structure. +type InternalV1StorageRegionsThresholdsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InternalV1StorageRegionsThresholdsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInternalV1StorageRegionsThresholdsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewInternalV1StorageRegionsThresholdsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewInternalV1StorageRegionsThresholdsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewInternalV1StorageRegionsThresholdsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewInternalV1StorageRegionsThresholdsGetOK creates a InternalV1StorageRegionsThresholdsGetOK with default headers values +func NewInternalV1StorageRegionsThresholdsGetOK() *InternalV1StorageRegionsThresholdsGetOK { + return &InternalV1StorageRegionsThresholdsGetOK{} +} + +/* InternalV1StorageRegionsThresholdsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type InternalV1StorageRegionsThresholdsGetOK struct { + Payload *models.Thresholds +} + +func (o *InternalV1StorageRegionsThresholdsGetOK) Error() string { + return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsGetOK %+v", 200, o.Payload) +} +func (o *InternalV1StorageRegionsThresholdsGetOK) GetPayload() *models.Thresholds { + return o.Payload +} + +func (o *InternalV1StorageRegionsThresholdsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Thresholds) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInternalV1StorageRegionsThresholdsGetUnauthorized creates a InternalV1StorageRegionsThresholdsGetUnauthorized with default headers values +func NewInternalV1StorageRegionsThresholdsGetUnauthorized() *InternalV1StorageRegionsThresholdsGetUnauthorized { + return &InternalV1StorageRegionsThresholdsGetUnauthorized{} +} + +/* InternalV1StorageRegionsThresholdsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type InternalV1StorageRegionsThresholdsGetUnauthorized struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsThresholdsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsGetUnauthorized %+v", 401, o.Payload) +} +func (o *InternalV1StorageRegionsThresholdsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsThresholdsGetUnauthorized) 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 +} + +// NewInternalV1StorageRegionsThresholdsGetNotFound creates a InternalV1StorageRegionsThresholdsGetNotFound with default headers values +func NewInternalV1StorageRegionsThresholdsGetNotFound() *InternalV1StorageRegionsThresholdsGetNotFound { + return &InternalV1StorageRegionsThresholdsGetNotFound{} +} + +/* InternalV1StorageRegionsThresholdsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type InternalV1StorageRegionsThresholdsGetNotFound struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsThresholdsGetNotFound) Error() string { + return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsGetNotFound %+v", 404, o.Payload) +} +func (o *InternalV1StorageRegionsThresholdsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsThresholdsGetNotFound) 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 +} + +// NewInternalV1StorageRegionsThresholdsGetInternalServerError creates a InternalV1StorageRegionsThresholdsGetInternalServerError with default headers values +func NewInternalV1StorageRegionsThresholdsGetInternalServerError() *InternalV1StorageRegionsThresholdsGetInternalServerError { + return &InternalV1StorageRegionsThresholdsGetInternalServerError{} +} + +/* InternalV1StorageRegionsThresholdsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type InternalV1StorageRegionsThresholdsGetInternalServerError struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsThresholdsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsGetInternalServerError %+v", 500, o.Payload) +} +func (o *InternalV1StorageRegionsThresholdsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsThresholdsGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_put_parameters.go new file mode 100644 index 00000000000..37d8366532b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_put_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package internal_storage_regions + +// 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" +) + +// NewInternalV1StorageRegionsThresholdsPutParams creates a new InternalV1StorageRegionsThresholdsPutParams 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 NewInternalV1StorageRegionsThresholdsPutParams() *InternalV1StorageRegionsThresholdsPutParams { + return &InternalV1StorageRegionsThresholdsPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewInternalV1StorageRegionsThresholdsPutParamsWithTimeout creates a new InternalV1StorageRegionsThresholdsPutParams object +// with the ability to set a timeout on a request. +func NewInternalV1StorageRegionsThresholdsPutParamsWithTimeout(timeout time.Duration) *InternalV1StorageRegionsThresholdsPutParams { + return &InternalV1StorageRegionsThresholdsPutParams{ + timeout: timeout, + } +} + +// NewInternalV1StorageRegionsThresholdsPutParamsWithContext creates a new InternalV1StorageRegionsThresholdsPutParams object +// with the ability to set a context for a request. +func NewInternalV1StorageRegionsThresholdsPutParamsWithContext(ctx context.Context) *InternalV1StorageRegionsThresholdsPutParams { + return &InternalV1StorageRegionsThresholdsPutParams{ + Context: ctx, + } +} + +// NewInternalV1StorageRegionsThresholdsPutParamsWithHTTPClient creates a new InternalV1StorageRegionsThresholdsPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewInternalV1StorageRegionsThresholdsPutParamsWithHTTPClient(client *http.Client) *InternalV1StorageRegionsThresholdsPutParams { + return &InternalV1StorageRegionsThresholdsPutParams{ + HTTPClient: client, + } +} + +/* InternalV1StorageRegionsThresholdsPutParams contains all the parameters to send to the API endpoint + for the internal v1 storage regions thresholds put operation. + + Typically these are written to a http.Request. +*/ +type InternalV1StorageRegionsThresholdsPutParams struct { + + /* Body. + + Parameters for updating default threshold settings for a region-zone + */ + Body *models.Thresholds + + /* RegionZoneID. + + ID of a Power Cloud Region Zone + */ + RegionZoneID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the internal v1 storage regions thresholds put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsThresholdsPutParams) WithDefaults() *InternalV1StorageRegionsThresholdsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the internal v1 storage regions thresholds put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InternalV1StorageRegionsThresholdsPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the internal v1 storage regions thresholds put params +func (o *InternalV1StorageRegionsThresholdsPutParams) WithTimeout(timeout time.Duration) *InternalV1StorageRegionsThresholdsPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the internal v1 storage regions thresholds put params +func (o *InternalV1StorageRegionsThresholdsPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the internal v1 storage regions thresholds put params +func (o *InternalV1StorageRegionsThresholdsPutParams) WithContext(ctx context.Context) *InternalV1StorageRegionsThresholdsPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the internal v1 storage regions thresholds put params +func (o *InternalV1StorageRegionsThresholdsPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the internal v1 storage regions thresholds put params +func (o *InternalV1StorageRegionsThresholdsPutParams) WithHTTPClient(client *http.Client) *InternalV1StorageRegionsThresholdsPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the internal v1 storage regions thresholds put params +func (o *InternalV1StorageRegionsThresholdsPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the internal v1 storage regions thresholds put params +func (o *InternalV1StorageRegionsThresholdsPutParams) WithBody(body *models.Thresholds) *InternalV1StorageRegionsThresholdsPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the internal v1 storage regions thresholds put params +func (o *InternalV1StorageRegionsThresholdsPutParams) SetBody(body *models.Thresholds) { + o.Body = body +} + +// WithRegionZoneID adds the regionZoneID to the internal v1 storage regions thresholds put params +func (o *InternalV1StorageRegionsThresholdsPutParams) WithRegionZoneID(regionZoneID string) *InternalV1StorageRegionsThresholdsPutParams { + o.SetRegionZoneID(regionZoneID) + return o +} + +// SetRegionZoneID adds the regionZoneId to the internal v1 storage regions thresholds put params +func (o *InternalV1StorageRegionsThresholdsPutParams) SetRegionZoneID(regionZoneID string) { + o.RegionZoneID = regionZoneID +} + +// WriteToRequest writes these params to a swagger request +func (o *InternalV1StorageRegionsThresholdsPutParams) 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 region_zone_id + if err := r.SetPathParam("region_zone_id", o.RegionZoneID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_put_responses.go new file mode 100644 index 00000000000..fab946caab8 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions/internal_v1_storage_regions_thresholds_put_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package internal_storage_regions + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// InternalV1StorageRegionsThresholdsPutReader is a Reader for the InternalV1StorageRegionsThresholdsPut structure. +type InternalV1StorageRegionsThresholdsPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InternalV1StorageRegionsThresholdsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewInternalV1StorageRegionsThresholdsPutAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewInternalV1StorageRegionsThresholdsPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewInternalV1StorageRegionsThresholdsPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewInternalV1StorageRegionsThresholdsPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewInternalV1StorageRegionsThresholdsPutConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewInternalV1StorageRegionsThresholdsPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewInternalV1StorageRegionsThresholdsPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewInternalV1StorageRegionsThresholdsPutAccepted creates a InternalV1StorageRegionsThresholdsPutAccepted with default headers values +func NewInternalV1StorageRegionsThresholdsPutAccepted() *InternalV1StorageRegionsThresholdsPutAccepted { + return &InternalV1StorageRegionsThresholdsPutAccepted{} +} + +/* InternalV1StorageRegionsThresholdsPutAccepted describes a response with status code 202, with default header values. + +OK, region-zone default threshold settings update +*/ +type InternalV1StorageRegionsThresholdsPutAccepted struct { + Payload *models.Thresholds +} + +func (o *InternalV1StorageRegionsThresholdsPutAccepted) Error() string { + return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsPutAccepted %+v", 202, o.Payload) +} +func (o *InternalV1StorageRegionsThresholdsPutAccepted) GetPayload() *models.Thresholds { + return o.Payload +} + +func (o *InternalV1StorageRegionsThresholdsPutAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Thresholds) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInternalV1StorageRegionsThresholdsPutBadRequest creates a InternalV1StorageRegionsThresholdsPutBadRequest with default headers values +func NewInternalV1StorageRegionsThresholdsPutBadRequest() *InternalV1StorageRegionsThresholdsPutBadRequest { + return &InternalV1StorageRegionsThresholdsPutBadRequest{} +} + +/* InternalV1StorageRegionsThresholdsPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type InternalV1StorageRegionsThresholdsPutBadRequest struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsThresholdsPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsPutBadRequest %+v", 400, o.Payload) +} +func (o *InternalV1StorageRegionsThresholdsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsThresholdsPutBadRequest) 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 +} + +// NewInternalV1StorageRegionsThresholdsPutUnauthorized creates a InternalV1StorageRegionsThresholdsPutUnauthorized with default headers values +func NewInternalV1StorageRegionsThresholdsPutUnauthorized() *InternalV1StorageRegionsThresholdsPutUnauthorized { + return &InternalV1StorageRegionsThresholdsPutUnauthorized{} +} + +/* InternalV1StorageRegionsThresholdsPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type InternalV1StorageRegionsThresholdsPutUnauthorized struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsThresholdsPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsPutUnauthorized %+v", 401, o.Payload) +} +func (o *InternalV1StorageRegionsThresholdsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsThresholdsPutUnauthorized) 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 +} + +// NewInternalV1StorageRegionsThresholdsPutForbidden creates a InternalV1StorageRegionsThresholdsPutForbidden with default headers values +func NewInternalV1StorageRegionsThresholdsPutForbidden() *InternalV1StorageRegionsThresholdsPutForbidden { + return &InternalV1StorageRegionsThresholdsPutForbidden{} +} + +/* InternalV1StorageRegionsThresholdsPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type InternalV1StorageRegionsThresholdsPutForbidden struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsThresholdsPutForbidden) Error() string { + return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsPutForbidden %+v", 403, o.Payload) +} +func (o *InternalV1StorageRegionsThresholdsPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsThresholdsPutForbidden) 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 +} + +// NewInternalV1StorageRegionsThresholdsPutConflict creates a InternalV1StorageRegionsThresholdsPutConflict with default headers values +func NewInternalV1StorageRegionsThresholdsPutConflict() *InternalV1StorageRegionsThresholdsPutConflict { + return &InternalV1StorageRegionsThresholdsPutConflict{} +} + +/* InternalV1StorageRegionsThresholdsPutConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type InternalV1StorageRegionsThresholdsPutConflict struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsThresholdsPutConflict) Error() string { + return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsPutConflict %+v", 409, o.Payload) +} +func (o *InternalV1StorageRegionsThresholdsPutConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsThresholdsPutConflict) 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 +} + +// NewInternalV1StorageRegionsThresholdsPutUnprocessableEntity creates a InternalV1StorageRegionsThresholdsPutUnprocessableEntity with default headers values +func NewInternalV1StorageRegionsThresholdsPutUnprocessableEntity() *InternalV1StorageRegionsThresholdsPutUnprocessableEntity { + return &InternalV1StorageRegionsThresholdsPutUnprocessableEntity{} +} + +/* InternalV1StorageRegionsThresholdsPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type InternalV1StorageRegionsThresholdsPutUnprocessableEntity struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsThresholdsPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsPutUnprocessableEntity %+v", 422, o.Payload) +} +func (o *InternalV1StorageRegionsThresholdsPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsThresholdsPutUnprocessableEntity) 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 +} + +// NewInternalV1StorageRegionsThresholdsPutInternalServerError creates a InternalV1StorageRegionsThresholdsPutInternalServerError with default headers values +func NewInternalV1StorageRegionsThresholdsPutInternalServerError() *InternalV1StorageRegionsThresholdsPutInternalServerError { + return &InternalV1StorageRegionsThresholdsPutInternalServerError{} +} + +/* InternalV1StorageRegionsThresholdsPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type InternalV1StorageRegionsThresholdsPutInternalServerError struct { + Payload *models.Error +} + +func (o *InternalV1StorageRegionsThresholdsPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /internal/v1/storage/regions/{region_zone_id}/thresholds][%d] internalV1StorageRegionsThresholdsPutInternalServerError %+v", 500, o.Payload) +} +func (o *InternalV1StorageRegionsThresholdsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *InternalV1StorageRegionsThresholdsPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/open_stacks_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/open_stacks_client.go new file mode 100644 index 00000000000..693bef3bab1 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/open_stacks_client.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package open_stacks + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new open stacks API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for open stacks API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceBrokerOpenstacksGet(params *ServiceBrokerOpenstacksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksGetOK, error) + + ServiceBrokerOpenstacksHostsGet(params *ServiceBrokerOpenstacksHostsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksHostsGetOK, error) + + ServiceBrokerOpenstacksOpenstackGet(params *ServiceBrokerOpenstacksOpenstackGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksOpenstackGetOK, error) + + ServiceBrokerOpenstacksPost(params *ServiceBrokerOpenstacksPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksPostOK, *ServiceBrokerOpenstacksPostCreated, error) + + ServiceBrokerOpenstacksServersGet(params *ServiceBrokerOpenstacksServersGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksServersGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + ServiceBrokerOpenstacksGet lists all open stack instances being managed +*/ +func (a *Client) ServiceBrokerOpenstacksGet(params *ServiceBrokerOpenstacksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerOpenstacksGetParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.openstacks.get", + Method: "GET", + PathPattern: "/broker/v1/openstacks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerOpenstacksGetReader{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.(*ServiceBrokerOpenstacksGetOK) + 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 serviceBroker.openstacks.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerOpenstacksHostsGet lists account information for all pvm instances on hostname +*/ +func (a *Client) ServiceBrokerOpenstacksHostsGet(params *ServiceBrokerOpenstacksHostsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksHostsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerOpenstacksHostsGetParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.openstacks.hosts.get", + Method: "GET", + PathPattern: "/broker/v1/openstacks/{openstack_id}/hosts/{hostname}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerOpenstacksHostsGetReader{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.(*ServiceBrokerOpenstacksHostsGetOK) + 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 serviceBroker.openstacks.hosts.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerOpenstacksOpenstackGet lists account information for all pvm instances on hostname +*/ +func (a *Client) ServiceBrokerOpenstacksOpenstackGet(params *ServiceBrokerOpenstacksOpenstackGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksOpenstackGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerOpenstacksOpenstackGetParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.openstacks.openstack.get", + Method: "GET", + PathPattern: "/broker/v1/openstacks/{openstack_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerOpenstacksOpenstackGetReader{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.(*ServiceBrokerOpenstacksOpenstackGetOK) + 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 serviceBroker.openstacks.openstack.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerOpenstacksPost creates a new open stack instance to be managed +*/ +func (a *Client) ServiceBrokerOpenstacksPost(params *ServiceBrokerOpenstacksPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksPostOK, *ServiceBrokerOpenstacksPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerOpenstacksPostParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.openstacks.post", + Method: "POST", + PathPattern: "/broker/v1/openstacks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerOpenstacksPostReader{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 *ServiceBrokerOpenstacksPostOK: + return value, nil, nil + case *ServiceBrokerOpenstacksPostCreated: + 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 open_stacks: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBrokerOpenstacksServersGet lists account information for a pvm instance +*/ +func (a *Client) ServiceBrokerOpenstacksServersGet(params *ServiceBrokerOpenstacksServersGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBrokerOpenstacksServersGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerOpenstacksServersGetParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.openstacks.servers.get", + Method: "GET", + PathPattern: "/broker/v1/openstacks/{openstack_id}/servers/{pvm_instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerOpenstacksServersGetReader{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.(*ServiceBrokerOpenstacksServersGetOK) + 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 serviceBroker.openstacks.servers.get: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_get_parameters.go new file mode 100644 index 00000000000..a5fc89bfd6c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_get_parameters.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package open_stacks + +// 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" +) + +// NewServiceBrokerOpenstacksGetParams creates a new ServiceBrokerOpenstacksGetParams 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 NewServiceBrokerOpenstacksGetParams() *ServiceBrokerOpenstacksGetParams { + return &ServiceBrokerOpenstacksGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerOpenstacksGetParamsWithTimeout creates a new ServiceBrokerOpenstacksGetParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerOpenstacksGetParamsWithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksGetParams { + return &ServiceBrokerOpenstacksGetParams{ + timeout: timeout, + } +} + +// NewServiceBrokerOpenstacksGetParamsWithContext creates a new ServiceBrokerOpenstacksGetParams object +// with the ability to set a context for a request. +func NewServiceBrokerOpenstacksGetParamsWithContext(ctx context.Context) *ServiceBrokerOpenstacksGetParams { + return &ServiceBrokerOpenstacksGetParams{ + Context: ctx, + } +} + +// NewServiceBrokerOpenstacksGetParamsWithHTTPClient creates a new ServiceBrokerOpenstacksGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerOpenstacksGetParamsWithHTTPClient(client *http.Client) *ServiceBrokerOpenstacksGetParams { + return &ServiceBrokerOpenstacksGetParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerOpenstacksGetParams contains all the parameters to send to the API endpoint + for the service broker openstacks get operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerOpenstacksGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker openstacks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksGetParams) WithDefaults() *ServiceBrokerOpenstacksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker openstacks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker openstacks get params +func (o *ServiceBrokerOpenstacksGetParams) WithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker openstacks get params +func (o *ServiceBrokerOpenstacksGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker openstacks get params +func (o *ServiceBrokerOpenstacksGetParams) WithContext(ctx context.Context) *ServiceBrokerOpenstacksGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker openstacks get params +func (o *ServiceBrokerOpenstacksGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker openstacks get params +func (o *ServiceBrokerOpenstacksGetParams) WithHTTPClient(client *http.Client) *ServiceBrokerOpenstacksGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker openstacks get params +func (o *ServiceBrokerOpenstacksGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerOpenstacksGetParams) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_get_responses.go new file mode 100644 index 00000000000..c1903411789 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_get_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package open_stacks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerOpenstacksGetReader is a Reader for the ServiceBrokerOpenstacksGet structure. +type ServiceBrokerOpenstacksGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerOpenstacksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerOpenstacksGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceBrokerOpenstacksGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewServiceBrokerOpenstacksGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewServiceBrokerOpenstacksGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerOpenstacksGetOK creates a ServiceBrokerOpenstacksGetOK with default headers values +func NewServiceBrokerOpenstacksGetOK() *ServiceBrokerOpenstacksGetOK { + return &ServiceBrokerOpenstacksGetOK{} +} + +/* ServiceBrokerOpenstacksGetOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerOpenstacksGetOK struct { + Payload *models.OpenStacks +} + +func (o *ServiceBrokerOpenstacksGetOK) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks][%d] serviceBrokerOpenstacksGetOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerOpenstacksGetOK) GetPayload() *models.OpenStacks { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.OpenStacks) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerOpenstacksGetBadRequest creates a ServiceBrokerOpenstacksGetBadRequest with default headers values +func NewServiceBrokerOpenstacksGetBadRequest() *ServiceBrokerOpenstacksGetBadRequest { + return &ServiceBrokerOpenstacksGetBadRequest{} +} + +/* ServiceBrokerOpenstacksGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ServiceBrokerOpenstacksGetBadRequest struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksGetBadRequest) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks][%d] serviceBrokerOpenstacksGetBadRequest %+v", 400, o.Payload) +} +func (o *ServiceBrokerOpenstacksGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksGetBadRequest) 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 +} + +// NewServiceBrokerOpenstacksGetForbidden creates a ServiceBrokerOpenstacksGetForbidden with default headers values +func NewServiceBrokerOpenstacksGetForbidden() *ServiceBrokerOpenstacksGetForbidden { + return &ServiceBrokerOpenstacksGetForbidden{} +} + +/* ServiceBrokerOpenstacksGetForbidden describes a response with status code 403, with default header values. + +Unauthorized +*/ +type ServiceBrokerOpenstacksGetForbidden struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksGetForbidden) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks][%d] serviceBrokerOpenstacksGetForbidden %+v", 403, o.Payload) +} +func (o *ServiceBrokerOpenstacksGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksGetForbidden) 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 +} + +// NewServiceBrokerOpenstacksGetInternalServerError creates a ServiceBrokerOpenstacksGetInternalServerError with default headers values +func NewServiceBrokerOpenstacksGetInternalServerError() *ServiceBrokerOpenstacksGetInternalServerError { + return &ServiceBrokerOpenstacksGetInternalServerError{} +} + +/* ServiceBrokerOpenstacksGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerOpenstacksGetInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks][%d] serviceBrokerOpenstacksGetInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerOpenstacksGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_hosts_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_hosts_get_parameters.go new file mode 100644 index 00000000000..0f29aa65ee4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_hosts_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package open_stacks + +// 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" +) + +// NewServiceBrokerOpenstacksHostsGetParams creates a new ServiceBrokerOpenstacksHostsGetParams 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 NewServiceBrokerOpenstacksHostsGetParams() *ServiceBrokerOpenstacksHostsGetParams { + return &ServiceBrokerOpenstacksHostsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerOpenstacksHostsGetParamsWithTimeout creates a new ServiceBrokerOpenstacksHostsGetParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerOpenstacksHostsGetParamsWithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksHostsGetParams { + return &ServiceBrokerOpenstacksHostsGetParams{ + timeout: timeout, + } +} + +// NewServiceBrokerOpenstacksHostsGetParamsWithContext creates a new ServiceBrokerOpenstacksHostsGetParams object +// with the ability to set a context for a request. +func NewServiceBrokerOpenstacksHostsGetParamsWithContext(ctx context.Context) *ServiceBrokerOpenstacksHostsGetParams { + return &ServiceBrokerOpenstacksHostsGetParams{ + Context: ctx, + } +} + +// NewServiceBrokerOpenstacksHostsGetParamsWithHTTPClient creates a new ServiceBrokerOpenstacksHostsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerOpenstacksHostsGetParamsWithHTTPClient(client *http.Client) *ServiceBrokerOpenstacksHostsGetParams { + return &ServiceBrokerOpenstacksHostsGetParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerOpenstacksHostsGetParams contains all the parameters to send to the API endpoint + for the service broker openstacks hosts get operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerOpenstacksHostsGetParams struct { + + /* Hostname. + + Hostname + */ + Hostname string + + /* OpenstackID. + + Openstack ID + */ + OpenstackID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker openstacks hosts get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksHostsGetParams) WithDefaults() *ServiceBrokerOpenstacksHostsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker openstacks hosts get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksHostsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker openstacks hosts get params +func (o *ServiceBrokerOpenstacksHostsGetParams) WithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksHostsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker openstacks hosts get params +func (o *ServiceBrokerOpenstacksHostsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker openstacks hosts get params +func (o *ServiceBrokerOpenstacksHostsGetParams) WithContext(ctx context.Context) *ServiceBrokerOpenstacksHostsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker openstacks hosts get params +func (o *ServiceBrokerOpenstacksHostsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker openstacks hosts get params +func (o *ServiceBrokerOpenstacksHostsGetParams) WithHTTPClient(client *http.Client) *ServiceBrokerOpenstacksHostsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker openstacks hosts get params +func (o *ServiceBrokerOpenstacksHostsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithHostname adds the hostname to the service broker openstacks hosts get params +func (o *ServiceBrokerOpenstacksHostsGetParams) WithHostname(hostname string) *ServiceBrokerOpenstacksHostsGetParams { + o.SetHostname(hostname) + return o +} + +// SetHostname adds the hostname to the service broker openstacks hosts get params +func (o *ServiceBrokerOpenstacksHostsGetParams) SetHostname(hostname string) { + o.Hostname = hostname +} + +// WithOpenstackID adds the openstackID to the service broker openstacks hosts get params +func (o *ServiceBrokerOpenstacksHostsGetParams) WithOpenstackID(openstackID string) *ServiceBrokerOpenstacksHostsGetParams { + o.SetOpenstackID(openstackID) + return o +} + +// SetOpenstackID adds the openstackId to the service broker openstacks hosts get params +func (o *ServiceBrokerOpenstacksHostsGetParams) SetOpenstackID(openstackID string) { + o.OpenstackID = openstackID +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerOpenstacksHostsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param hostname + if err := r.SetPathParam("hostname", o.Hostname); err != nil { + return err + } + + // path param openstack_id + if err := r.SetPathParam("openstack_id", o.OpenstackID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_hosts_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_hosts_get_responses.go new file mode 100644 index 00000000000..83eff4cf2e6 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_hosts_get_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package open_stacks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerOpenstacksHostsGetReader is a Reader for the ServiceBrokerOpenstacksHostsGet structure. +type ServiceBrokerOpenstacksHostsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerOpenstacksHostsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerOpenstacksHostsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceBrokerOpenstacksHostsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewServiceBrokerOpenstacksHostsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewServiceBrokerOpenstacksHostsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerOpenstacksHostsGetOK creates a ServiceBrokerOpenstacksHostsGetOK with default headers values +func NewServiceBrokerOpenstacksHostsGetOK() *ServiceBrokerOpenstacksHostsGetOK { + return &ServiceBrokerOpenstacksHostsGetOK{} +} + +/* ServiceBrokerOpenstacksHostsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerOpenstacksHostsGetOK struct { + Payload *models.HostInfo +} + +func (o *ServiceBrokerOpenstacksHostsGetOK) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/hosts/{hostname}][%d] serviceBrokerOpenstacksHostsGetOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerOpenstacksHostsGetOK) GetPayload() *models.HostInfo { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksHostsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HostInfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerOpenstacksHostsGetBadRequest creates a ServiceBrokerOpenstacksHostsGetBadRequest with default headers values +func NewServiceBrokerOpenstacksHostsGetBadRequest() *ServiceBrokerOpenstacksHostsGetBadRequest { + return &ServiceBrokerOpenstacksHostsGetBadRequest{} +} + +/* ServiceBrokerOpenstacksHostsGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ServiceBrokerOpenstacksHostsGetBadRequest struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksHostsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/hosts/{hostname}][%d] serviceBrokerOpenstacksHostsGetBadRequest %+v", 400, o.Payload) +} +func (o *ServiceBrokerOpenstacksHostsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksHostsGetBadRequest) 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 +} + +// NewServiceBrokerOpenstacksHostsGetNotFound creates a ServiceBrokerOpenstacksHostsGetNotFound with default headers values +func NewServiceBrokerOpenstacksHostsGetNotFound() *ServiceBrokerOpenstacksHostsGetNotFound { + return &ServiceBrokerOpenstacksHostsGetNotFound{} +} + +/* ServiceBrokerOpenstacksHostsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type ServiceBrokerOpenstacksHostsGetNotFound struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksHostsGetNotFound) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/hosts/{hostname}][%d] serviceBrokerOpenstacksHostsGetNotFound %+v", 404, o.Payload) +} +func (o *ServiceBrokerOpenstacksHostsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksHostsGetNotFound) 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 +} + +// NewServiceBrokerOpenstacksHostsGetInternalServerError creates a ServiceBrokerOpenstacksHostsGetInternalServerError with default headers values +func NewServiceBrokerOpenstacksHostsGetInternalServerError() *ServiceBrokerOpenstacksHostsGetInternalServerError { + return &ServiceBrokerOpenstacksHostsGetInternalServerError{} +} + +/* ServiceBrokerOpenstacksHostsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerOpenstacksHostsGetInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksHostsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/hosts/{hostname}][%d] serviceBrokerOpenstacksHostsGetInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerOpenstacksHostsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksHostsGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_openstack_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_openstack_get_parameters.go new file mode 100644 index 00000000000..11249b70fb7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_openstack_get_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package open_stacks + +// 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" +) + +// NewServiceBrokerOpenstacksOpenstackGetParams creates a new ServiceBrokerOpenstacksOpenstackGetParams 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 NewServiceBrokerOpenstacksOpenstackGetParams() *ServiceBrokerOpenstacksOpenstackGetParams { + return &ServiceBrokerOpenstacksOpenstackGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerOpenstacksOpenstackGetParamsWithTimeout creates a new ServiceBrokerOpenstacksOpenstackGetParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerOpenstacksOpenstackGetParamsWithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksOpenstackGetParams { + return &ServiceBrokerOpenstacksOpenstackGetParams{ + timeout: timeout, + } +} + +// NewServiceBrokerOpenstacksOpenstackGetParamsWithContext creates a new ServiceBrokerOpenstacksOpenstackGetParams object +// with the ability to set a context for a request. +func NewServiceBrokerOpenstacksOpenstackGetParamsWithContext(ctx context.Context) *ServiceBrokerOpenstacksOpenstackGetParams { + return &ServiceBrokerOpenstacksOpenstackGetParams{ + Context: ctx, + } +} + +// NewServiceBrokerOpenstacksOpenstackGetParamsWithHTTPClient creates a new ServiceBrokerOpenstacksOpenstackGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerOpenstacksOpenstackGetParamsWithHTTPClient(client *http.Client) *ServiceBrokerOpenstacksOpenstackGetParams { + return &ServiceBrokerOpenstacksOpenstackGetParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerOpenstacksOpenstackGetParams contains all the parameters to send to the API endpoint + for the service broker openstacks openstack get operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerOpenstacksOpenstackGetParams struct { + + /* OpenstackID. + + Openstack ID + */ + OpenstackID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker openstacks openstack get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksOpenstackGetParams) WithDefaults() *ServiceBrokerOpenstacksOpenstackGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker openstacks openstack get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksOpenstackGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker openstacks openstack get params +func (o *ServiceBrokerOpenstacksOpenstackGetParams) WithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksOpenstackGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker openstacks openstack get params +func (o *ServiceBrokerOpenstacksOpenstackGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker openstacks openstack get params +func (o *ServiceBrokerOpenstacksOpenstackGetParams) WithContext(ctx context.Context) *ServiceBrokerOpenstacksOpenstackGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker openstacks openstack get params +func (o *ServiceBrokerOpenstacksOpenstackGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker openstacks openstack get params +func (o *ServiceBrokerOpenstacksOpenstackGetParams) WithHTTPClient(client *http.Client) *ServiceBrokerOpenstacksOpenstackGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker openstacks openstack get params +func (o *ServiceBrokerOpenstacksOpenstackGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithOpenstackID adds the openstackID to the service broker openstacks openstack get params +func (o *ServiceBrokerOpenstacksOpenstackGetParams) WithOpenstackID(openstackID string) *ServiceBrokerOpenstacksOpenstackGetParams { + o.SetOpenstackID(openstackID) + return o +} + +// SetOpenstackID adds the openstackId to the service broker openstacks openstack get params +func (o *ServiceBrokerOpenstacksOpenstackGetParams) SetOpenstackID(openstackID string) { + o.OpenstackID = openstackID +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerOpenstacksOpenstackGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param openstack_id + if err := r.SetPathParam("openstack_id", o.OpenstackID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_openstack_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_openstack_get_responses.go new file mode 100644 index 00000000000..dece779e2ef --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_openstack_get_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package open_stacks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerOpenstacksOpenstackGetReader is a Reader for the ServiceBrokerOpenstacksOpenstackGet structure. +type ServiceBrokerOpenstacksOpenstackGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerOpenstacksOpenstackGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerOpenstacksOpenstackGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceBrokerOpenstacksOpenstackGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewServiceBrokerOpenstacksOpenstackGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewServiceBrokerOpenstacksOpenstackGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerOpenstacksOpenstackGetOK creates a ServiceBrokerOpenstacksOpenstackGetOK with default headers values +func NewServiceBrokerOpenstacksOpenstackGetOK() *ServiceBrokerOpenstacksOpenstackGetOK { + return &ServiceBrokerOpenstacksOpenstackGetOK{} +} + +/* ServiceBrokerOpenstacksOpenstackGetOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerOpenstacksOpenstackGetOK struct { + Payload *models.OpenStackInfo +} + +func (o *ServiceBrokerOpenstacksOpenstackGetOK) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}][%d] serviceBrokerOpenstacksOpenstackGetOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerOpenstacksOpenstackGetOK) GetPayload() *models.OpenStackInfo { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksOpenstackGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.OpenStackInfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerOpenstacksOpenstackGetBadRequest creates a ServiceBrokerOpenstacksOpenstackGetBadRequest with default headers values +func NewServiceBrokerOpenstacksOpenstackGetBadRequest() *ServiceBrokerOpenstacksOpenstackGetBadRequest { + return &ServiceBrokerOpenstacksOpenstackGetBadRequest{} +} + +/* ServiceBrokerOpenstacksOpenstackGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ServiceBrokerOpenstacksOpenstackGetBadRequest struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksOpenstackGetBadRequest) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}][%d] serviceBrokerOpenstacksOpenstackGetBadRequest %+v", 400, o.Payload) +} +func (o *ServiceBrokerOpenstacksOpenstackGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksOpenstackGetBadRequest) 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 +} + +// NewServiceBrokerOpenstacksOpenstackGetNotFound creates a ServiceBrokerOpenstacksOpenstackGetNotFound with default headers values +func NewServiceBrokerOpenstacksOpenstackGetNotFound() *ServiceBrokerOpenstacksOpenstackGetNotFound { + return &ServiceBrokerOpenstacksOpenstackGetNotFound{} +} + +/* ServiceBrokerOpenstacksOpenstackGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type ServiceBrokerOpenstacksOpenstackGetNotFound struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksOpenstackGetNotFound) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}][%d] serviceBrokerOpenstacksOpenstackGetNotFound %+v", 404, o.Payload) +} +func (o *ServiceBrokerOpenstacksOpenstackGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksOpenstackGetNotFound) 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 +} + +// NewServiceBrokerOpenstacksOpenstackGetInternalServerError creates a ServiceBrokerOpenstacksOpenstackGetInternalServerError with default headers values +func NewServiceBrokerOpenstacksOpenstackGetInternalServerError() *ServiceBrokerOpenstacksOpenstackGetInternalServerError { + return &ServiceBrokerOpenstacksOpenstackGetInternalServerError{} +} + +/* ServiceBrokerOpenstacksOpenstackGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerOpenstacksOpenstackGetInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksOpenstackGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}][%d] serviceBrokerOpenstacksOpenstackGetInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerOpenstacksOpenstackGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksOpenstackGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_post_parameters.go new file mode 100644 index 00000000000..32935216b2d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_post_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package open_stacks + +// 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" +) + +// NewServiceBrokerOpenstacksPostParams creates a new ServiceBrokerOpenstacksPostParams 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 NewServiceBrokerOpenstacksPostParams() *ServiceBrokerOpenstacksPostParams { + return &ServiceBrokerOpenstacksPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerOpenstacksPostParamsWithTimeout creates a new ServiceBrokerOpenstacksPostParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerOpenstacksPostParamsWithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksPostParams { + return &ServiceBrokerOpenstacksPostParams{ + timeout: timeout, + } +} + +// NewServiceBrokerOpenstacksPostParamsWithContext creates a new ServiceBrokerOpenstacksPostParams object +// with the ability to set a context for a request. +func NewServiceBrokerOpenstacksPostParamsWithContext(ctx context.Context) *ServiceBrokerOpenstacksPostParams { + return &ServiceBrokerOpenstacksPostParams{ + Context: ctx, + } +} + +// NewServiceBrokerOpenstacksPostParamsWithHTTPClient creates a new ServiceBrokerOpenstacksPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerOpenstacksPostParamsWithHTTPClient(client *http.Client) *ServiceBrokerOpenstacksPostParams { + return &ServiceBrokerOpenstacksPostParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerOpenstacksPostParams contains all the parameters to send to the API endpoint + for the service broker openstacks post operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerOpenstacksPostParams struct { + + /* Body. + + Parameters for the creation of a new Open Stack Instance + */ + Body *models.OpenStackCreate + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker openstacks post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksPostParams) WithDefaults() *ServiceBrokerOpenstacksPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker openstacks post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker openstacks post params +func (o *ServiceBrokerOpenstacksPostParams) WithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker openstacks post params +func (o *ServiceBrokerOpenstacksPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker openstacks post params +func (o *ServiceBrokerOpenstacksPostParams) WithContext(ctx context.Context) *ServiceBrokerOpenstacksPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker openstacks post params +func (o *ServiceBrokerOpenstacksPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker openstacks post params +func (o *ServiceBrokerOpenstacksPostParams) WithHTTPClient(client *http.Client) *ServiceBrokerOpenstacksPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker openstacks post params +func (o *ServiceBrokerOpenstacksPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the service broker openstacks post params +func (o *ServiceBrokerOpenstacksPostParams) WithBody(body *models.OpenStackCreate) *ServiceBrokerOpenstacksPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the service broker openstacks post params +func (o *ServiceBrokerOpenstacksPostParams) SetBody(body *models.OpenStackCreate) { + o.Body = body +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerOpenstacksPostParams) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_post_responses.go new file mode 100644 index 00000000000..b83e9e39719 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_post_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package open_stacks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerOpenstacksPostReader is a Reader for the ServiceBrokerOpenstacksPost structure. +type ServiceBrokerOpenstacksPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerOpenstacksPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerOpenstacksPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 201: + result := NewServiceBrokerOpenstacksPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceBrokerOpenstacksPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewServiceBrokerOpenstacksPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewServiceBrokerOpenstacksPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewServiceBrokerOpenstacksPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerOpenstacksPostOK creates a ServiceBrokerOpenstacksPostOK with default headers values +func NewServiceBrokerOpenstacksPostOK() *ServiceBrokerOpenstacksPostOK { + return &ServiceBrokerOpenstacksPostOK{} +} + +/* ServiceBrokerOpenstacksPostOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerOpenstacksPostOK struct { + Payload *models.OpenStack +} + +func (o *ServiceBrokerOpenstacksPostOK) Error() string { + return fmt.Sprintf("[POST /broker/v1/openstacks][%d] serviceBrokerOpenstacksPostOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerOpenstacksPostOK) GetPayload() *models.OpenStack { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.OpenStack) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerOpenstacksPostCreated creates a ServiceBrokerOpenstacksPostCreated with default headers values +func NewServiceBrokerOpenstacksPostCreated() *ServiceBrokerOpenstacksPostCreated { + return &ServiceBrokerOpenstacksPostCreated{} +} + +/* ServiceBrokerOpenstacksPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type ServiceBrokerOpenstacksPostCreated struct { + Payload *models.OpenStack +} + +func (o *ServiceBrokerOpenstacksPostCreated) Error() string { + return fmt.Sprintf("[POST /broker/v1/openstacks][%d] serviceBrokerOpenstacksPostCreated %+v", 201, o.Payload) +} +func (o *ServiceBrokerOpenstacksPostCreated) GetPayload() *models.OpenStack { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.OpenStack) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerOpenstacksPostBadRequest creates a ServiceBrokerOpenstacksPostBadRequest with default headers values +func NewServiceBrokerOpenstacksPostBadRequest() *ServiceBrokerOpenstacksPostBadRequest { + return &ServiceBrokerOpenstacksPostBadRequest{} +} + +/* ServiceBrokerOpenstacksPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ServiceBrokerOpenstacksPostBadRequest struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksPostBadRequest) Error() string { + return fmt.Sprintf("[POST /broker/v1/openstacks][%d] serviceBrokerOpenstacksPostBadRequest %+v", 400, o.Payload) +} +func (o *ServiceBrokerOpenstacksPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksPostBadRequest) 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 +} + +// NewServiceBrokerOpenstacksPostConflict creates a ServiceBrokerOpenstacksPostConflict with default headers values +func NewServiceBrokerOpenstacksPostConflict() *ServiceBrokerOpenstacksPostConflict { + return &ServiceBrokerOpenstacksPostConflict{} +} + +/* ServiceBrokerOpenstacksPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type ServiceBrokerOpenstacksPostConflict struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksPostConflict) Error() string { + return fmt.Sprintf("[POST /broker/v1/openstacks][%d] serviceBrokerOpenstacksPostConflict %+v", 409, o.Payload) +} +func (o *ServiceBrokerOpenstacksPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksPostConflict) 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 +} + +// NewServiceBrokerOpenstacksPostUnprocessableEntity creates a ServiceBrokerOpenstacksPostUnprocessableEntity with default headers values +func NewServiceBrokerOpenstacksPostUnprocessableEntity() *ServiceBrokerOpenstacksPostUnprocessableEntity { + return &ServiceBrokerOpenstacksPostUnprocessableEntity{} +} + +/* ServiceBrokerOpenstacksPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type ServiceBrokerOpenstacksPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /broker/v1/openstacks][%d] serviceBrokerOpenstacksPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *ServiceBrokerOpenstacksPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksPostUnprocessableEntity) 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 +} + +// NewServiceBrokerOpenstacksPostInternalServerError creates a ServiceBrokerOpenstacksPostInternalServerError with default headers values +func NewServiceBrokerOpenstacksPostInternalServerError() *ServiceBrokerOpenstacksPostInternalServerError { + return &ServiceBrokerOpenstacksPostInternalServerError{} +} + +/* ServiceBrokerOpenstacksPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerOpenstacksPostInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /broker/v1/openstacks][%d] serviceBrokerOpenstacksPostInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerOpenstacksPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_servers_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_servers_get_parameters.go new file mode 100644 index 00000000000..dbe1a1a52fc --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_servers_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package open_stacks + +// 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" +) + +// NewServiceBrokerOpenstacksServersGetParams creates a new ServiceBrokerOpenstacksServersGetParams 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 NewServiceBrokerOpenstacksServersGetParams() *ServiceBrokerOpenstacksServersGetParams { + return &ServiceBrokerOpenstacksServersGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerOpenstacksServersGetParamsWithTimeout creates a new ServiceBrokerOpenstacksServersGetParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerOpenstacksServersGetParamsWithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksServersGetParams { + return &ServiceBrokerOpenstacksServersGetParams{ + timeout: timeout, + } +} + +// NewServiceBrokerOpenstacksServersGetParamsWithContext creates a new ServiceBrokerOpenstacksServersGetParams object +// with the ability to set a context for a request. +func NewServiceBrokerOpenstacksServersGetParamsWithContext(ctx context.Context) *ServiceBrokerOpenstacksServersGetParams { + return &ServiceBrokerOpenstacksServersGetParams{ + Context: ctx, + } +} + +// NewServiceBrokerOpenstacksServersGetParamsWithHTTPClient creates a new ServiceBrokerOpenstacksServersGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerOpenstacksServersGetParamsWithHTTPClient(client *http.Client) *ServiceBrokerOpenstacksServersGetParams { + return &ServiceBrokerOpenstacksServersGetParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerOpenstacksServersGetParams contains all the parameters to send to the API endpoint + for the service broker openstacks servers get operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerOpenstacksServersGetParams struct { + + /* OpenstackID. + + Openstack ID + */ + OpenstackID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker openstacks servers get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksServersGetParams) WithDefaults() *ServiceBrokerOpenstacksServersGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker openstacks servers get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerOpenstacksServersGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker openstacks servers get params +func (o *ServiceBrokerOpenstacksServersGetParams) WithTimeout(timeout time.Duration) *ServiceBrokerOpenstacksServersGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker openstacks servers get params +func (o *ServiceBrokerOpenstacksServersGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker openstacks servers get params +func (o *ServiceBrokerOpenstacksServersGetParams) WithContext(ctx context.Context) *ServiceBrokerOpenstacksServersGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker openstacks servers get params +func (o *ServiceBrokerOpenstacksServersGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker openstacks servers get params +func (o *ServiceBrokerOpenstacksServersGetParams) WithHTTPClient(client *http.Client) *ServiceBrokerOpenstacksServersGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker openstacks servers get params +func (o *ServiceBrokerOpenstacksServersGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithOpenstackID adds the openstackID to the service broker openstacks servers get params +func (o *ServiceBrokerOpenstacksServersGetParams) WithOpenstackID(openstackID string) *ServiceBrokerOpenstacksServersGetParams { + o.SetOpenstackID(openstackID) + return o +} + +// SetOpenstackID adds the openstackId to the service broker openstacks servers get params +func (o *ServiceBrokerOpenstacksServersGetParams) SetOpenstackID(openstackID string) { + o.OpenstackID = openstackID +} + +// WithPvmInstanceID adds the pvmInstanceID to the service broker openstacks servers get params +func (o *ServiceBrokerOpenstacksServersGetParams) WithPvmInstanceID(pvmInstanceID string) *ServiceBrokerOpenstacksServersGetParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the service broker openstacks servers get params +func (o *ServiceBrokerOpenstacksServersGetParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerOpenstacksServersGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param openstack_id + if err := r.SetPathParam("openstack_id", o.OpenstackID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_servers_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_servers_get_responses.go new file mode 100644 index 00000000000..d52ebc75f71 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/open_stacks/service_broker_openstacks_servers_get_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package open_stacks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerOpenstacksServersGetReader is a Reader for the ServiceBrokerOpenstacksServersGet structure. +type ServiceBrokerOpenstacksServersGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerOpenstacksServersGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerOpenstacksServersGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceBrokerOpenstacksServersGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewServiceBrokerOpenstacksServersGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewServiceBrokerOpenstacksServersGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerOpenstacksServersGetOK creates a ServiceBrokerOpenstacksServersGetOK with default headers values +func NewServiceBrokerOpenstacksServersGetOK() *ServiceBrokerOpenstacksServersGetOK { + return &ServiceBrokerOpenstacksServersGetOK{} +} + +/* ServiceBrokerOpenstacksServersGetOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerOpenstacksServersGetOK struct { + Payload *models.HostPVMInstance +} + +func (o *ServiceBrokerOpenstacksServersGetOK) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/servers/{pvm_instance_id}][%d] serviceBrokerOpenstacksServersGetOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerOpenstacksServersGetOK) GetPayload() *models.HostPVMInstance { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksServersGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HostPVMInstance) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBrokerOpenstacksServersGetBadRequest creates a ServiceBrokerOpenstacksServersGetBadRequest with default headers values +func NewServiceBrokerOpenstacksServersGetBadRequest() *ServiceBrokerOpenstacksServersGetBadRequest { + return &ServiceBrokerOpenstacksServersGetBadRequest{} +} + +/* ServiceBrokerOpenstacksServersGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ServiceBrokerOpenstacksServersGetBadRequest struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksServersGetBadRequest) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/servers/{pvm_instance_id}][%d] serviceBrokerOpenstacksServersGetBadRequest %+v", 400, o.Payload) +} +func (o *ServiceBrokerOpenstacksServersGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksServersGetBadRequest) 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 +} + +// NewServiceBrokerOpenstacksServersGetNotFound creates a ServiceBrokerOpenstacksServersGetNotFound with default headers values +func NewServiceBrokerOpenstacksServersGetNotFound() *ServiceBrokerOpenstacksServersGetNotFound { + return &ServiceBrokerOpenstacksServersGetNotFound{} +} + +/* ServiceBrokerOpenstacksServersGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type ServiceBrokerOpenstacksServersGetNotFound struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksServersGetNotFound) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/servers/{pvm_instance_id}][%d] serviceBrokerOpenstacksServersGetNotFound %+v", 404, o.Payload) +} +func (o *ServiceBrokerOpenstacksServersGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksServersGetNotFound) 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 +} + +// NewServiceBrokerOpenstacksServersGetInternalServerError creates a ServiceBrokerOpenstacksServersGetInternalServerError with default headers values +func NewServiceBrokerOpenstacksServersGetInternalServerError() *ServiceBrokerOpenstacksServersGetInternalServerError { + return &ServiceBrokerOpenstacksServersGetInternalServerError{} +} + +/* ServiceBrokerOpenstacksServersGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerOpenstacksServersGetInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerOpenstacksServersGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /broker/v1/openstacks/{openstack_id}/servers/{pvm_instance_id}][%d] serviceBrokerOpenstacksServersGetInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerOpenstacksServersGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerOpenstacksServersGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/p_cloud_cloud_connections_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/p_cloud_cloud_connections_client.go new file mode 100644 index 00000000000..6b3a5437c37 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/p_cloud_cloud_connections_client.go @@ -0,0 +1,374 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud cloud connections API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud cloud connections API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudCloudconnectionsDelete(params *PcloudCloudconnectionsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsDeleteOK, *PcloudCloudconnectionsDeleteAccepted, error) + + PcloudCloudconnectionsGet(params *PcloudCloudconnectionsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsGetOK, error) + + PcloudCloudconnectionsGetall(params *PcloudCloudconnectionsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsGetallOK, error) + + PcloudCloudconnectionsNetworksDelete(params *PcloudCloudconnectionsNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsNetworksDeleteOK, *PcloudCloudconnectionsNetworksDeleteAccepted, error) + + PcloudCloudconnectionsNetworksPut(params *PcloudCloudconnectionsNetworksPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsNetworksPutOK, *PcloudCloudconnectionsNetworksPutAccepted, error) + + PcloudCloudconnectionsPost(params *PcloudCloudconnectionsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsPostOK, *PcloudCloudconnectionsPostCreated, *PcloudCloudconnectionsPostAccepted, error) + + PcloudCloudconnectionsPut(params *PcloudCloudconnectionsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsPutOK, *PcloudCloudconnectionsPutAccepted, error) + + PcloudCloudconnectionsVirtualprivatecloudsGetall(params *PcloudCloudconnectionsVirtualprivatecloudsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsVirtualprivatecloudsGetallOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudCloudconnectionsDelete deletes a cloud connection +*/ +func (a *Client) PcloudCloudconnectionsDelete(params *PcloudCloudconnectionsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsDeleteOK, *PcloudCloudconnectionsDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudconnectionsDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudconnections.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudconnectionsDeleteReader{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 *PcloudCloudconnectionsDeleteOK: + return value, nil, nil + case *PcloudCloudconnectionsDeleteAccepted: + 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 p_cloud_cloud_connections: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudconnectionsGet gets a cloud connection s state information +*/ +func (a *Client) PcloudCloudconnectionsGet(params *PcloudCloudconnectionsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudconnectionsGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudconnections.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudconnectionsGetReader{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.(*PcloudCloudconnectionsGetOK) + 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 pcloud.cloudconnections.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudconnectionsGetall gets all cloud connections in this cloud instance +*/ +func (a *Client) PcloudCloudconnectionsGetall(params *PcloudCloudconnectionsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudconnectionsGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudconnections.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudconnectionsGetallReader{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.(*PcloudCloudconnectionsGetallOK) + 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 pcloud.cloudconnections.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudconnectionsNetworksDelete deletes a network from a cloud connection +*/ +func (a *Client) PcloudCloudconnectionsNetworksDelete(params *PcloudCloudconnectionsNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsNetworksDeleteOK, *PcloudCloudconnectionsNetworksDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudconnectionsNetworksDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudconnections.networks.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudconnectionsNetworksDeleteReader{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 *PcloudCloudconnectionsNetworksDeleteOK: + return value, nil, nil + case *PcloudCloudconnectionsNetworksDeleteAccepted: + 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 p_cloud_cloud_connections: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudconnectionsNetworksPut adds a network to the cloud connection +*/ +func (a *Client) PcloudCloudconnectionsNetworksPut(params *PcloudCloudconnectionsNetworksPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsNetworksPutOK, *PcloudCloudconnectionsNetworksPutAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudconnectionsNetworksPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudconnections.networks.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudconnectionsNetworksPutReader{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 *PcloudCloudconnectionsNetworksPutOK: + return value, nil, nil + case *PcloudCloudconnectionsNetworksPutAccepted: + 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 p_cloud_cloud_connections: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudconnectionsPost creates a new cloud connection +*/ +func (a *Client) PcloudCloudconnectionsPost(params *PcloudCloudconnectionsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsPostOK, *PcloudCloudconnectionsPostCreated, *PcloudCloudconnectionsPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudconnectionsPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudconnections.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudconnectionsPostReader{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, nil, err + } + switch value := result.(type) { + case *PcloudCloudconnectionsPostOK: + return value, nil, nil, nil + case *PcloudCloudconnectionsPostCreated: + return nil, value, nil, nil + case *PcloudCloudconnectionsPostAccepted: + return nil, 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 p_cloud_cloud_connections: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudconnectionsPut updates a cloud connection +*/ +func (a *Client) PcloudCloudconnectionsPut(params *PcloudCloudconnectionsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsPutOK, *PcloudCloudconnectionsPutAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudconnectionsPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudconnections.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudconnectionsPutReader{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 *PcloudCloudconnectionsPutOK: + return value, nil, nil + case *PcloudCloudconnectionsPutAccepted: + 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 p_cloud_cloud_connections: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudconnectionsVirtualprivatecloudsGetall gets all virtual private cloud connections in this cloud instance +*/ +func (a *Client) PcloudCloudconnectionsVirtualprivatecloudsGetall(params *PcloudCloudconnectionsVirtualprivatecloudsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudconnectionsVirtualprivatecloudsGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudconnectionsVirtualprivatecloudsGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudconnections.virtualprivateclouds.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections-virtual-private-clouds", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudconnectionsVirtualprivatecloudsGetallReader{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.(*PcloudCloudconnectionsVirtualprivatecloudsGetallOK) + 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 pcloud.cloudconnections.virtualprivateclouds.getall: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_delete_parameters.go new file mode 100644 index 00000000000..9cbc14c98f4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_delete_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// 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" +) + +// NewPcloudCloudconnectionsDeleteParams creates a new PcloudCloudconnectionsDeleteParams 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 NewPcloudCloudconnectionsDeleteParams() *PcloudCloudconnectionsDeleteParams { + return &PcloudCloudconnectionsDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudconnectionsDeleteParamsWithTimeout creates a new PcloudCloudconnectionsDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudconnectionsDeleteParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsDeleteParams { + return &PcloudCloudconnectionsDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudCloudconnectionsDeleteParamsWithContext creates a new PcloudCloudconnectionsDeleteParams object +// with the ability to set a context for a request. +func NewPcloudCloudconnectionsDeleteParamsWithContext(ctx context.Context) *PcloudCloudconnectionsDeleteParams { + return &PcloudCloudconnectionsDeleteParams{ + Context: ctx, + } +} + +// NewPcloudCloudconnectionsDeleteParamsWithHTTPClient creates a new PcloudCloudconnectionsDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudconnectionsDeleteParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsDeleteParams { + return &PcloudCloudconnectionsDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudCloudconnectionsDeleteParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudconnectionsDeleteParams struct { + + /* CloudConnectionID. + + Cloud Connection ID + */ + CloudConnectionID string + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudconnections delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsDeleteParams) WithDefaults() *PcloudCloudconnectionsDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudconnections delete params +func (o *PcloudCloudconnectionsDeleteParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudconnections delete params +func (o *PcloudCloudconnectionsDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudconnections delete params +func (o *PcloudCloudconnectionsDeleteParams) WithContext(ctx context.Context) *PcloudCloudconnectionsDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudconnections delete params +func (o *PcloudCloudconnectionsDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudconnections delete params +func (o *PcloudCloudconnectionsDeleteParams) WithHTTPClient(client *http.Client) *PcloudCloudconnectionsDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudconnections delete params +func (o *PcloudCloudconnectionsDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudConnectionID adds the cloudConnectionID to the pcloud cloudconnections delete params +func (o *PcloudCloudconnectionsDeleteParams) WithCloudConnectionID(cloudConnectionID string) *PcloudCloudconnectionsDeleteParams { + o.SetCloudConnectionID(cloudConnectionID) + return o +} + +// SetCloudConnectionID adds the cloudConnectionId to the pcloud cloudconnections delete params +func (o *PcloudCloudconnectionsDeleteParams) SetCloudConnectionID(cloudConnectionID string) { + o.CloudConnectionID = cloudConnectionID +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudconnections delete params +func (o *PcloudCloudconnectionsDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudconnectionsDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudconnections delete params +func (o *PcloudCloudconnectionsDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudconnectionsDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_connection_id + if err := r.SetPathParam("cloud_connection_id", o.CloudConnectionID); err != nil { + return err + } + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_delete_responses.go new file mode 100644 index 00000000000..6d5d1c69029 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_delete_responses.go @@ -0,0 +1,255 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudconnectionsDeleteReader is a Reader for the PcloudCloudconnectionsDelete structure. +type PcloudCloudconnectionsDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudconnectionsDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudconnectionsDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 202: + result := NewPcloudCloudconnectionsDeleteAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudconnectionsDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudconnectionsDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewPcloudCloudconnectionsDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudconnectionsDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudconnectionsDeleteOK creates a PcloudCloudconnectionsDeleteOK with default headers values +func NewPcloudCloudconnectionsDeleteOK() *PcloudCloudconnectionsDeleteOK { + return &PcloudCloudconnectionsDeleteOK{} +} + +/* PcloudCloudconnectionsDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudconnectionsDeleteOK struct { + Payload models.Object +} + +func (o *PcloudCloudconnectionsDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudCloudconnectionsDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudCloudconnectionsDeleteOK) 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 +} + +// NewPcloudCloudconnectionsDeleteAccepted creates a PcloudCloudconnectionsDeleteAccepted with default headers values +func NewPcloudCloudconnectionsDeleteAccepted() *PcloudCloudconnectionsDeleteAccepted { + return &PcloudCloudconnectionsDeleteAccepted{} +} + +/* PcloudCloudconnectionsDeleteAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudCloudconnectionsDeleteAccepted struct { + Payload *models.JobReference +} + +func (o *PcloudCloudconnectionsDeleteAccepted) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsDeleteAccepted %+v", 202, o.Payload) +} +func (o *PcloudCloudconnectionsDeleteAccepted) GetPayload() *models.JobReference { + return o.Payload +} + +func (o *PcloudCloudconnectionsDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.JobReference) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudconnectionsDeleteBadRequest creates a PcloudCloudconnectionsDeleteBadRequest with default headers values +func NewPcloudCloudconnectionsDeleteBadRequest() *PcloudCloudconnectionsDeleteBadRequest { + return &PcloudCloudconnectionsDeleteBadRequest{} +} + +/* PcloudCloudconnectionsDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudconnectionsDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudconnectionsDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsDeleteBadRequest) 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 +} + +// NewPcloudCloudconnectionsDeleteUnauthorized creates a PcloudCloudconnectionsDeleteUnauthorized with default headers values +func NewPcloudCloudconnectionsDeleteUnauthorized() *PcloudCloudconnectionsDeleteUnauthorized { + return &PcloudCloudconnectionsDeleteUnauthorized{} +} + +/* PcloudCloudconnectionsDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudconnectionsDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudconnectionsDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsDeleteUnauthorized) 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 +} + +// NewPcloudCloudconnectionsDeleteGone creates a PcloudCloudconnectionsDeleteGone with default headers values +func NewPcloudCloudconnectionsDeleteGone() *PcloudCloudconnectionsDeleteGone { + return &PcloudCloudconnectionsDeleteGone{} +} + +/* PcloudCloudconnectionsDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudCloudconnectionsDeleteGone struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsDeleteGone) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsDeleteGone %+v", 410, o.Payload) +} +func (o *PcloudCloudconnectionsDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsDeleteGone) 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 +} + +// NewPcloudCloudconnectionsDeleteInternalServerError creates a PcloudCloudconnectionsDeleteInternalServerError with default headers values +func NewPcloudCloudconnectionsDeleteInternalServerError() *PcloudCloudconnectionsDeleteInternalServerError { + return &PcloudCloudconnectionsDeleteInternalServerError{} +} + +/* PcloudCloudconnectionsDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudconnectionsDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudconnectionsDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_get_parameters.go new file mode 100644 index 00000000000..16a386f8d24 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// 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" +) + +// NewPcloudCloudconnectionsGetParams creates a new PcloudCloudconnectionsGetParams 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 NewPcloudCloudconnectionsGetParams() *PcloudCloudconnectionsGetParams { + return &PcloudCloudconnectionsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudconnectionsGetParamsWithTimeout creates a new PcloudCloudconnectionsGetParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudconnectionsGetParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsGetParams { + return &PcloudCloudconnectionsGetParams{ + timeout: timeout, + } +} + +// NewPcloudCloudconnectionsGetParamsWithContext creates a new PcloudCloudconnectionsGetParams object +// with the ability to set a context for a request. +func NewPcloudCloudconnectionsGetParamsWithContext(ctx context.Context) *PcloudCloudconnectionsGetParams { + return &PcloudCloudconnectionsGetParams{ + Context: ctx, + } +} + +// NewPcloudCloudconnectionsGetParamsWithHTTPClient creates a new PcloudCloudconnectionsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudconnectionsGetParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsGetParams { + return &PcloudCloudconnectionsGetParams{ + HTTPClient: client, + } +} + +/* PcloudCloudconnectionsGetParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections get operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudconnectionsGetParams struct { + + /* CloudConnectionID. + + Cloud Connection ID + */ + CloudConnectionID string + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudconnections get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsGetParams) WithDefaults() *PcloudCloudconnectionsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudconnections get params +func (o *PcloudCloudconnectionsGetParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudconnections get params +func (o *PcloudCloudconnectionsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudconnections get params +func (o *PcloudCloudconnectionsGetParams) WithContext(ctx context.Context) *PcloudCloudconnectionsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudconnections get params +func (o *PcloudCloudconnectionsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudconnections get params +func (o *PcloudCloudconnectionsGetParams) WithHTTPClient(client *http.Client) *PcloudCloudconnectionsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudconnections get params +func (o *PcloudCloudconnectionsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudConnectionID adds the cloudConnectionID to the pcloud cloudconnections get params +func (o *PcloudCloudconnectionsGetParams) WithCloudConnectionID(cloudConnectionID string) *PcloudCloudconnectionsGetParams { + o.SetCloudConnectionID(cloudConnectionID) + return o +} + +// SetCloudConnectionID adds the cloudConnectionId to the pcloud cloudconnections get params +func (o *PcloudCloudconnectionsGetParams) SetCloudConnectionID(cloudConnectionID string) { + o.CloudConnectionID = cloudConnectionID +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudconnections get params +func (o *PcloudCloudconnectionsGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudconnectionsGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudconnections get params +func (o *PcloudCloudconnectionsGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudconnectionsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_connection_id + if err := r.SetPathParam("cloud_connection_id", o.CloudConnectionID); err != nil { + return err + } + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_get_responses.go new file mode 100644 index 00000000000..5a75e69a4c4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudconnectionsGetReader is a Reader for the PcloudCloudconnectionsGet structure. +type PcloudCloudconnectionsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudconnectionsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudconnectionsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudconnectionsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudconnectionsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudconnectionsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudconnectionsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudconnectionsGetOK creates a PcloudCloudconnectionsGetOK with default headers values +func NewPcloudCloudconnectionsGetOK() *PcloudCloudconnectionsGetOK { + return &PcloudCloudconnectionsGetOK{} +} + +/* PcloudCloudconnectionsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudconnectionsGetOK struct { + Payload *models.CloudConnection +} + +func (o *PcloudCloudconnectionsGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsGetOK %+v", 200, o.Payload) +} +func (o *PcloudCloudconnectionsGetOK) GetPayload() *models.CloudConnection { + return o.Payload +} + +func (o *PcloudCloudconnectionsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CloudConnection) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudconnectionsGetBadRequest creates a PcloudCloudconnectionsGetBadRequest with default headers values +func NewPcloudCloudconnectionsGetBadRequest() *PcloudCloudconnectionsGetBadRequest { + return &PcloudCloudconnectionsGetBadRequest{} +} + +/* PcloudCloudconnectionsGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudconnectionsGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudconnectionsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsGetBadRequest) 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 +} + +// NewPcloudCloudconnectionsGetUnauthorized creates a PcloudCloudconnectionsGetUnauthorized with default headers values +func NewPcloudCloudconnectionsGetUnauthorized() *PcloudCloudconnectionsGetUnauthorized { + return &PcloudCloudconnectionsGetUnauthorized{} +} + +/* PcloudCloudconnectionsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudconnectionsGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudconnectionsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsGetUnauthorized) 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 +} + +// NewPcloudCloudconnectionsGetNotFound creates a PcloudCloudconnectionsGetNotFound with default headers values +func NewPcloudCloudconnectionsGetNotFound() *PcloudCloudconnectionsGetNotFound { + return &PcloudCloudconnectionsGetNotFound{} +} + +/* PcloudCloudconnectionsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudconnectionsGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudconnectionsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsGetNotFound) 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 +} + +// NewPcloudCloudconnectionsGetInternalServerError creates a PcloudCloudconnectionsGetInternalServerError with default headers values +func NewPcloudCloudconnectionsGetInternalServerError() *PcloudCloudconnectionsGetInternalServerError { + return &PcloudCloudconnectionsGetInternalServerError{} +} + +/* PcloudCloudconnectionsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudconnectionsGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudconnectionsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_getall_parameters.go new file mode 100644 index 00000000000..ab74a7af066 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_getall_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// 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" +) + +// NewPcloudCloudconnectionsGetallParams creates a new PcloudCloudconnectionsGetallParams 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 NewPcloudCloudconnectionsGetallParams() *PcloudCloudconnectionsGetallParams { + return &PcloudCloudconnectionsGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudconnectionsGetallParamsWithTimeout creates a new PcloudCloudconnectionsGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudconnectionsGetallParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsGetallParams { + return &PcloudCloudconnectionsGetallParams{ + timeout: timeout, + } +} + +// NewPcloudCloudconnectionsGetallParamsWithContext creates a new PcloudCloudconnectionsGetallParams object +// with the ability to set a context for a request. +func NewPcloudCloudconnectionsGetallParamsWithContext(ctx context.Context) *PcloudCloudconnectionsGetallParams { + return &PcloudCloudconnectionsGetallParams{ + Context: ctx, + } +} + +// NewPcloudCloudconnectionsGetallParamsWithHTTPClient creates a new PcloudCloudconnectionsGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudconnectionsGetallParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsGetallParams { + return &PcloudCloudconnectionsGetallParams{ + HTTPClient: client, + } +} + +/* PcloudCloudconnectionsGetallParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudconnectionsGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudconnections getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsGetallParams) WithDefaults() *PcloudCloudconnectionsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudconnections getall params +func (o *PcloudCloudconnectionsGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudconnections getall params +func (o *PcloudCloudconnectionsGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudconnections getall params +func (o *PcloudCloudconnectionsGetallParams) WithContext(ctx context.Context) *PcloudCloudconnectionsGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudconnections getall params +func (o *PcloudCloudconnectionsGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudconnections getall params +func (o *PcloudCloudconnectionsGetallParams) WithHTTPClient(client *http.Client) *PcloudCloudconnectionsGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudconnections getall params +func (o *PcloudCloudconnectionsGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudconnections getall params +func (o *PcloudCloudconnectionsGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudconnectionsGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudconnections getall params +func (o *PcloudCloudconnectionsGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudconnectionsGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_getall_responses.go new file mode 100644 index 00000000000..f096d6de76a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_getall_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudconnectionsGetallReader is a Reader for the PcloudCloudconnectionsGetall structure. +type PcloudCloudconnectionsGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudconnectionsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudconnectionsGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudconnectionsGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudconnectionsGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 408: + result := NewPcloudCloudconnectionsGetallRequestTimeout() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudconnectionsGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudconnectionsGetallOK creates a PcloudCloudconnectionsGetallOK with default headers values +func NewPcloudCloudconnectionsGetallOK() *PcloudCloudconnectionsGetallOK { + return &PcloudCloudconnectionsGetallOK{} +} + +/* PcloudCloudconnectionsGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudconnectionsGetallOK struct { + Payload *models.CloudConnections +} + +func (o *PcloudCloudconnectionsGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsGetallOK %+v", 200, o.Payload) +} +func (o *PcloudCloudconnectionsGetallOK) GetPayload() *models.CloudConnections { + return o.Payload +} + +func (o *PcloudCloudconnectionsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CloudConnections) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudconnectionsGetallBadRequest creates a PcloudCloudconnectionsGetallBadRequest with default headers values +func NewPcloudCloudconnectionsGetallBadRequest() *PcloudCloudconnectionsGetallBadRequest { + return &PcloudCloudconnectionsGetallBadRequest{} +} + +/* PcloudCloudconnectionsGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudconnectionsGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudconnectionsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsGetallBadRequest) 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 +} + +// NewPcloudCloudconnectionsGetallUnauthorized creates a PcloudCloudconnectionsGetallUnauthorized with default headers values +func NewPcloudCloudconnectionsGetallUnauthorized() *PcloudCloudconnectionsGetallUnauthorized { + return &PcloudCloudconnectionsGetallUnauthorized{} +} + +/* PcloudCloudconnectionsGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudconnectionsGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudconnectionsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsGetallUnauthorized) 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 +} + +// NewPcloudCloudconnectionsGetallRequestTimeout creates a PcloudCloudconnectionsGetallRequestTimeout with default headers values +func NewPcloudCloudconnectionsGetallRequestTimeout() *PcloudCloudconnectionsGetallRequestTimeout { + return &PcloudCloudconnectionsGetallRequestTimeout{} +} + +/* PcloudCloudconnectionsGetallRequestTimeout describes a response with status code 408, with default header values. + +Request Timeout +*/ +type PcloudCloudconnectionsGetallRequestTimeout struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsGetallRequestTimeout) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsGetallRequestTimeout %+v", 408, o.Payload) +} +func (o *PcloudCloudconnectionsGetallRequestTimeout) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsGetallRequestTimeout) 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 +} + +// NewPcloudCloudconnectionsGetallInternalServerError creates a PcloudCloudconnectionsGetallInternalServerError with default headers values +func NewPcloudCloudconnectionsGetallInternalServerError() *PcloudCloudconnectionsGetallInternalServerError { + return &PcloudCloudconnectionsGetallInternalServerError{} +} + +/* PcloudCloudconnectionsGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudconnectionsGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudconnectionsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_delete_parameters.go new file mode 100644 index 00000000000..e3c9466d439 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_delete_parameters.go @@ -0,0 +1,193 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// 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" +) + +// NewPcloudCloudconnectionsNetworksDeleteParams creates a new PcloudCloudconnectionsNetworksDeleteParams 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 NewPcloudCloudconnectionsNetworksDeleteParams() *PcloudCloudconnectionsNetworksDeleteParams { + return &PcloudCloudconnectionsNetworksDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudconnectionsNetworksDeleteParamsWithTimeout creates a new PcloudCloudconnectionsNetworksDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudconnectionsNetworksDeleteParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsNetworksDeleteParams { + return &PcloudCloudconnectionsNetworksDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudCloudconnectionsNetworksDeleteParamsWithContext creates a new PcloudCloudconnectionsNetworksDeleteParams object +// with the ability to set a context for a request. +func NewPcloudCloudconnectionsNetworksDeleteParamsWithContext(ctx context.Context) *PcloudCloudconnectionsNetworksDeleteParams { + return &PcloudCloudconnectionsNetworksDeleteParams{ + Context: ctx, + } +} + +// NewPcloudCloudconnectionsNetworksDeleteParamsWithHTTPClient creates a new PcloudCloudconnectionsNetworksDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudconnectionsNetworksDeleteParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsNetworksDeleteParams { + return &PcloudCloudconnectionsNetworksDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudCloudconnectionsNetworksDeleteParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections networks delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudconnectionsNetworksDeleteParams struct { + + /* CloudConnectionID. + + Cloud Connection ID + */ + CloudConnectionID string + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* NetworkID. + + Network ID + */ + NetworkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudconnections networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsNetworksDeleteParams) WithDefaults() *PcloudCloudconnectionsNetworksDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsNetworksDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudconnections networks delete params +func (o *PcloudCloudconnectionsNetworksDeleteParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsNetworksDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudconnections networks delete params +func (o *PcloudCloudconnectionsNetworksDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudconnections networks delete params +func (o *PcloudCloudconnectionsNetworksDeleteParams) WithContext(ctx context.Context) *PcloudCloudconnectionsNetworksDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudconnections networks delete params +func (o *PcloudCloudconnectionsNetworksDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudconnections networks delete params +func (o *PcloudCloudconnectionsNetworksDeleteParams) WithHTTPClient(client *http.Client) *PcloudCloudconnectionsNetworksDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudconnections networks delete params +func (o *PcloudCloudconnectionsNetworksDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudConnectionID adds the cloudConnectionID to the pcloud cloudconnections networks delete params +func (o *PcloudCloudconnectionsNetworksDeleteParams) WithCloudConnectionID(cloudConnectionID string) *PcloudCloudconnectionsNetworksDeleteParams { + o.SetCloudConnectionID(cloudConnectionID) + return o +} + +// SetCloudConnectionID adds the cloudConnectionId to the pcloud cloudconnections networks delete params +func (o *PcloudCloudconnectionsNetworksDeleteParams) SetCloudConnectionID(cloudConnectionID string) { + o.CloudConnectionID = cloudConnectionID +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudconnections networks delete params +func (o *PcloudCloudconnectionsNetworksDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudconnectionsNetworksDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudconnections networks delete params +func (o *PcloudCloudconnectionsNetworksDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithNetworkID adds the networkID to the pcloud cloudconnections networks delete params +func (o *PcloudCloudconnectionsNetworksDeleteParams) WithNetworkID(networkID string) *PcloudCloudconnectionsNetworksDeleteParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the pcloud cloudconnections networks delete params +func (o *PcloudCloudconnectionsNetworksDeleteParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudconnectionsNetworksDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_connection_id + if err := r.SetPathParam("cloud_connection_id", o.CloudConnectionID); err != nil { + return err + } + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_delete_responses.go new file mode 100644 index 00000000000..02137028515 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_delete_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudconnectionsNetworksDeleteReader is a Reader for the PcloudCloudconnectionsNetworksDelete structure. +type PcloudCloudconnectionsNetworksDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudconnectionsNetworksDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudconnectionsNetworksDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 202: + result := NewPcloudCloudconnectionsNetworksDeleteAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudconnectionsNetworksDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudconnectionsNetworksDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewPcloudCloudconnectionsNetworksDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudconnectionsNetworksDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudconnectionsNetworksDeleteOK creates a PcloudCloudconnectionsNetworksDeleteOK with default headers values +func NewPcloudCloudconnectionsNetworksDeleteOK() *PcloudCloudconnectionsNetworksDeleteOK { + return &PcloudCloudconnectionsNetworksDeleteOK{} +} + +/* PcloudCloudconnectionsNetworksDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudconnectionsNetworksDeleteOK struct { + Payload *models.CloudConnection +} + +func (o *PcloudCloudconnectionsNetworksDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudCloudconnectionsNetworksDeleteOK) GetPayload() *models.CloudConnection { + return o.Payload +} + +func (o *PcloudCloudconnectionsNetworksDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CloudConnection) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudconnectionsNetworksDeleteAccepted creates a PcloudCloudconnectionsNetworksDeleteAccepted with default headers values +func NewPcloudCloudconnectionsNetworksDeleteAccepted() *PcloudCloudconnectionsNetworksDeleteAccepted { + return &PcloudCloudconnectionsNetworksDeleteAccepted{} +} + +/* PcloudCloudconnectionsNetworksDeleteAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudCloudconnectionsNetworksDeleteAccepted struct { + Payload *models.JobReference +} + +func (o *PcloudCloudconnectionsNetworksDeleteAccepted) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksDeleteAccepted %+v", 202, o.Payload) +} +func (o *PcloudCloudconnectionsNetworksDeleteAccepted) GetPayload() *models.JobReference { + return o.Payload +} + +func (o *PcloudCloudconnectionsNetworksDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.JobReference) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudconnectionsNetworksDeleteBadRequest creates a PcloudCloudconnectionsNetworksDeleteBadRequest with default headers values +func NewPcloudCloudconnectionsNetworksDeleteBadRequest() *PcloudCloudconnectionsNetworksDeleteBadRequest { + return &PcloudCloudconnectionsNetworksDeleteBadRequest{} +} + +/* PcloudCloudconnectionsNetworksDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudconnectionsNetworksDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsNetworksDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudconnectionsNetworksDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsNetworksDeleteBadRequest) 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 +} + +// NewPcloudCloudconnectionsNetworksDeleteUnauthorized creates a PcloudCloudconnectionsNetworksDeleteUnauthorized with default headers values +func NewPcloudCloudconnectionsNetworksDeleteUnauthorized() *PcloudCloudconnectionsNetworksDeleteUnauthorized { + return &PcloudCloudconnectionsNetworksDeleteUnauthorized{} +} + +/* PcloudCloudconnectionsNetworksDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudconnectionsNetworksDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsNetworksDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudconnectionsNetworksDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsNetworksDeleteUnauthorized) 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 +} + +// NewPcloudCloudconnectionsNetworksDeleteGone creates a PcloudCloudconnectionsNetworksDeleteGone with default headers values +func NewPcloudCloudconnectionsNetworksDeleteGone() *PcloudCloudconnectionsNetworksDeleteGone { + return &PcloudCloudconnectionsNetworksDeleteGone{} +} + +/* PcloudCloudconnectionsNetworksDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudCloudconnectionsNetworksDeleteGone struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsNetworksDeleteGone) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksDeleteGone %+v", 410, o.Payload) +} +func (o *PcloudCloudconnectionsNetworksDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsNetworksDeleteGone) 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 +} + +// NewPcloudCloudconnectionsNetworksDeleteInternalServerError creates a PcloudCloudconnectionsNetworksDeleteInternalServerError with default headers values +func NewPcloudCloudconnectionsNetworksDeleteInternalServerError() *PcloudCloudconnectionsNetworksDeleteInternalServerError { + return &PcloudCloudconnectionsNetworksDeleteInternalServerError{} +} + +/* PcloudCloudconnectionsNetworksDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudconnectionsNetworksDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsNetworksDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudconnectionsNetworksDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsNetworksDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_put_parameters.go new file mode 100644 index 00000000000..c19e5e7ad4a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_put_parameters.go @@ -0,0 +1,193 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// 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" +) + +// NewPcloudCloudconnectionsNetworksPutParams creates a new PcloudCloudconnectionsNetworksPutParams 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 NewPcloudCloudconnectionsNetworksPutParams() *PcloudCloudconnectionsNetworksPutParams { + return &PcloudCloudconnectionsNetworksPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudconnectionsNetworksPutParamsWithTimeout creates a new PcloudCloudconnectionsNetworksPutParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudconnectionsNetworksPutParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsNetworksPutParams { + return &PcloudCloudconnectionsNetworksPutParams{ + timeout: timeout, + } +} + +// NewPcloudCloudconnectionsNetworksPutParamsWithContext creates a new PcloudCloudconnectionsNetworksPutParams object +// with the ability to set a context for a request. +func NewPcloudCloudconnectionsNetworksPutParamsWithContext(ctx context.Context) *PcloudCloudconnectionsNetworksPutParams { + return &PcloudCloudconnectionsNetworksPutParams{ + Context: ctx, + } +} + +// NewPcloudCloudconnectionsNetworksPutParamsWithHTTPClient creates a new PcloudCloudconnectionsNetworksPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudconnectionsNetworksPutParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsNetworksPutParams { + return &PcloudCloudconnectionsNetworksPutParams{ + HTTPClient: client, + } +} + +/* PcloudCloudconnectionsNetworksPutParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections networks put operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudconnectionsNetworksPutParams struct { + + /* CloudConnectionID. + + Cloud Connection ID + */ + CloudConnectionID string + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* NetworkID. + + Network ID + */ + NetworkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudconnections networks put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsNetworksPutParams) WithDefaults() *PcloudCloudconnectionsNetworksPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections networks put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsNetworksPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudconnections networks put params +func (o *PcloudCloudconnectionsNetworksPutParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsNetworksPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudconnections networks put params +func (o *PcloudCloudconnectionsNetworksPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudconnections networks put params +func (o *PcloudCloudconnectionsNetworksPutParams) WithContext(ctx context.Context) *PcloudCloudconnectionsNetworksPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudconnections networks put params +func (o *PcloudCloudconnectionsNetworksPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudconnections networks put params +func (o *PcloudCloudconnectionsNetworksPutParams) WithHTTPClient(client *http.Client) *PcloudCloudconnectionsNetworksPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudconnections networks put params +func (o *PcloudCloudconnectionsNetworksPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudConnectionID adds the cloudConnectionID to the pcloud cloudconnections networks put params +func (o *PcloudCloudconnectionsNetworksPutParams) WithCloudConnectionID(cloudConnectionID string) *PcloudCloudconnectionsNetworksPutParams { + o.SetCloudConnectionID(cloudConnectionID) + return o +} + +// SetCloudConnectionID adds the cloudConnectionId to the pcloud cloudconnections networks put params +func (o *PcloudCloudconnectionsNetworksPutParams) SetCloudConnectionID(cloudConnectionID string) { + o.CloudConnectionID = cloudConnectionID +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudconnections networks put params +func (o *PcloudCloudconnectionsNetworksPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudconnectionsNetworksPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudconnections networks put params +func (o *PcloudCloudconnectionsNetworksPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithNetworkID adds the networkID to the pcloud cloudconnections networks put params +func (o *PcloudCloudconnectionsNetworksPutParams) WithNetworkID(networkID string) *PcloudCloudconnectionsNetworksPutParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the pcloud cloudconnections networks put params +func (o *PcloudCloudconnectionsNetworksPutParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudconnectionsNetworksPutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_connection_id + if err := r.SetPathParam("cloud_connection_id", o.CloudConnectionID); err != nil { + return err + } + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_put_responses.go new file mode 100644 index 00000000000..e4abe1cc082 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_networks_put_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudconnectionsNetworksPutReader is a Reader for the PcloudCloudconnectionsNetworksPut structure. +type PcloudCloudconnectionsNetworksPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudconnectionsNetworksPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudconnectionsNetworksPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 202: + result := NewPcloudCloudconnectionsNetworksPutAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudconnectionsNetworksPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudconnectionsNetworksPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudCloudconnectionsNetworksPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudconnectionsNetworksPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudconnectionsNetworksPutOK creates a PcloudCloudconnectionsNetworksPutOK with default headers values +func NewPcloudCloudconnectionsNetworksPutOK() *PcloudCloudconnectionsNetworksPutOK { + return &PcloudCloudconnectionsNetworksPutOK{} +} + +/* PcloudCloudconnectionsNetworksPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudconnectionsNetworksPutOK struct { + Payload *models.CloudConnection +} + +func (o *PcloudCloudconnectionsNetworksPutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksPutOK %+v", 200, o.Payload) +} +func (o *PcloudCloudconnectionsNetworksPutOK) GetPayload() *models.CloudConnection { + return o.Payload +} + +func (o *PcloudCloudconnectionsNetworksPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CloudConnection) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudconnectionsNetworksPutAccepted creates a PcloudCloudconnectionsNetworksPutAccepted with default headers values +func NewPcloudCloudconnectionsNetworksPutAccepted() *PcloudCloudconnectionsNetworksPutAccepted { + return &PcloudCloudconnectionsNetworksPutAccepted{} +} + +/* PcloudCloudconnectionsNetworksPutAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudCloudconnectionsNetworksPutAccepted struct { + Payload *models.JobReference +} + +func (o *PcloudCloudconnectionsNetworksPutAccepted) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksPutAccepted %+v", 202, o.Payload) +} +func (o *PcloudCloudconnectionsNetworksPutAccepted) GetPayload() *models.JobReference { + return o.Payload +} + +func (o *PcloudCloudconnectionsNetworksPutAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.JobReference) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudconnectionsNetworksPutBadRequest creates a PcloudCloudconnectionsNetworksPutBadRequest with default headers values +func NewPcloudCloudconnectionsNetworksPutBadRequest() *PcloudCloudconnectionsNetworksPutBadRequest { + return &PcloudCloudconnectionsNetworksPutBadRequest{} +} + +/* PcloudCloudconnectionsNetworksPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudconnectionsNetworksPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsNetworksPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudconnectionsNetworksPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsNetworksPutBadRequest) 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 +} + +// NewPcloudCloudconnectionsNetworksPutUnauthorized creates a PcloudCloudconnectionsNetworksPutUnauthorized with default headers values +func NewPcloudCloudconnectionsNetworksPutUnauthorized() *PcloudCloudconnectionsNetworksPutUnauthorized { + return &PcloudCloudconnectionsNetworksPutUnauthorized{} +} + +/* PcloudCloudconnectionsNetworksPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudconnectionsNetworksPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsNetworksPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudconnectionsNetworksPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsNetworksPutUnauthorized) 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 +} + +// NewPcloudCloudconnectionsNetworksPutUnprocessableEntity creates a PcloudCloudconnectionsNetworksPutUnprocessableEntity with default headers values +func NewPcloudCloudconnectionsNetworksPutUnprocessableEntity() *PcloudCloudconnectionsNetworksPutUnprocessableEntity { + return &PcloudCloudconnectionsNetworksPutUnprocessableEntity{} +} + +/* PcloudCloudconnectionsNetworksPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudCloudconnectionsNetworksPutUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsNetworksPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksPutUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudCloudconnectionsNetworksPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsNetworksPutUnprocessableEntity) 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 +} + +// NewPcloudCloudconnectionsNetworksPutInternalServerError creates a PcloudCloudconnectionsNetworksPutInternalServerError with default headers values +func NewPcloudCloudconnectionsNetworksPutInternalServerError() *PcloudCloudconnectionsNetworksPutInternalServerError { + return &PcloudCloudconnectionsNetworksPutInternalServerError{} +} + +/* PcloudCloudconnectionsNetworksPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudconnectionsNetworksPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsNetworksPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}/networks/{network_id}][%d] pcloudCloudconnectionsNetworksPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudconnectionsNetworksPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsNetworksPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_parameters.go new file mode 100644 index 00000000000..71ee602f8c9 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// 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" +) + +// NewPcloudCloudconnectionsPostParams creates a new PcloudCloudconnectionsPostParams 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 NewPcloudCloudconnectionsPostParams() *PcloudCloudconnectionsPostParams { + return &PcloudCloudconnectionsPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudconnectionsPostParamsWithTimeout creates a new PcloudCloudconnectionsPostParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudconnectionsPostParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsPostParams { + return &PcloudCloudconnectionsPostParams{ + timeout: timeout, + } +} + +// NewPcloudCloudconnectionsPostParamsWithContext creates a new PcloudCloudconnectionsPostParams object +// with the ability to set a context for a request. +func NewPcloudCloudconnectionsPostParamsWithContext(ctx context.Context) *PcloudCloudconnectionsPostParams { + return &PcloudCloudconnectionsPostParams{ + Context: ctx, + } +} + +// NewPcloudCloudconnectionsPostParamsWithHTTPClient creates a new PcloudCloudconnectionsPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudconnectionsPostParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsPostParams { + return &PcloudCloudconnectionsPostParams{ + HTTPClient: client, + } +} + +/* PcloudCloudconnectionsPostParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections post operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudconnectionsPostParams struct { + + /* Body. + + Parameters for the creation of a new cloud connection + */ + Body *models.CloudConnectionCreate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudconnections post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsPostParams) WithDefaults() *PcloudCloudconnectionsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudconnections post params +func (o *PcloudCloudconnectionsPostParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudconnections post params +func (o *PcloudCloudconnectionsPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudconnections post params +func (o *PcloudCloudconnectionsPostParams) WithContext(ctx context.Context) *PcloudCloudconnectionsPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudconnections post params +func (o *PcloudCloudconnectionsPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudconnections post params +func (o *PcloudCloudconnectionsPostParams) WithHTTPClient(client *http.Client) *PcloudCloudconnectionsPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudconnections post params +func (o *PcloudCloudconnectionsPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud cloudconnections post params +func (o *PcloudCloudconnectionsPostParams) WithBody(body *models.CloudConnectionCreate) *PcloudCloudconnectionsPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud cloudconnections post params +func (o *PcloudCloudconnectionsPostParams) SetBody(body *models.CloudConnectionCreate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudconnections post params +func (o *PcloudCloudconnectionsPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudconnectionsPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudconnections post params +func (o *PcloudCloudconnectionsPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudconnectionsPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_responses.go new file mode 100644 index 00000000000..b0f46e4e926 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_post_responses.go @@ -0,0 +1,333 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudconnectionsPostReader is a Reader for the PcloudCloudconnectionsPost structure. +type PcloudCloudconnectionsPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudconnectionsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudconnectionsPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 201: + result := NewPcloudCloudconnectionsPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 202: + result := NewPcloudCloudconnectionsPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudconnectionsPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudconnectionsPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudCloudconnectionsPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudCloudconnectionsPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudconnectionsPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudconnectionsPostOK creates a PcloudCloudconnectionsPostOK with default headers values +func NewPcloudCloudconnectionsPostOK() *PcloudCloudconnectionsPostOK { + return &PcloudCloudconnectionsPostOK{} +} + +/* PcloudCloudconnectionsPostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudconnectionsPostOK struct { + Payload *models.CloudConnection +} + +func (o *PcloudCloudconnectionsPostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostOK %+v", 200, o.Payload) +} +func (o *PcloudCloudconnectionsPostOK) GetPayload() *models.CloudConnection { + return o.Payload +} + +func (o *PcloudCloudconnectionsPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CloudConnection) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudconnectionsPostCreated creates a PcloudCloudconnectionsPostCreated with default headers values +func NewPcloudCloudconnectionsPostCreated() *PcloudCloudconnectionsPostCreated { + return &PcloudCloudconnectionsPostCreated{} +} + +/* PcloudCloudconnectionsPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type PcloudCloudconnectionsPostCreated struct { + Payload *models.CloudConnection +} + +func (o *PcloudCloudconnectionsPostCreated) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostCreated %+v", 201, o.Payload) +} +func (o *PcloudCloudconnectionsPostCreated) GetPayload() *models.CloudConnection { + return o.Payload +} + +func (o *PcloudCloudconnectionsPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CloudConnection) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudconnectionsPostAccepted creates a PcloudCloudconnectionsPostAccepted with default headers values +func NewPcloudCloudconnectionsPostAccepted() *PcloudCloudconnectionsPostAccepted { + return &PcloudCloudconnectionsPostAccepted{} +} + +/* PcloudCloudconnectionsPostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudCloudconnectionsPostAccepted struct { + Payload *models.CloudConnectionCreateResponse +} + +func (o *PcloudCloudconnectionsPostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostAccepted %+v", 202, o.Payload) +} +func (o *PcloudCloudconnectionsPostAccepted) GetPayload() *models.CloudConnectionCreateResponse { + return o.Payload +} + +func (o *PcloudCloudconnectionsPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CloudConnectionCreateResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudconnectionsPostBadRequest creates a PcloudCloudconnectionsPostBadRequest with default headers values +func NewPcloudCloudconnectionsPostBadRequest() *PcloudCloudconnectionsPostBadRequest { + return &PcloudCloudconnectionsPostBadRequest{} +} + +/* PcloudCloudconnectionsPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudconnectionsPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudconnectionsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsPostBadRequest) 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 +} + +// NewPcloudCloudconnectionsPostUnauthorized creates a PcloudCloudconnectionsPostUnauthorized with default headers values +func NewPcloudCloudconnectionsPostUnauthorized() *PcloudCloudconnectionsPostUnauthorized { + return &PcloudCloudconnectionsPostUnauthorized{} +} + +/* PcloudCloudconnectionsPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudconnectionsPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudconnectionsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsPostUnauthorized) 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 +} + +// NewPcloudCloudconnectionsPostConflict creates a PcloudCloudconnectionsPostConflict with default headers values +func NewPcloudCloudconnectionsPostConflict() *PcloudCloudconnectionsPostConflict { + return &PcloudCloudconnectionsPostConflict{} +} + +/* PcloudCloudconnectionsPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudCloudconnectionsPostConflict struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostConflict %+v", 409, o.Payload) +} +func (o *PcloudCloudconnectionsPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsPostConflict) 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 +} + +// NewPcloudCloudconnectionsPostUnprocessableEntity creates a PcloudCloudconnectionsPostUnprocessableEntity with default headers values +func NewPcloudCloudconnectionsPostUnprocessableEntity() *PcloudCloudconnectionsPostUnprocessableEntity { + return &PcloudCloudconnectionsPostUnprocessableEntity{} +} + +/* PcloudCloudconnectionsPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudCloudconnectionsPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudCloudconnectionsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsPostUnprocessableEntity) 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 +} + +// NewPcloudCloudconnectionsPostInternalServerError creates a PcloudCloudconnectionsPostInternalServerError with default headers values +func NewPcloudCloudconnectionsPostInternalServerError() *PcloudCloudconnectionsPostInternalServerError { + return &PcloudCloudconnectionsPostInternalServerError{} +} + +/* PcloudCloudconnectionsPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudconnectionsPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections][%d] pcloudCloudconnectionsPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudconnectionsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_put_parameters.go new file mode 100644 index 00000000000..136980886a0 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_put_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// 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" +) + +// NewPcloudCloudconnectionsPutParams creates a new PcloudCloudconnectionsPutParams 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 NewPcloudCloudconnectionsPutParams() *PcloudCloudconnectionsPutParams { + return &PcloudCloudconnectionsPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudconnectionsPutParamsWithTimeout creates a new PcloudCloudconnectionsPutParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudconnectionsPutParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsPutParams { + return &PcloudCloudconnectionsPutParams{ + timeout: timeout, + } +} + +// NewPcloudCloudconnectionsPutParamsWithContext creates a new PcloudCloudconnectionsPutParams object +// with the ability to set a context for a request. +func NewPcloudCloudconnectionsPutParamsWithContext(ctx context.Context) *PcloudCloudconnectionsPutParams { + return &PcloudCloudconnectionsPutParams{ + Context: ctx, + } +} + +// NewPcloudCloudconnectionsPutParamsWithHTTPClient creates a new PcloudCloudconnectionsPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudconnectionsPutParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsPutParams { + return &PcloudCloudconnectionsPutParams{ + HTTPClient: client, + } +} + +/* PcloudCloudconnectionsPutParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections put operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudconnectionsPutParams struct { + + /* Body. + + Parameters to update a Cloud Connection + */ + Body *models.CloudConnectionUpdate + + /* CloudConnectionID. + + Cloud Connection ID + */ + CloudConnectionID string + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudconnections put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsPutParams) WithDefaults() *PcloudCloudconnectionsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudconnections put params +func (o *PcloudCloudconnectionsPutParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudconnections put params +func (o *PcloudCloudconnectionsPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudconnections put params +func (o *PcloudCloudconnectionsPutParams) WithContext(ctx context.Context) *PcloudCloudconnectionsPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudconnections put params +func (o *PcloudCloudconnectionsPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudconnections put params +func (o *PcloudCloudconnectionsPutParams) WithHTTPClient(client *http.Client) *PcloudCloudconnectionsPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudconnections put params +func (o *PcloudCloudconnectionsPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud cloudconnections put params +func (o *PcloudCloudconnectionsPutParams) WithBody(body *models.CloudConnectionUpdate) *PcloudCloudconnectionsPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud cloudconnections put params +func (o *PcloudCloudconnectionsPutParams) SetBody(body *models.CloudConnectionUpdate) { + o.Body = body +} + +// WithCloudConnectionID adds the cloudConnectionID to the pcloud cloudconnections put params +func (o *PcloudCloudconnectionsPutParams) WithCloudConnectionID(cloudConnectionID string) *PcloudCloudconnectionsPutParams { + o.SetCloudConnectionID(cloudConnectionID) + return o +} + +// SetCloudConnectionID adds the cloudConnectionId to the pcloud cloudconnections put params +func (o *PcloudCloudconnectionsPutParams) SetCloudConnectionID(cloudConnectionID string) { + o.CloudConnectionID = cloudConnectionID +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudconnections put params +func (o *PcloudCloudconnectionsPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudconnectionsPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudconnections put params +func (o *PcloudCloudconnectionsPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudconnectionsPutParams) 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 cloud_connection_id + if err := r.SetPathParam("cloud_connection_id", o.CloudConnectionID); err != nil { + return err + } + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_put_responses.go new file mode 100644 index 00000000000..1eaec8d50d7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_put_responses.go @@ -0,0 +1,371 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudconnectionsPutReader is a Reader for the PcloudCloudconnectionsPut structure. +type PcloudCloudconnectionsPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudconnectionsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudconnectionsPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 202: + result := NewPcloudCloudconnectionsPutAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudconnectionsPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudconnectionsPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudconnectionsPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 405: + result := NewPcloudCloudconnectionsPutMethodNotAllowed() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudCloudconnectionsPutConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudCloudconnectionsPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudconnectionsPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudconnectionsPutOK creates a PcloudCloudconnectionsPutOK with default headers values +func NewPcloudCloudconnectionsPutOK() *PcloudCloudconnectionsPutOK { + return &PcloudCloudconnectionsPutOK{} +} + +/* PcloudCloudconnectionsPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudconnectionsPutOK struct { + Payload *models.CloudConnection +} + +func (o *PcloudCloudconnectionsPutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutOK %+v", 200, o.Payload) +} +func (o *PcloudCloudconnectionsPutOK) GetPayload() *models.CloudConnection { + return o.Payload +} + +func (o *PcloudCloudconnectionsPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CloudConnection) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudconnectionsPutAccepted creates a PcloudCloudconnectionsPutAccepted with default headers values +func NewPcloudCloudconnectionsPutAccepted() *PcloudCloudconnectionsPutAccepted { + return &PcloudCloudconnectionsPutAccepted{} +} + +/* PcloudCloudconnectionsPutAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudCloudconnectionsPutAccepted struct { + Payload *models.JobReference +} + +func (o *PcloudCloudconnectionsPutAccepted) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutAccepted %+v", 202, o.Payload) +} +func (o *PcloudCloudconnectionsPutAccepted) GetPayload() *models.JobReference { + return o.Payload +} + +func (o *PcloudCloudconnectionsPutAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.JobReference) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudconnectionsPutBadRequest creates a PcloudCloudconnectionsPutBadRequest with default headers values +func NewPcloudCloudconnectionsPutBadRequest() *PcloudCloudconnectionsPutBadRequest { + return &PcloudCloudconnectionsPutBadRequest{} +} + +/* PcloudCloudconnectionsPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudconnectionsPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudconnectionsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsPutBadRequest) 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 +} + +// NewPcloudCloudconnectionsPutUnauthorized creates a PcloudCloudconnectionsPutUnauthorized with default headers values +func NewPcloudCloudconnectionsPutUnauthorized() *PcloudCloudconnectionsPutUnauthorized { + return &PcloudCloudconnectionsPutUnauthorized{} +} + +/* PcloudCloudconnectionsPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudconnectionsPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudconnectionsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsPutUnauthorized) 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 +} + +// NewPcloudCloudconnectionsPutNotFound creates a PcloudCloudconnectionsPutNotFound with default headers values +func NewPcloudCloudconnectionsPutNotFound() *PcloudCloudconnectionsPutNotFound { + return &PcloudCloudconnectionsPutNotFound{} +} + +/* PcloudCloudconnectionsPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudconnectionsPutNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsPutNotFound) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudconnectionsPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsPutNotFound) 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 +} + +// NewPcloudCloudconnectionsPutMethodNotAllowed creates a PcloudCloudconnectionsPutMethodNotAllowed with default headers values +func NewPcloudCloudconnectionsPutMethodNotAllowed() *PcloudCloudconnectionsPutMethodNotAllowed { + return &PcloudCloudconnectionsPutMethodNotAllowed{} +} + +/* PcloudCloudconnectionsPutMethodNotAllowed describes a response with status code 405, with default header values. + +Method Not Allowed +*/ +type PcloudCloudconnectionsPutMethodNotAllowed struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsPutMethodNotAllowed) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutMethodNotAllowed %+v", 405, o.Payload) +} +func (o *PcloudCloudconnectionsPutMethodNotAllowed) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsPutMethodNotAllowed) 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 +} + +// NewPcloudCloudconnectionsPutConflict creates a PcloudCloudconnectionsPutConflict with default headers values +func NewPcloudCloudconnectionsPutConflict() *PcloudCloudconnectionsPutConflict { + return &PcloudCloudconnectionsPutConflict{} +} + +/* PcloudCloudconnectionsPutConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudCloudconnectionsPutConflict struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsPutConflict) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutConflict %+v", 409, o.Payload) +} +func (o *PcloudCloudconnectionsPutConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsPutConflict) 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 +} + +// NewPcloudCloudconnectionsPutUnprocessableEntity creates a PcloudCloudconnectionsPutUnprocessableEntity with default headers values +func NewPcloudCloudconnectionsPutUnprocessableEntity() *PcloudCloudconnectionsPutUnprocessableEntity { + return &PcloudCloudconnectionsPutUnprocessableEntity{} +} + +/* PcloudCloudconnectionsPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudCloudconnectionsPutUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudCloudconnectionsPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsPutUnprocessableEntity) 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 +} + +// NewPcloudCloudconnectionsPutInternalServerError creates a PcloudCloudconnectionsPutInternalServerError with default headers values +func NewPcloudCloudconnectionsPutInternalServerError() *PcloudCloudconnectionsPutInternalServerError { + return &PcloudCloudconnectionsPutInternalServerError{} +} + +/* PcloudCloudconnectionsPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudconnectionsPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections/{cloud_connection_id}][%d] pcloudCloudconnectionsPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudconnectionsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_virtualprivateclouds_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_virtualprivateclouds_getall_parameters.go new file mode 100644 index 00000000000..6cc7c04cd6a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_virtualprivateclouds_getall_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// 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" +) + +// NewPcloudCloudconnectionsVirtualprivatecloudsGetallParams creates a new PcloudCloudconnectionsVirtualprivatecloudsGetallParams 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 NewPcloudCloudconnectionsVirtualprivatecloudsGetallParams() *PcloudCloudconnectionsVirtualprivatecloudsGetallParams { + return &PcloudCloudconnectionsVirtualprivatecloudsGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudconnectionsVirtualprivatecloudsGetallParamsWithTimeout creates a new PcloudCloudconnectionsVirtualprivatecloudsGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudconnectionsVirtualprivatecloudsGetallParamsWithTimeout(timeout time.Duration) *PcloudCloudconnectionsVirtualprivatecloudsGetallParams { + return &PcloudCloudconnectionsVirtualprivatecloudsGetallParams{ + timeout: timeout, + } +} + +// NewPcloudCloudconnectionsVirtualprivatecloudsGetallParamsWithContext creates a new PcloudCloudconnectionsVirtualprivatecloudsGetallParams object +// with the ability to set a context for a request. +func NewPcloudCloudconnectionsVirtualprivatecloudsGetallParamsWithContext(ctx context.Context) *PcloudCloudconnectionsVirtualprivatecloudsGetallParams { + return &PcloudCloudconnectionsVirtualprivatecloudsGetallParams{ + Context: ctx, + } +} + +// NewPcloudCloudconnectionsVirtualprivatecloudsGetallParamsWithHTTPClient creates a new PcloudCloudconnectionsVirtualprivatecloudsGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudconnectionsVirtualprivatecloudsGetallParamsWithHTTPClient(client *http.Client) *PcloudCloudconnectionsVirtualprivatecloudsGetallParams { + return &PcloudCloudconnectionsVirtualprivatecloudsGetallParams{ + HTTPClient: client, + } +} + +/* PcloudCloudconnectionsVirtualprivatecloudsGetallParams contains all the parameters to send to the API endpoint + for the pcloud cloudconnections virtualprivateclouds getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudconnectionsVirtualprivatecloudsGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudconnections virtualprivateclouds getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallParams) WithDefaults() *PcloudCloudconnectionsVirtualprivatecloudsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudconnections virtualprivateclouds getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudconnections virtualprivateclouds getall params +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudconnectionsVirtualprivatecloudsGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudconnections virtualprivateclouds getall params +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudconnections virtualprivateclouds getall params +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallParams) WithContext(ctx context.Context) *PcloudCloudconnectionsVirtualprivatecloudsGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudconnections virtualprivateclouds getall params +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudconnections virtualprivateclouds getall params +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallParams) WithHTTPClient(client *http.Client) *PcloudCloudconnectionsVirtualprivatecloudsGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudconnections virtualprivateclouds getall params +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudconnections virtualprivateclouds getall params +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudconnectionsVirtualprivatecloudsGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudconnections virtualprivateclouds getall params +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_virtualprivateclouds_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_virtualprivateclouds_getall_responses.go new file mode 100644 index 00000000000..ad162ef31e7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections/pcloud_cloudconnections_virtualprivateclouds_getall_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_cloud_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudconnectionsVirtualprivatecloudsGetallReader is a Reader for the PcloudCloudconnectionsVirtualprivatecloudsGetall structure. +type PcloudCloudconnectionsVirtualprivatecloudsGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudconnectionsVirtualprivatecloudsGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudconnectionsVirtualprivatecloudsGetallOK creates a PcloudCloudconnectionsVirtualprivatecloudsGetallOK with default headers values +func NewPcloudCloudconnectionsVirtualprivatecloudsGetallOK() *PcloudCloudconnectionsVirtualprivatecloudsGetallOK { + return &PcloudCloudconnectionsVirtualprivatecloudsGetallOK{} +} + +/* PcloudCloudconnectionsVirtualprivatecloudsGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudconnectionsVirtualprivatecloudsGetallOK struct { + Payload *models.CloudConnectionVirtualPrivateClouds +} + +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections-virtual-private-clouds][%d] pcloudCloudconnectionsVirtualprivatecloudsGetallOK %+v", 200, o.Payload) +} +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallOK) GetPayload() *models.CloudConnectionVirtualPrivateClouds { + return o.Payload +} + +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CloudConnectionVirtualPrivateClouds) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest creates a PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest with default headers values +func NewPcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest() *PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest { + return &PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest{} +} + +/* PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections-virtual-private-clouds][%d] pcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest) 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 +} + +// NewPcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized creates a PcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized with default headers values +func NewPcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized() *PcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized { + return &PcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized{} +} + +/* PcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections-virtual-private-clouds][%d] pcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallUnauthorized) 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 +} + +// NewPcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError creates a PcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError with default headers values +func NewPcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError() *PcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError { + return &PcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError{} +} + +/* PcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cloud-connections-virtual-private-clouds][%d] pcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudconnectionsVirtualprivatecloudsGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events/p_cloud_events_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events/p_cloud_events_client.go new file mode 100644 index 00000000000..7305a15619f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events/p_cloud_events_client.go @@ -0,0 +1,121 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_events + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud events API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud events API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudEventsGet(params *PcloudEventsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudEventsGetOK, error) + + PcloudEventsGetquery(params *PcloudEventsGetqueryParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudEventsGetqueryOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudEventsGet gets a single event +*/ +func (a *Client) PcloudEventsGet(params *PcloudEventsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudEventsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudEventsGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.events.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/events/{event_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudEventsGetReader{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.(*PcloudEventsGetOK) + 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 pcloud.events.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudEventsGetquery gets events from this cloud instance since a specific timestamp +*/ +func (a *Client) PcloudEventsGetquery(params *PcloudEventsGetqueryParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudEventsGetqueryOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudEventsGetqueryParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.events.getquery", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/events", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudEventsGetqueryReader{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.(*PcloudEventsGetqueryOK) + 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 pcloud.events.getquery: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events/pcloud_events_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events/pcloud_events_get_parameters.go new file mode 100644 index 00000000000..a2b5d98e841 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events/pcloud_events_get_parameters.go @@ -0,0 +1,196 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_events + +// 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" +) + +// NewPcloudEventsGetParams creates a new PcloudEventsGetParams 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 NewPcloudEventsGetParams() *PcloudEventsGetParams { + return &PcloudEventsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudEventsGetParamsWithTimeout creates a new PcloudEventsGetParams object +// with the ability to set a timeout on a request. +func NewPcloudEventsGetParamsWithTimeout(timeout time.Duration) *PcloudEventsGetParams { + return &PcloudEventsGetParams{ + timeout: timeout, + } +} + +// NewPcloudEventsGetParamsWithContext creates a new PcloudEventsGetParams object +// with the ability to set a context for a request. +func NewPcloudEventsGetParamsWithContext(ctx context.Context) *PcloudEventsGetParams { + return &PcloudEventsGetParams{ + Context: ctx, + } +} + +// NewPcloudEventsGetParamsWithHTTPClient creates a new PcloudEventsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudEventsGetParamsWithHTTPClient(client *http.Client) *PcloudEventsGetParams { + return &PcloudEventsGetParams{ + HTTPClient: client, + } +} + +/* PcloudEventsGetParams contains all the parameters to send to the API endpoint + for the pcloud events get operation. + + Typically these are written to a http.Request. +*/ +type PcloudEventsGetParams struct { + + /* AcceptLanguage. + + The language requested for the return document + */ + AcceptLanguage *string + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* EventID. + + Event ID + */ + EventID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud events get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudEventsGetParams) WithDefaults() *PcloudEventsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud events get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudEventsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud events get params +func (o *PcloudEventsGetParams) WithTimeout(timeout time.Duration) *PcloudEventsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud events get params +func (o *PcloudEventsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud events get params +func (o *PcloudEventsGetParams) WithContext(ctx context.Context) *PcloudEventsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud events get params +func (o *PcloudEventsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud events get params +func (o *PcloudEventsGetParams) WithHTTPClient(client *http.Client) *PcloudEventsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud events get params +func (o *PcloudEventsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAcceptLanguage adds the acceptLanguage to the pcloud events get params +func (o *PcloudEventsGetParams) WithAcceptLanguage(acceptLanguage *string) *PcloudEventsGetParams { + o.SetAcceptLanguage(acceptLanguage) + return o +} + +// SetAcceptLanguage adds the acceptLanguage to the pcloud events get params +func (o *PcloudEventsGetParams) SetAcceptLanguage(acceptLanguage *string) { + o.AcceptLanguage = acceptLanguage +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud events get params +func (o *PcloudEventsGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudEventsGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud events get params +func (o *PcloudEventsGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithEventID adds the eventID to the pcloud events get params +func (o *PcloudEventsGetParams) WithEventID(eventID string) *PcloudEventsGetParams { + o.SetEventID(eventID) + return o +} + +// SetEventID adds the eventId to the pcloud events get params +func (o *PcloudEventsGetParams) SetEventID(eventID string) { + o.EventID = eventID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudEventsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.AcceptLanguage != nil { + + // header param Accept-Language + if err := r.SetHeaderParam("Accept-Language", *o.AcceptLanguage); err != nil { + return err + } + } + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param event_id + if err := r.SetPathParam("event_id", o.EventID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events/pcloud_events_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events/pcloud_events_get_responses.go new file mode 100644 index 00000000000..ff28ed26483 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events/pcloud_events_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_events + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudEventsGetReader is a Reader for the PcloudEventsGet structure. +type PcloudEventsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudEventsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudEventsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudEventsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudEventsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudEventsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudEventsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudEventsGetOK creates a PcloudEventsGetOK with default headers values +func NewPcloudEventsGetOK() *PcloudEventsGetOK { + return &PcloudEventsGetOK{} +} + +/* PcloudEventsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudEventsGetOK struct { + Payload *models.Event +} + +func (o *PcloudEventsGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events/{event_id}][%d] pcloudEventsGetOK %+v", 200, o.Payload) +} +func (o *PcloudEventsGetOK) GetPayload() *models.Event { + return o.Payload +} + +func (o *PcloudEventsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Event) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudEventsGetBadRequest creates a PcloudEventsGetBadRequest with default headers values +func NewPcloudEventsGetBadRequest() *PcloudEventsGetBadRequest { + return &PcloudEventsGetBadRequest{} +} + +/* PcloudEventsGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudEventsGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudEventsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events/{event_id}][%d] pcloudEventsGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudEventsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudEventsGetBadRequest) 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 +} + +// NewPcloudEventsGetUnauthorized creates a PcloudEventsGetUnauthorized with default headers values +func NewPcloudEventsGetUnauthorized() *PcloudEventsGetUnauthorized { + return &PcloudEventsGetUnauthorized{} +} + +/* PcloudEventsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudEventsGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudEventsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events/{event_id}][%d] pcloudEventsGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudEventsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudEventsGetUnauthorized) 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 +} + +// NewPcloudEventsGetNotFound creates a PcloudEventsGetNotFound with default headers values +func NewPcloudEventsGetNotFound() *PcloudEventsGetNotFound { + return &PcloudEventsGetNotFound{} +} + +/* PcloudEventsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudEventsGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudEventsGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events/{event_id}][%d] pcloudEventsGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudEventsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudEventsGetNotFound) 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 +} + +// NewPcloudEventsGetInternalServerError creates a PcloudEventsGetInternalServerError with default headers values +func NewPcloudEventsGetInternalServerError() *PcloudEventsGetInternalServerError { + return &PcloudEventsGetInternalServerError{} +} + +/* PcloudEventsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudEventsGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudEventsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events/{event_id}][%d] pcloudEventsGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudEventsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudEventsGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events/pcloud_events_getquery_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events/pcloud_events_getquery_parameters.go new file mode 100644 index 00000000000..4ee037fa96f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events/pcloud_events_getquery_parameters.go @@ -0,0 +1,276 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_events + +// 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" +) + +// NewPcloudEventsGetqueryParams creates a new PcloudEventsGetqueryParams 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 NewPcloudEventsGetqueryParams() *PcloudEventsGetqueryParams { + return &PcloudEventsGetqueryParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudEventsGetqueryParamsWithTimeout creates a new PcloudEventsGetqueryParams object +// with the ability to set a timeout on a request. +func NewPcloudEventsGetqueryParamsWithTimeout(timeout time.Duration) *PcloudEventsGetqueryParams { + return &PcloudEventsGetqueryParams{ + timeout: timeout, + } +} + +// NewPcloudEventsGetqueryParamsWithContext creates a new PcloudEventsGetqueryParams object +// with the ability to set a context for a request. +func NewPcloudEventsGetqueryParamsWithContext(ctx context.Context) *PcloudEventsGetqueryParams { + return &PcloudEventsGetqueryParams{ + Context: ctx, + } +} + +// NewPcloudEventsGetqueryParamsWithHTTPClient creates a new PcloudEventsGetqueryParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudEventsGetqueryParamsWithHTTPClient(client *http.Client) *PcloudEventsGetqueryParams { + return &PcloudEventsGetqueryParams{ + HTTPClient: client, + } +} + +/* PcloudEventsGetqueryParams contains all the parameters to send to the API endpoint + for the pcloud events getquery operation. + + Typically these are written to a http.Request. +*/ +type PcloudEventsGetqueryParams struct { + + /* AcceptLanguage. + + The language requested for the return document + */ + AcceptLanguage *string + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* FromTime. + + A from query time in either ISO 8601 or unix epoch format + */ + FromTime *string + + /* Time. + + (deprecated - use from_time) A time in either ISO 8601 or unix epoch format + */ + Time *string + + /* ToTime. + + A to query time in either ISO 8601 or unix epoch format + */ + ToTime *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud events getquery params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudEventsGetqueryParams) WithDefaults() *PcloudEventsGetqueryParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud events getquery params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudEventsGetqueryParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) WithTimeout(timeout time.Duration) *PcloudEventsGetqueryParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) WithContext(ctx context.Context) *PcloudEventsGetqueryParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) WithHTTPClient(client *http.Client) *PcloudEventsGetqueryParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAcceptLanguage adds the acceptLanguage to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) WithAcceptLanguage(acceptLanguage *string) *PcloudEventsGetqueryParams { + o.SetAcceptLanguage(acceptLanguage) + return o +} + +// SetAcceptLanguage adds the acceptLanguage to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) SetAcceptLanguage(acceptLanguage *string) { + o.AcceptLanguage = acceptLanguage +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) WithCloudInstanceID(cloudInstanceID string) *PcloudEventsGetqueryParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithFromTime adds the fromTime to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) WithFromTime(fromTime *string) *PcloudEventsGetqueryParams { + o.SetFromTime(fromTime) + return o +} + +// SetFromTime adds the fromTime to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) SetFromTime(fromTime *string) { + o.FromTime = fromTime +} + +// WithTime adds the time to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) WithTime(time *string) *PcloudEventsGetqueryParams { + o.SetTime(time) + return o +} + +// SetTime adds the time to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) SetTime(time *string) { + o.Time = time +} + +// WithToTime adds the toTime to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) WithToTime(toTime *string) *PcloudEventsGetqueryParams { + o.SetToTime(toTime) + return o +} + +// SetToTime adds the toTime to the pcloud events getquery params +func (o *PcloudEventsGetqueryParams) SetToTime(toTime *string) { + o.ToTime = toTime +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudEventsGetqueryParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.AcceptLanguage != nil { + + // header param Accept-Language + if err := r.SetHeaderParam("Accept-Language", *o.AcceptLanguage); err != nil { + return err + } + } + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if o.FromTime != nil { + + // query param from_time + var qrFromTime string + + if o.FromTime != nil { + qrFromTime = *o.FromTime + } + qFromTime := qrFromTime + if qFromTime != "" { + + if err := r.SetQueryParam("from_time", qFromTime); err != nil { + return err + } + } + } + + if o.Time != nil { + + // query param time + var qrTime string + + if o.Time != nil { + qrTime = *o.Time + } + qTime := qrTime + if qTime != "" { + + if err := r.SetQueryParam("time", qTime); err != nil { + return err + } + } + } + + if o.ToTime != nil { + + // query param to_time + var qrToTime string + + if o.ToTime != nil { + qrToTime = *o.ToTime + } + qToTime := qrToTime + if qToTime != "" { + + if err := r.SetQueryParam("to_time", qToTime); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events/pcloud_events_getquery_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events/pcloud_events_getquery_responses.go new file mode 100644 index 00000000000..b018f267f24 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events/pcloud_events_getquery_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_events + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudEventsGetqueryReader is a Reader for the PcloudEventsGetquery structure. +type PcloudEventsGetqueryReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudEventsGetqueryReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudEventsGetqueryOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudEventsGetqueryBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudEventsGetqueryUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudEventsGetqueryInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudEventsGetqueryOK creates a PcloudEventsGetqueryOK with default headers values +func NewPcloudEventsGetqueryOK() *PcloudEventsGetqueryOK { + return &PcloudEventsGetqueryOK{} +} + +/* PcloudEventsGetqueryOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudEventsGetqueryOK struct { + Payload *models.Events +} + +func (o *PcloudEventsGetqueryOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events][%d] pcloudEventsGetqueryOK %+v", 200, o.Payload) +} +func (o *PcloudEventsGetqueryOK) GetPayload() *models.Events { + return o.Payload +} + +func (o *PcloudEventsGetqueryOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Events) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudEventsGetqueryBadRequest creates a PcloudEventsGetqueryBadRequest with default headers values +func NewPcloudEventsGetqueryBadRequest() *PcloudEventsGetqueryBadRequest { + return &PcloudEventsGetqueryBadRequest{} +} + +/* PcloudEventsGetqueryBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudEventsGetqueryBadRequest struct { + Payload *models.Error +} + +func (o *PcloudEventsGetqueryBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events][%d] pcloudEventsGetqueryBadRequest %+v", 400, o.Payload) +} +func (o *PcloudEventsGetqueryBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudEventsGetqueryBadRequest) 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 +} + +// NewPcloudEventsGetqueryUnauthorized creates a PcloudEventsGetqueryUnauthorized with default headers values +func NewPcloudEventsGetqueryUnauthorized() *PcloudEventsGetqueryUnauthorized { + return &PcloudEventsGetqueryUnauthorized{} +} + +/* PcloudEventsGetqueryUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudEventsGetqueryUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudEventsGetqueryUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events][%d] pcloudEventsGetqueryUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudEventsGetqueryUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudEventsGetqueryUnauthorized) 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 +} + +// NewPcloudEventsGetqueryInternalServerError creates a PcloudEventsGetqueryInternalServerError with default headers values +func NewPcloudEventsGetqueryInternalServerError() *PcloudEventsGetqueryInternalServerError { + return &PcloudEventsGetqueryInternalServerError{} +} + +/* PcloudEventsGetqueryInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudEventsGetqueryInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudEventsGetqueryInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/events][%d] pcloudEventsGetqueryInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudEventsGetqueryInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudEventsGetqueryInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/p_cloud_images_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/p_cloud_images_client.go new file mode 100644 index 00000000000..be0badf8135 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/p_cloud_images_client.go @@ -0,0 +1,573 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud images API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud images API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudCloudinstancesImagesDelete(params *PcloudCloudinstancesImagesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesDeleteOK, error) + + PcloudCloudinstancesImagesExportPost(params *PcloudCloudinstancesImagesExportPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesExportPostAccepted, error) + + PcloudCloudinstancesImagesGet(params *PcloudCloudinstancesImagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesGetOK, error) + + PcloudCloudinstancesImagesGetall(params *PcloudCloudinstancesImagesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesGetallOK, error) + + PcloudCloudinstancesImagesPost(params *PcloudCloudinstancesImagesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesPostOK, *PcloudCloudinstancesImagesPostCreated, error) + + PcloudCloudinstancesStockimagesGet(params *PcloudCloudinstancesStockimagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesStockimagesGetOK, error) + + PcloudCloudinstancesStockimagesGetall(params *PcloudCloudinstancesStockimagesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesStockimagesGetallOK, error) + + PcloudImagesGet(params *PcloudImagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudImagesGetOK, error) + + PcloudImagesGetall(params *PcloudImagesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudImagesGetallOK, error) + + PcloudV1CloudinstancesCosimagesGet(params *PcloudV1CloudinstancesCosimagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV1CloudinstancesCosimagesGetOK, error) + + PcloudV1CloudinstancesCosimagesPost(params *PcloudV1CloudinstancesCosimagesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV1CloudinstancesCosimagesPostAccepted, error) + + PcloudV2ImagesExportGet(params *PcloudV2ImagesExportGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2ImagesExportGetOK, error) + + PcloudV2ImagesExportPost(params *PcloudV2ImagesExportPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2ImagesExportPostAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudCloudinstancesImagesDelete deletes an image from a cloud instance +*/ +func (a *Client) PcloudCloudinstancesImagesDelete(params *PcloudCloudinstancesImagesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesImagesDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.images.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesImagesDeleteReader{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.(*PcloudCloudinstancesImagesDeleteOK) + 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 pcloud.cloudinstances.images.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesImagesExportPost exports an image +*/ +func (a *Client) PcloudCloudinstancesImagesExportPost(params *PcloudCloudinstancesImagesExportPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesExportPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesImagesExportPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.images.export.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}/export", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesImagesExportPostReader{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.(*PcloudCloudinstancesImagesExportPostAccepted) + 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 pcloud.cloudinstances.images.export.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesImagesGet detaileds info of an image +*/ +func (a *Client) PcloudCloudinstancesImagesGet(params *PcloudCloudinstancesImagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesImagesGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.images.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesImagesGetReader{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.(*PcloudCloudinstancesImagesGetOK) + 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 pcloud.cloudinstances.images.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesImagesGetall lists all images for this cloud instance +*/ +func (a *Client) PcloudCloudinstancesImagesGetall(params *PcloudCloudinstancesImagesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesImagesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.images.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/images", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesImagesGetallReader{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.(*PcloudCloudinstancesImagesGetallOK) + 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 pcloud.cloudinstances.images.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesImagesPost creates a new image from available images +*/ +func (a *Client) PcloudCloudinstancesImagesPost(params *PcloudCloudinstancesImagesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesImagesPostOK, *PcloudCloudinstancesImagesPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesImagesPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.images.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/images", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesImagesPostReader{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 *PcloudCloudinstancesImagesPostOK: + return value, nil, nil + case *PcloudCloudinstancesImagesPostCreated: + 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 p_cloud_images: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesStockimagesGet detaileds info of an available stock image +*/ +func (a *Client) PcloudCloudinstancesStockimagesGet(params *PcloudCloudinstancesStockimagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesStockimagesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesStockimagesGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.stockimages.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images/{image_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesStockimagesGetReader{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.(*PcloudCloudinstancesStockimagesGetOK) + 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 pcloud.cloudinstances.stockimages.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesStockimagesGetall lists all available stock images +*/ +func (a *Client) PcloudCloudinstancesStockimagesGetall(params *PcloudCloudinstancesStockimagesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesStockimagesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesStockimagesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.stockimages.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesStockimagesGetallReader{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.(*PcloudCloudinstancesStockimagesGetallOK) + 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 pcloud.cloudinstances.stockimages.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudImagesGet deprecateds for pcloud v1 cloud instances cloud instance id stock images image id detailed info of an available stock image +*/ +func (a *Client) PcloudImagesGet(params *PcloudImagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudImagesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudImagesGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.images.get", + Method: "GET", + PathPattern: "/pcloud/v1/images/{image_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudImagesGetReader{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.(*PcloudImagesGetOK) + 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 pcloud.images.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudImagesGetall deprecateds for pcloud v1 cloud instances cloud instance id stock images list all available stock images +*/ +func (a *Client) PcloudImagesGetall(params *PcloudImagesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudImagesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudImagesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.images.getall", + Method: "GET", + PathPattern: "/pcloud/v1/images", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudImagesGetallReader{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.(*PcloudImagesGetallOK) + 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 pcloud.images.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV1CloudinstancesCosimagesGet gets detail of last cos image import job +*/ +func (a *Client) PcloudV1CloudinstancesCosimagesGet(params *PcloudV1CloudinstancesCosimagesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV1CloudinstancesCosimagesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV1CloudinstancesCosimagesGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v1.cloudinstances.cosimages.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV1CloudinstancesCosimagesGetReader{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.(*PcloudV1CloudinstancesCosimagesGetOK) + 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 pcloud.v1.cloudinstances.cosimages.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV1CloudinstancesCosimagesPost creates an cos image import job +*/ +func (a *Client) PcloudV1CloudinstancesCosimagesPost(params *PcloudV1CloudinstancesCosimagesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV1CloudinstancesCosimagesPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV1CloudinstancesCosimagesPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v1.cloudinstances.cosimages.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV1CloudinstancesCosimagesPostReader{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.(*PcloudV1CloudinstancesCosimagesPostAccepted) + 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 pcloud.v1.cloudinstances.cosimages.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2ImagesExportGet gets detail of last image export job +*/ +func (a *Client) PcloudV2ImagesExportGet(params *PcloudV2ImagesExportGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2ImagesExportGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2ImagesExportGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.images.export.get", + Method: "GET", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2ImagesExportGetReader{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.(*PcloudV2ImagesExportGetOK) + 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 pcloud.v2.images.export.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2ImagesExportPost adds image export job to the jobs queue +*/ +func (a *Client) PcloudV2ImagesExportPost(params *PcloudV2ImagesExportPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2ImagesExportPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2ImagesExportPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.images.export.post", + Method: "POST", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2ImagesExportPostReader{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.(*PcloudV2ImagesExportPostAccepted) + 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 pcloud.v2.images.export.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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_delete_parameters.go new file mode 100644 index 00000000000..36c1a384ab1 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_delete_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// 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" +) + +// NewPcloudCloudinstancesImagesDeleteParams creates a new PcloudCloudinstancesImagesDeleteParams 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 NewPcloudCloudinstancesImagesDeleteParams() *PcloudCloudinstancesImagesDeleteParams { + return &PcloudCloudinstancesImagesDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesImagesDeleteParamsWithTimeout creates a new PcloudCloudinstancesImagesDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesImagesDeleteParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesDeleteParams { + return &PcloudCloudinstancesImagesDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesImagesDeleteParamsWithContext creates a new PcloudCloudinstancesImagesDeleteParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesImagesDeleteParamsWithContext(ctx context.Context) *PcloudCloudinstancesImagesDeleteParams { + return &PcloudCloudinstancesImagesDeleteParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesImagesDeleteParamsWithHTTPClient creates a new PcloudCloudinstancesImagesDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesImagesDeleteParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesImagesDeleteParams { + return &PcloudCloudinstancesImagesDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesImagesDeleteParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances images delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesImagesDeleteParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* ImageID. + + Image ID of a image + */ + ImageID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances images delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesDeleteParams) WithDefaults() *PcloudCloudinstancesImagesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances images delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances images delete params +func (o *PcloudCloudinstancesImagesDeleteParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances images delete params +func (o *PcloudCloudinstancesImagesDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances images delete params +func (o *PcloudCloudinstancesImagesDeleteParams) WithContext(ctx context.Context) *PcloudCloudinstancesImagesDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances images delete params +func (o *PcloudCloudinstancesImagesDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances images delete params +func (o *PcloudCloudinstancesImagesDeleteParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesImagesDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances images delete params +func (o *PcloudCloudinstancesImagesDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances images delete params +func (o *PcloudCloudinstancesImagesDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesImagesDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances images delete params +func (o *PcloudCloudinstancesImagesDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithImageID adds the imageID to the pcloud cloudinstances images delete params +func (o *PcloudCloudinstancesImagesDeleteParams) WithImageID(imageID string) *PcloudCloudinstancesImagesDeleteParams { + o.SetImageID(imageID) + return o +} + +// SetImageID adds the imageId to the pcloud cloudinstances images delete params +func (o *PcloudCloudinstancesImagesDeleteParams) SetImageID(imageID string) { + o.ImageID = imageID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesImagesDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param image_id + if err := r.SetPathParam("image_id", o.ImageID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_delete_responses.go new file mode 100644 index 00000000000..2771980097f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_delete_responses.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesImagesDeleteReader is a Reader for the PcloudCloudinstancesImagesDelete structure. +type PcloudCloudinstancesImagesDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesImagesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesImagesDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesImagesDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesImagesDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewPcloudCloudinstancesImagesDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesImagesDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesImagesDeleteOK creates a PcloudCloudinstancesImagesDeleteOK with default headers values +func NewPcloudCloudinstancesImagesDeleteOK() *PcloudCloudinstancesImagesDeleteOK { + return &PcloudCloudinstancesImagesDeleteOK{} +} + +/* PcloudCloudinstancesImagesDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesImagesDeleteOK struct { + Payload models.Object +} + +func (o *PcloudCloudinstancesImagesDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesImagesDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesDeleteOK) 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 +} + +// NewPcloudCloudinstancesImagesDeleteBadRequest creates a PcloudCloudinstancesImagesDeleteBadRequest with default headers values +func NewPcloudCloudinstancesImagesDeleteBadRequest() *PcloudCloudinstancesImagesDeleteBadRequest { + return &PcloudCloudinstancesImagesDeleteBadRequest{} +} + +/* PcloudCloudinstancesImagesDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesImagesDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesImagesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesDeleteBadRequest) 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 +} + +// NewPcloudCloudinstancesImagesDeleteUnauthorized creates a PcloudCloudinstancesImagesDeleteUnauthorized with default headers values +func NewPcloudCloudinstancesImagesDeleteUnauthorized() *PcloudCloudinstancesImagesDeleteUnauthorized { + return &PcloudCloudinstancesImagesDeleteUnauthorized{} +} + +/* PcloudCloudinstancesImagesDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesImagesDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesImagesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesDeleteUnauthorized) 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 +} + +// NewPcloudCloudinstancesImagesDeleteGone creates a PcloudCloudinstancesImagesDeleteGone with default headers values +func NewPcloudCloudinstancesImagesDeleteGone() *PcloudCloudinstancesImagesDeleteGone { + return &PcloudCloudinstancesImagesDeleteGone{} +} + +/* PcloudCloudinstancesImagesDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudCloudinstancesImagesDeleteGone struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesDeleteGone) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesDeleteGone %+v", 410, o.Payload) +} +func (o *PcloudCloudinstancesImagesDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesDeleteGone) 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 +} + +// NewPcloudCloudinstancesImagesDeleteInternalServerError creates a PcloudCloudinstancesImagesDeleteInternalServerError with default headers values +func NewPcloudCloudinstancesImagesDeleteInternalServerError() *PcloudCloudinstancesImagesDeleteInternalServerError { + return &PcloudCloudinstancesImagesDeleteInternalServerError{} +} + +/* PcloudCloudinstancesImagesDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesImagesDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesImagesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_export_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_export_post_parameters.go new file mode 100644 index 00000000000..ec3a6247a8c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_export_post_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// 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" +) + +// NewPcloudCloudinstancesImagesExportPostParams creates a new PcloudCloudinstancesImagesExportPostParams 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 NewPcloudCloudinstancesImagesExportPostParams() *PcloudCloudinstancesImagesExportPostParams { + return &PcloudCloudinstancesImagesExportPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesImagesExportPostParamsWithTimeout creates a new PcloudCloudinstancesImagesExportPostParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesImagesExportPostParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesExportPostParams { + return &PcloudCloudinstancesImagesExportPostParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesImagesExportPostParamsWithContext creates a new PcloudCloudinstancesImagesExportPostParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesImagesExportPostParamsWithContext(ctx context.Context) *PcloudCloudinstancesImagesExportPostParams { + return &PcloudCloudinstancesImagesExportPostParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesImagesExportPostParamsWithHTTPClient creates a new PcloudCloudinstancesImagesExportPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesImagesExportPostParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesImagesExportPostParams { + return &PcloudCloudinstancesImagesExportPostParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesImagesExportPostParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances images export post operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesImagesExportPostParams struct { + + /* Body. + + Parameters for exporting an image + */ + Body *models.ExportImage + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* ImageID. + + Image ID of a image + */ + ImageID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances images export post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesExportPostParams) WithDefaults() *PcloudCloudinstancesImagesExportPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances images export post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesExportPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances images export post params +func (o *PcloudCloudinstancesImagesExportPostParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesExportPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances images export post params +func (o *PcloudCloudinstancesImagesExportPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances images export post params +func (o *PcloudCloudinstancesImagesExportPostParams) WithContext(ctx context.Context) *PcloudCloudinstancesImagesExportPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances images export post params +func (o *PcloudCloudinstancesImagesExportPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances images export post params +func (o *PcloudCloudinstancesImagesExportPostParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesImagesExportPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances images export post params +func (o *PcloudCloudinstancesImagesExportPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud cloudinstances images export post params +func (o *PcloudCloudinstancesImagesExportPostParams) WithBody(body *models.ExportImage) *PcloudCloudinstancesImagesExportPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud cloudinstances images export post params +func (o *PcloudCloudinstancesImagesExportPostParams) SetBody(body *models.ExportImage) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances images export post params +func (o *PcloudCloudinstancesImagesExportPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesImagesExportPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances images export post params +func (o *PcloudCloudinstancesImagesExportPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithImageID adds the imageID to the pcloud cloudinstances images export post params +func (o *PcloudCloudinstancesImagesExportPostParams) WithImageID(imageID string) *PcloudCloudinstancesImagesExportPostParams { + o.SetImageID(imageID) + return o +} + +// SetImageID adds the imageId to the pcloud cloudinstances images export post params +func (o *PcloudCloudinstancesImagesExportPostParams) SetImageID(imageID string) { + o.ImageID = imageID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesImagesExportPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param image_id + if err := r.SetPathParam("image_id", o.ImageID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_export_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_export_post_responses.go new file mode 100644 index 00000000000..0b0a6a0b005 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_export_post_responses.go @@ -0,0 +1,255 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesImagesExportPostReader is a Reader for the PcloudCloudinstancesImagesExportPost structure. +type PcloudCloudinstancesImagesExportPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesImagesExportPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudCloudinstancesImagesExportPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesImagesExportPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesImagesExportPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesImagesExportPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudCloudinstancesImagesExportPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesImagesExportPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesImagesExportPostAccepted creates a PcloudCloudinstancesImagesExportPostAccepted with default headers values +func NewPcloudCloudinstancesImagesExportPostAccepted() *PcloudCloudinstancesImagesExportPostAccepted { + return &PcloudCloudinstancesImagesExportPostAccepted{} +} + +/* PcloudCloudinstancesImagesExportPostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudCloudinstancesImagesExportPostAccepted struct { + Payload models.Object +} + +func (o *PcloudCloudinstancesImagesExportPostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudCloudinstancesImagesExportPostAccepted %+v", 202, o.Payload) +} +func (o *PcloudCloudinstancesImagesExportPostAccepted) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesExportPostAccepted) 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 +} + +// NewPcloudCloudinstancesImagesExportPostBadRequest creates a PcloudCloudinstancesImagesExportPostBadRequest with default headers values +func NewPcloudCloudinstancesImagesExportPostBadRequest() *PcloudCloudinstancesImagesExportPostBadRequest { + return &PcloudCloudinstancesImagesExportPostBadRequest{} +} + +/* PcloudCloudinstancesImagesExportPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesImagesExportPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesExportPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudCloudinstancesImagesExportPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesImagesExportPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesExportPostBadRequest) 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 +} + +// NewPcloudCloudinstancesImagesExportPostUnauthorized creates a PcloudCloudinstancesImagesExportPostUnauthorized with default headers values +func NewPcloudCloudinstancesImagesExportPostUnauthorized() *PcloudCloudinstancesImagesExportPostUnauthorized { + return &PcloudCloudinstancesImagesExportPostUnauthorized{} +} + +/* PcloudCloudinstancesImagesExportPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesImagesExportPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesExportPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudCloudinstancesImagesExportPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesImagesExportPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesExportPostUnauthorized) 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 +} + +// NewPcloudCloudinstancesImagesExportPostNotFound creates a PcloudCloudinstancesImagesExportPostNotFound with default headers values +func NewPcloudCloudinstancesImagesExportPostNotFound() *PcloudCloudinstancesImagesExportPostNotFound { + return &PcloudCloudinstancesImagesExportPostNotFound{} +} + +/* PcloudCloudinstancesImagesExportPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesImagesExportPostNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesExportPostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudCloudinstancesImagesExportPostNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudinstancesImagesExportPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesExportPostNotFound) 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 +} + +// NewPcloudCloudinstancesImagesExportPostUnprocessableEntity creates a PcloudCloudinstancesImagesExportPostUnprocessableEntity with default headers values +func NewPcloudCloudinstancesImagesExportPostUnprocessableEntity() *PcloudCloudinstancesImagesExportPostUnprocessableEntity { + return &PcloudCloudinstancesImagesExportPostUnprocessableEntity{} +} + +/* PcloudCloudinstancesImagesExportPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudCloudinstancesImagesExportPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesExportPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudCloudinstancesImagesExportPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudCloudinstancesImagesExportPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesExportPostUnprocessableEntity) 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 +} + +// NewPcloudCloudinstancesImagesExportPostInternalServerError creates a PcloudCloudinstancesImagesExportPostInternalServerError with default headers values +func NewPcloudCloudinstancesImagesExportPostInternalServerError() *PcloudCloudinstancesImagesExportPostInternalServerError { + return &PcloudCloudinstancesImagesExportPostInternalServerError{} +} + +/* PcloudCloudinstancesImagesExportPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesImagesExportPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesExportPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudCloudinstancesImagesExportPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesImagesExportPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesExportPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_get_parameters.go new file mode 100644 index 00000000000..decd92c083d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// 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" +) + +// NewPcloudCloudinstancesImagesGetParams creates a new PcloudCloudinstancesImagesGetParams 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 NewPcloudCloudinstancesImagesGetParams() *PcloudCloudinstancesImagesGetParams { + return &PcloudCloudinstancesImagesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesImagesGetParamsWithTimeout creates a new PcloudCloudinstancesImagesGetParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesImagesGetParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesGetParams { + return &PcloudCloudinstancesImagesGetParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesImagesGetParamsWithContext creates a new PcloudCloudinstancesImagesGetParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesImagesGetParamsWithContext(ctx context.Context) *PcloudCloudinstancesImagesGetParams { + return &PcloudCloudinstancesImagesGetParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesImagesGetParamsWithHTTPClient creates a new PcloudCloudinstancesImagesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesImagesGetParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesImagesGetParams { + return &PcloudCloudinstancesImagesGetParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesImagesGetParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances images get operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesImagesGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* ImageID. + + Image ID of a image + */ + ImageID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances images get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesGetParams) WithDefaults() *PcloudCloudinstancesImagesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances images get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances images get params +func (o *PcloudCloudinstancesImagesGetParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances images get params +func (o *PcloudCloudinstancesImagesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances images get params +func (o *PcloudCloudinstancesImagesGetParams) WithContext(ctx context.Context) *PcloudCloudinstancesImagesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances images get params +func (o *PcloudCloudinstancesImagesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances images get params +func (o *PcloudCloudinstancesImagesGetParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesImagesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances images get params +func (o *PcloudCloudinstancesImagesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances images get params +func (o *PcloudCloudinstancesImagesGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesImagesGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances images get params +func (o *PcloudCloudinstancesImagesGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithImageID adds the imageID to the pcloud cloudinstances images get params +func (o *PcloudCloudinstancesImagesGetParams) WithImageID(imageID string) *PcloudCloudinstancesImagesGetParams { + o.SetImageID(imageID) + return o +} + +// SetImageID adds the imageId to the pcloud cloudinstances images get params +func (o *PcloudCloudinstancesImagesGetParams) SetImageID(imageID string) { + o.ImageID = imageID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesImagesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param image_id + if err := r.SetPathParam("image_id", o.ImageID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_get_responses.go new file mode 100644 index 00000000000..d4b52ee6e60 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesImagesGetReader is a Reader for the PcloudCloudinstancesImagesGet structure. +type PcloudCloudinstancesImagesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesImagesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesImagesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesImagesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesImagesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesImagesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesImagesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesImagesGetOK creates a PcloudCloudinstancesImagesGetOK with default headers values +func NewPcloudCloudinstancesImagesGetOK() *PcloudCloudinstancesImagesGetOK { + return &PcloudCloudinstancesImagesGetOK{} +} + +/* PcloudCloudinstancesImagesGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesImagesGetOK struct { + Payload *models.Image +} + +func (o *PcloudCloudinstancesImagesGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesGetOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesImagesGetOK) GetPayload() *models.Image { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Image) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesImagesGetBadRequest creates a PcloudCloudinstancesImagesGetBadRequest with default headers values +func NewPcloudCloudinstancesImagesGetBadRequest() *PcloudCloudinstancesImagesGetBadRequest { + return &PcloudCloudinstancesImagesGetBadRequest{} +} + +/* PcloudCloudinstancesImagesGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesImagesGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesImagesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesGetBadRequest) 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 +} + +// NewPcloudCloudinstancesImagesGetUnauthorized creates a PcloudCloudinstancesImagesGetUnauthorized with default headers values +func NewPcloudCloudinstancesImagesGetUnauthorized() *PcloudCloudinstancesImagesGetUnauthorized { + return &PcloudCloudinstancesImagesGetUnauthorized{} +} + +/* PcloudCloudinstancesImagesGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesImagesGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesImagesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesGetUnauthorized) 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 +} + +// NewPcloudCloudinstancesImagesGetNotFound creates a PcloudCloudinstancesImagesGetNotFound with default headers values +func NewPcloudCloudinstancesImagesGetNotFound() *PcloudCloudinstancesImagesGetNotFound { + return &PcloudCloudinstancesImagesGetNotFound{} +} + +/* PcloudCloudinstancesImagesGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesImagesGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudinstancesImagesGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesGetNotFound) 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 +} + +// NewPcloudCloudinstancesImagesGetInternalServerError creates a PcloudCloudinstancesImagesGetInternalServerError with default headers values +func NewPcloudCloudinstancesImagesGetInternalServerError() *PcloudCloudinstancesImagesGetInternalServerError { + return &PcloudCloudinstancesImagesGetInternalServerError{} +} + +/* PcloudCloudinstancesImagesGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesImagesGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images/{image_id}][%d] pcloudCloudinstancesImagesGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesImagesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_getall_parameters.go new file mode 100644 index 00000000000..a0acea17e18 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_getall_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// 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" +) + +// NewPcloudCloudinstancesImagesGetallParams creates a new PcloudCloudinstancesImagesGetallParams 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 NewPcloudCloudinstancesImagesGetallParams() *PcloudCloudinstancesImagesGetallParams { + return &PcloudCloudinstancesImagesGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesImagesGetallParamsWithTimeout creates a new PcloudCloudinstancesImagesGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesImagesGetallParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesGetallParams { + return &PcloudCloudinstancesImagesGetallParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesImagesGetallParamsWithContext creates a new PcloudCloudinstancesImagesGetallParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesImagesGetallParamsWithContext(ctx context.Context) *PcloudCloudinstancesImagesGetallParams { + return &PcloudCloudinstancesImagesGetallParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesImagesGetallParamsWithHTTPClient creates a new PcloudCloudinstancesImagesGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesImagesGetallParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesImagesGetallParams { + return &PcloudCloudinstancesImagesGetallParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesImagesGetallParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances images getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesImagesGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances images getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesGetallParams) WithDefaults() *PcloudCloudinstancesImagesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances images getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances images getall params +func (o *PcloudCloudinstancesImagesGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances images getall params +func (o *PcloudCloudinstancesImagesGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances images getall params +func (o *PcloudCloudinstancesImagesGetallParams) WithContext(ctx context.Context) *PcloudCloudinstancesImagesGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances images getall params +func (o *PcloudCloudinstancesImagesGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances images getall params +func (o *PcloudCloudinstancesImagesGetallParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesImagesGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances images getall params +func (o *PcloudCloudinstancesImagesGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances images getall params +func (o *PcloudCloudinstancesImagesGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesImagesGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances images getall params +func (o *PcloudCloudinstancesImagesGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesImagesGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_getall_responses.go new file mode 100644 index 00000000000..a06568fe256 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_getall_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesImagesGetallReader is a Reader for the PcloudCloudinstancesImagesGetall structure. +type PcloudCloudinstancesImagesGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesImagesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesImagesGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesImagesGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesImagesGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesImagesGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesImagesGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesImagesGetallOK creates a PcloudCloudinstancesImagesGetallOK with default headers values +func NewPcloudCloudinstancesImagesGetallOK() *PcloudCloudinstancesImagesGetallOK { + return &PcloudCloudinstancesImagesGetallOK{} +} + +/* PcloudCloudinstancesImagesGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesImagesGetallOK struct { + Payload *models.Images +} + +func (o *PcloudCloudinstancesImagesGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesGetallOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesImagesGetallOK) GetPayload() *models.Images { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Images) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesImagesGetallBadRequest creates a PcloudCloudinstancesImagesGetallBadRequest with default headers values +func NewPcloudCloudinstancesImagesGetallBadRequest() *PcloudCloudinstancesImagesGetallBadRequest { + return &PcloudCloudinstancesImagesGetallBadRequest{} +} + +/* PcloudCloudinstancesImagesGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesImagesGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesImagesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesGetallBadRequest) 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 +} + +// NewPcloudCloudinstancesImagesGetallUnauthorized creates a PcloudCloudinstancesImagesGetallUnauthorized with default headers values +func NewPcloudCloudinstancesImagesGetallUnauthorized() *PcloudCloudinstancesImagesGetallUnauthorized { + return &PcloudCloudinstancesImagesGetallUnauthorized{} +} + +/* PcloudCloudinstancesImagesGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesImagesGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesImagesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesGetallUnauthorized) 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 +} + +// NewPcloudCloudinstancesImagesGetallNotFound creates a PcloudCloudinstancesImagesGetallNotFound with default headers values +func NewPcloudCloudinstancesImagesGetallNotFound() *PcloudCloudinstancesImagesGetallNotFound { + return &PcloudCloudinstancesImagesGetallNotFound{} +} + +/* PcloudCloudinstancesImagesGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesImagesGetallNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesGetallNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesGetallNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudinstancesImagesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesGetallNotFound) 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 +} + +// NewPcloudCloudinstancesImagesGetallInternalServerError creates a PcloudCloudinstancesImagesGetallInternalServerError with default headers values +func NewPcloudCloudinstancesImagesGetallInternalServerError() *PcloudCloudinstancesImagesGetallInternalServerError { + return &PcloudCloudinstancesImagesGetallInternalServerError{} +} + +/* PcloudCloudinstancesImagesGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesImagesGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesImagesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_post_parameters.go new file mode 100644 index 00000000000..cd22b7b195b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// 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" +) + +// NewPcloudCloudinstancesImagesPostParams creates a new PcloudCloudinstancesImagesPostParams 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 NewPcloudCloudinstancesImagesPostParams() *PcloudCloudinstancesImagesPostParams { + return &PcloudCloudinstancesImagesPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesImagesPostParamsWithTimeout creates a new PcloudCloudinstancesImagesPostParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesImagesPostParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesPostParams { + return &PcloudCloudinstancesImagesPostParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesImagesPostParamsWithContext creates a new PcloudCloudinstancesImagesPostParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesImagesPostParamsWithContext(ctx context.Context) *PcloudCloudinstancesImagesPostParams { + return &PcloudCloudinstancesImagesPostParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesImagesPostParamsWithHTTPClient creates a new PcloudCloudinstancesImagesPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesImagesPostParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesImagesPostParams { + return &PcloudCloudinstancesImagesPostParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesImagesPostParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances images post operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesImagesPostParams struct { + + /* Body. + + Parameters for the creation of a new image from available images + */ + Body *models.CreateImage + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances images post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesPostParams) WithDefaults() *PcloudCloudinstancesImagesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances images post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesImagesPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances images post params +func (o *PcloudCloudinstancesImagesPostParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesImagesPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances images post params +func (o *PcloudCloudinstancesImagesPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances images post params +func (o *PcloudCloudinstancesImagesPostParams) WithContext(ctx context.Context) *PcloudCloudinstancesImagesPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances images post params +func (o *PcloudCloudinstancesImagesPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances images post params +func (o *PcloudCloudinstancesImagesPostParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesImagesPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances images post params +func (o *PcloudCloudinstancesImagesPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud cloudinstances images post params +func (o *PcloudCloudinstancesImagesPostParams) WithBody(body *models.CreateImage) *PcloudCloudinstancesImagesPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud cloudinstances images post params +func (o *PcloudCloudinstancesImagesPostParams) SetBody(body *models.CreateImage) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances images post params +func (o *PcloudCloudinstancesImagesPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesImagesPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances images post params +func (o *PcloudCloudinstancesImagesPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesImagesPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_post_responses.go new file mode 100644 index 00000000000..570d84672c7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_images_post_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesImagesPostReader is a Reader for the PcloudCloudinstancesImagesPost structure. +type PcloudCloudinstancesImagesPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesImagesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesImagesPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 201: + result := NewPcloudCloudinstancesImagesPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesImagesPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesImagesPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudCloudinstancesImagesPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudCloudinstancesImagesPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesImagesPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesImagesPostOK creates a PcloudCloudinstancesImagesPostOK with default headers values +func NewPcloudCloudinstancesImagesPostOK() *PcloudCloudinstancesImagesPostOK { + return &PcloudCloudinstancesImagesPostOK{} +} + +/* PcloudCloudinstancesImagesPostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesImagesPostOK struct { + Payload *models.Image +} + +func (o *PcloudCloudinstancesImagesPostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesPostOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesImagesPostOK) GetPayload() *models.Image { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Image) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesImagesPostCreated creates a PcloudCloudinstancesImagesPostCreated with default headers values +func NewPcloudCloudinstancesImagesPostCreated() *PcloudCloudinstancesImagesPostCreated { + return &PcloudCloudinstancesImagesPostCreated{} +} + +/* PcloudCloudinstancesImagesPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type PcloudCloudinstancesImagesPostCreated struct { + Payload *models.Image +} + +func (o *PcloudCloudinstancesImagesPostCreated) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesPostCreated %+v", 201, o.Payload) +} +func (o *PcloudCloudinstancesImagesPostCreated) GetPayload() *models.Image { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Image) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesImagesPostBadRequest creates a PcloudCloudinstancesImagesPostBadRequest with default headers values +func NewPcloudCloudinstancesImagesPostBadRequest() *PcloudCloudinstancesImagesPostBadRequest { + return &PcloudCloudinstancesImagesPostBadRequest{} +} + +/* PcloudCloudinstancesImagesPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesImagesPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesImagesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesPostBadRequest) 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 +} + +// NewPcloudCloudinstancesImagesPostUnauthorized creates a PcloudCloudinstancesImagesPostUnauthorized with default headers values +func NewPcloudCloudinstancesImagesPostUnauthorized() *PcloudCloudinstancesImagesPostUnauthorized { + return &PcloudCloudinstancesImagesPostUnauthorized{} +} + +/* PcloudCloudinstancesImagesPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesImagesPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesImagesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesPostUnauthorized) 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 +} + +// NewPcloudCloudinstancesImagesPostConflict creates a PcloudCloudinstancesImagesPostConflict with default headers values +func NewPcloudCloudinstancesImagesPostConflict() *PcloudCloudinstancesImagesPostConflict { + return &PcloudCloudinstancesImagesPostConflict{} +} + +/* PcloudCloudinstancesImagesPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudCloudinstancesImagesPostConflict struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesPostConflict %+v", 409, o.Payload) +} +func (o *PcloudCloudinstancesImagesPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesPostConflict) 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 +} + +// NewPcloudCloudinstancesImagesPostUnprocessableEntity creates a PcloudCloudinstancesImagesPostUnprocessableEntity with default headers values +func NewPcloudCloudinstancesImagesPostUnprocessableEntity() *PcloudCloudinstancesImagesPostUnprocessableEntity { + return &PcloudCloudinstancesImagesPostUnprocessableEntity{} +} + +/* PcloudCloudinstancesImagesPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudCloudinstancesImagesPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudCloudinstancesImagesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesPostUnprocessableEntity) 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 +} + +// NewPcloudCloudinstancesImagesPostInternalServerError creates a PcloudCloudinstancesImagesPostInternalServerError with default headers values +func NewPcloudCloudinstancesImagesPostInternalServerError() *PcloudCloudinstancesImagesPostInternalServerError { + return &PcloudCloudinstancesImagesPostInternalServerError{} +} + +/* PcloudCloudinstancesImagesPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesImagesPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesImagesPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/images][%d] pcloudCloudinstancesImagesPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesImagesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesImagesPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_get_parameters.go new file mode 100644 index 00000000000..071d73d8024 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// 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" +) + +// NewPcloudCloudinstancesStockimagesGetParams creates a new PcloudCloudinstancesStockimagesGetParams 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 NewPcloudCloudinstancesStockimagesGetParams() *PcloudCloudinstancesStockimagesGetParams { + return &PcloudCloudinstancesStockimagesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesStockimagesGetParamsWithTimeout creates a new PcloudCloudinstancesStockimagesGetParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesStockimagesGetParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesStockimagesGetParams { + return &PcloudCloudinstancesStockimagesGetParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesStockimagesGetParamsWithContext creates a new PcloudCloudinstancesStockimagesGetParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesStockimagesGetParamsWithContext(ctx context.Context) *PcloudCloudinstancesStockimagesGetParams { + return &PcloudCloudinstancesStockimagesGetParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesStockimagesGetParamsWithHTTPClient creates a new PcloudCloudinstancesStockimagesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesStockimagesGetParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesStockimagesGetParams { + return &PcloudCloudinstancesStockimagesGetParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesStockimagesGetParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances stockimages get operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesStockimagesGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* ImageID. + + Image ID of a image + */ + ImageID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances stockimages get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesStockimagesGetParams) WithDefaults() *PcloudCloudinstancesStockimagesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances stockimages get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesStockimagesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances stockimages get params +func (o *PcloudCloudinstancesStockimagesGetParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesStockimagesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances stockimages get params +func (o *PcloudCloudinstancesStockimagesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances stockimages get params +func (o *PcloudCloudinstancesStockimagesGetParams) WithContext(ctx context.Context) *PcloudCloudinstancesStockimagesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances stockimages get params +func (o *PcloudCloudinstancesStockimagesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances stockimages get params +func (o *PcloudCloudinstancesStockimagesGetParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesStockimagesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances stockimages get params +func (o *PcloudCloudinstancesStockimagesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances stockimages get params +func (o *PcloudCloudinstancesStockimagesGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesStockimagesGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances stockimages get params +func (o *PcloudCloudinstancesStockimagesGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithImageID adds the imageID to the pcloud cloudinstances stockimages get params +func (o *PcloudCloudinstancesStockimagesGetParams) WithImageID(imageID string) *PcloudCloudinstancesStockimagesGetParams { + o.SetImageID(imageID) + return o +} + +// SetImageID adds the imageId to the pcloud cloudinstances stockimages get params +func (o *PcloudCloudinstancesStockimagesGetParams) SetImageID(imageID string) { + o.ImageID = imageID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesStockimagesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param image_id + if err := r.SetPathParam("image_id", o.ImageID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_get_responses.go new file mode 100644 index 00000000000..2073da1cac2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesStockimagesGetReader is a Reader for the PcloudCloudinstancesStockimagesGet structure. +type PcloudCloudinstancesStockimagesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesStockimagesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesStockimagesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesStockimagesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesStockimagesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesStockimagesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesStockimagesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesStockimagesGetOK creates a PcloudCloudinstancesStockimagesGetOK with default headers values +func NewPcloudCloudinstancesStockimagesGetOK() *PcloudCloudinstancesStockimagesGetOK { + return &PcloudCloudinstancesStockimagesGetOK{} +} + +/* PcloudCloudinstancesStockimagesGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesStockimagesGetOK struct { + Payload *models.Image +} + +func (o *PcloudCloudinstancesStockimagesGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images/{image_id}][%d] pcloudCloudinstancesStockimagesGetOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesStockimagesGetOK) GetPayload() *models.Image { + return o.Payload +} + +func (o *PcloudCloudinstancesStockimagesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Image) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesStockimagesGetBadRequest creates a PcloudCloudinstancesStockimagesGetBadRequest with default headers values +func NewPcloudCloudinstancesStockimagesGetBadRequest() *PcloudCloudinstancesStockimagesGetBadRequest { + return &PcloudCloudinstancesStockimagesGetBadRequest{} +} + +/* PcloudCloudinstancesStockimagesGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesStockimagesGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesStockimagesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images/{image_id}][%d] pcloudCloudinstancesStockimagesGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesStockimagesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesStockimagesGetBadRequest) 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 +} + +// NewPcloudCloudinstancesStockimagesGetUnauthorized creates a PcloudCloudinstancesStockimagesGetUnauthorized with default headers values +func NewPcloudCloudinstancesStockimagesGetUnauthorized() *PcloudCloudinstancesStockimagesGetUnauthorized { + return &PcloudCloudinstancesStockimagesGetUnauthorized{} +} + +/* PcloudCloudinstancesStockimagesGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesStockimagesGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesStockimagesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images/{image_id}][%d] pcloudCloudinstancesStockimagesGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesStockimagesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesStockimagesGetUnauthorized) 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 +} + +// NewPcloudCloudinstancesStockimagesGetNotFound creates a PcloudCloudinstancesStockimagesGetNotFound with default headers values +func NewPcloudCloudinstancesStockimagesGetNotFound() *PcloudCloudinstancesStockimagesGetNotFound { + return &PcloudCloudinstancesStockimagesGetNotFound{} +} + +/* PcloudCloudinstancesStockimagesGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesStockimagesGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesStockimagesGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images/{image_id}][%d] pcloudCloudinstancesStockimagesGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudinstancesStockimagesGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesStockimagesGetNotFound) 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 +} + +// NewPcloudCloudinstancesStockimagesGetInternalServerError creates a PcloudCloudinstancesStockimagesGetInternalServerError with default headers values +func NewPcloudCloudinstancesStockimagesGetInternalServerError() *PcloudCloudinstancesStockimagesGetInternalServerError { + return &PcloudCloudinstancesStockimagesGetInternalServerError{} +} + +/* PcloudCloudinstancesStockimagesGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesStockimagesGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesStockimagesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images/{image_id}][%d] pcloudCloudinstancesStockimagesGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesStockimagesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesStockimagesGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_getall_parameters.go new file mode 100644 index 00000000000..cec512f7bd6 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_getall_parameters.go @@ -0,0 +1,218 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// 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/go-openapi/swag" +) + +// NewPcloudCloudinstancesStockimagesGetallParams creates a new PcloudCloudinstancesStockimagesGetallParams 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 NewPcloudCloudinstancesStockimagesGetallParams() *PcloudCloudinstancesStockimagesGetallParams { + return &PcloudCloudinstancesStockimagesGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesStockimagesGetallParamsWithTimeout creates a new PcloudCloudinstancesStockimagesGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesStockimagesGetallParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesStockimagesGetallParams { + return &PcloudCloudinstancesStockimagesGetallParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesStockimagesGetallParamsWithContext creates a new PcloudCloudinstancesStockimagesGetallParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesStockimagesGetallParamsWithContext(ctx context.Context) *PcloudCloudinstancesStockimagesGetallParams { + return &PcloudCloudinstancesStockimagesGetallParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesStockimagesGetallParamsWithHTTPClient creates a new PcloudCloudinstancesStockimagesGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesStockimagesGetallParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesStockimagesGetallParams { + return &PcloudCloudinstancesStockimagesGetallParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesStockimagesGetallParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances stockimages getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesStockimagesGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* Sap. + + Include SAP images with get available stock images + */ + Sap *bool + + /* Vtl. + + Include VTL images with get available stock images + */ + Vtl *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances stockimages getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesStockimagesGetallParams) WithDefaults() *PcloudCloudinstancesStockimagesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances stockimages getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesStockimagesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances stockimages getall params +func (o *PcloudCloudinstancesStockimagesGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesStockimagesGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances stockimages getall params +func (o *PcloudCloudinstancesStockimagesGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances stockimages getall params +func (o *PcloudCloudinstancesStockimagesGetallParams) WithContext(ctx context.Context) *PcloudCloudinstancesStockimagesGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances stockimages getall params +func (o *PcloudCloudinstancesStockimagesGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances stockimages getall params +func (o *PcloudCloudinstancesStockimagesGetallParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesStockimagesGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances stockimages getall params +func (o *PcloudCloudinstancesStockimagesGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances stockimages getall params +func (o *PcloudCloudinstancesStockimagesGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesStockimagesGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances stockimages getall params +func (o *PcloudCloudinstancesStockimagesGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithSap adds the sap to the pcloud cloudinstances stockimages getall params +func (o *PcloudCloudinstancesStockimagesGetallParams) WithSap(sap *bool) *PcloudCloudinstancesStockimagesGetallParams { + o.SetSap(sap) + return o +} + +// SetSap adds the sap to the pcloud cloudinstances stockimages getall params +func (o *PcloudCloudinstancesStockimagesGetallParams) SetSap(sap *bool) { + o.Sap = sap +} + +// WithVtl adds the vtl to the pcloud cloudinstances stockimages getall params +func (o *PcloudCloudinstancesStockimagesGetallParams) WithVtl(vtl *bool) *PcloudCloudinstancesStockimagesGetallParams { + o.SetVtl(vtl) + return o +} + +// SetVtl adds the vtl to the pcloud cloudinstances stockimages getall params +func (o *PcloudCloudinstancesStockimagesGetallParams) SetVtl(vtl *bool) { + o.Vtl = vtl +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesStockimagesGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if o.Sap != nil { + + // query param sap + var qrSap bool + + if o.Sap != nil { + qrSap = *o.Sap + } + qSap := swag.FormatBool(qrSap) + if qSap != "" { + + if err := r.SetQueryParam("sap", qSap); err != nil { + return err + } + } + } + + if o.Vtl != nil { + + // query param vtl + var qrVtl bool + + if o.Vtl != nil { + qrVtl = *o.Vtl + } + qVtl := swag.FormatBool(qrVtl) + if qVtl != "" { + + if err := r.SetQueryParam("vtl", qVtl); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_getall_responses.go new file mode 100644 index 00000000000..b30c83880b7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_cloudinstances_stockimages_getall_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesStockimagesGetallReader is a Reader for the PcloudCloudinstancesStockimagesGetall structure. +type PcloudCloudinstancesStockimagesGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesStockimagesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesStockimagesGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesStockimagesGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesStockimagesGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesStockimagesGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesStockimagesGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesStockimagesGetallOK creates a PcloudCloudinstancesStockimagesGetallOK with default headers values +func NewPcloudCloudinstancesStockimagesGetallOK() *PcloudCloudinstancesStockimagesGetallOK { + return &PcloudCloudinstancesStockimagesGetallOK{} +} + +/* PcloudCloudinstancesStockimagesGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesStockimagesGetallOK struct { + Payload *models.Images +} + +func (o *PcloudCloudinstancesStockimagesGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images][%d] pcloudCloudinstancesStockimagesGetallOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesStockimagesGetallOK) GetPayload() *models.Images { + return o.Payload +} + +func (o *PcloudCloudinstancesStockimagesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Images) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesStockimagesGetallBadRequest creates a PcloudCloudinstancesStockimagesGetallBadRequest with default headers values +func NewPcloudCloudinstancesStockimagesGetallBadRequest() *PcloudCloudinstancesStockimagesGetallBadRequest { + return &PcloudCloudinstancesStockimagesGetallBadRequest{} +} + +/* PcloudCloudinstancesStockimagesGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesStockimagesGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesStockimagesGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images][%d] pcloudCloudinstancesStockimagesGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesStockimagesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesStockimagesGetallBadRequest) 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 +} + +// NewPcloudCloudinstancesStockimagesGetallUnauthorized creates a PcloudCloudinstancesStockimagesGetallUnauthorized with default headers values +func NewPcloudCloudinstancesStockimagesGetallUnauthorized() *PcloudCloudinstancesStockimagesGetallUnauthorized { + return &PcloudCloudinstancesStockimagesGetallUnauthorized{} +} + +/* PcloudCloudinstancesStockimagesGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesStockimagesGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesStockimagesGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images][%d] pcloudCloudinstancesStockimagesGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesStockimagesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesStockimagesGetallUnauthorized) 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 +} + +// NewPcloudCloudinstancesStockimagesGetallNotFound creates a PcloudCloudinstancesStockimagesGetallNotFound with default headers values +func NewPcloudCloudinstancesStockimagesGetallNotFound() *PcloudCloudinstancesStockimagesGetallNotFound { + return &PcloudCloudinstancesStockimagesGetallNotFound{} +} + +/* PcloudCloudinstancesStockimagesGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesStockimagesGetallNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesStockimagesGetallNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images][%d] pcloudCloudinstancesStockimagesGetallNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudinstancesStockimagesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesStockimagesGetallNotFound) 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 +} + +// NewPcloudCloudinstancesStockimagesGetallInternalServerError creates a PcloudCloudinstancesStockimagesGetallInternalServerError with default headers values +func NewPcloudCloudinstancesStockimagesGetallInternalServerError() *PcloudCloudinstancesStockimagesGetallInternalServerError { + return &PcloudCloudinstancesStockimagesGetallInternalServerError{} +} + +/* PcloudCloudinstancesStockimagesGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesStockimagesGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesStockimagesGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/stock-images][%d] pcloudCloudinstancesStockimagesGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesStockimagesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesStockimagesGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_images_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_images_get_parameters.go new file mode 100644 index 00000000000..91192f6fdcc --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_images_get_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// 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" +) + +// NewPcloudImagesGetParams creates a new PcloudImagesGetParams 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 NewPcloudImagesGetParams() *PcloudImagesGetParams { + return &PcloudImagesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudImagesGetParamsWithTimeout creates a new PcloudImagesGetParams object +// with the ability to set a timeout on a request. +func NewPcloudImagesGetParamsWithTimeout(timeout time.Duration) *PcloudImagesGetParams { + return &PcloudImagesGetParams{ + timeout: timeout, + } +} + +// NewPcloudImagesGetParamsWithContext creates a new PcloudImagesGetParams object +// with the ability to set a context for a request. +func NewPcloudImagesGetParamsWithContext(ctx context.Context) *PcloudImagesGetParams { + return &PcloudImagesGetParams{ + Context: ctx, + } +} + +// NewPcloudImagesGetParamsWithHTTPClient creates a new PcloudImagesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudImagesGetParamsWithHTTPClient(client *http.Client) *PcloudImagesGetParams { + return &PcloudImagesGetParams{ + HTTPClient: client, + } +} + +/* PcloudImagesGetParams contains all the parameters to send to the API endpoint + for the pcloud images get operation. + + Typically these are written to a http.Request. +*/ +type PcloudImagesGetParams struct { + + /* ImageID. + + Image ID of a image + */ + ImageID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud images get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudImagesGetParams) WithDefaults() *PcloudImagesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud images get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudImagesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud images get params +func (o *PcloudImagesGetParams) WithTimeout(timeout time.Duration) *PcloudImagesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud images get params +func (o *PcloudImagesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud images get params +func (o *PcloudImagesGetParams) WithContext(ctx context.Context) *PcloudImagesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud images get params +func (o *PcloudImagesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud images get params +func (o *PcloudImagesGetParams) WithHTTPClient(client *http.Client) *PcloudImagesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud images get params +func (o *PcloudImagesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithImageID adds the imageID to the pcloud images get params +func (o *PcloudImagesGetParams) WithImageID(imageID string) *PcloudImagesGetParams { + o.SetImageID(imageID) + return o +} + +// SetImageID adds the imageId to the pcloud images get params +func (o *PcloudImagesGetParams) SetImageID(imageID string) { + o.ImageID = imageID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudImagesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param image_id + if err := r.SetPathParam("image_id", o.ImageID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_images_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_images_get_responses.go new file mode 100644 index 00000000000..040e27c3fe4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_images_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudImagesGetReader is a Reader for the PcloudImagesGet structure. +type PcloudImagesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudImagesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudImagesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudImagesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudImagesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudImagesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudImagesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudImagesGetOK creates a PcloudImagesGetOK with default headers values +func NewPcloudImagesGetOK() *PcloudImagesGetOK { + return &PcloudImagesGetOK{} +} + +/* PcloudImagesGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudImagesGetOK struct { + Payload *models.Image +} + +func (o *PcloudImagesGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/images/{image_id}][%d] pcloudImagesGetOK %+v", 200, o.Payload) +} +func (o *PcloudImagesGetOK) GetPayload() *models.Image { + return o.Payload +} + +func (o *PcloudImagesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Image) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudImagesGetBadRequest creates a PcloudImagesGetBadRequest with default headers values +func NewPcloudImagesGetBadRequest() *PcloudImagesGetBadRequest { + return &PcloudImagesGetBadRequest{} +} + +/* PcloudImagesGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudImagesGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudImagesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/images/{image_id}][%d] pcloudImagesGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudImagesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudImagesGetBadRequest) 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 +} + +// NewPcloudImagesGetUnauthorized creates a PcloudImagesGetUnauthorized with default headers values +func NewPcloudImagesGetUnauthorized() *PcloudImagesGetUnauthorized { + return &PcloudImagesGetUnauthorized{} +} + +/* PcloudImagesGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudImagesGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudImagesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/images/{image_id}][%d] pcloudImagesGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudImagesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudImagesGetUnauthorized) 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 +} + +// NewPcloudImagesGetNotFound creates a PcloudImagesGetNotFound with default headers values +func NewPcloudImagesGetNotFound() *PcloudImagesGetNotFound { + return &PcloudImagesGetNotFound{} +} + +/* PcloudImagesGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudImagesGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudImagesGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/images/{image_id}][%d] pcloudImagesGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudImagesGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudImagesGetNotFound) 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 +} + +// NewPcloudImagesGetInternalServerError creates a PcloudImagesGetInternalServerError with default headers values +func NewPcloudImagesGetInternalServerError() *PcloudImagesGetInternalServerError { + return &PcloudImagesGetInternalServerError{} +} + +/* PcloudImagesGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudImagesGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudImagesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/images/{image_id}][%d] pcloudImagesGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudImagesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudImagesGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_images_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_images_getall_parameters.go new file mode 100644 index 00000000000..cb90f6f5a67 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_images_getall_parameters.go @@ -0,0 +1,196 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// 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/go-openapi/swag" +) + +// NewPcloudImagesGetallParams creates a new PcloudImagesGetallParams 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 NewPcloudImagesGetallParams() *PcloudImagesGetallParams { + return &PcloudImagesGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudImagesGetallParamsWithTimeout creates a new PcloudImagesGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudImagesGetallParamsWithTimeout(timeout time.Duration) *PcloudImagesGetallParams { + return &PcloudImagesGetallParams{ + timeout: timeout, + } +} + +// NewPcloudImagesGetallParamsWithContext creates a new PcloudImagesGetallParams object +// with the ability to set a context for a request. +func NewPcloudImagesGetallParamsWithContext(ctx context.Context) *PcloudImagesGetallParams { + return &PcloudImagesGetallParams{ + Context: ctx, + } +} + +// NewPcloudImagesGetallParamsWithHTTPClient creates a new PcloudImagesGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudImagesGetallParamsWithHTTPClient(client *http.Client) *PcloudImagesGetallParams { + return &PcloudImagesGetallParams{ + HTTPClient: client, + } +} + +/* PcloudImagesGetallParams contains all the parameters to send to the API endpoint + for the pcloud images getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudImagesGetallParams struct { + + /* Sap. + + Include SAP images with get available stock images + */ + Sap *bool + + /* Vtl. + + Include VTL images with get available stock images + */ + Vtl *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud images getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudImagesGetallParams) WithDefaults() *PcloudImagesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud images getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudImagesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud images getall params +func (o *PcloudImagesGetallParams) WithTimeout(timeout time.Duration) *PcloudImagesGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud images getall params +func (o *PcloudImagesGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud images getall params +func (o *PcloudImagesGetallParams) WithContext(ctx context.Context) *PcloudImagesGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud images getall params +func (o *PcloudImagesGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud images getall params +func (o *PcloudImagesGetallParams) WithHTTPClient(client *http.Client) *PcloudImagesGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud images getall params +func (o *PcloudImagesGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithSap adds the sap to the pcloud images getall params +func (o *PcloudImagesGetallParams) WithSap(sap *bool) *PcloudImagesGetallParams { + o.SetSap(sap) + return o +} + +// SetSap adds the sap to the pcloud images getall params +func (o *PcloudImagesGetallParams) SetSap(sap *bool) { + o.Sap = sap +} + +// WithVtl adds the vtl to the pcloud images getall params +func (o *PcloudImagesGetallParams) WithVtl(vtl *bool) *PcloudImagesGetallParams { + o.SetVtl(vtl) + return o +} + +// SetVtl adds the vtl to the pcloud images getall params +func (o *PcloudImagesGetallParams) SetVtl(vtl *bool) { + o.Vtl = vtl +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudImagesGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Sap != nil { + + // query param sap + var qrSap bool + + if o.Sap != nil { + qrSap = *o.Sap + } + qSap := swag.FormatBool(qrSap) + if qSap != "" { + + if err := r.SetQueryParam("sap", qSap); err != nil { + return err + } + } + } + + if o.Vtl != nil { + + // query param vtl + var qrVtl bool + + if o.Vtl != nil { + qrVtl = *o.Vtl + } + qVtl := swag.FormatBool(qrVtl) + if qVtl != "" { + + if err := r.SetQueryParam("vtl", qVtl); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_images_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_images_getall_responses.go new file mode 100644 index 00000000000..5be159bd652 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_images_getall_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudImagesGetallReader is a Reader for the PcloudImagesGetall structure. +type PcloudImagesGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudImagesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudImagesGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudImagesGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudImagesGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudImagesGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudImagesGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudImagesGetallOK creates a PcloudImagesGetallOK with default headers values +func NewPcloudImagesGetallOK() *PcloudImagesGetallOK { + return &PcloudImagesGetallOK{} +} + +/* PcloudImagesGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudImagesGetallOK struct { + Payload *models.Images +} + +func (o *PcloudImagesGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/images][%d] pcloudImagesGetallOK %+v", 200, o.Payload) +} +func (o *PcloudImagesGetallOK) GetPayload() *models.Images { + return o.Payload +} + +func (o *PcloudImagesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Images) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudImagesGetallBadRequest creates a PcloudImagesGetallBadRequest with default headers values +func NewPcloudImagesGetallBadRequest() *PcloudImagesGetallBadRequest { + return &PcloudImagesGetallBadRequest{} +} + +/* PcloudImagesGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudImagesGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudImagesGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/images][%d] pcloudImagesGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudImagesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudImagesGetallBadRequest) 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 +} + +// NewPcloudImagesGetallUnauthorized creates a PcloudImagesGetallUnauthorized with default headers values +func NewPcloudImagesGetallUnauthorized() *PcloudImagesGetallUnauthorized { + return &PcloudImagesGetallUnauthorized{} +} + +/* PcloudImagesGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudImagesGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudImagesGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/images][%d] pcloudImagesGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudImagesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudImagesGetallUnauthorized) 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 +} + +// NewPcloudImagesGetallNotFound creates a PcloudImagesGetallNotFound with default headers values +func NewPcloudImagesGetallNotFound() *PcloudImagesGetallNotFound { + return &PcloudImagesGetallNotFound{} +} + +/* PcloudImagesGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudImagesGetallNotFound struct { + Payload *models.Error +} + +func (o *PcloudImagesGetallNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/images][%d] pcloudImagesGetallNotFound %+v", 404, o.Payload) +} +func (o *PcloudImagesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudImagesGetallNotFound) 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 +} + +// NewPcloudImagesGetallInternalServerError creates a PcloudImagesGetallInternalServerError with default headers values +func NewPcloudImagesGetallInternalServerError() *PcloudImagesGetallInternalServerError { + return &PcloudImagesGetallInternalServerError{} +} + +/* PcloudImagesGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudImagesGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudImagesGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/images][%d] pcloudImagesGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudImagesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudImagesGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_get_parameters.go new file mode 100644 index 00000000000..dd5a1f9ad02 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_get_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// 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" +) + +// NewPcloudV1CloudinstancesCosimagesGetParams creates a new PcloudV1CloudinstancesCosimagesGetParams 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 NewPcloudV1CloudinstancesCosimagesGetParams() *PcloudV1CloudinstancesCosimagesGetParams { + return &PcloudV1CloudinstancesCosimagesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV1CloudinstancesCosimagesGetParamsWithTimeout creates a new PcloudV1CloudinstancesCosimagesGetParams object +// with the ability to set a timeout on a request. +func NewPcloudV1CloudinstancesCosimagesGetParamsWithTimeout(timeout time.Duration) *PcloudV1CloudinstancesCosimagesGetParams { + return &PcloudV1CloudinstancesCosimagesGetParams{ + timeout: timeout, + } +} + +// NewPcloudV1CloudinstancesCosimagesGetParamsWithContext creates a new PcloudV1CloudinstancesCosimagesGetParams object +// with the ability to set a context for a request. +func NewPcloudV1CloudinstancesCosimagesGetParamsWithContext(ctx context.Context) *PcloudV1CloudinstancesCosimagesGetParams { + return &PcloudV1CloudinstancesCosimagesGetParams{ + Context: ctx, + } +} + +// NewPcloudV1CloudinstancesCosimagesGetParamsWithHTTPClient creates a new PcloudV1CloudinstancesCosimagesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV1CloudinstancesCosimagesGetParamsWithHTTPClient(client *http.Client) *PcloudV1CloudinstancesCosimagesGetParams { + return &PcloudV1CloudinstancesCosimagesGetParams{ + HTTPClient: client, + } +} + +/* PcloudV1CloudinstancesCosimagesGetParams contains all the parameters to send to the API endpoint + for the pcloud v1 cloudinstances cosimages get operation. + + Typically these are written to a http.Request. +*/ +type PcloudV1CloudinstancesCosimagesGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v1 cloudinstances cosimages get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV1CloudinstancesCosimagesGetParams) WithDefaults() *PcloudV1CloudinstancesCosimagesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v1 cloudinstances cosimages get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV1CloudinstancesCosimagesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v1 cloudinstances cosimages get params +func (o *PcloudV1CloudinstancesCosimagesGetParams) WithTimeout(timeout time.Duration) *PcloudV1CloudinstancesCosimagesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v1 cloudinstances cosimages get params +func (o *PcloudV1CloudinstancesCosimagesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v1 cloudinstances cosimages get params +func (o *PcloudV1CloudinstancesCosimagesGetParams) WithContext(ctx context.Context) *PcloudV1CloudinstancesCosimagesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v1 cloudinstances cosimages get params +func (o *PcloudV1CloudinstancesCosimagesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v1 cloudinstances cosimages get params +func (o *PcloudV1CloudinstancesCosimagesGetParams) WithHTTPClient(client *http.Client) *PcloudV1CloudinstancesCosimagesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v1 cloudinstances cosimages get params +func (o *PcloudV1CloudinstancesCosimagesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v1 cloudinstances cosimages get params +func (o *PcloudV1CloudinstancesCosimagesGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV1CloudinstancesCosimagesGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v1 cloudinstances cosimages get params +func (o *PcloudV1CloudinstancesCosimagesGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV1CloudinstancesCosimagesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_get_responses.go new file mode 100644 index 00000000000..54dad0dc1a2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_get_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV1CloudinstancesCosimagesGetReader is a Reader for the PcloudV1CloudinstancesCosimagesGet structure. +type PcloudV1CloudinstancesCosimagesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV1CloudinstancesCosimagesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudV1CloudinstancesCosimagesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPcloudV1CloudinstancesCosimagesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV1CloudinstancesCosimagesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV1CloudinstancesCosimagesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV1CloudinstancesCosimagesGetOK creates a PcloudV1CloudinstancesCosimagesGetOK with default headers values +func NewPcloudV1CloudinstancesCosimagesGetOK() *PcloudV1CloudinstancesCosimagesGetOK { + return &PcloudV1CloudinstancesCosimagesGetOK{} +} + +/* PcloudV1CloudinstancesCosimagesGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudV1CloudinstancesCosimagesGetOK struct { + Payload *models.Job +} + +func (o *PcloudV1CloudinstancesCosimagesGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesGetOK %+v", 200, o.Payload) +} +func (o *PcloudV1CloudinstancesCosimagesGetOK) GetPayload() *models.Job { + return o.Payload +} + +func (o *PcloudV1CloudinstancesCosimagesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Job) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV1CloudinstancesCosimagesGetUnauthorized creates a PcloudV1CloudinstancesCosimagesGetUnauthorized with default headers values +func NewPcloudV1CloudinstancesCosimagesGetUnauthorized() *PcloudV1CloudinstancesCosimagesGetUnauthorized { + return &PcloudV1CloudinstancesCosimagesGetUnauthorized{} +} + +/* PcloudV1CloudinstancesCosimagesGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV1CloudinstancesCosimagesGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV1CloudinstancesCosimagesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV1CloudinstancesCosimagesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV1CloudinstancesCosimagesGetUnauthorized) 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 +} + +// NewPcloudV1CloudinstancesCosimagesGetNotFound creates a PcloudV1CloudinstancesCosimagesGetNotFound with default headers values +func NewPcloudV1CloudinstancesCosimagesGetNotFound() *PcloudV1CloudinstancesCosimagesGetNotFound { + return &PcloudV1CloudinstancesCosimagesGetNotFound{} +} + +/* PcloudV1CloudinstancesCosimagesGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudV1CloudinstancesCosimagesGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudV1CloudinstancesCosimagesGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudV1CloudinstancesCosimagesGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV1CloudinstancesCosimagesGetNotFound) 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 +} + +// NewPcloudV1CloudinstancesCosimagesGetInternalServerError creates a PcloudV1CloudinstancesCosimagesGetInternalServerError with default headers values +func NewPcloudV1CloudinstancesCosimagesGetInternalServerError() *PcloudV1CloudinstancesCosimagesGetInternalServerError { + return &PcloudV1CloudinstancesCosimagesGetInternalServerError{} +} + +/* PcloudV1CloudinstancesCosimagesGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV1CloudinstancesCosimagesGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV1CloudinstancesCosimagesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV1CloudinstancesCosimagesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV1CloudinstancesCosimagesGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_post_parameters.go new file mode 100644 index 00000000000..199d9e7a724 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// 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" +) + +// NewPcloudV1CloudinstancesCosimagesPostParams creates a new PcloudV1CloudinstancesCosimagesPostParams 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 NewPcloudV1CloudinstancesCosimagesPostParams() *PcloudV1CloudinstancesCosimagesPostParams { + return &PcloudV1CloudinstancesCosimagesPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV1CloudinstancesCosimagesPostParamsWithTimeout creates a new PcloudV1CloudinstancesCosimagesPostParams object +// with the ability to set a timeout on a request. +func NewPcloudV1CloudinstancesCosimagesPostParamsWithTimeout(timeout time.Duration) *PcloudV1CloudinstancesCosimagesPostParams { + return &PcloudV1CloudinstancesCosimagesPostParams{ + timeout: timeout, + } +} + +// NewPcloudV1CloudinstancesCosimagesPostParamsWithContext creates a new PcloudV1CloudinstancesCosimagesPostParams object +// with the ability to set a context for a request. +func NewPcloudV1CloudinstancesCosimagesPostParamsWithContext(ctx context.Context) *PcloudV1CloudinstancesCosimagesPostParams { + return &PcloudV1CloudinstancesCosimagesPostParams{ + Context: ctx, + } +} + +// NewPcloudV1CloudinstancesCosimagesPostParamsWithHTTPClient creates a new PcloudV1CloudinstancesCosimagesPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV1CloudinstancesCosimagesPostParamsWithHTTPClient(client *http.Client) *PcloudV1CloudinstancesCosimagesPostParams { + return &PcloudV1CloudinstancesCosimagesPostParams{ + HTTPClient: client, + } +} + +/* PcloudV1CloudinstancesCosimagesPostParams contains all the parameters to send to the API endpoint + for the pcloud v1 cloudinstances cosimages post operation. + + Typically these are written to a http.Request. +*/ +type PcloudV1CloudinstancesCosimagesPostParams struct { + + /* Body. + + Parameters for the creation of a new cos-image import job + */ + Body *models.CreateCosImageImportJob + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v1 cloudinstances cosimages post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV1CloudinstancesCosimagesPostParams) WithDefaults() *PcloudV1CloudinstancesCosimagesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v1 cloudinstances cosimages post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV1CloudinstancesCosimagesPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v1 cloudinstances cosimages post params +func (o *PcloudV1CloudinstancesCosimagesPostParams) WithTimeout(timeout time.Duration) *PcloudV1CloudinstancesCosimagesPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v1 cloudinstances cosimages post params +func (o *PcloudV1CloudinstancesCosimagesPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v1 cloudinstances cosimages post params +func (o *PcloudV1CloudinstancesCosimagesPostParams) WithContext(ctx context.Context) *PcloudV1CloudinstancesCosimagesPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v1 cloudinstances cosimages post params +func (o *PcloudV1CloudinstancesCosimagesPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v1 cloudinstances cosimages post params +func (o *PcloudV1CloudinstancesCosimagesPostParams) WithHTTPClient(client *http.Client) *PcloudV1CloudinstancesCosimagesPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v1 cloudinstances cosimages post params +func (o *PcloudV1CloudinstancesCosimagesPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud v1 cloudinstances cosimages post params +func (o *PcloudV1CloudinstancesCosimagesPostParams) WithBody(body *models.CreateCosImageImportJob) *PcloudV1CloudinstancesCosimagesPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud v1 cloudinstances cosimages post params +func (o *PcloudV1CloudinstancesCosimagesPostParams) SetBody(body *models.CreateCosImageImportJob) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v1 cloudinstances cosimages post params +func (o *PcloudV1CloudinstancesCosimagesPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV1CloudinstancesCosimagesPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v1 cloudinstances cosimages post params +func (o *PcloudV1CloudinstancesCosimagesPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV1CloudinstancesCosimagesPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_post_responses.go new file mode 100644 index 00000000000..ac1a8d0adac --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v1_cloudinstances_cosimages_post_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV1CloudinstancesCosimagesPostReader is a Reader for the PcloudV1CloudinstancesCosimagesPost structure. +type PcloudV1CloudinstancesCosimagesPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV1CloudinstancesCosimagesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudV1CloudinstancesCosimagesPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudV1CloudinstancesCosimagesPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudV1CloudinstancesCosimagesPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudV1CloudinstancesCosimagesPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudV1CloudinstancesCosimagesPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudV1CloudinstancesCosimagesPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV1CloudinstancesCosimagesPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV1CloudinstancesCosimagesPostAccepted creates a PcloudV1CloudinstancesCosimagesPostAccepted with default headers values +func NewPcloudV1CloudinstancesCosimagesPostAccepted() *PcloudV1CloudinstancesCosimagesPostAccepted { + return &PcloudV1CloudinstancesCosimagesPostAccepted{} +} + +/* PcloudV1CloudinstancesCosimagesPostAccepted describes a response with status code 202, with default header values. + +Accepted, cos-image import successfully added to the jobs queue +*/ +type PcloudV1CloudinstancesCosimagesPostAccepted struct { + Payload *models.JobReference +} + +func (o *PcloudV1CloudinstancesCosimagesPostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesPostAccepted %+v", 202, o.Payload) +} +func (o *PcloudV1CloudinstancesCosimagesPostAccepted) GetPayload() *models.JobReference { + return o.Payload +} + +func (o *PcloudV1CloudinstancesCosimagesPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.JobReference) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV1CloudinstancesCosimagesPostBadRequest creates a PcloudV1CloudinstancesCosimagesPostBadRequest with default headers values +func NewPcloudV1CloudinstancesCosimagesPostBadRequest() *PcloudV1CloudinstancesCosimagesPostBadRequest { + return &PcloudV1CloudinstancesCosimagesPostBadRequest{} +} + +/* PcloudV1CloudinstancesCosimagesPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudV1CloudinstancesCosimagesPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudV1CloudinstancesCosimagesPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudV1CloudinstancesCosimagesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV1CloudinstancesCosimagesPostBadRequest) 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 +} + +// NewPcloudV1CloudinstancesCosimagesPostUnauthorized creates a PcloudV1CloudinstancesCosimagesPostUnauthorized with default headers values +func NewPcloudV1CloudinstancesCosimagesPostUnauthorized() *PcloudV1CloudinstancesCosimagesPostUnauthorized { + return &PcloudV1CloudinstancesCosimagesPostUnauthorized{} +} + +/* PcloudV1CloudinstancesCosimagesPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV1CloudinstancesCosimagesPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV1CloudinstancesCosimagesPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV1CloudinstancesCosimagesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV1CloudinstancesCosimagesPostUnauthorized) 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 +} + +// NewPcloudV1CloudinstancesCosimagesPostForbidden creates a PcloudV1CloudinstancesCosimagesPostForbidden with default headers values +func NewPcloudV1CloudinstancesCosimagesPostForbidden() *PcloudV1CloudinstancesCosimagesPostForbidden { + return &PcloudV1CloudinstancesCosimagesPostForbidden{} +} + +/* PcloudV1CloudinstancesCosimagesPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudV1CloudinstancesCosimagesPostForbidden struct { + Payload *models.Error +} + +func (o *PcloudV1CloudinstancesCosimagesPostForbidden) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesPostForbidden %+v", 403, o.Payload) +} +func (o *PcloudV1CloudinstancesCosimagesPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV1CloudinstancesCosimagesPostForbidden) 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 +} + +// NewPcloudV1CloudinstancesCosimagesPostConflict creates a PcloudV1CloudinstancesCosimagesPostConflict with default headers values +func NewPcloudV1CloudinstancesCosimagesPostConflict() *PcloudV1CloudinstancesCosimagesPostConflict { + return &PcloudV1CloudinstancesCosimagesPostConflict{} +} + +/* PcloudV1CloudinstancesCosimagesPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudV1CloudinstancesCosimagesPostConflict struct { + Payload *models.Error +} + +func (o *PcloudV1CloudinstancesCosimagesPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesPostConflict %+v", 409, o.Payload) +} +func (o *PcloudV1CloudinstancesCosimagesPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV1CloudinstancesCosimagesPostConflict) 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 +} + +// NewPcloudV1CloudinstancesCosimagesPostUnprocessableEntity creates a PcloudV1CloudinstancesCosimagesPostUnprocessableEntity with default headers values +func NewPcloudV1CloudinstancesCosimagesPostUnprocessableEntity() *PcloudV1CloudinstancesCosimagesPostUnprocessableEntity { + return &PcloudV1CloudinstancesCosimagesPostUnprocessableEntity{} +} + +/* PcloudV1CloudinstancesCosimagesPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudV1CloudinstancesCosimagesPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudV1CloudinstancesCosimagesPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudV1CloudinstancesCosimagesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV1CloudinstancesCosimagesPostUnprocessableEntity) 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 +} + +// NewPcloudV1CloudinstancesCosimagesPostInternalServerError creates a PcloudV1CloudinstancesCosimagesPostInternalServerError with default headers values +func NewPcloudV1CloudinstancesCosimagesPostInternalServerError() *PcloudV1CloudinstancesCosimagesPostInternalServerError { + return &PcloudV1CloudinstancesCosimagesPostInternalServerError{} +} + +/* PcloudV1CloudinstancesCosimagesPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV1CloudinstancesCosimagesPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV1CloudinstancesCosimagesPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/cos-images][%d] pcloudV1CloudinstancesCosimagesPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV1CloudinstancesCosimagesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV1CloudinstancesCosimagesPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v2_images_export_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v2_images_export_get_parameters.go new file mode 100644 index 00000000000..6a7f12b258f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v2_images_export_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// 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" +) + +// NewPcloudV2ImagesExportGetParams creates a new PcloudV2ImagesExportGetParams 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 NewPcloudV2ImagesExportGetParams() *PcloudV2ImagesExportGetParams { + return &PcloudV2ImagesExportGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2ImagesExportGetParamsWithTimeout creates a new PcloudV2ImagesExportGetParams object +// with the ability to set a timeout on a request. +func NewPcloudV2ImagesExportGetParamsWithTimeout(timeout time.Duration) *PcloudV2ImagesExportGetParams { + return &PcloudV2ImagesExportGetParams{ + timeout: timeout, + } +} + +// NewPcloudV2ImagesExportGetParamsWithContext creates a new PcloudV2ImagesExportGetParams object +// with the ability to set a context for a request. +func NewPcloudV2ImagesExportGetParamsWithContext(ctx context.Context) *PcloudV2ImagesExportGetParams { + return &PcloudV2ImagesExportGetParams{ + Context: ctx, + } +} + +// NewPcloudV2ImagesExportGetParamsWithHTTPClient creates a new PcloudV2ImagesExportGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2ImagesExportGetParamsWithHTTPClient(client *http.Client) *PcloudV2ImagesExportGetParams { + return &PcloudV2ImagesExportGetParams{ + HTTPClient: client, + } +} + +/* PcloudV2ImagesExportGetParams contains all the parameters to send to the API endpoint + for the pcloud v2 images export get operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2ImagesExportGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* ImageID. + + Image ID of a image + */ + ImageID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 images export get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2ImagesExportGetParams) WithDefaults() *PcloudV2ImagesExportGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 images export get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2ImagesExportGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 images export get params +func (o *PcloudV2ImagesExportGetParams) WithTimeout(timeout time.Duration) *PcloudV2ImagesExportGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 images export get params +func (o *PcloudV2ImagesExportGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 images export get params +func (o *PcloudV2ImagesExportGetParams) WithContext(ctx context.Context) *PcloudV2ImagesExportGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 images export get params +func (o *PcloudV2ImagesExportGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 images export get params +func (o *PcloudV2ImagesExportGetParams) WithHTTPClient(client *http.Client) *PcloudV2ImagesExportGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 images export get params +func (o *PcloudV2ImagesExportGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 images export get params +func (o *PcloudV2ImagesExportGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2ImagesExportGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 images export get params +func (o *PcloudV2ImagesExportGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithImageID adds the imageID to the pcloud v2 images export get params +func (o *PcloudV2ImagesExportGetParams) WithImageID(imageID string) *PcloudV2ImagesExportGetParams { + o.SetImageID(imageID) + return o +} + +// SetImageID adds the imageId to the pcloud v2 images export get params +func (o *PcloudV2ImagesExportGetParams) SetImageID(imageID string) { + o.ImageID = imageID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2ImagesExportGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param image_id + if err := r.SetPathParam("image_id", o.ImageID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v2_images_export_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v2_images_export_get_responses.go new file mode 100644 index 00000000000..a5c695a14bc --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v2_images_export_get_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV2ImagesExportGetReader is a Reader for the PcloudV2ImagesExportGet structure. +type PcloudV2ImagesExportGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2ImagesExportGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudV2ImagesExportGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPcloudV2ImagesExportGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2ImagesExportGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2ImagesExportGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV2ImagesExportGetOK creates a PcloudV2ImagesExportGetOK with default headers values +func NewPcloudV2ImagesExportGetOK() *PcloudV2ImagesExportGetOK { + return &PcloudV2ImagesExportGetOK{} +} + +/* PcloudV2ImagesExportGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudV2ImagesExportGetOK struct { + Payload *models.Job +} + +func (o *PcloudV2ImagesExportGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportGetOK %+v", 200, o.Payload) +} +func (o *PcloudV2ImagesExportGetOK) GetPayload() *models.Job { + return o.Payload +} + +func (o *PcloudV2ImagesExportGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Job) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2ImagesExportGetUnauthorized creates a PcloudV2ImagesExportGetUnauthorized with default headers values +func NewPcloudV2ImagesExportGetUnauthorized() *PcloudV2ImagesExportGetUnauthorized { + return &PcloudV2ImagesExportGetUnauthorized{} +} + +/* PcloudV2ImagesExportGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2ImagesExportGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV2ImagesExportGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV2ImagesExportGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2ImagesExportGetUnauthorized) 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 +} + +// NewPcloudV2ImagesExportGetNotFound creates a PcloudV2ImagesExportGetNotFound with default headers values +func NewPcloudV2ImagesExportGetNotFound() *PcloudV2ImagesExportGetNotFound { + return &PcloudV2ImagesExportGetNotFound{} +} + +/* PcloudV2ImagesExportGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudV2ImagesExportGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudV2ImagesExportGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudV2ImagesExportGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2ImagesExportGetNotFound) 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 +} + +// NewPcloudV2ImagesExportGetInternalServerError creates a PcloudV2ImagesExportGetInternalServerError with default headers values +func NewPcloudV2ImagesExportGetInternalServerError() *PcloudV2ImagesExportGetInternalServerError { + return &PcloudV2ImagesExportGetInternalServerError{} +} + +/* PcloudV2ImagesExportGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2ImagesExportGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV2ImagesExportGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV2ImagesExportGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2ImagesExportGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v2_images_export_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v2_images_export_post_parameters.go new file mode 100644 index 00000000000..da0c0be1502 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v2_images_export_post_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// 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" +) + +// NewPcloudV2ImagesExportPostParams creates a new PcloudV2ImagesExportPostParams 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 NewPcloudV2ImagesExportPostParams() *PcloudV2ImagesExportPostParams { + return &PcloudV2ImagesExportPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2ImagesExportPostParamsWithTimeout creates a new PcloudV2ImagesExportPostParams object +// with the ability to set a timeout on a request. +func NewPcloudV2ImagesExportPostParamsWithTimeout(timeout time.Duration) *PcloudV2ImagesExportPostParams { + return &PcloudV2ImagesExportPostParams{ + timeout: timeout, + } +} + +// NewPcloudV2ImagesExportPostParamsWithContext creates a new PcloudV2ImagesExportPostParams object +// with the ability to set a context for a request. +func NewPcloudV2ImagesExportPostParamsWithContext(ctx context.Context) *PcloudV2ImagesExportPostParams { + return &PcloudV2ImagesExportPostParams{ + Context: ctx, + } +} + +// NewPcloudV2ImagesExportPostParamsWithHTTPClient creates a new PcloudV2ImagesExportPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2ImagesExportPostParamsWithHTTPClient(client *http.Client) *PcloudV2ImagesExportPostParams { + return &PcloudV2ImagesExportPostParams{ + HTTPClient: client, + } +} + +/* PcloudV2ImagesExportPostParams contains all the parameters to send to the API endpoint + for the pcloud v2 images export post operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2ImagesExportPostParams struct { + + /* Body. + + Parameters for the export + */ + Body *models.ExportImage + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* ImageID. + + Image ID of a image + */ + ImageID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 images export post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2ImagesExportPostParams) WithDefaults() *PcloudV2ImagesExportPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 images export post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2ImagesExportPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 images export post params +func (o *PcloudV2ImagesExportPostParams) WithTimeout(timeout time.Duration) *PcloudV2ImagesExportPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 images export post params +func (o *PcloudV2ImagesExportPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 images export post params +func (o *PcloudV2ImagesExportPostParams) WithContext(ctx context.Context) *PcloudV2ImagesExportPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 images export post params +func (o *PcloudV2ImagesExportPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 images export post params +func (o *PcloudV2ImagesExportPostParams) WithHTTPClient(client *http.Client) *PcloudV2ImagesExportPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 images export post params +func (o *PcloudV2ImagesExportPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud v2 images export post params +func (o *PcloudV2ImagesExportPostParams) WithBody(body *models.ExportImage) *PcloudV2ImagesExportPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud v2 images export post params +func (o *PcloudV2ImagesExportPostParams) SetBody(body *models.ExportImage) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 images export post params +func (o *PcloudV2ImagesExportPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2ImagesExportPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 images export post params +func (o *PcloudV2ImagesExportPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithImageID adds the imageID to the pcloud v2 images export post params +func (o *PcloudV2ImagesExportPostParams) WithImageID(imageID string) *PcloudV2ImagesExportPostParams { + o.SetImageID(imageID) + return o +} + +// SetImageID adds the imageId to the pcloud v2 images export post params +func (o *PcloudV2ImagesExportPostParams) SetImageID(imageID string) { + o.ImageID = imageID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2ImagesExportPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param image_id + if err := r.SetPathParam("image_id", o.ImageID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v2_images_export_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v2_images_export_post_responses.go new file mode 100644 index 00000000000..43957ae2cc2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images/pcloud_v2_images_export_post_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_images + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV2ImagesExportPostReader is a Reader for the PcloudV2ImagesExportPost structure. +type PcloudV2ImagesExportPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2ImagesExportPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudV2ImagesExportPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudV2ImagesExportPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudV2ImagesExportPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2ImagesExportPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudV2ImagesExportPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudV2ImagesExportPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2ImagesExportPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV2ImagesExportPostAccepted creates a PcloudV2ImagesExportPostAccepted with default headers values +func NewPcloudV2ImagesExportPostAccepted() *PcloudV2ImagesExportPostAccepted { + return &PcloudV2ImagesExportPostAccepted{} +} + +/* PcloudV2ImagesExportPostAccepted describes a response with status code 202, with default header values. + +Accepted, image export successfully added to the jobs queue +*/ +type PcloudV2ImagesExportPostAccepted struct { + Payload *models.JobReference +} + +func (o *PcloudV2ImagesExportPostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportPostAccepted %+v", 202, o.Payload) +} +func (o *PcloudV2ImagesExportPostAccepted) GetPayload() *models.JobReference { + return o.Payload +} + +func (o *PcloudV2ImagesExportPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.JobReference) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2ImagesExportPostBadRequest creates a PcloudV2ImagesExportPostBadRequest with default headers values +func NewPcloudV2ImagesExportPostBadRequest() *PcloudV2ImagesExportPostBadRequest { + return &PcloudV2ImagesExportPostBadRequest{} +} + +/* PcloudV2ImagesExportPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudV2ImagesExportPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudV2ImagesExportPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudV2ImagesExportPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2ImagesExportPostBadRequest) 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 +} + +// NewPcloudV2ImagesExportPostUnauthorized creates a PcloudV2ImagesExportPostUnauthorized with default headers values +func NewPcloudV2ImagesExportPostUnauthorized() *PcloudV2ImagesExportPostUnauthorized { + return &PcloudV2ImagesExportPostUnauthorized{} +} + +/* PcloudV2ImagesExportPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2ImagesExportPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV2ImagesExportPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV2ImagesExportPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2ImagesExportPostUnauthorized) 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 +} + +// NewPcloudV2ImagesExportPostNotFound creates a PcloudV2ImagesExportPostNotFound with default headers values +func NewPcloudV2ImagesExportPostNotFound() *PcloudV2ImagesExportPostNotFound { + return &PcloudV2ImagesExportPostNotFound{} +} + +/* PcloudV2ImagesExportPostNotFound describes a response with status code 404, with default header values. + +image id not found +*/ +type PcloudV2ImagesExportPostNotFound struct { + Payload *models.Error +} + +func (o *PcloudV2ImagesExportPostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportPostNotFound %+v", 404, o.Payload) +} +func (o *PcloudV2ImagesExportPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2ImagesExportPostNotFound) 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 +} + +// NewPcloudV2ImagesExportPostConflict creates a PcloudV2ImagesExportPostConflict with default headers values +func NewPcloudV2ImagesExportPostConflict() *PcloudV2ImagesExportPostConflict { + return &PcloudV2ImagesExportPostConflict{} +} + +/* PcloudV2ImagesExportPostConflict describes a response with status code 409, with default header values. + +Conflict, a conflict has prevented adding image export job +*/ +type PcloudV2ImagesExportPostConflict struct { + Payload *models.Error +} + +func (o *PcloudV2ImagesExportPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportPostConflict %+v", 409, o.Payload) +} +func (o *PcloudV2ImagesExportPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2ImagesExportPostConflict) 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 +} + +// NewPcloudV2ImagesExportPostUnprocessableEntity creates a PcloudV2ImagesExportPostUnprocessableEntity with default headers values +func NewPcloudV2ImagesExportPostUnprocessableEntity() *PcloudV2ImagesExportPostUnprocessableEntity { + return &PcloudV2ImagesExportPostUnprocessableEntity{} +} + +/* PcloudV2ImagesExportPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudV2ImagesExportPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudV2ImagesExportPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudV2ImagesExportPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2ImagesExportPostUnprocessableEntity) 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 +} + +// NewPcloudV2ImagesExportPostInternalServerError creates a PcloudV2ImagesExportPostInternalServerError with default headers values +func NewPcloudV2ImagesExportPostInternalServerError() *PcloudV2ImagesExportPostInternalServerError { + return &PcloudV2ImagesExportPostInternalServerError{} +} + +/* PcloudV2ImagesExportPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2ImagesExportPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV2ImagesExportPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/images/{image_id}/export][%d] pcloudV2ImagesExportPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV2ImagesExportPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2ImagesExportPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/p_cloud_instances_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/p_cloud_instances_client.go new file mode 100644 index 00000000000..b8c3c3c8b1b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/p_cloud_instances_client.go @@ -0,0 +1,162 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_instances + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud instances API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud instances API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudCloudinstancesDelete(params *PcloudCloudinstancesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesDeleteOK, error) + + PcloudCloudinstancesGet(params *PcloudCloudinstancesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesGetOK, error) + + PcloudCloudinstancesPut(params *PcloudCloudinstancesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudCloudinstancesDelete deletes a power cloud instance +*/ +func (a *Client) PcloudCloudinstancesDelete(params *PcloudCloudinstancesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesDeleteReader{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.(*PcloudCloudinstancesDeleteOK) + 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 pcloud.cloudinstances.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesGet gets a cloud instance s current state information +*/ +func (a *Client) PcloudCloudinstancesGet(params *PcloudCloudinstancesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesGetReader{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.(*PcloudCloudinstancesGetOK) + 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 pcloud.cloudinstances.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesPut updates upgrade a cloud instance +*/ +func (a *Client) PcloudCloudinstancesPut(params *PcloudCloudinstancesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesPutReader{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.(*PcloudCloudinstancesPutOK) + 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 pcloud.cloudinstances.put: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_delete_parameters.go new file mode 100644 index 00000000000..e375cf1652f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_delete_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_instances + +// 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" +) + +// NewPcloudCloudinstancesDeleteParams creates a new PcloudCloudinstancesDeleteParams 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 NewPcloudCloudinstancesDeleteParams() *PcloudCloudinstancesDeleteParams { + return &PcloudCloudinstancesDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesDeleteParamsWithTimeout creates a new PcloudCloudinstancesDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesDeleteParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesDeleteParams { + return &PcloudCloudinstancesDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesDeleteParamsWithContext creates a new PcloudCloudinstancesDeleteParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesDeleteParamsWithContext(ctx context.Context) *PcloudCloudinstancesDeleteParams { + return &PcloudCloudinstancesDeleteParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesDeleteParamsWithHTTPClient creates a new PcloudCloudinstancesDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesDeleteParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesDeleteParams { + return &PcloudCloudinstancesDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesDeleteParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesDeleteParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesDeleteParams) WithDefaults() *PcloudCloudinstancesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances delete params +func (o *PcloudCloudinstancesDeleteParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances delete params +func (o *PcloudCloudinstancesDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances delete params +func (o *PcloudCloudinstancesDeleteParams) WithContext(ctx context.Context) *PcloudCloudinstancesDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances delete params +func (o *PcloudCloudinstancesDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances delete params +func (o *PcloudCloudinstancesDeleteParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances delete params +func (o *PcloudCloudinstancesDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances delete params +func (o *PcloudCloudinstancesDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances delete params +func (o *PcloudCloudinstancesDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_delete_responses.go new file mode 100644 index 00000000000..6bd8adbbadf --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_delete_responses.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesDeleteReader is a Reader for the PcloudCloudinstancesDelete structure. +type PcloudCloudinstancesDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewPcloudCloudinstancesDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesDeleteOK creates a PcloudCloudinstancesDeleteOK with default headers values +func NewPcloudCloudinstancesDeleteOK() *PcloudCloudinstancesDeleteOK { + return &PcloudCloudinstancesDeleteOK{} +} + +/* PcloudCloudinstancesDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesDeleteOK struct { + Payload models.Object +} + +func (o *PcloudCloudinstancesDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudCloudinstancesDeleteOK) 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 +} + +// NewPcloudCloudinstancesDeleteBadRequest creates a PcloudCloudinstancesDeleteBadRequest with default headers values +func NewPcloudCloudinstancesDeleteBadRequest() *PcloudCloudinstancesDeleteBadRequest { + return &PcloudCloudinstancesDeleteBadRequest{} +} + +/* PcloudCloudinstancesDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesDeleteBadRequest) 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 +} + +// NewPcloudCloudinstancesDeleteUnauthorized creates a PcloudCloudinstancesDeleteUnauthorized with default headers values +func NewPcloudCloudinstancesDeleteUnauthorized() *PcloudCloudinstancesDeleteUnauthorized { + return &PcloudCloudinstancesDeleteUnauthorized{} +} + +/* PcloudCloudinstancesDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesDeleteUnauthorized) 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 +} + +// NewPcloudCloudinstancesDeleteGone creates a PcloudCloudinstancesDeleteGone with default headers values +func NewPcloudCloudinstancesDeleteGone() *PcloudCloudinstancesDeleteGone { + return &PcloudCloudinstancesDeleteGone{} +} + +/* PcloudCloudinstancesDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudCloudinstancesDeleteGone struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesDeleteGone) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesDeleteGone %+v", 410, o.Payload) +} +func (o *PcloudCloudinstancesDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesDeleteGone) 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 +} + +// NewPcloudCloudinstancesDeleteInternalServerError creates a PcloudCloudinstancesDeleteInternalServerError with default headers values +func NewPcloudCloudinstancesDeleteInternalServerError() *PcloudCloudinstancesDeleteInternalServerError { + return &PcloudCloudinstancesDeleteInternalServerError{} +} + +/* PcloudCloudinstancesDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_get_parameters.go new file mode 100644 index 00000000000..4eda9ee4e00 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_get_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_instances + +// 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" +) + +// NewPcloudCloudinstancesGetParams creates a new PcloudCloudinstancesGetParams 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 NewPcloudCloudinstancesGetParams() *PcloudCloudinstancesGetParams { + return &PcloudCloudinstancesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesGetParamsWithTimeout creates a new PcloudCloudinstancesGetParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesGetParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesGetParams { + return &PcloudCloudinstancesGetParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesGetParamsWithContext creates a new PcloudCloudinstancesGetParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesGetParamsWithContext(ctx context.Context) *PcloudCloudinstancesGetParams { + return &PcloudCloudinstancesGetParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesGetParamsWithHTTPClient creates a new PcloudCloudinstancesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesGetParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesGetParams { + return &PcloudCloudinstancesGetParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesGetParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances get operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesGetParams) WithDefaults() *PcloudCloudinstancesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances get params +func (o *PcloudCloudinstancesGetParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances get params +func (o *PcloudCloudinstancesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances get params +func (o *PcloudCloudinstancesGetParams) WithContext(ctx context.Context) *PcloudCloudinstancesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances get params +func (o *PcloudCloudinstancesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances get params +func (o *PcloudCloudinstancesGetParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances get params +func (o *PcloudCloudinstancesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances get params +func (o *PcloudCloudinstancesGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances get params +func (o *PcloudCloudinstancesGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_get_responses.go new file mode 100644 index 00000000000..c7056df69fe --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesGetReader is a Reader for the PcloudCloudinstancesGet structure. +type PcloudCloudinstancesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesGetOK creates a PcloudCloudinstancesGetOK with default headers values +func NewPcloudCloudinstancesGetOK() *PcloudCloudinstancesGetOK { + return &PcloudCloudinstancesGetOK{} +} + +/* PcloudCloudinstancesGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesGetOK struct { + Payload *models.CloudInstance +} + +func (o *PcloudCloudinstancesGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesGetOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesGetOK) GetPayload() *models.CloudInstance { + return o.Payload +} + +func (o *PcloudCloudinstancesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CloudInstance) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesGetBadRequest creates a PcloudCloudinstancesGetBadRequest with default headers values +func NewPcloudCloudinstancesGetBadRequest() *PcloudCloudinstancesGetBadRequest { + return &PcloudCloudinstancesGetBadRequest{} +} + +/* PcloudCloudinstancesGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesGetBadRequest) 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 +} + +// NewPcloudCloudinstancesGetUnauthorized creates a PcloudCloudinstancesGetUnauthorized with default headers values +func NewPcloudCloudinstancesGetUnauthorized() *PcloudCloudinstancesGetUnauthorized { + return &PcloudCloudinstancesGetUnauthorized{} +} + +/* PcloudCloudinstancesGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesGetUnauthorized) 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 +} + +// NewPcloudCloudinstancesGetNotFound creates a PcloudCloudinstancesGetNotFound with default headers values +func NewPcloudCloudinstancesGetNotFound() *PcloudCloudinstancesGetNotFound { + return &PcloudCloudinstancesGetNotFound{} +} + +/* PcloudCloudinstancesGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudinstancesGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesGetNotFound) 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 +} + +// NewPcloudCloudinstancesGetInternalServerError creates a PcloudCloudinstancesGetInternalServerError with default headers values +func NewPcloudCloudinstancesGetInternalServerError() *PcloudCloudinstancesGetInternalServerError { + return &PcloudCloudinstancesGetInternalServerError{} +} + +/* PcloudCloudinstancesGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_put_parameters.go new file mode 100644 index 00000000000..4e47d1af78c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_put_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_instances + +// 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" +) + +// NewPcloudCloudinstancesPutParams creates a new PcloudCloudinstancesPutParams 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 NewPcloudCloudinstancesPutParams() *PcloudCloudinstancesPutParams { + return &PcloudCloudinstancesPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesPutParamsWithTimeout creates a new PcloudCloudinstancesPutParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesPutParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesPutParams { + return &PcloudCloudinstancesPutParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesPutParamsWithContext creates a new PcloudCloudinstancesPutParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesPutParamsWithContext(ctx context.Context) *PcloudCloudinstancesPutParams { + return &PcloudCloudinstancesPutParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesPutParamsWithHTTPClient creates a new PcloudCloudinstancesPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesPutParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesPutParams { + return &PcloudCloudinstancesPutParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesPutParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances put operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesPutParams struct { + + /* Body. + + Parameters for updating a Power Cloud Instance + */ + Body *models.CloudInstanceUpdate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesPutParams) WithDefaults() *PcloudCloudinstancesPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances put params +func (o *PcloudCloudinstancesPutParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances put params +func (o *PcloudCloudinstancesPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances put params +func (o *PcloudCloudinstancesPutParams) WithContext(ctx context.Context) *PcloudCloudinstancesPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances put params +func (o *PcloudCloudinstancesPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances put params +func (o *PcloudCloudinstancesPutParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances put params +func (o *PcloudCloudinstancesPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud cloudinstances put params +func (o *PcloudCloudinstancesPutParams) WithBody(body *models.CloudInstanceUpdate) *PcloudCloudinstancesPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud cloudinstances put params +func (o *PcloudCloudinstancesPutParams) SetBody(body *models.CloudInstanceUpdate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances put params +func (o *PcloudCloudinstancesPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances put params +func (o *PcloudCloudinstancesPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesPutParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_put_responses.go new file mode 100644 index 00000000000..8d6cf4b567a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances/pcloud_cloudinstances_put_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesPutReader is a Reader for the PcloudCloudinstancesPut structure. +type PcloudCloudinstancesPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudCloudinstancesPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesPutOK creates a PcloudCloudinstancesPutOK with default headers values +func NewPcloudCloudinstancesPutOK() *PcloudCloudinstancesPutOK { + return &PcloudCloudinstancesPutOK{} +} + +/* PcloudCloudinstancesPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesPutOK struct { + Payload *models.CloudInstance +} + +func (o *PcloudCloudinstancesPutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesPutOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesPutOK) GetPayload() *models.CloudInstance { + return o.Payload +} + +func (o *PcloudCloudinstancesPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CloudInstance) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesPutBadRequest creates a PcloudCloudinstancesPutBadRequest with default headers values +func NewPcloudCloudinstancesPutBadRequest() *PcloudCloudinstancesPutBadRequest { + return &PcloudCloudinstancesPutBadRequest{} +} + +/* PcloudCloudinstancesPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesPutBadRequest) 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 +} + +// NewPcloudCloudinstancesPutUnauthorized creates a PcloudCloudinstancesPutUnauthorized with default headers values +func NewPcloudCloudinstancesPutUnauthorized() *PcloudCloudinstancesPutUnauthorized { + return &PcloudCloudinstancesPutUnauthorized{} +} + +/* PcloudCloudinstancesPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesPutUnauthorized) 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 +} + +// NewPcloudCloudinstancesPutUnprocessableEntity creates a PcloudCloudinstancesPutUnprocessableEntity with default headers values +func NewPcloudCloudinstancesPutUnprocessableEntity() *PcloudCloudinstancesPutUnprocessableEntity { + return &PcloudCloudinstancesPutUnprocessableEntity{} +} + +/* PcloudCloudinstancesPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudCloudinstancesPutUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesPutUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudCloudinstancesPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesPutUnprocessableEntity) 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 +} + +// NewPcloudCloudinstancesPutInternalServerError creates a PcloudCloudinstancesPutInternalServerError with default headers values +func NewPcloudCloudinstancesPutInternalServerError() *PcloudCloudinstancesPutInternalServerError { + return &PcloudCloudinstancesPutInternalServerError{} +} + +/* PcloudCloudinstancesPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}][%d] pcloudCloudinstancesPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/p_cloud_jobs_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/p_cloud_jobs_client.go new file mode 100644 index 00000000000..0d4c362afd2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/p_cloud_jobs_client.go @@ -0,0 +1,162 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_jobs + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud jobs API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud jobs API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudCloudinstancesJobsDelete(params *PcloudCloudinstancesJobsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesJobsDeleteOK, error) + + PcloudCloudinstancesJobsGet(params *PcloudCloudinstancesJobsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesJobsGetOK, error) + + PcloudCloudinstancesJobsGetall(params *PcloudCloudinstancesJobsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesJobsGetallOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudCloudinstancesJobsDelete deletes a cloud instance job +*/ +func (a *Client) PcloudCloudinstancesJobsDelete(params *PcloudCloudinstancesJobsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesJobsDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesJobsDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.jobs.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesJobsDeleteReader{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.(*PcloudCloudinstancesJobsDeleteOK) + 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 pcloud.cloudinstances.jobs.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesJobsGet lists the detail of a job +*/ +func (a *Client) PcloudCloudinstancesJobsGet(params *PcloudCloudinstancesJobsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesJobsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesJobsGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.jobs.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesJobsGetReader{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.(*PcloudCloudinstancesJobsGetOK) + 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 pcloud.cloudinstances.jobs.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesJobsGetall lists up to the last 5 jobs initiated by the cloud instance +*/ +func (a *Client) PcloudCloudinstancesJobsGetall(params *PcloudCloudinstancesJobsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesJobsGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesJobsGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.jobs.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/jobs", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesJobsGetallReader{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.(*PcloudCloudinstancesJobsGetallOK) + 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 pcloud.cloudinstances.jobs.getall: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_delete_parameters.go new file mode 100644 index 00000000000..9e3b31e1ef7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_delete_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_jobs + +// 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" +) + +// NewPcloudCloudinstancesJobsDeleteParams creates a new PcloudCloudinstancesJobsDeleteParams 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 NewPcloudCloudinstancesJobsDeleteParams() *PcloudCloudinstancesJobsDeleteParams { + return &PcloudCloudinstancesJobsDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesJobsDeleteParamsWithTimeout creates a new PcloudCloudinstancesJobsDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesJobsDeleteParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesJobsDeleteParams { + return &PcloudCloudinstancesJobsDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesJobsDeleteParamsWithContext creates a new PcloudCloudinstancesJobsDeleteParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesJobsDeleteParamsWithContext(ctx context.Context) *PcloudCloudinstancesJobsDeleteParams { + return &PcloudCloudinstancesJobsDeleteParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesJobsDeleteParamsWithHTTPClient creates a new PcloudCloudinstancesJobsDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesJobsDeleteParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesJobsDeleteParams { + return &PcloudCloudinstancesJobsDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesJobsDeleteParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances jobs delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesJobsDeleteParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* JobID. + + PCloud Job ID + */ + JobID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances jobs delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesJobsDeleteParams) WithDefaults() *PcloudCloudinstancesJobsDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances jobs delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesJobsDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances jobs delete params +func (o *PcloudCloudinstancesJobsDeleteParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesJobsDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances jobs delete params +func (o *PcloudCloudinstancesJobsDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances jobs delete params +func (o *PcloudCloudinstancesJobsDeleteParams) WithContext(ctx context.Context) *PcloudCloudinstancesJobsDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances jobs delete params +func (o *PcloudCloudinstancesJobsDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances jobs delete params +func (o *PcloudCloudinstancesJobsDeleteParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesJobsDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances jobs delete params +func (o *PcloudCloudinstancesJobsDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances jobs delete params +func (o *PcloudCloudinstancesJobsDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesJobsDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances jobs delete params +func (o *PcloudCloudinstancesJobsDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithJobID adds the jobID to the pcloud cloudinstances jobs delete params +func (o *PcloudCloudinstancesJobsDeleteParams) WithJobID(jobID string) *PcloudCloudinstancesJobsDeleteParams { + o.SetJobID(jobID) + return o +} + +// SetJobID adds the jobId to the pcloud cloudinstances jobs delete params +func (o *PcloudCloudinstancesJobsDeleteParams) SetJobID(jobID string) { + o.JobID = jobID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesJobsDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param job_id + if err := r.SetPathParam("job_id", o.JobID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_delete_responses.go new file mode 100644 index 00000000000..da6ffd992dd --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_delete_responses.go @@ -0,0 +1,255 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_jobs + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesJobsDeleteReader is a Reader for the PcloudCloudinstancesJobsDelete structure. +type PcloudCloudinstancesJobsDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesJobsDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesJobsDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesJobsDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesJobsDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesJobsDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudCloudinstancesJobsDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesJobsDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesJobsDeleteOK creates a PcloudCloudinstancesJobsDeleteOK with default headers values +func NewPcloudCloudinstancesJobsDeleteOK() *PcloudCloudinstancesJobsDeleteOK { + return &PcloudCloudinstancesJobsDeleteOK{} +} + +/* PcloudCloudinstancesJobsDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesJobsDeleteOK struct { + Payload models.Object +} + +func (o *PcloudCloudinstancesJobsDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesJobsDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsDeleteOK) 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 +} + +// NewPcloudCloudinstancesJobsDeleteBadRequest creates a PcloudCloudinstancesJobsDeleteBadRequest with default headers values +func NewPcloudCloudinstancesJobsDeleteBadRequest() *PcloudCloudinstancesJobsDeleteBadRequest { + return &PcloudCloudinstancesJobsDeleteBadRequest{} +} + +/* PcloudCloudinstancesJobsDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesJobsDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesJobsDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesJobsDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsDeleteBadRequest) 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 +} + +// NewPcloudCloudinstancesJobsDeleteUnauthorized creates a PcloudCloudinstancesJobsDeleteUnauthorized with default headers values +func NewPcloudCloudinstancesJobsDeleteUnauthorized() *PcloudCloudinstancesJobsDeleteUnauthorized { + return &PcloudCloudinstancesJobsDeleteUnauthorized{} +} + +/* PcloudCloudinstancesJobsDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesJobsDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesJobsDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesJobsDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsDeleteUnauthorized) 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 +} + +// NewPcloudCloudinstancesJobsDeleteNotFound creates a PcloudCloudinstancesJobsDeleteNotFound with default headers values +func NewPcloudCloudinstancesJobsDeleteNotFound() *PcloudCloudinstancesJobsDeleteNotFound { + return &PcloudCloudinstancesJobsDeleteNotFound{} +} + +/* PcloudCloudinstancesJobsDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesJobsDeleteNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesJobsDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsDeleteNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudinstancesJobsDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsDeleteNotFound) 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 +} + +// NewPcloudCloudinstancesJobsDeleteConflict creates a PcloudCloudinstancesJobsDeleteConflict with default headers values +func NewPcloudCloudinstancesJobsDeleteConflict() *PcloudCloudinstancesJobsDeleteConflict { + return &PcloudCloudinstancesJobsDeleteConflict{} +} + +/* PcloudCloudinstancesJobsDeleteConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudCloudinstancesJobsDeleteConflict struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesJobsDeleteConflict) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsDeleteConflict %+v", 409, o.Payload) +} +func (o *PcloudCloudinstancesJobsDeleteConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsDeleteConflict) 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 +} + +// NewPcloudCloudinstancesJobsDeleteInternalServerError creates a PcloudCloudinstancesJobsDeleteInternalServerError with default headers values +func NewPcloudCloudinstancesJobsDeleteInternalServerError() *PcloudCloudinstancesJobsDeleteInternalServerError { + return &PcloudCloudinstancesJobsDeleteInternalServerError{} +} + +/* PcloudCloudinstancesJobsDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesJobsDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesJobsDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesJobsDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_get_parameters.go new file mode 100644 index 00000000000..8b584354795 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_jobs + +// 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" +) + +// NewPcloudCloudinstancesJobsGetParams creates a new PcloudCloudinstancesJobsGetParams 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 NewPcloudCloudinstancesJobsGetParams() *PcloudCloudinstancesJobsGetParams { + return &PcloudCloudinstancesJobsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesJobsGetParamsWithTimeout creates a new PcloudCloudinstancesJobsGetParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesJobsGetParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesJobsGetParams { + return &PcloudCloudinstancesJobsGetParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesJobsGetParamsWithContext creates a new PcloudCloudinstancesJobsGetParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesJobsGetParamsWithContext(ctx context.Context) *PcloudCloudinstancesJobsGetParams { + return &PcloudCloudinstancesJobsGetParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesJobsGetParamsWithHTTPClient creates a new PcloudCloudinstancesJobsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesJobsGetParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesJobsGetParams { + return &PcloudCloudinstancesJobsGetParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesJobsGetParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances jobs get operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesJobsGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* JobID. + + PCloud Job ID + */ + JobID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances jobs get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesJobsGetParams) WithDefaults() *PcloudCloudinstancesJobsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances jobs get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesJobsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances jobs get params +func (o *PcloudCloudinstancesJobsGetParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesJobsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances jobs get params +func (o *PcloudCloudinstancesJobsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances jobs get params +func (o *PcloudCloudinstancesJobsGetParams) WithContext(ctx context.Context) *PcloudCloudinstancesJobsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances jobs get params +func (o *PcloudCloudinstancesJobsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances jobs get params +func (o *PcloudCloudinstancesJobsGetParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesJobsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances jobs get params +func (o *PcloudCloudinstancesJobsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances jobs get params +func (o *PcloudCloudinstancesJobsGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesJobsGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances jobs get params +func (o *PcloudCloudinstancesJobsGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithJobID adds the jobID to the pcloud cloudinstances jobs get params +func (o *PcloudCloudinstancesJobsGetParams) WithJobID(jobID string) *PcloudCloudinstancesJobsGetParams { + o.SetJobID(jobID) + return o +} + +// SetJobID adds the jobId to the pcloud cloudinstances jobs get params +func (o *PcloudCloudinstancesJobsGetParams) SetJobID(jobID string) { + o.JobID = jobID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesJobsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param job_id + if err := r.SetPathParam("job_id", o.JobID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_get_responses.go new file mode 100644 index 00000000000..b232653f032 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_jobs + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesJobsGetReader is a Reader for the PcloudCloudinstancesJobsGet structure. +type PcloudCloudinstancesJobsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesJobsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesJobsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesJobsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesJobsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesJobsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesJobsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesJobsGetOK creates a PcloudCloudinstancesJobsGetOK with default headers values +func NewPcloudCloudinstancesJobsGetOK() *PcloudCloudinstancesJobsGetOK { + return &PcloudCloudinstancesJobsGetOK{} +} + +/* PcloudCloudinstancesJobsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesJobsGetOK struct { + Payload *models.Job +} + +func (o *PcloudCloudinstancesJobsGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsGetOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesJobsGetOK) GetPayload() *models.Job { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Job) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesJobsGetBadRequest creates a PcloudCloudinstancesJobsGetBadRequest with default headers values +func NewPcloudCloudinstancesJobsGetBadRequest() *PcloudCloudinstancesJobsGetBadRequest { + return &PcloudCloudinstancesJobsGetBadRequest{} +} + +/* PcloudCloudinstancesJobsGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesJobsGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesJobsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesJobsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsGetBadRequest) 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 +} + +// NewPcloudCloudinstancesJobsGetUnauthorized creates a PcloudCloudinstancesJobsGetUnauthorized with default headers values +func NewPcloudCloudinstancesJobsGetUnauthorized() *PcloudCloudinstancesJobsGetUnauthorized { + return &PcloudCloudinstancesJobsGetUnauthorized{} +} + +/* PcloudCloudinstancesJobsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesJobsGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesJobsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesJobsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsGetUnauthorized) 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 +} + +// NewPcloudCloudinstancesJobsGetNotFound creates a PcloudCloudinstancesJobsGetNotFound with default headers values +func NewPcloudCloudinstancesJobsGetNotFound() *PcloudCloudinstancesJobsGetNotFound { + return &PcloudCloudinstancesJobsGetNotFound{} +} + +/* PcloudCloudinstancesJobsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesJobsGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesJobsGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudinstancesJobsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsGetNotFound) 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 +} + +// NewPcloudCloudinstancesJobsGetInternalServerError creates a PcloudCloudinstancesJobsGetInternalServerError with default headers values +func NewPcloudCloudinstancesJobsGetInternalServerError() *PcloudCloudinstancesJobsGetInternalServerError { + return &PcloudCloudinstancesJobsGetInternalServerError{} +} + +/* PcloudCloudinstancesJobsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesJobsGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesJobsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs/{job_id}][%d] pcloudCloudinstancesJobsGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesJobsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_getall_parameters.go new file mode 100644 index 00000000000..50646a09eb0 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_getall_parameters.go @@ -0,0 +1,251 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_jobs + +// 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" +) + +// NewPcloudCloudinstancesJobsGetallParams creates a new PcloudCloudinstancesJobsGetallParams 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 NewPcloudCloudinstancesJobsGetallParams() *PcloudCloudinstancesJobsGetallParams { + return &PcloudCloudinstancesJobsGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesJobsGetallParamsWithTimeout creates a new PcloudCloudinstancesJobsGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesJobsGetallParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesJobsGetallParams { + return &PcloudCloudinstancesJobsGetallParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesJobsGetallParamsWithContext creates a new PcloudCloudinstancesJobsGetallParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesJobsGetallParamsWithContext(ctx context.Context) *PcloudCloudinstancesJobsGetallParams { + return &PcloudCloudinstancesJobsGetallParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesJobsGetallParamsWithHTTPClient creates a new PcloudCloudinstancesJobsGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesJobsGetallParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesJobsGetallParams { + return &PcloudCloudinstancesJobsGetallParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesJobsGetallParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances jobs getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesJobsGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* OperationAction. + + Operation action to filter jobs (optional) vmCapture - includes operation action value (vmCapture) imageExport - includes operation action value (imageExport) imageImport - includes operation action value (imageImport) storage - includes operation action values (vmCapture,imageExport,imageImport) + */ + OperationAction *string + + /* OperationID. + + Operation ID to filter jobs (optional) + */ + OperationID *string + + /* OperationTarget. + + Operation target to filter jobs (optional) + */ + OperationTarget *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances jobs getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesJobsGetallParams) WithDefaults() *PcloudCloudinstancesJobsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances jobs getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesJobsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances jobs getall params +func (o *PcloudCloudinstancesJobsGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesJobsGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances jobs getall params +func (o *PcloudCloudinstancesJobsGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances jobs getall params +func (o *PcloudCloudinstancesJobsGetallParams) WithContext(ctx context.Context) *PcloudCloudinstancesJobsGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances jobs getall params +func (o *PcloudCloudinstancesJobsGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances jobs getall params +func (o *PcloudCloudinstancesJobsGetallParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesJobsGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances jobs getall params +func (o *PcloudCloudinstancesJobsGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances jobs getall params +func (o *PcloudCloudinstancesJobsGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesJobsGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances jobs getall params +func (o *PcloudCloudinstancesJobsGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithOperationAction adds the operationAction to the pcloud cloudinstances jobs getall params +func (o *PcloudCloudinstancesJobsGetallParams) WithOperationAction(operationAction *string) *PcloudCloudinstancesJobsGetallParams { + o.SetOperationAction(operationAction) + return o +} + +// SetOperationAction adds the operationAction to the pcloud cloudinstances jobs getall params +func (o *PcloudCloudinstancesJobsGetallParams) SetOperationAction(operationAction *string) { + o.OperationAction = operationAction +} + +// WithOperationID adds the operationID to the pcloud cloudinstances jobs getall params +func (o *PcloudCloudinstancesJobsGetallParams) WithOperationID(operationID *string) *PcloudCloudinstancesJobsGetallParams { + o.SetOperationID(operationID) + return o +} + +// SetOperationID adds the operationId to the pcloud cloudinstances jobs getall params +func (o *PcloudCloudinstancesJobsGetallParams) SetOperationID(operationID *string) { + o.OperationID = operationID +} + +// WithOperationTarget adds the operationTarget to the pcloud cloudinstances jobs getall params +func (o *PcloudCloudinstancesJobsGetallParams) WithOperationTarget(operationTarget *string) *PcloudCloudinstancesJobsGetallParams { + o.SetOperationTarget(operationTarget) + return o +} + +// SetOperationTarget adds the operationTarget to the pcloud cloudinstances jobs getall params +func (o *PcloudCloudinstancesJobsGetallParams) SetOperationTarget(operationTarget *string) { + o.OperationTarget = operationTarget +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesJobsGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if o.OperationAction != nil { + + // query param operation.action + var qrOperationAction string + + if o.OperationAction != nil { + qrOperationAction = *o.OperationAction + } + qOperationAction := qrOperationAction + if qOperationAction != "" { + + if err := r.SetQueryParam("operation.action", qOperationAction); err != nil { + return err + } + } + } + + if o.OperationID != nil { + + // query param operation.id + var qrOperationID string + + if o.OperationID != nil { + qrOperationID = *o.OperationID + } + qOperationID := qrOperationID + if qOperationID != "" { + + if err := r.SetQueryParam("operation.id", qOperationID); err != nil { + return err + } + } + } + + if o.OperationTarget != nil { + + // query param operation.target + var qrOperationTarget string + + if o.OperationTarget != nil { + qrOperationTarget = *o.OperationTarget + } + qOperationTarget := qrOperationTarget + if qOperationTarget != "" { + + if err := r.SetQueryParam("operation.target", qOperationTarget); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_getall_responses.go new file mode 100644 index 00000000000..d3b942e52ff --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs/pcloud_cloudinstances_jobs_getall_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_jobs + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesJobsGetallReader is a Reader for the PcloudCloudinstancesJobsGetall structure. +type PcloudCloudinstancesJobsGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesJobsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesJobsGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesJobsGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesJobsGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesJobsGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesJobsGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesJobsGetallOK creates a PcloudCloudinstancesJobsGetallOK with default headers values +func NewPcloudCloudinstancesJobsGetallOK() *PcloudCloudinstancesJobsGetallOK { + return &PcloudCloudinstancesJobsGetallOK{} +} + +/* PcloudCloudinstancesJobsGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesJobsGetallOK struct { + Payload *models.Jobs +} + +func (o *PcloudCloudinstancesJobsGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs][%d] pcloudCloudinstancesJobsGetallOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesJobsGetallOK) GetPayload() *models.Jobs { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Jobs) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesJobsGetallBadRequest creates a PcloudCloudinstancesJobsGetallBadRequest with default headers values +func NewPcloudCloudinstancesJobsGetallBadRequest() *PcloudCloudinstancesJobsGetallBadRequest { + return &PcloudCloudinstancesJobsGetallBadRequest{} +} + +/* PcloudCloudinstancesJobsGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesJobsGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesJobsGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs][%d] pcloudCloudinstancesJobsGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesJobsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsGetallBadRequest) 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 +} + +// NewPcloudCloudinstancesJobsGetallUnauthorized creates a PcloudCloudinstancesJobsGetallUnauthorized with default headers values +func NewPcloudCloudinstancesJobsGetallUnauthorized() *PcloudCloudinstancesJobsGetallUnauthorized { + return &PcloudCloudinstancesJobsGetallUnauthorized{} +} + +/* PcloudCloudinstancesJobsGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesJobsGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesJobsGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs][%d] pcloudCloudinstancesJobsGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesJobsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsGetallUnauthorized) 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 +} + +// NewPcloudCloudinstancesJobsGetallNotFound creates a PcloudCloudinstancesJobsGetallNotFound with default headers values +func NewPcloudCloudinstancesJobsGetallNotFound() *PcloudCloudinstancesJobsGetallNotFound { + return &PcloudCloudinstancesJobsGetallNotFound{} +} + +/* PcloudCloudinstancesJobsGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesJobsGetallNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesJobsGetallNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs][%d] pcloudCloudinstancesJobsGetallNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudinstancesJobsGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsGetallNotFound) 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 +} + +// NewPcloudCloudinstancesJobsGetallInternalServerError creates a PcloudCloudinstancesJobsGetallInternalServerError with default headers values +func NewPcloudCloudinstancesJobsGetallInternalServerError() *PcloudCloudinstancesJobsGetallInternalServerError { + return &PcloudCloudinstancesJobsGetallInternalServerError{} +} + +/* PcloudCloudinstancesJobsGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesJobsGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesJobsGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/jobs][%d] pcloudCloudinstancesJobsGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesJobsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesJobsGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/p_cloud_networks_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/p_cloud_networks_client.go new file mode 100644 index 00000000000..5a08ce2c9b4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/p_cloud_networks_client.go @@ -0,0 +1,450 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud networks API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud networks API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudNetworksDelete(params *PcloudNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksDeleteOK, error) + + PcloudNetworksGet(params *PcloudNetworksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksGetOK, error) + + PcloudNetworksGetall(params *PcloudNetworksGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksGetallOK, error) + + PcloudNetworksPortsDelete(params *PcloudNetworksPortsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsDeleteOK, error) + + PcloudNetworksPortsGet(params *PcloudNetworksPortsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsGetOK, error) + + PcloudNetworksPortsGetall(params *PcloudNetworksPortsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsGetallOK, error) + + PcloudNetworksPortsPost(params *PcloudNetworksPortsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsPostCreated, error) + + PcloudNetworksPortsPut(params *PcloudNetworksPortsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsPutOK, error) + + PcloudNetworksPost(params *PcloudNetworksPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPostOK, *PcloudNetworksPostCreated, error) + + PcloudNetworksPut(params *PcloudNetworksPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudNetworksDelete deletes a network +*/ +func (a *Client) PcloudNetworksDelete(params *PcloudNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudNetworksDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.networks.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudNetworksDeleteReader{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.(*PcloudNetworksDeleteOK) + 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 pcloud.networks.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudNetworksGet gets a network s current state information +*/ +func (a *Client) PcloudNetworksGet(params *PcloudNetworksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudNetworksGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.networks.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudNetworksGetReader{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.(*PcloudNetworksGetOK) + 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 pcloud.networks.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudNetworksGetall gets all networks in this cloud instance +*/ +func (a *Client) PcloudNetworksGetall(params *PcloudNetworksGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudNetworksGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.networks.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudNetworksGetallReader{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.(*PcloudNetworksGetallOK) + 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 pcloud.networks.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudNetworksPortsDelete deletes a network port +*/ +func (a *Client) PcloudNetworksPortsDelete(params *PcloudNetworksPortsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudNetworksPortsDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.networks.ports.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudNetworksPortsDeleteReader{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.(*PcloudNetworksPortsDeleteOK) + 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 pcloud.networks.ports.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudNetworksPortsGet gets a port s information +*/ +func (a *Client) PcloudNetworksPortsGet(params *PcloudNetworksPortsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudNetworksPortsGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.networks.ports.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudNetworksPortsGetReader{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.(*PcloudNetworksPortsGetOK) + 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 pcloud.networks.ports.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudNetworksPortsGetall gets all ports for this network +*/ +func (a *Client) PcloudNetworksPortsGetall(params *PcloudNetworksPortsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudNetworksPortsGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.networks.ports.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudNetworksPortsGetallReader{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.(*PcloudNetworksPortsGetallOK) + 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 pcloud.networks.ports.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudNetworksPortsPost performs port addition deletion and listing +*/ +func (a *Client) PcloudNetworksPortsPost(params *PcloudNetworksPortsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudNetworksPortsPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.networks.ports.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudNetworksPortsPostReader{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.(*PcloudNetworksPortsPostCreated) + 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 pcloud.networks.ports.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudNetworksPortsPut updates a port s information +*/ +func (a *Client) PcloudNetworksPortsPut(params *PcloudNetworksPortsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPortsPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudNetworksPortsPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.networks.ports.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudNetworksPortsPutReader{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.(*PcloudNetworksPortsPutOK) + 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 pcloud.networks.ports.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudNetworksPost creates a new network +*/ +func (a *Client) PcloudNetworksPost(params *PcloudNetworksPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPostOK, *PcloudNetworksPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudNetworksPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.networks.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudNetworksPostReader{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 *PcloudNetworksPostOK: + return value, nil, nil + case *PcloudNetworksPostCreated: + 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 p_cloud_networks: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudNetworksPut updates a network +*/ +func (a *Client) PcloudNetworksPut(params *PcloudNetworksPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudNetworksPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudNetworksPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.networks.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudNetworksPutReader{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.(*PcloudNetworksPutOK) + 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 pcloud.networks.put: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_delete_parameters.go new file mode 100644 index 00000000000..ed9fd5e8b66 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_delete_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// 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" +) + +// NewPcloudNetworksDeleteParams creates a new PcloudNetworksDeleteParams 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 NewPcloudNetworksDeleteParams() *PcloudNetworksDeleteParams { + return &PcloudNetworksDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudNetworksDeleteParamsWithTimeout creates a new PcloudNetworksDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudNetworksDeleteParamsWithTimeout(timeout time.Duration) *PcloudNetworksDeleteParams { + return &PcloudNetworksDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudNetworksDeleteParamsWithContext creates a new PcloudNetworksDeleteParams object +// with the ability to set a context for a request. +func NewPcloudNetworksDeleteParamsWithContext(ctx context.Context) *PcloudNetworksDeleteParams { + return &PcloudNetworksDeleteParams{ + Context: ctx, + } +} + +// NewPcloudNetworksDeleteParamsWithHTTPClient creates a new PcloudNetworksDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudNetworksDeleteParamsWithHTTPClient(client *http.Client) *PcloudNetworksDeleteParams { + return &PcloudNetworksDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudNetworksDeleteParams contains all the parameters to send to the API endpoint + for the pcloud networks delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudNetworksDeleteParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* NetworkID. + + Network ID + */ + NetworkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksDeleteParams) WithDefaults() *PcloudNetworksDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud networks delete params +func (o *PcloudNetworksDeleteParams) WithTimeout(timeout time.Duration) *PcloudNetworksDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud networks delete params +func (o *PcloudNetworksDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud networks delete params +func (o *PcloudNetworksDeleteParams) WithContext(ctx context.Context) *PcloudNetworksDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud networks delete params +func (o *PcloudNetworksDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud networks delete params +func (o *PcloudNetworksDeleteParams) WithHTTPClient(client *http.Client) *PcloudNetworksDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud networks delete params +func (o *PcloudNetworksDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud networks delete params +func (o *PcloudNetworksDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudNetworksDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud networks delete params +func (o *PcloudNetworksDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithNetworkID adds the networkID to the pcloud networks delete params +func (o *PcloudNetworksDeleteParams) WithNetworkID(networkID string) *PcloudNetworksDeleteParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the pcloud networks delete params +func (o *PcloudNetworksDeleteParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudNetworksDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_delete_responses.go new file mode 100644 index 00000000000..67dba95234b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_delete_responses.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudNetworksDeleteReader is a Reader for the PcloudNetworksDelete structure. +type PcloudNetworksDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudNetworksDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudNetworksDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudNetworksDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudNetworksDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewPcloudNetworksDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudNetworksDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudNetworksDeleteOK creates a PcloudNetworksDeleteOK with default headers values +func NewPcloudNetworksDeleteOK() *PcloudNetworksDeleteOK { + return &PcloudNetworksDeleteOK{} +} + +/* PcloudNetworksDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudNetworksDeleteOK struct { + Payload models.Object +} + +func (o *PcloudNetworksDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudNetworksDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudNetworksDeleteOK) 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 +} + +// NewPcloudNetworksDeleteBadRequest creates a PcloudNetworksDeleteBadRequest with default headers values +func NewPcloudNetworksDeleteBadRequest() *PcloudNetworksDeleteBadRequest { + return &PcloudNetworksDeleteBadRequest{} +} + +/* PcloudNetworksDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudNetworksDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudNetworksDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudNetworksDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksDeleteBadRequest) 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 +} + +// NewPcloudNetworksDeleteUnauthorized creates a PcloudNetworksDeleteUnauthorized with default headers values +func NewPcloudNetworksDeleteUnauthorized() *PcloudNetworksDeleteUnauthorized { + return &PcloudNetworksDeleteUnauthorized{} +} + +/* PcloudNetworksDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudNetworksDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudNetworksDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudNetworksDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksDeleteUnauthorized) 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 +} + +// NewPcloudNetworksDeleteGone creates a PcloudNetworksDeleteGone with default headers values +func NewPcloudNetworksDeleteGone() *PcloudNetworksDeleteGone { + return &PcloudNetworksDeleteGone{} +} + +/* PcloudNetworksDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudNetworksDeleteGone struct { + Payload *models.Error +} + +func (o *PcloudNetworksDeleteGone) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksDeleteGone %+v", 410, o.Payload) +} +func (o *PcloudNetworksDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksDeleteGone) 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 +} + +// NewPcloudNetworksDeleteInternalServerError creates a PcloudNetworksDeleteInternalServerError with default headers values +func NewPcloudNetworksDeleteInternalServerError() *PcloudNetworksDeleteInternalServerError { + return &PcloudNetworksDeleteInternalServerError{} +} + +/* PcloudNetworksDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudNetworksDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudNetworksDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudNetworksDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_get_parameters.go new file mode 100644 index 00000000000..a9694c898a4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// 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" +) + +// NewPcloudNetworksGetParams creates a new PcloudNetworksGetParams 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 NewPcloudNetworksGetParams() *PcloudNetworksGetParams { + return &PcloudNetworksGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudNetworksGetParamsWithTimeout creates a new PcloudNetworksGetParams object +// with the ability to set a timeout on a request. +func NewPcloudNetworksGetParamsWithTimeout(timeout time.Duration) *PcloudNetworksGetParams { + return &PcloudNetworksGetParams{ + timeout: timeout, + } +} + +// NewPcloudNetworksGetParamsWithContext creates a new PcloudNetworksGetParams object +// with the ability to set a context for a request. +func NewPcloudNetworksGetParamsWithContext(ctx context.Context) *PcloudNetworksGetParams { + return &PcloudNetworksGetParams{ + Context: ctx, + } +} + +// NewPcloudNetworksGetParamsWithHTTPClient creates a new PcloudNetworksGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudNetworksGetParamsWithHTTPClient(client *http.Client) *PcloudNetworksGetParams { + return &PcloudNetworksGetParams{ + HTTPClient: client, + } +} + +/* PcloudNetworksGetParams contains all the parameters to send to the API endpoint + for the pcloud networks get operation. + + Typically these are written to a http.Request. +*/ +type PcloudNetworksGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* NetworkID. + + Network ID + */ + NetworkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud networks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksGetParams) WithDefaults() *PcloudNetworksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud networks get params +func (o *PcloudNetworksGetParams) WithTimeout(timeout time.Duration) *PcloudNetworksGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud networks get params +func (o *PcloudNetworksGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud networks get params +func (o *PcloudNetworksGetParams) WithContext(ctx context.Context) *PcloudNetworksGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud networks get params +func (o *PcloudNetworksGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud networks get params +func (o *PcloudNetworksGetParams) WithHTTPClient(client *http.Client) *PcloudNetworksGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud networks get params +func (o *PcloudNetworksGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud networks get params +func (o *PcloudNetworksGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudNetworksGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud networks get params +func (o *PcloudNetworksGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithNetworkID adds the networkID to the pcloud networks get params +func (o *PcloudNetworksGetParams) WithNetworkID(networkID string) *PcloudNetworksGetParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the pcloud networks get params +func (o *PcloudNetworksGetParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudNetworksGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_get_responses.go new file mode 100644 index 00000000000..d66f5f1b203 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudNetworksGetReader is a Reader for the PcloudNetworksGet structure. +type PcloudNetworksGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudNetworksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudNetworksGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudNetworksGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudNetworksGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudNetworksGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudNetworksGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudNetworksGetOK creates a PcloudNetworksGetOK with default headers values +func NewPcloudNetworksGetOK() *PcloudNetworksGetOK { + return &PcloudNetworksGetOK{} +} + +/* PcloudNetworksGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudNetworksGetOK struct { + Payload *models.Network +} + +func (o *PcloudNetworksGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksGetOK %+v", 200, o.Payload) +} +func (o *PcloudNetworksGetOK) GetPayload() *models.Network { + return o.Payload +} + +func (o *PcloudNetworksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Network) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudNetworksGetBadRequest creates a PcloudNetworksGetBadRequest with default headers values +func NewPcloudNetworksGetBadRequest() *PcloudNetworksGetBadRequest { + return &PcloudNetworksGetBadRequest{} +} + +/* PcloudNetworksGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudNetworksGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudNetworksGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudNetworksGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksGetBadRequest) 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 +} + +// NewPcloudNetworksGetUnauthorized creates a PcloudNetworksGetUnauthorized with default headers values +func NewPcloudNetworksGetUnauthorized() *PcloudNetworksGetUnauthorized { + return &PcloudNetworksGetUnauthorized{} +} + +/* PcloudNetworksGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudNetworksGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudNetworksGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudNetworksGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksGetUnauthorized) 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 +} + +// NewPcloudNetworksGetNotFound creates a PcloudNetworksGetNotFound with default headers values +func NewPcloudNetworksGetNotFound() *PcloudNetworksGetNotFound { + return &PcloudNetworksGetNotFound{} +} + +/* PcloudNetworksGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudNetworksGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudNetworksGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudNetworksGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksGetNotFound) 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 +} + +// NewPcloudNetworksGetInternalServerError creates a PcloudNetworksGetInternalServerError with default headers values +func NewPcloudNetworksGetInternalServerError() *PcloudNetworksGetInternalServerError { + return &PcloudNetworksGetInternalServerError{} +} + +/* PcloudNetworksGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudNetworksGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudNetworksGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudNetworksGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_getall_parameters.go new file mode 100644 index 00000000000..3ec2e1b918a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_getall_parameters.go @@ -0,0 +1,183 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// 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" +) + +// NewPcloudNetworksGetallParams creates a new PcloudNetworksGetallParams 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 NewPcloudNetworksGetallParams() *PcloudNetworksGetallParams { + return &PcloudNetworksGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudNetworksGetallParamsWithTimeout creates a new PcloudNetworksGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudNetworksGetallParamsWithTimeout(timeout time.Duration) *PcloudNetworksGetallParams { + return &PcloudNetworksGetallParams{ + timeout: timeout, + } +} + +// NewPcloudNetworksGetallParamsWithContext creates a new PcloudNetworksGetallParams object +// with the ability to set a context for a request. +func NewPcloudNetworksGetallParamsWithContext(ctx context.Context) *PcloudNetworksGetallParams { + return &PcloudNetworksGetallParams{ + Context: ctx, + } +} + +// NewPcloudNetworksGetallParamsWithHTTPClient creates a new PcloudNetworksGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudNetworksGetallParamsWithHTTPClient(client *http.Client) *PcloudNetworksGetallParams { + return &PcloudNetworksGetallParams{ + HTTPClient: client, + } +} + +/* PcloudNetworksGetallParams contains all the parameters to send to the API endpoint + for the pcloud networks getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudNetworksGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* Filter. + + A filter expression that filters resources listed in the response + */ + Filter *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud networks getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksGetallParams) WithDefaults() *PcloudNetworksGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud networks getall params +func (o *PcloudNetworksGetallParams) WithTimeout(timeout time.Duration) *PcloudNetworksGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud networks getall params +func (o *PcloudNetworksGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud networks getall params +func (o *PcloudNetworksGetallParams) WithContext(ctx context.Context) *PcloudNetworksGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud networks getall params +func (o *PcloudNetworksGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud networks getall params +func (o *PcloudNetworksGetallParams) WithHTTPClient(client *http.Client) *PcloudNetworksGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud networks getall params +func (o *PcloudNetworksGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud networks getall params +func (o *PcloudNetworksGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudNetworksGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud networks getall params +func (o *PcloudNetworksGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithFilter adds the filter to the pcloud networks getall params +func (o *PcloudNetworksGetallParams) WithFilter(filter *string) *PcloudNetworksGetallParams { + o.SetFilter(filter) + return o +} + +// SetFilter adds the filter to the pcloud networks getall params +func (o *PcloudNetworksGetallParams) SetFilter(filter *string) { + o.Filter = filter +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudNetworksGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if o.Filter != nil { + + // query param filter + var qrFilter string + + if o.Filter != nil { + qrFilter = *o.Filter + } + qFilter := qrFilter + if qFilter != "" { + + if err := r.SetQueryParam("filter", qFilter); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_getall_responses.go new file mode 100644 index 00000000000..fd07134b23a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_getall_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudNetworksGetallReader is a Reader for the PcloudNetworksGetall structure. +type PcloudNetworksGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudNetworksGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudNetworksGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudNetworksGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudNetworksGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudNetworksGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudNetworksGetallOK creates a PcloudNetworksGetallOK with default headers values +func NewPcloudNetworksGetallOK() *PcloudNetworksGetallOK { + return &PcloudNetworksGetallOK{} +} + +/* PcloudNetworksGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudNetworksGetallOK struct { + Payload *models.Networks +} + +func (o *PcloudNetworksGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksGetallOK %+v", 200, o.Payload) +} +func (o *PcloudNetworksGetallOK) GetPayload() *models.Networks { + return o.Payload +} + +func (o *PcloudNetworksGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Networks) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudNetworksGetallBadRequest creates a PcloudNetworksGetallBadRequest with default headers values +func NewPcloudNetworksGetallBadRequest() *PcloudNetworksGetallBadRequest { + return &PcloudNetworksGetallBadRequest{} +} + +/* PcloudNetworksGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudNetworksGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudNetworksGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudNetworksGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksGetallBadRequest) 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 +} + +// NewPcloudNetworksGetallUnauthorized creates a PcloudNetworksGetallUnauthorized with default headers values +func NewPcloudNetworksGetallUnauthorized() *PcloudNetworksGetallUnauthorized { + return &PcloudNetworksGetallUnauthorized{} +} + +/* PcloudNetworksGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudNetworksGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudNetworksGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudNetworksGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksGetallUnauthorized) 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 +} + +// NewPcloudNetworksGetallInternalServerError creates a PcloudNetworksGetallInternalServerError with default headers values +func NewPcloudNetworksGetallInternalServerError() *PcloudNetworksGetallInternalServerError { + return &PcloudNetworksGetallInternalServerError{} +} + +/* PcloudNetworksGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudNetworksGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudNetworksGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudNetworksGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_delete_parameters.go new file mode 100644 index 00000000000..2782cd9eb0d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_delete_parameters.go @@ -0,0 +1,193 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// 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" +) + +// NewPcloudNetworksPortsDeleteParams creates a new PcloudNetworksPortsDeleteParams 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 NewPcloudNetworksPortsDeleteParams() *PcloudNetworksPortsDeleteParams { + return &PcloudNetworksPortsDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudNetworksPortsDeleteParamsWithTimeout creates a new PcloudNetworksPortsDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudNetworksPortsDeleteParamsWithTimeout(timeout time.Duration) *PcloudNetworksPortsDeleteParams { + return &PcloudNetworksPortsDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudNetworksPortsDeleteParamsWithContext creates a new PcloudNetworksPortsDeleteParams object +// with the ability to set a context for a request. +func NewPcloudNetworksPortsDeleteParamsWithContext(ctx context.Context) *PcloudNetworksPortsDeleteParams { + return &PcloudNetworksPortsDeleteParams{ + Context: ctx, + } +} + +// NewPcloudNetworksPortsDeleteParamsWithHTTPClient creates a new PcloudNetworksPortsDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudNetworksPortsDeleteParamsWithHTTPClient(client *http.Client) *PcloudNetworksPortsDeleteParams { + return &PcloudNetworksPortsDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudNetworksPortsDeleteParams contains all the parameters to send to the API endpoint + for the pcloud networks ports delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudNetworksPortsDeleteParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* NetworkID. + + Network ID + */ + NetworkID string + + /* PortID. + + Port ID + */ + PortID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud networks ports delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsDeleteParams) WithDefaults() *PcloudNetworksPortsDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks ports delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud networks ports delete params +func (o *PcloudNetworksPortsDeleteParams) WithTimeout(timeout time.Duration) *PcloudNetworksPortsDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud networks ports delete params +func (o *PcloudNetworksPortsDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud networks ports delete params +func (o *PcloudNetworksPortsDeleteParams) WithContext(ctx context.Context) *PcloudNetworksPortsDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud networks ports delete params +func (o *PcloudNetworksPortsDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud networks ports delete params +func (o *PcloudNetworksPortsDeleteParams) WithHTTPClient(client *http.Client) *PcloudNetworksPortsDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud networks ports delete params +func (o *PcloudNetworksPortsDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud networks ports delete params +func (o *PcloudNetworksPortsDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudNetworksPortsDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud networks ports delete params +func (o *PcloudNetworksPortsDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithNetworkID adds the networkID to the pcloud networks ports delete params +func (o *PcloudNetworksPortsDeleteParams) WithNetworkID(networkID string) *PcloudNetworksPortsDeleteParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the pcloud networks ports delete params +func (o *PcloudNetworksPortsDeleteParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WithPortID adds the portID to the pcloud networks ports delete params +func (o *PcloudNetworksPortsDeleteParams) WithPortID(portID string) *PcloudNetworksPortsDeleteParams { + o.SetPortID(portID) + return o +} + +// SetPortID adds the portId to the pcloud networks ports delete params +func (o *PcloudNetworksPortsDeleteParams) SetPortID(portID string) { + o.PortID = portID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudNetworksPortsDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + // path param port_id + if err := r.SetPathParam("port_id", o.PortID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_delete_responses.go new file mode 100644 index 00000000000..45c94b0225b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_delete_responses.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudNetworksPortsDeleteReader is a Reader for the PcloudNetworksPortsDelete structure. +type PcloudNetworksPortsDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudNetworksPortsDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudNetworksPortsDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudNetworksPortsDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudNetworksPortsDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewPcloudNetworksPortsDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudNetworksPortsDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudNetworksPortsDeleteOK creates a PcloudNetworksPortsDeleteOK with default headers values +func NewPcloudNetworksPortsDeleteOK() *PcloudNetworksPortsDeleteOK { + return &PcloudNetworksPortsDeleteOK{} +} + +/* PcloudNetworksPortsDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudNetworksPortsDeleteOK struct { + Payload models.Object +} + +func (o *PcloudNetworksPortsDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudNetworksPortsDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudNetworksPortsDeleteOK) 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 +} + +// NewPcloudNetworksPortsDeleteBadRequest creates a PcloudNetworksPortsDeleteBadRequest with default headers values +func NewPcloudNetworksPortsDeleteBadRequest() *PcloudNetworksPortsDeleteBadRequest { + return &PcloudNetworksPortsDeleteBadRequest{} +} + +/* PcloudNetworksPortsDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudNetworksPortsDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudNetworksPortsDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsDeleteBadRequest) 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 +} + +// NewPcloudNetworksPortsDeleteUnauthorized creates a PcloudNetworksPortsDeleteUnauthorized with default headers values +func NewPcloudNetworksPortsDeleteUnauthorized() *PcloudNetworksPortsDeleteUnauthorized { + return &PcloudNetworksPortsDeleteUnauthorized{} +} + +/* PcloudNetworksPortsDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudNetworksPortsDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudNetworksPortsDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsDeleteUnauthorized) 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 +} + +// NewPcloudNetworksPortsDeleteGone creates a PcloudNetworksPortsDeleteGone with default headers values +func NewPcloudNetworksPortsDeleteGone() *PcloudNetworksPortsDeleteGone { + return &PcloudNetworksPortsDeleteGone{} +} + +/* PcloudNetworksPortsDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudNetworksPortsDeleteGone struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsDeleteGone) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsDeleteGone %+v", 410, o.Payload) +} +func (o *PcloudNetworksPortsDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsDeleteGone) 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 +} + +// NewPcloudNetworksPortsDeleteInternalServerError creates a PcloudNetworksPortsDeleteInternalServerError with default headers values +func NewPcloudNetworksPortsDeleteInternalServerError() *PcloudNetworksPortsDeleteInternalServerError { + return &PcloudNetworksPortsDeleteInternalServerError{} +} + +/* PcloudNetworksPortsDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudNetworksPortsDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudNetworksPortsDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_get_parameters.go new file mode 100644 index 00000000000..cced0387781 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_get_parameters.go @@ -0,0 +1,193 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// 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" +) + +// NewPcloudNetworksPortsGetParams creates a new PcloudNetworksPortsGetParams 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 NewPcloudNetworksPortsGetParams() *PcloudNetworksPortsGetParams { + return &PcloudNetworksPortsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudNetworksPortsGetParamsWithTimeout creates a new PcloudNetworksPortsGetParams object +// with the ability to set a timeout on a request. +func NewPcloudNetworksPortsGetParamsWithTimeout(timeout time.Duration) *PcloudNetworksPortsGetParams { + return &PcloudNetworksPortsGetParams{ + timeout: timeout, + } +} + +// NewPcloudNetworksPortsGetParamsWithContext creates a new PcloudNetworksPortsGetParams object +// with the ability to set a context for a request. +func NewPcloudNetworksPortsGetParamsWithContext(ctx context.Context) *PcloudNetworksPortsGetParams { + return &PcloudNetworksPortsGetParams{ + Context: ctx, + } +} + +// NewPcloudNetworksPortsGetParamsWithHTTPClient creates a new PcloudNetworksPortsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudNetworksPortsGetParamsWithHTTPClient(client *http.Client) *PcloudNetworksPortsGetParams { + return &PcloudNetworksPortsGetParams{ + HTTPClient: client, + } +} + +/* PcloudNetworksPortsGetParams contains all the parameters to send to the API endpoint + for the pcloud networks ports get operation. + + Typically these are written to a http.Request. +*/ +type PcloudNetworksPortsGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* NetworkID. + + Network ID + */ + NetworkID string + + /* PortID. + + Port ID + */ + PortID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud networks ports get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsGetParams) WithDefaults() *PcloudNetworksPortsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks ports get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud networks ports get params +func (o *PcloudNetworksPortsGetParams) WithTimeout(timeout time.Duration) *PcloudNetworksPortsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud networks ports get params +func (o *PcloudNetworksPortsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud networks ports get params +func (o *PcloudNetworksPortsGetParams) WithContext(ctx context.Context) *PcloudNetworksPortsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud networks ports get params +func (o *PcloudNetworksPortsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud networks ports get params +func (o *PcloudNetworksPortsGetParams) WithHTTPClient(client *http.Client) *PcloudNetworksPortsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud networks ports get params +func (o *PcloudNetworksPortsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud networks ports get params +func (o *PcloudNetworksPortsGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudNetworksPortsGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud networks ports get params +func (o *PcloudNetworksPortsGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithNetworkID adds the networkID to the pcloud networks ports get params +func (o *PcloudNetworksPortsGetParams) WithNetworkID(networkID string) *PcloudNetworksPortsGetParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the pcloud networks ports get params +func (o *PcloudNetworksPortsGetParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WithPortID adds the portID to the pcloud networks ports get params +func (o *PcloudNetworksPortsGetParams) WithPortID(portID string) *PcloudNetworksPortsGetParams { + o.SetPortID(portID) + return o +} + +// SetPortID adds the portId to the pcloud networks ports get params +func (o *PcloudNetworksPortsGetParams) SetPortID(portID string) { + o.PortID = portID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudNetworksPortsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + // path param port_id + if err := r.SetPathParam("port_id", o.PortID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_get_responses.go new file mode 100644 index 00000000000..70ff78c3f8a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_get_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudNetworksPortsGetReader is a Reader for the PcloudNetworksPortsGet structure. +type PcloudNetworksPortsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudNetworksPortsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudNetworksPortsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPcloudNetworksPortsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudNetworksPortsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudNetworksPortsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudNetworksPortsGetOK creates a PcloudNetworksPortsGetOK with default headers values +func NewPcloudNetworksPortsGetOK() *PcloudNetworksPortsGetOK { + return &PcloudNetworksPortsGetOK{} +} + +/* PcloudNetworksPortsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudNetworksPortsGetOK struct { + Payload *models.NetworkPort +} + +func (o *PcloudNetworksPortsGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsGetOK %+v", 200, o.Payload) +} +func (o *PcloudNetworksPortsGetOK) GetPayload() *models.NetworkPort { + return o.Payload +} + +func (o *PcloudNetworksPortsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkPort) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudNetworksPortsGetUnauthorized creates a PcloudNetworksPortsGetUnauthorized with default headers values +func NewPcloudNetworksPortsGetUnauthorized() *PcloudNetworksPortsGetUnauthorized { + return &PcloudNetworksPortsGetUnauthorized{} +} + +/* PcloudNetworksPortsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudNetworksPortsGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudNetworksPortsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsGetUnauthorized) 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 +} + +// NewPcloudNetworksPortsGetNotFound creates a PcloudNetworksPortsGetNotFound with default headers values +func NewPcloudNetworksPortsGetNotFound() *PcloudNetworksPortsGetNotFound { + return &PcloudNetworksPortsGetNotFound{} +} + +/* PcloudNetworksPortsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudNetworksPortsGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudNetworksPortsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsGetNotFound) 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 +} + +// NewPcloudNetworksPortsGetInternalServerError creates a PcloudNetworksPortsGetInternalServerError with default headers values +func NewPcloudNetworksPortsGetInternalServerError() *PcloudNetworksPortsGetInternalServerError { + return &PcloudNetworksPortsGetInternalServerError{} +} + +/* PcloudNetworksPortsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudNetworksPortsGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudNetworksPortsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_getall_parameters.go new file mode 100644 index 00000000000..bae1e68171f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_getall_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// 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" +) + +// NewPcloudNetworksPortsGetallParams creates a new PcloudNetworksPortsGetallParams 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 NewPcloudNetworksPortsGetallParams() *PcloudNetworksPortsGetallParams { + return &PcloudNetworksPortsGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudNetworksPortsGetallParamsWithTimeout creates a new PcloudNetworksPortsGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudNetworksPortsGetallParamsWithTimeout(timeout time.Duration) *PcloudNetworksPortsGetallParams { + return &PcloudNetworksPortsGetallParams{ + timeout: timeout, + } +} + +// NewPcloudNetworksPortsGetallParamsWithContext creates a new PcloudNetworksPortsGetallParams object +// with the ability to set a context for a request. +func NewPcloudNetworksPortsGetallParamsWithContext(ctx context.Context) *PcloudNetworksPortsGetallParams { + return &PcloudNetworksPortsGetallParams{ + Context: ctx, + } +} + +// NewPcloudNetworksPortsGetallParamsWithHTTPClient creates a new PcloudNetworksPortsGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudNetworksPortsGetallParamsWithHTTPClient(client *http.Client) *PcloudNetworksPortsGetallParams { + return &PcloudNetworksPortsGetallParams{ + HTTPClient: client, + } +} + +/* PcloudNetworksPortsGetallParams contains all the parameters to send to the API endpoint + for the pcloud networks ports getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudNetworksPortsGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* NetworkID. + + Network ID + */ + NetworkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud networks ports getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsGetallParams) WithDefaults() *PcloudNetworksPortsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks ports getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud networks ports getall params +func (o *PcloudNetworksPortsGetallParams) WithTimeout(timeout time.Duration) *PcloudNetworksPortsGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud networks ports getall params +func (o *PcloudNetworksPortsGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud networks ports getall params +func (o *PcloudNetworksPortsGetallParams) WithContext(ctx context.Context) *PcloudNetworksPortsGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud networks ports getall params +func (o *PcloudNetworksPortsGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud networks ports getall params +func (o *PcloudNetworksPortsGetallParams) WithHTTPClient(client *http.Client) *PcloudNetworksPortsGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud networks ports getall params +func (o *PcloudNetworksPortsGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud networks ports getall params +func (o *PcloudNetworksPortsGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudNetworksPortsGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud networks ports getall params +func (o *PcloudNetworksPortsGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithNetworkID adds the networkID to the pcloud networks ports getall params +func (o *PcloudNetworksPortsGetallParams) WithNetworkID(networkID string) *PcloudNetworksPortsGetallParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the pcloud networks ports getall params +func (o *PcloudNetworksPortsGetallParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudNetworksPortsGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_getall_responses.go new file mode 100644 index 00000000000..4c5a21006cf --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_getall_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudNetworksPortsGetallReader is a Reader for the PcloudNetworksPortsGetall structure. +type PcloudNetworksPortsGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudNetworksPortsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudNetworksPortsGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudNetworksPortsGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudNetworksPortsGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudNetworksPortsGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudNetworksPortsGetallOK creates a PcloudNetworksPortsGetallOK with default headers values +func NewPcloudNetworksPortsGetallOK() *PcloudNetworksPortsGetallOK { + return &PcloudNetworksPortsGetallOK{} +} + +/* PcloudNetworksPortsGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudNetworksPortsGetallOK struct { + Payload *models.NetworkPorts +} + +func (o *PcloudNetworksPortsGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallOK %+v", 200, o.Payload) +} +func (o *PcloudNetworksPortsGetallOK) GetPayload() *models.NetworkPorts { + return o.Payload +} + +func (o *PcloudNetworksPortsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkPorts) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudNetworksPortsGetallBadRequest creates a PcloudNetworksPortsGetallBadRequest with default headers values +func NewPcloudNetworksPortsGetallBadRequest() *PcloudNetworksPortsGetallBadRequest { + return &PcloudNetworksPortsGetallBadRequest{} +} + +/* PcloudNetworksPortsGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudNetworksPortsGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudNetworksPortsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsGetallBadRequest) 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 +} + +// NewPcloudNetworksPortsGetallUnauthorized creates a PcloudNetworksPortsGetallUnauthorized with default headers values +func NewPcloudNetworksPortsGetallUnauthorized() *PcloudNetworksPortsGetallUnauthorized { + return &PcloudNetworksPortsGetallUnauthorized{} +} + +/* PcloudNetworksPortsGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudNetworksPortsGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudNetworksPortsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsGetallUnauthorized) 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 +} + +// NewPcloudNetworksPortsGetallInternalServerError creates a PcloudNetworksPortsGetallInternalServerError with default headers values +func NewPcloudNetworksPortsGetallInternalServerError() *PcloudNetworksPortsGetallInternalServerError { + return &PcloudNetworksPortsGetallInternalServerError{} +} + +/* PcloudNetworksPortsGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudNetworksPortsGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudNetworksPortsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_post_parameters.go new file mode 100644 index 00000000000..ffeb93590c3 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_post_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// 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" +) + +// NewPcloudNetworksPortsPostParams creates a new PcloudNetworksPortsPostParams 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 NewPcloudNetworksPortsPostParams() *PcloudNetworksPortsPostParams { + return &PcloudNetworksPortsPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudNetworksPortsPostParamsWithTimeout creates a new PcloudNetworksPortsPostParams object +// with the ability to set a timeout on a request. +func NewPcloudNetworksPortsPostParamsWithTimeout(timeout time.Duration) *PcloudNetworksPortsPostParams { + return &PcloudNetworksPortsPostParams{ + timeout: timeout, + } +} + +// NewPcloudNetworksPortsPostParamsWithContext creates a new PcloudNetworksPortsPostParams object +// with the ability to set a context for a request. +func NewPcloudNetworksPortsPostParamsWithContext(ctx context.Context) *PcloudNetworksPortsPostParams { + return &PcloudNetworksPortsPostParams{ + Context: ctx, + } +} + +// NewPcloudNetworksPortsPostParamsWithHTTPClient creates a new PcloudNetworksPortsPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudNetworksPortsPostParamsWithHTTPClient(client *http.Client) *PcloudNetworksPortsPostParams { + return &PcloudNetworksPortsPostParams{ + HTTPClient: client, + } +} + +/* PcloudNetworksPortsPostParams contains all the parameters to send to the API endpoint + for the pcloud networks ports post operation. + + Typically these are written to a http.Request. +*/ +type PcloudNetworksPortsPostParams struct { + + /* Body. + + Create a Network Port + */ + Body *models.NetworkPortCreate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* NetworkID. + + Network ID + */ + NetworkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud networks ports post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsPostParams) WithDefaults() *PcloudNetworksPortsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks ports post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud networks ports post params +func (o *PcloudNetworksPortsPostParams) WithTimeout(timeout time.Duration) *PcloudNetworksPortsPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud networks ports post params +func (o *PcloudNetworksPortsPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud networks ports post params +func (o *PcloudNetworksPortsPostParams) WithContext(ctx context.Context) *PcloudNetworksPortsPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud networks ports post params +func (o *PcloudNetworksPortsPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud networks ports post params +func (o *PcloudNetworksPortsPostParams) WithHTTPClient(client *http.Client) *PcloudNetworksPortsPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud networks ports post params +func (o *PcloudNetworksPortsPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud networks ports post params +func (o *PcloudNetworksPortsPostParams) WithBody(body *models.NetworkPortCreate) *PcloudNetworksPortsPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud networks ports post params +func (o *PcloudNetworksPortsPostParams) SetBody(body *models.NetworkPortCreate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud networks ports post params +func (o *PcloudNetworksPortsPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudNetworksPortsPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud networks ports post params +func (o *PcloudNetworksPortsPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithNetworkID adds the networkID to the pcloud networks ports post params +func (o *PcloudNetworksPortsPostParams) WithNetworkID(networkID string) *PcloudNetworksPortsPostParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the pcloud networks ports post params +func (o *PcloudNetworksPortsPostParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudNetworksPortsPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_post_responses.go new file mode 100644 index 00000000000..a284e8b3ac2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_post_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudNetworksPortsPostReader is a Reader for the PcloudNetworksPortsPost structure. +type PcloudNetworksPortsPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudNetworksPortsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 201: + result := NewPcloudNetworksPortsPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudNetworksPortsPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudNetworksPortsPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudNetworksPortsPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudNetworksPortsPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudNetworksPortsPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudNetworksPortsPostCreated creates a PcloudNetworksPortsPostCreated with default headers values +func NewPcloudNetworksPortsPostCreated() *PcloudNetworksPortsPostCreated { + return &PcloudNetworksPortsPostCreated{} +} + +/* PcloudNetworksPortsPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type PcloudNetworksPortsPostCreated struct { + Payload *models.NetworkPort +} + +func (o *PcloudNetworksPortsPostCreated) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsPostCreated %+v", 201, o.Payload) +} +func (o *PcloudNetworksPortsPostCreated) GetPayload() *models.NetworkPort { + return o.Payload +} + +func (o *PcloudNetworksPortsPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkPort) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudNetworksPortsPostBadRequest creates a PcloudNetworksPortsPostBadRequest with default headers values +func NewPcloudNetworksPortsPostBadRequest() *PcloudNetworksPortsPostBadRequest { + return &PcloudNetworksPortsPostBadRequest{} +} + +/* PcloudNetworksPortsPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudNetworksPortsPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudNetworksPortsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsPostBadRequest) 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 +} + +// NewPcloudNetworksPortsPostUnauthorized creates a PcloudNetworksPortsPostUnauthorized with default headers values +func NewPcloudNetworksPortsPostUnauthorized() *PcloudNetworksPortsPostUnauthorized { + return &PcloudNetworksPortsPostUnauthorized{} +} + +/* PcloudNetworksPortsPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudNetworksPortsPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudNetworksPortsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsPostUnauthorized) 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 +} + +// NewPcloudNetworksPortsPostConflict creates a PcloudNetworksPortsPostConflict with default headers values +func NewPcloudNetworksPortsPostConflict() *PcloudNetworksPortsPostConflict { + return &PcloudNetworksPortsPostConflict{} +} + +/* PcloudNetworksPortsPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudNetworksPortsPostConflict struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsPostConflict %+v", 409, o.Payload) +} +func (o *PcloudNetworksPortsPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsPostConflict) 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 +} + +// NewPcloudNetworksPortsPostUnprocessableEntity creates a PcloudNetworksPortsPostUnprocessableEntity with default headers values +func NewPcloudNetworksPortsPostUnprocessableEntity() *PcloudNetworksPortsPostUnprocessableEntity { + return &PcloudNetworksPortsPostUnprocessableEntity{} +} + +/* PcloudNetworksPortsPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudNetworksPortsPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudNetworksPortsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsPostUnprocessableEntity) 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 +} + +// NewPcloudNetworksPortsPostInternalServerError creates a PcloudNetworksPortsPostInternalServerError with default headers values +func NewPcloudNetworksPortsPostInternalServerError() *PcloudNetworksPortsPostInternalServerError { + return &PcloudNetworksPortsPostInternalServerError{} +} + +/* PcloudNetworksPortsPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudNetworksPortsPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports][%d] pcloudNetworksPortsPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudNetworksPortsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_put_parameters.go new file mode 100644 index 00000000000..fce7c87e67f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_put_parameters.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// 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" +) + +// NewPcloudNetworksPortsPutParams creates a new PcloudNetworksPortsPutParams 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 NewPcloudNetworksPortsPutParams() *PcloudNetworksPortsPutParams { + return &PcloudNetworksPortsPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudNetworksPortsPutParamsWithTimeout creates a new PcloudNetworksPortsPutParams object +// with the ability to set a timeout on a request. +func NewPcloudNetworksPortsPutParamsWithTimeout(timeout time.Duration) *PcloudNetworksPortsPutParams { + return &PcloudNetworksPortsPutParams{ + timeout: timeout, + } +} + +// NewPcloudNetworksPortsPutParamsWithContext creates a new PcloudNetworksPortsPutParams object +// with the ability to set a context for a request. +func NewPcloudNetworksPortsPutParamsWithContext(ctx context.Context) *PcloudNetworksPortsPutParams { + return &PcloudNetworksPortsPutParams{ + Context: ctx, + } +} + +// NewPcloudNetworksPortsPutParamsWithHTTPClient creates a new PcloudNetworksPortsPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudNetworksPortsPutParamsWithHTTPClient(client *http.Client) *PcloudNetworksPortsPutParams { + return &PcloudNetworksPortsPutParams{ + HTTPClient: client, + } +} + +/* PcloudNetworksPortsPutParams contains all the parameters to send to the API endpoint + for the pcloud networks ports put operation. + + Typically these are written to a http.Request. +*/ +type PcloudNetworksPortsPutParams struct { + + /* Body. + + Parameters for updating a Port + */ + Body *models.NetworkPortUpdate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* NetworkID. + + Network ID + */ + NetworkID string + + /* PortID. + + Port ID + */ + PortID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud networks ports put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsPutParams) WithDefaults() *PcloudNetworksPortsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks ports put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPortsPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud networks ports put params +func (o *PcloudNetworksPortsPutParams) WithTimeout(timeout time.Duration) *PcloudNetworksPortsPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud networks ports put params +func (o *PcloudNetworksPortsPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud networks ports put params +func (o *PcloudNetworksPortsPutParams) WithContext(ctx context.Context) *PcloudNetworksPortsPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud networks ports put params +func (o *PcloudNetworksPortsPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud networks ports put params +func (o *PcloudNetworksPortsPutParams) WithHTTPClient(client *http.Client) *PcloudNetworksPortsPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud networks ports put params +func (o *PcloudNetworksPortsPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud networks ports put params +func (o *PcloudNetworksPortsPutParams) WithBody(body *models.NetworkPortUpdate) *PcloudNetworksPortsPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud networks ports put params +func (o *PcloudNetworksPortsPutParams) SetBody(body *models.NetworkPortUpdate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud networks ports put params +func (o *PcloudNetworksPortsPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudNetworksPortsPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud networks ports put params +func (o *PcloudNetworksPortsPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithNetworkID adds the networkID to the pcloud networks ports put params +func (o *PcloudNetworksPortsPutParams) WithNetworkID(networkID string) *PcloudNetworksPortsPutParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the pcloud networks ports put params +func (o *PcloudNetworksPortsPutParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WithPortID adds the portID to the pcloud networks ports put params +func (o *PcloudNetworksPortsPutParams) WithPortID(portID string) *PcloudNetworksPortsPutParams { + o.SetPortID(portID) + return o +} + +// SetPortID adds the portId to the pcloud networks ports put params +func (o *PcloudNetworksPortsPutParams) SetPortID(portID string) { + o.PortID = portID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudNetworksPortsPutParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + // path param port_id + if err := r.SetPathParam("port_id", o.PortID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_put_responses.go new file mode 100644 index 00000000000..4fc8e47d290 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_ports_put_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudNetworksPortsPutReader is a Reader for the PcloudNetworksPortsPut structure. +type PcloudNetworksPortsPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudNetworksPortsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudNetworksPortsPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudNetworksPortsPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudNetworksPortsPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudNetworksPortsPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudNetworksPortsPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudNetworksPortsPutOK creates a PcloudNetworksPortsPutOK with default headers values +func NewPcloudNetworksPortsPutOK() *PcloudNetworksPortsPutOK { + return &PcloudNetworksPortsPutOK{} +} + +/* PcloudNetworksPortsPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudNetworksPortsPutOK struct { + Payload *models.NetworkPort +} + +func (o *PcloudNetworksPortsPutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsPutOK %+v", 200, o.Payload) +} +func (o *PcloudNetworksPortsPutOK) GetPayload() *models.NetworkPort { + return o.Payload +} + +func (o *PcloudNetworksPortsPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkPort) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudNetworksPortsPutBadRequest creates a PcloudNetworksPortsPutBadRequest with default headers values +func NewPcloudNetworksPortsPutBadRequest() *PcloudNetworksPortsPutBadRequest { + return &PcloudNetworksPortsPutBadRequest{} +} + +/* PcloudNetworksPortsPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudNetworksPortsPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudNetworksPortsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsPutBadRequest) 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 +} + +// NewPcloudNetworksPortsPutUnauthorized creates a PcloudNetworksPortsPutUnauthorized with default headers values +func NewPcloudNetworksPortsPutUnauthorized() *PcloudNetworksPortsPutUnauthorized { + return &PcloudNetworksPortsPutUnauthorized{} +} + +/* PcloudNetworksPortsPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudNetworksPortsPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudNetworksPortsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsPutUnauthorized) 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 +} + +// NewPcloudNetworksPortsPutUnprocessableEntity creates a PcloudNetworksPortsPutUnprocessableEntity with default headers values +func NewPcloudNetworksPortsPutUnprocessableEntity() *PcloudNetworksPortsPutUnprocessableEntity { + return &PcloudNetworksPortsPutUnprocessableEntity{} +} + +/* PcloudNetworksPortsPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudNetworksPortsPutUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsPutUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudNetworksPortsPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsPutUnprocessableEntity) 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 +} + +// NewPcloudNetworksPortsPutInternalServerError creates a PcloudNetworksPortsPutInternalServerError with default headers values +func NewPcloudNetworksPortsPutInternalServerError() *PcloudNetworksPortsPutInternalServerError { + return &PcloudNetworksPortsPutInternalServerError{} +} + +/* PcloudNetworksPortsPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudNetworksPortsPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudNetworksPortsPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}/ports/{port_id}][%d] pcloudNetworksPortsPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudNetworksPortsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPortsPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_post_parameters.go new file mode 100644 index 00000000000..dea14d36adf --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// 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" +) + +// NewPcloudNetworksPostParams creates a new PcloudNetworksPostParams 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 NewPcloudNetworksPostParams() *PcloudNetworksPostParams { + return &PcloudNetworksPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudNetworksPostParamsWithTimeout creates a new PcloudNetworksPostParams object +// with the ability to set a timeout on a request. +func NewPcloudNetworksPostParamsWithTimeout(timeout time.Duration) *PcloudNetworksPostParams { + return &PcloudNetworksPostParams{ + timeout: timeout, + } +} + +// NewPcloudNetworksPostParamsWithContext creates a new PcloudNetworksPostParams object +// with the ability to set a context for a request. +func NewPcloudNetworksPostParamsWithContext(ctx context.Context) *PcloudNetworksPostParams { + return &PcloudNetworksPostParams{ + Context: ctx, + } +} + +// NewPcloudNetworksPostParamsWithHTTPClient creates a new PcloudNetworksPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudNetworksPostParamsWithHTTPClient(client *http.Client) *PcloudNetworksPostParams { + return &PcloudNetworksPostParams{ + HTTPClient: client, + } +} + +/* PcloudNetworksPostParams contains all the parameters to send to the API endpoint + for the pcloud networks post operation. + + Typically these are written to a http.Request. +*/ +type PcloudNetworksPostParams struct { + + /* Body. + + Parameters for the creation of a new network + */ + Body *models.NetworkCreate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud networks post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPostParams) WithDefaults() *PcloudNetworksPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud networks post params +func (o *PcloudNetworksPostParams) WithTimeout(timeout time.Duration) *PcloudNetworksPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud networks post params +func (o *PcloudNetworksPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud networks post params +func (o *PcloudNetworksPostParams) WithContext(ctx context.Context) *PcloudNetworksPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud networks post params +func (o *PcloudNetworksPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud networks post params +func (o *PcloudNetworksPostParams) WithHTTPClient(client *http.Client) *PcloudNetworksPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud networks post params +func (o *PcloudNetworksPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud networks post params +func (o *PcloudNetworksPostParams) WithBody(body *models.NetworkCreate) *PcloudNetworksPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud networks post params +func (o *PcloudNetworksPostParams) SetBody(body *models.NetworkCreate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud networks post params +func (o *PcloudNetworksPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudNetworksPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud networks post params +func (o *PcloudNetworksPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudNetworksPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_post_responses.go new file mode 100644 index 00000000000..27a0da33a61 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_post_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudNetworksPostReader is a Reader for the PcloudNetworksPost structure. +type PcloudNetworksPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudNetworksPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudNetworksPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 201: + result := NewPcloudNetworksPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudNetworksPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudNetworksPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudNetworksPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudNetworksPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudNetworksPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudNetworksPostOK creates a PcloudNetworksPostOK with default headers values +func NewPcloudNetworksPostOK() *PcloudNetworksPostOK { + return &PcloudNetworksPostOK{} +} + +/* PcloudNetworksPostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudNetworksPostOK struct { + Payload *models.Network +} + +func (o *PcloudNetworksPostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksPostOK %+v", 200, o.Payload) +} +func (o *PcloudNetworksPostOK) GetPayload() *models.Network { + return o.Payload +} + +func (o *PcloudNetworksPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Network) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudNetworksPostCreated creates a PcloudNetworksPostCreated with default headers values +func NewPcloudNetworksPostCreated() *PcloudNetworksPostCreated { + return &PcloudNetworksPostCreated{} +} + +/* PcloudNetworksPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type PcloudNetworksPostCreated struct { + Payload *models.Network +} + +func (o *PcloudNetworksPostCreated) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksPostCreated %+v", 201, o.Payload) +} +func (o *PcloudNetworksPostCreated) GetPayload() *models.Network { + return o.Payload +} + +func (o *PcloudNetworksPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Network) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudNetworksPostBadRequest creates a PcloudNetworksPostBadRequest with default headers values +func NewPcloudNetworksPostBadRequest() *PcloudNetworksPostBadRequest { + return &PcloudNetworksPostBadRequest{} +} + +/* PcloudNetworksPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudNetworksPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudNetworksPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudNetworksPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPostBadRequest) 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 +} + +// NewPcloudNetworksPostUnauthorized creates a PcloudNetworksPostUnauthorized with default headers values +func NewPcloudNetworksPostUnauthorized() *PcloudNetworksPostUnauthorized { + return &PcloudNetworksPostUnauthorized{} +} + +/* PcloudNetworksPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudNetworksPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudNetworksPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudNetworksPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPostUnauthorized) 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 +} + +// NewPcloudNetworksPostConflict creates a PcloudNetworksPostConflict with default headers values +func NewPcloudNetworksPostConflict() *PcloudNetworksPostConflict { + return &PcloudNetworksPostConflict{} +} + +/* PcloudNetworksPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudNetworksPostConflict struct { + Payload *models.Error +} + +func (o *PcloudNetworksPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksPostConflict %+v", 409, o.Payload) +} +func (o *PcloudNetworksPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPostConflict) 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 +} + +// NewPcloudNetworksPostUnprocessableEntity creates a PcloudNetworksPostUnprocessableEntity with default headers values +func NewPcloudNetworksPostUnprocessableEntity() *PcloudNetworksPostUnprocessableEntity { + return &PcloudNetworksPostUnprocessableEntity{} +} + +/* PcloudNetworksPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudNetworksPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudNetworksPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudNetworksPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPostUnprocessableEntity) 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 +} + +// NewPcloudNetworksPostInternalServerError creates a PcloudNetworksPostInternalServerError with default headers values +func NewPcloudNetworksPostInternalServerError() *PcloudNetworksPostInternalServerError { + return &PcloudNetworksPostInternalServerError{} +} + +/* PcloudNetworksPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudNetworksPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudNetworksPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][%d] pcloudNetworksPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudNetworksPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_put_parameters.go new file mode 100644 index 00000000000..00ef70f90f8 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_put_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// 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" +) + +// NewPcloudNetworksPutParams creates a new PcloudNetworksPutParams 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 NewPcloudNetworksPutParams() *PcloudNetworksPutParams { + return &PcloudNetworksPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudNetworksPutParamsWithTimeout creates a new PcloudNetworksPutParams object +// with the ability to set a timeout on a request. +func NewPcloudNetworksPutParamsWithTimeout(timeout time.Duration) *PcloudNetworksPutParams { + return &PcloudNetworksPutParams{ + timeout: timeout, + } +} + +// NewPcloudNetworksPutParamsWithContext creates a new PcloudNetworksPutParams object +// with the ability to set a context for a request. +func NewPcloudNetworksPutParamsWithContext(ctx context.Context) *PcloudNetworksPutParams { + return &PcloudNetworksPutParams{ + Context: ctx, + } +} + +// NewPcloudNetworksPutParamsWithHTTPClient creates a new PcloudNetworksPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudNetworksPutParamsWithHTTPClient(client *http.Client) *PcloudNetworksPutParams { + return &PcloudNetworksPutParams{ + HTTPClient: client, + } +} + +/* PcloudNetworksPutParams contains all the parameters to send to the API endpoint + for the pcloud networks put operation. + + Typically these are written to a http.Request. +*/ +type PcloudNetworksPutParams struct { + + /* Body. + + Parameters to update a Network + */ + Body *models.NetworkUpdate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* NetworkID. + + Network ID + */ + NetworkID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud networks put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPutParams) WithDefaults() *PcloudNetworksPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud networks put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudNetworksPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud networks put params +func (o *PcloudNetworksPutParams) WithTimeout(timeout time.Duration) *PcloudNetworksPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud networks put params +func (o *PcloudNetworksPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud networks put params +func (o *PcloudNetworksPutParams) WithContext(ctx context.Context) *PcloudNetworksPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud networks put params +func (o *PcloudNetworksPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud networks put params +func (o *PcloudNetworksPutParams) WithHTTPClient(client *http.Client) *PcloudNetworksPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud networks put params +func (o *PcloudNetworksPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud networks put params +func (o *PcloudNetworksPutParams) WithBody(body *models.NetworkUpdate) *PcloudNetworksPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud networks put params +func (o *PcloudNetworksPutParams) SetBody(body *models.NetworkUpdate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud networks put params +func (o *PcloudNetworksPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudNetworksPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud networks put params +func (o *PcloudNetworksPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithNetworkID adds the networkID to the pcloud networks put params +func (o *PcloudNetworksPutParams) WithNetworkID(networkID string) *PcloudNetworksPutParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the pcloud networks put params +func (o *PcloudNetworksPutParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudNetworksPutParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_put_responses.go new file mode 100644 index 00000000000..935956e0abc --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks/pcloud_networks_put_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_networks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudNetworksPutReader is a Reader for the PcloudNetworksPut structure. +type PcloudNetworksPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudNetworksPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudNetworksPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudNetworksPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudNetworksPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudNetworksPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudNetworksPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudNetworksPutOK creates a PcloudNetworksPutOK with default headers values +func NewPcloudNetworksPutOK() *PcloudNetworksPutOK { + return &PcloudNetworksPutOK{} +} + +/* PcloudNetworksPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudNetworksPutOK struct { + Payload *models.Network +} + +func (o *PcloudNetworksPutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksPutOK %+v", 200, o.Payload) +} +func (o *PcloudNetworksPutOK) GetPayload() *models.Network { + return o.Payload +} + +func (o *PcloudNetworksPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Network) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudNetworksPutBadRequest creates a PcloudNetworksPutBadRequest with default headers values +func NewPcloudNetworksPutBadRequest() *PcloudNetworksPutBadRequest { + return &PcloudNetworksPutBadRequest{} +} + +/* PcloudNetworksPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudNetworksPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudNetworksPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudNetworksPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPutBadRequest) 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 +} + +// NewPcloudNetworksPutUnauthorized creates a PcloudNetworksPutUnauthorized with default headers values +func NewPcloudNetworksPutUnauthorized() *PcloudNetworksPutUnauthorized { + return &PcloudNetworksPutUnauthorized{} +} + +/* PcloudNetworksPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudNetworksPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudNetworksPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudNetworksPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPutUnauthorized) 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 +} + +// NewPcloudNetworksPutUnprocessableEntity creates a PcloudNetworksPutUnprocessableEntity with default headers values +func NewPcloudNetworksPutUnprocessableEntity() *PcloudNetworksPutUnprocessableEntity { + return &PcloudNetworksPutUnprocessableEntity{} +} + +/* PcloudNetworksPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudNetworksPutUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudNetworksPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksPutUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudNetworksPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPutUnprocessableEntity) 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 +} + +// NewPcloudNetworksPutInternalServerError creates a PcloudNetworksPutInternalServerError with default headers values +func NewPcloudNetworksPutInternalServerError() *PcloudNetworksPutInternalServerError { + return &PcloudNetworksPutInternalServerError{} +} + +/* PcloudNetworksPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudNetworksPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudNetworksPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/networks/{network_id}][%d] pcloudNetworksPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudNetworksPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudNetworksPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/p_cloudp_vm_instances_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/p_cloudp_vm_instances_client.go new file mode 100644 index 00000000000..4e52d968233 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/p_cloudp_vm_instances_client.go @@ -0,0 +1,904 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud p vm instances API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud p vm instances API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudPvminstancesActionPost(params *PcloudPvminstancesActionPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesActionPostOK, error) + + PcloudPvminstancesCapturePost(params *PcloudPvminstancesCapturePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesCapturePostOK, *PcloudPvminstancesCapturePostAccepted, error) + + PcloudPvminstancesClonePost(params *PcloudPvminstancesClonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesClonePostAccepted, error) + + PcloudPvminstancesConsoleGet(params *PcloudPvminstancesConsoleGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesConsoleGetOK, error) + + PcloudPvminstancesConsolePost(params *PcloudPvminstancesConsolePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesConsolePostCreated, error) + + PcloudPvminstancesConsolePut(params *PcloudPvminstancesConsolePutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesConsolePutOK, error) + + PcloudPvminstancesDelete(params *PcloudPvminstancesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesDeleteOK, error) + + PcloudPvminstancesGet(params *PcloudPvminstancesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesGetOK, error) + + PcloudPvminstancesGetall(params *PcloudPvminstancesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesGetallOK, error) + + PcloudPvminstancesNetworksDelete(params *PcloudPvminstancesNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksDeleteOK, error) + + PcloudPvminstancesNetworksGet(params *PcloudPvminstancesNetworksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksGetOK, error) + + PcloudPvminstancesNetworksGetall(params *PcloudPvminstancesNetworksGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksGetallOK, error) + + PcloudPvminstancesNetworksPost(params *PcloudPvminstancesNetworksPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksPostCreated, error) + + PcloudPvminstancesOperationsPost(params *PcloudPvminstancesOperationsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesOperationsPostOK, error) + + PcloudPvminstancesPost(params *PcloudPvminstancesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesPostOK, *PcloudPvminstancesPostCreated, *PcloudPvminstancesPostAccepted, error) + + PcloudPvminstancesPut(params *PcloudPvminstancesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesPutAccepted, error) + + PcloudPvminstancesSnapshotsGetall(params *PcloudPvminstancesSnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesSnapshotsGetallOK, error) + + PcloudPvminstancesSnapshotsPost(params *PcloudPvminstancesSnapshotsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesSnapshotsPostAccepted, error) + + PcloudPvminstancesSnapshotsRestorePost(params *PcloudPvminstancesSnapshotsRestorePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesSnapshotsRestorePostAccepted, error) + + PcloudV2PvminstancesCaptureGet(params *PcloudV2PvminstancesCaptureGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2PvminstancesCaptureGetOK, error) + + PcloudV2PvminstancesCapturePost(params *PcloudV2PvminstancesCapturePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2PvminstancesCapturePostAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudPvminstancesActionPost performs an action start stop reboot immediate shutdown reset on a p VM instance +*/ +func (a *Client) PcloudPvminstancesActionPost(params *PcloudPvminstancesActionPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesActionPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesActionPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.action.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/action", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesActionPostReader{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.(*PcloudPvminstancesActionPostOK) + 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 pcloud.pvminstances.action.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesCapturePost captures a p VM instance and create a deployable image +*/ +func (a *Client) PcloudPvminstancesCapturePost(params *PcloudPvminstancesCapturePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesCapturePostOK, *PcloudPvminstancesCapturePostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesCapturePostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.capture.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesCapturePostReader{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 *PcloudPvminstancesCapturePostOK: + return value, nil, nil + case *PcloudPvminstancesCapturePostAccepted: + 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 p_cloud_p_vm_instances: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesClonePost clones a p VM instance +*/ +func (a *Client) PcloudPvminstancesClonePost(params *PcloudPvminstancesClonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesClonePostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesClonePostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.clone.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesClonePostReader{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.(*PcloudPvminstancesClonePostAccepted) + 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 pcloud.pvminstances.clone.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesConsoleGet lists all console languages +*/ +func (a *Client) PcloudPvminstancesConsoleGet(params *PcloudPvminstancesConsoleGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesConsoleGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesConsoleGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.console.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesConsoleGetReader{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.(*PcloudPvminstancesConsoleGetOK) + 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 pcloud.pvminstances.console.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesConsolePost generates the no v n c console URL +*/ +func (a *Client) PcloudPvminstancesConsolePost(params *PcloudPvminstancesConsolePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesConsolePostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesConsolePostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.console.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesConsolePostReader{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.(*PcloudPvminstancesConsolePostCreated) + 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 pcloud.pvminstances.console.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesConsolePut updates p VM instance console laguage code +*/ +func (a *Client) PcloudPvminstancesConsolePut(params *PcloudPvminstancesConsolePutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesConsolePutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesConsolePutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.console.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesConsolePutReader{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.(*PcloudPvminstancesConsolePutOK) + 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 pcloud.pvminstances.console.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesDelete deletes a p cloud p VM instance +*/ +func (a *Client) PcloudPvminstancesDelete(params *PcloudPvminstancesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesDeleteReader{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.(*PcloudPvminstancesDeleteOK) + 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 pcloud.pvminstances.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesGet gets a p VM instance s current state information +*/ +func (a *Client) PcloudPvminstancesGet(params *PcloudPvminstancesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesGetReader{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.(*PcloudPvminstancesGetOK) + 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 pcloud.pvminstances.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesGetall gets all the pvm instances for this cloud instance +*/ +func (a *Client) PcloudPvminstancesGetall(params *PcloudPvminstancesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesGetallReader{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.(*PcloudPvminstancesGetallOK) + 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 pcloud.pvminstances.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesNetworksDelete removes all address of network from a p VM instance +*/ +func (a *Client) PcloudPvminstancesNetworksDelete(params *PcloudPvminstancesNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesNetworksDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.networks.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesNetworksDeleteReader{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.(*PcloudPvminstancesNetworksDeleteOK) + 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 pcloud.pvminstances.networks.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesNetworksGet gets a p VM instance s network information +*/ +func (a *Client) PcloudPvminstancesNetworksGet(params *PcloudPvminstancesNetworksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesNetworksGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.networks.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesNetworksGetReader{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.(*PcloudPvminstancesNetworksGetOK) + 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 pcloud.pvminstances.networks.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesNetworksGetall gets all networks for this p VM instance +*/ +func (a *Client) PcloudPvminstancesNetworksGetall(params *PcloudPvminstancesNetworksGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesNetworksGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.networks.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesNetworksGetallReader{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.(*PcloudPvminstancesNetworksGetallOK) + 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 pcloud.pvminstances.networks.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesNetworksPost performs network addition +*/ +func (a *Client) PcloudPvminstancesNetworksPost(params *PcloudPvminstancesNetworksPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesNetworksPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesNetworksPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.networks.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesNetworksPostReader{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.(*PcloudPvminstancesNetworksPostCreated) + 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 pcloud.pvminstances.networks.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesOperationsPost performs an operation on a p VM instance +*/ +func (a *Client) PcloudPvminstancesOperationsPost(params *PcloudPvminstancesOperationsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesOperationsPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesOperationsPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.operations.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/operations", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesOperationsPostReader{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.(*PcloudPvminstancesOperationsPostOK) + 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 pcloud.pvminstances.operations.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesPost creates a new power VM instance +*/ +func (a *Client) PcloudPvminstancesPost(params *PcloudPvminstancesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesPostOK, *PcloudPvminstancesPostCreated, *PcloudPvminstancesPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesPostReader{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, nil, err + } + switch value := result.(type) { + case *PcloudPvminstancesPostOK: + return value, nil, nil, nil + case *PcloudPvminstancesPostCreated: + return nil, value, nil, nil + case *PcloudPvminstancesPostAccepted: + return nil, 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 p_cloud_p_vm_instances: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesPut updates a p cloud p VM instance +*/ +func (a *Client) PcloudPvminstancesPut(params *PcloudPvminstancesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesPutAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesPutReader{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.(*PcloudPvminstancesPutAccepted) + 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 pcloud.pvminstances.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesSnapshotsGetall gets all snapshots for this p VM instance +*/ +func (a *Client) PcloudPvminstancesSnapshotsGetall(params *PcloudPvminstancesSnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesSnapshotsGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesSnapshotsGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.snapshots.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesSnapshotsGetallReader{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.(*PcloudPvminstancesSnapshotsGetallOK) + 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 pcloud.pvminstances.snapshots.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesSnapshotsPost creates a p VM instance snapshot +*/ +func (a *Client) PcloudPvminstancesSnapshotsPost(params *PcloudPvminstancesSnapshotsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesSnapshotsPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesSnapshotsPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.snapshots.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesSnapshotsPostReader{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.(*PcloudPvminstancesSnapshotsPostAccepted) + 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 pcloud.pvminstances.snapshots.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesSnapshotsRestorePost restores a p VM instance snapshot +*/ +func (a *Client) PcloudPvminstancesSnapshotsRestorePost(params *PcloudPvminstancesSnapshotsRestorePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesSnapshotsRestorePostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesSnapshotsRestorePostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.snapshots.restore.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots/{snapshot_id}/restore", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesSnapshotsRestorePostReader{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.(*PcloudPvminstancesSnapshotsRestorePostAccepted) + 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 pcloud.pvminstances.snapshots.restore.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2PvminstancesCaptureGet gets detail of last capture job +*/ +func (a *Client) PcloudV2PvminstancesCaptureGet(params *PcloudV2PvminstancesCaptureGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2PvminstancesCaptureGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2PvminstancesCaptureGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.pvminstances.capture.get", + Method: "GET", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2PvminstancesCaptureGetReader{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.(*PcloudV2PvminstancesCaptureGetOK) + 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 pcloud.v2.pvminstances.capture.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2PvminstancesCapturePost adds a capture pvm instance to the jobs queue +*/ +func (a *Client) PcloudV2PvminstancesCapturePost(params *PcloudV2PvminstancesCapturePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2PvminstancesCapturePostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2PvminstancesCapturePostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.pvminstances.capture.post", + Method: "POST", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2PvminstancesCapturePostReader{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.(*PcloudV2PvminstancesCapturePostAccepted) + 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 pcloud.v2.pvminstances.capture.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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_action_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_action_post_parameters.go new file mode 100644 index 00000000000..27ae8aa3274 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_action_post_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesActionPostParams creates a new PcloudPvminstancesActionPostParams 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 NewPcloudPvminstancesActionPostParams() *PcloudPvminstancesActionPostParams { + return &PcloudPvminstancesActionPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesActionPostParamsWithTimeout creates a new PcloudPvminstancesActionPostParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesActionPostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesActionPostParams { + return &PcloudPvminstancesActionPostParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesActionPostParamsWithContext creates a new PcloudPvminstancesActionPostParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesActionPostParamsWithContext(ctx context.Context) *PcloudPvminstancesActionPostParams { + return &PcloudPvminstancesActionPostParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesActionPostParamsWithHTTPClient creates a new PcloudPvminstancesActionPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesActionPostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesActionPostParams { + return &PcloudPvminstancesActionPostParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesActionPostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances action post operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesActionPostParams struct { + + /* Body. + + Parameters for the desired action + */ + Body *models.PVMInstanceAction + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances action post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesActionPostParams) WithDefaults() *PcloudPvminstancesActionPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances action post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesActionPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances action post params +func (o *PcloudPvminstancesActionPostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesActionPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances action post params +func (o *PcloudPvminstancesActionPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances action post params +func (o *PcloudPvminstancesActionPostParams) WithContext(ctx context.Context) *PcloudPvminstancesActionPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances action post params +func (o *PcloudPvminstancesActionPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances action post params +func (o *PcloudPvminstancesActionPostParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesActionPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances action post params +func (o *PcloudPvminstancesActionPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud pvminstances action post params +func (o *PcloudPvminstancesActionPostParams) WithBody(body *models.PVMInstanceAction) *PcloudPvminstancesActionPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances action post params +func (o *PcloudPvminstancesActionPostParams) SetBody(body *models.PVMInstanceAction) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances action post params +func (o *PcloudPvminstancesActionPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesActionPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances action post params +func (o *PcloudPvminstancesActionPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances action post params +func (o *PcloudPvminstancesActionPostParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesActionPostParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances action post params +func (o *PcloudPvminstancesActionPostParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesActionPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_action_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_action_post_responses.go new file mode 100644 index 00000000000..3f0e3a3f825 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_action_post_responses.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesActionPostReader is a Reader for the PcloudPvminstancesActionPost structure. +type PcloudPvminstancesActionPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesActionPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesActionPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesActionPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesActionPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesActionPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesActionPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesActionPostOK creates a PcloudPvminstancesActionPostOK with default headers values +func NewPcloudPvminstancesActionPostOK() *PcloudPvminstancesActionPostOK { + return &PcloudPvminstancesActionPostOK{} +} + +/* PcloudPvminstancesActionPostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesActionPostOK struct { + Payload models.Object +} + +func (o *PcloudPvminstancesActionPostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/action][%d] pcloudPvminstancesActionPostOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesActionPostOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudPvminstancesActionPostOK) 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 +} + +// NewPcloudPvminstancesActionPostBadRequest creates a PcloudPvminstancesActionPostBadRequest with default headers values +func NewPcloudPvminstancesActionPostBadRequest() *PcloudPvminstancesActionPostBadRequest { + return &PcloudPvminstancesActionPostBadRequest{} +} + +/* PcloudPvminstancesActionPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesActionPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesActionPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/action][%d] pcloudPvminstancesActionPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesActionPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesActionPostBadRequest) 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 +} + +// NewPcloudPvminstancesActionPostUnauthorized creates a PcloudPvminstancesActionPostUnauthorized with default headers values +func NewPcloudPvminstancesActionPostUnauthorized() *PcloudPvminstancesActionPostUnauthorized { + return &PcloudPvminstancesActionPostUnauthorized{} +} + +/* PcloudPvminstancesActionPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesActionPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesActionPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/action][%d] pcloudPvminstancesActionPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesActionPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesActionPostUnauthorized) 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 +} + +// NewPcloudPvminstancesActionPostNotFound creates a PcloudPvminstancesActionPostNotFound with default headers values +func NewPcloudPvminstancesActionPostNotFound() *PcloudPvminstancesActionPostNotFound { + return &PcloudPvminstancesActionPostNotFound{} +} + +/* PcloudPvminstancesActionPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesActionPostNotFound struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesActionPostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/action][%d] pcloudPvminstancesActionPostNotFound %+v", 404, o.Payload) +} +func (o *PcloudPvminstancesActionPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesActionPostNotFound) 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 +} + +// NewPcloudPvminstancesActionPostInternalServerError creates a PcloudPvminstancesActionPostInternalServerError with default headers values +func NewPcloudPvminstancesActionPostInternalServerError() *PcloudPvminstancesActionPostInternalServerError { + return &PcloudPvminstancesActionPostInternalServerError{} +} + +/* PcloudPvminstancesActionPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesActionPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesActionPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/action][%d] pcloudPvminstancesActionPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesActionPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesActionPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_capture_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_capture_post_parameters.go new file mode 100644 index 00000000000..501695e66b3 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_capture_post_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesCapturePostParams creates a new PcloudPvminstancesCapturePostParams 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 NewPcloudPvminstancesCapturePostParams() *PcloudPvminstancesCapturePostParams { + return &PcloudPvminstancesCapturePostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesCapturePostParamsWithTimeout creates a new PcloudPvminstancesCapturePostParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesCapturePostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesCapturePostParams { + return &PcloudPvminstancesCapturePostParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesCapturePostParamsWithContext creates a new PcloudPvminstancesCapturePostParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesCapturePostParamsWithContext(ctx context.Context) *PcloudPvminstancesCapturePostParams { + return &PcloudPvminstancesCapturePostParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesCapturePostParamsWithHTTPClient creates a new PcloudPvminstancesCapturePostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesCapturePostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesCapturePostParams { + return &PcloudPvminstancesCapturePostParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesCapturePostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances capture post operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesCapturePostParams struct { + + /* Body. + + Parameters for the capture PVMInstance + */ + Body *models.PVMInstanceCapture + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances capture post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesCapturePostParams) WithDefaults() *PcloudPvminstancesCapturePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances capture post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesCapturePostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances capture post params +func (o *PcloudPvminstancesCapturePostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesCapturePostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances capture post params +func (o *PcloudPvminstancesCapturePostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances capture post params +func (o *PcloudPvminstancesCapturePostParams) WithContext(ctx context.Context) *PcloudPvminstancesCapturePostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances capture post params +func (o *PcloudPvminstancesCapturePostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances capture post params +func (o *PcloudPvminstancesCapturePostParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesCapturePostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances capture post params +func (o *PcloudPvminstancesCapturePostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud pvminstances capture post params +func (o *PcloudPvminstancesCapturePostParams) WithBody(body *models.PVMInstanceCapture) *PcloudPvminstancesCapturePostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances capture post params +func (o *PcloudPvminstancesCapturePostParams) SetBody(body *models.PVMInstanceCapture) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances capture post params +func (o *PcloudPvminstancesCapturePostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesCapturePostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances capture post params +func (o *PcloudPvminstancesCapturePostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances capture post params +func (o *PcloudPvminstancesCapturePostParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesCapturePostParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances capture post params +func (o *PcloudPvminstancesCapturePostParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesCapturePostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_capture_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_capture_post_responses.go new file mode 100644 index 00000000000..436187f56ac --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_capture_post_responses.go @@ -0,0 +1,253 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesCapturePostReader is a Reader for the PcloudPvminstancesCapturePost structure. +type PcloudPvminstancesCapturePostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesCapturePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesCapturePostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 202: + result := NewPcloudPvminstancesCapturePostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesCapturePostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesCapturePostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudPvminstancesCapturePostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesCapturePostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesCapturePostOK creates a PcloudPvminstancesCapturePostOK with default headers values +func NewPcloudPvminstancesCapturePostOK() *PcloudPvminstancesCapturePostOK { + return &PcloudPvminstancesCapturePostOK{} +} + +/* PcloudPvminstancesCapturePostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesCapturePostOK struct { + Payload models.Object +} + +func (o *PcloudPvminstancesCapturePostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudPvminstancesCapturePostOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesCapturePostOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudPvminstancesCapturePostOK) 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 +} + +// NewPcloudPvminstancesCapturePostAccepted creates a PcloudPvminstancesCapturePostAccepted with default headers values +func NewPcloudPvminstancesCapturePostAccepted() *PcloudPvminstancesCapturePostAccepted { + return &PcloudPvminstancesCapturePostAccepted{} +} + +/* PcloudPvminstancesCapturePostAccepted describes a response with status code 202, with default header values. + +Accepted, upload to cloud storage in progress +*/ +type PcloudPvminstancesCapturePostAccepted struct { + Payload models.Object +} + +func (o *PcloudPvminstancesCapturePostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudPvminstancesCapturePostAccepted %+v", 202, o.Payload) +} +func (o *PcloudPvminstancesCapturePostAccepted) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudPvminstancesCapturePostAccepted) 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 +} + +// NewPcloudPvminstancesCapturePostBadRequest creates a PcloudPvminstancesCapturePostBadRequest with default headers values +func NewPcloudPvminstancesCapturePostBadRequest() *PcloudPvminstancesCapturePostBadRequest { + return &PcloudPvminstancesCapturePostBadRequest{} +} + +/* PcloudPvminstancesCapturePostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesCapturePostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesCapturePostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudPvminstancesCapturePostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesCapturePostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesCapturePostBadRequest) 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 +} + +// NewPcloudPvminstancesCapturePostUnauthorized creates a PcloudPvminstancesCapturePostUnauthorized with default headers values +func NewPcloudPvminstancesCapturePostUnauthorized() *PcloudPvminstancesCapturePostUnauthorized { + return &PcloudPvminstancesCapturePostUnauthorized{} +} + +/* PcloudPvminstancesCapturePostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesCapturePostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesCapturePostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudPvminstancesCapturePostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesCapturePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesCapturePostUnauthorized) 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 +} + +// NewPcloudPvminstancesCapturePostUnprocessableEntity creates a PcloudPvminstancesCapturePostUnprocessableEntity with default headers values +func NewPcloudPvminstancesCapturePostUnprocessableEntity() *PcloudPvminstancesCapturePostUnprocessableEntity { + return &PcloudPvminstancesCapturePostUnprocessableEntity{} +} + +/* PcloudPvminstancesCapturePostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudPvminstancesCapturePostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesCapturePostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudPvminstancesCapturePostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudPvminstancesCapturePostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesCapturePostUnprocessableEntity) 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 +} + +// NewPcloudPvminstancesCapturePostInternalServerError creates a PcloudPvminstancesCapturePostInternalServerError with default headers values +func NewPcloudPvminstancesCapturePostInternalServerError() *PcloudPvminstancesCapturePostInternalServerError { + return &PcloudPvminstancesCapturePostInternalServerError{} +} + +/* PcloudPvminstancesCapturePostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesCapturePostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesCapturePostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudPvminstancesCapturePostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesCapturePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesCapturePostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_parameters.go new file mode 100644 index 00000000000..b51625f4cec --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesClonePostParams creates a new PcloudPvminstancesClonePostParams 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 NewPcloudPvminstancesClonePostParams() *PcloudPvminstancesClonePostParams { + return &PcloudPvminstancesClonePostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesClonePostParamsWithTimeout creates a new PcloudPvminstancesClonePostParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesClonePostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesClonePostParams { + return &PcloudPvminstancesClonePostParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesClonePostParamsWithContext creates a new PcloudPvminstancesClonePostParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesClonePostParamsWithContext(ctx context.Context) *PcloudPvminstancesClonePostParams { + return &PcloudPvminstancesClonePostParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesClonePostParamsWithHTTPClient creates a new PcloudPvminstancesClonePostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesClonePostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesClonePostParams { + return &PcloudPvminstancesClonePostParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesClonePostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances clone post operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesClonePostParams struct { + + /* Body. + + Clone PVM Instance parameters + */ + Body *models.PVMInstanceClone + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances clone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesClonePostParams) WithDefaults() *PcloudPvminstancesClonePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances clone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesClonePostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances clone post params +func (o *PcloudPvminstancesClonePostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesClonePostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances clone post params +func (o *PcloudPvminstancesClonePostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances clone post params +func (o *PcloudPvminstancesClonePostParams) WithContext(ctx context.Context) *PcloudPvminstancesClonePostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances clone post params +func (o *PcloudPvminstancesClonePostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances clone post params +func (o *PcloudPvminstancesClonePostParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesClonePostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances clone post params +func (o *PcloudPvminstancesClonePostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud pvminstances clone post params +func (o *PcloudPvminstancesClonePostParams) WithBody(body *models.PVMInstanceClone) *PcloudPvminstancesClonePostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances clone post params +func (o *PcloudPvminstancesClonePostParams) SetBody(body *models.PVMInstanceClone) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances clone post params +func (o *PcloudPvminstancesClonePostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesClonePostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances clone post params +func (o *PcloudPvminstancesClonePostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances clone post params +func (o *PcloudPvminstancesClonePostParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesClonePostParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances clone post params +func (o *PcloudPvminstancesClonePostParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesClonePostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_responses.go new file mode 100644 index 00000000000..4d4e0510a68 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_clone_post_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesClonePostReader is a Reader for the PcloudPvminstancesClonePost structure. +type PcloudPvminstancesClonePostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesClonePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudPvminstancesClonePostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesClonePostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesClonePostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudPvminstancesClonePostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudPvminstancesClonePostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesClonePostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesClonePostAccepted creates a PcloudPvminstancesClonePostAccepted with default headers values +func NewPcloudPvminstancesClonePostAccepted() *PcloudPvminstancesClonePostAccepted { + return &PcloudPvminstancesClonePostAccepted{} +} + +/* PcloudPvminstancesClonePostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudPvminstancesClonePostAccepted struct { + Payload *models.PVMInstance +} + +func (o *PcloudPvminstancesClonePostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostAccepted %+v", 202, o.Payload) +} +func (o *PcloudPvminstancesClonePostAccepted) GetPayload() *models.PVMInstance { + return o.Payload +} + +func (o *PcloudPvminstancesClonePostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PVMInstance) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesClonePostBadRequest creates a PcloudPvminstancesClonePostBadRequest with default headers values +func NewPcloudPvminstancesClonePostBadRequest() *PcloudPvminstancesClonePostBadRequest { + return &PcloudPvminstancesClonePostBadRequest{} +} + +/* PcloudPvminstancesClonePostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesClonePostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesClonePostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesClonePostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesClonePostBadRequest) 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 +} + +// NewPcloudPvminstancesClonePostUnauthorized creates a PcloudPvminstancesClonePostUnauthorized with default headers values +func NewPcloudPvminstancesClonePostUnauthorized() *PcloudPvminstancesClonePostUnauthorized { + return &PcloudPvminstancesClonePostUnauthorized{} +} + +/* PcloudPvminstancesClonePostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesClonePostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesClonePostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesClonePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesClonePostUnauthorized) 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 +} + +// NewPcloudPvminstancesClonePostConflict creates a PcloudPvminstancesClonePostConflict with default headers values +func NewPcloudPvminstancesClonePostConflict() *PcloudPvminstancesClonePostConflict { + return &PcloudPvminstancesClonePostConflict{} +} + +/* PcloudPvminstancesClonePostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudPvminstancesClonePostConflict struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesClonePostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostConflict %+v", 409, o.Payload) +} +func (o *PcloudPvminstancesClonePostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesClonePostConflict) 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 +} + +// NewPcloudPvminstancesClonePostUnprocessableEntity creates a PcloudPvminstancesClonePostUnprocessableEntity with default headers values +func NewPcloudPvminstancesClonePostUnprocessableEntity() *PcloudPvminstancesClonePostUnprocessableEntity { + return &PcloudPvminstancesClonePostUnprocessableEntity{} +} + +/* PcloudPvminstancesClonePostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudPvminstancesClonePostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesClonePostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudPvminstancesClonePostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesClonePostUnprocessableEntity) 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 +} + +// NewPcloudPvminstancesClonePostInternalServerError creates a PcloudPvminstancesClonePostInternalServerError with default headers values +func NewPcloudPvminstancesClonePostInternalServerError() *PcloudPvminstancesClonePostInternalServerError { + return &PcloudPvminstancesClonePostInternalServerError{} +} + +/* PcloudPvminstancesClonePostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesClonePostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesClonePostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/clone][%d] pcloudPvminstancesClonePostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesClonePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesClonePostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_get_parameters.go new file mode 100644 index 00000000000..80d994b2c28 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesConsoleGetParams creates a new PcloudPvminstancesConsoleGetParams 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 NewPcloudPvminstancesConsoleGetParams() *PcloudPvminstancesConsoleGetParams { + return &PcloudPvminstancesConsoleGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesConsoleGetParamsWithTimeout creates a new PcloudPvminstancesConsoleGetParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesConsoleGetParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesConsoleGetParams { + return &PcloudPvminstancesConsoleGetParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesConsoleGetParamsWithContext creates a new PcloudPvminstancesConsoleGetParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesConsoleGetParamsWithContext(ctx context.Context) *PcloudPvminstancesConsoleGetParams { + return &PcloudPvminstancesConsoleGetParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesConsoleGetParamsWithHTTPClient creates a new PcloudPvminstancesConsoleGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesConsoleGetParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesConsoleGetParams { + return &PcloudPvminstancesConsoleGetParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesConsoleGetParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances console get operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesConsoleGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances console get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesConsoleGetParams) WithDefaults() *PcloudPvminstancesConsoleGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances console get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesConsoleGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances console get params +func (o *PcloudPvminstancesConsoleGetParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesConsoleGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances console get params +func (o *PcloudPvminstancesConsoleGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances console get params +func (o *PcloudPvminstancesConsoleGetParams) WithContext(ctx context.Context) *PcloudPvminstancesConsoleGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances console get params +func (o *PcloudPvminstancesConsoleGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances console get params +func (o *PcloudPvminstancesConsoleGetParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesConsoleGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances console get params +func (o *PcloudPvminstancesConsoleGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances console get params +func (o *PcloudPvminstancesConsoleGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesConsoleGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances console get params +func (o *PcloudPvminstancesConsoleGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances console get params +func (o *PcloudPvminstancesConsoleGetParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesConsoleGetParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances console get params +func (o *PcloudPvminstancesConsoleGetParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesConsoleGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_get_responses.go new file mode 100644 index 00000000000..1caf34981c1 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_get_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesConsoleGetReader is a Reader for the PcloudPvminstancesConsoleGet structure. +type PcloudPvminstancesConsoleGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesConsoleGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesConsoleGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesConsoleGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesConsoleGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesConsoleGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesConsoleGetOK creates a PcloudPvminstancesConsoleGetOK with default headers values +func NewPcloudPvminstancesConsoleGetOK() *PcloudPvminstancesConsoleGetOK { + return &PcloudPvminstancesConsoleGetOK{} +} + +/* PcloudPvminstancesConsoleGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesConsoleGetOK struct { + Payload *models.ConsoleLanguages +} + +func (o *PcloudPvminstancesConsoleGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsoleGetOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesConsoleGetOK) GetPayload() *models.ConsoleLanguages { + return o.Payload +} + +func (o *PcloudPvminstancesConsoleGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ConsoleLanguages) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesConsoleGetBadRequest creates a PcloudPvminstancesConsoleGetBadRequest with default headers values +func NewPcloudPvminstancesConsoleGetBadRequest() *PcloudPvminstancesConsoleGetBadRequest { + return &PcloudPvminstancesConsoleGetBadRequest{} +} + +/* PcloudPvminstancesConsoleGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesConsoleGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesConsoleGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsoleGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesConsoleGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesConsoleGetBadRequest) 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 +} + +// NewPcloudPvminstancesConsoleGetUnauthorized creates a PcloudPvminstancesConsoleGetUnauthorized with default headers values +func NewPcloudPvminstancesConsoleGetUnauthorized() *PcloudPvminstancesConsoleGetUnauthorized { + return &PcloudPvminstancesConsoleGetUnauthorized{} +} + +/* PcloudPvminstancesConsoleGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesConsoleGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesConsoleGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsoleGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesConsoleGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesConsoleGetUnauthorized) 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 +} + +// NewPcloudPvminstancesConsoleGetInternalServerError creates a PcloudPvminstancesConsoleGetInternalServerError with default headers values +func NewPcloudPvminstancesConsoleGetInternalServerError() *PcloudPvminstancesConsoleGetInternalServerError { + return &PcloudPvminstancesConsoleGetInternalServerError{} +} + +/* PcloudPvminstancesConsoleGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesConsoleGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesConsoleGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsoleGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesConsoleGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesConsoleGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_post_parameters.go new file mode 100644 index 00000000000..86a27e66340 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_post_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesConsolePostParams creates a new PcloudPvminstancesConsolePostParams 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 NewPcloudPvminstancesConsolePostParams() *PcloudPvminstancesConsolePostParams { + return &PcloudPvminstancesConsolePostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesConsolePostParamsWithTimeout creates a new PcloudPvminstancesConsolePostParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesConsolePostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesConsolePostParams { + return &PcloudPvminstancesConsolePostParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesConsolePostParamsWithContext creates a new PcloudPvminstancesConsolePostParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesConsolePostParamsWithContext(ctx context.Context) *PcloudPvminstancesConsolePostParams { + return &PcloudPvminstancesConsolePostParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesConsolePostParamsWithHTTPClient creates a new PcloudPvminstancesConsolePostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesConsolePostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesConsolePostParams { + return &PcloudPvminstancesConsolePostParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesConsolePostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances console post operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesConsolePostParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances console post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesConsolePostParams) WithDefaults() *PcloudPvminstancesConsolePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances console post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesConsolePostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances console post params +func (o *PcloudPvminstancesConsolePostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesConsolePostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances console post params +func (o *PcloudPvminstancesConsolePostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances console post params +func (o *PcloudPvminstancesConsolePostParams) WithContext(ctx context.Context) *PcloudPvminstancesConsolePostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances console post params +func (o *PcloudPvminstancesConsolePostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances console post params +func (o *PcloudPvminstancesConsolePostParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesConsolePostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances console post params +func (o *PcloudPvminstancesConsolePostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances console post params +func (o *PcloudPvminstancesConsolePostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesConsolePostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances console post params +func (o *PcloudPvminstancesConsolePostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances console post params +func (o *PcloudPvminstancesConsolePostParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesConsolePostParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances console post params +func (o *PcloudPvminstancesConsolePostParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesConsolePostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_post_responses.go new file mode 100644 index 00000000000..590e7f5b1eb --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_post_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesConsolePostReader is a Reader for the PcloudPvminstancesConsolePost structure. +type PcloudPvminstancesConsolePostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesConsolePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 201: + result := NewPcloudPvminstancesConsolePostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPcloudPvminstancesConsolePostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudPvminstancesConsolePostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesConsolePostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesConsolePostCreated creates a PcloudPvminstancesConsolePostCreated with default headers values +func NewPcloudPvminstancesConsolePostCreated() *PcloudPvminstancesConsolePostCreated { + return &PcloudPvminstancesConsolePostCreated{} +} + +/* PcloudPvminstancesConsolePostCreated describes a response with status code 201, with default header values. + +Created +*/ +type PcloudPvminstancesConsolePostCreated struct { + Payload *models.PVMInstanceConsole +} + +func (o *PcloudPvminstancesConsolePostCreated) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePostCreated %+v", 201, o.Payload) +} +func (o *PcloudPvminstancesConsolePostCreated) GetPayload() *models.PVMInstanceConsole { + return o.Payload +} + +func (o *PcloudPvminstancesConsolePostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PVMInstanceConsole) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesConsolePostUnauthorized creates a PcloudPvminstancesConsolePostUnauthorized with default headers values +func NewPcloudPvminstancesConsolePostUnauthorized() *PcloudPvminstancesConsolePostUnauthorized { + return &PcloudPvminstancesConsolePostUnauthorized{} +} + +/* PcloudPvminstancesConsolePostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesConsolePostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesConsolePostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesConsolePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesConsolePostUnauthorized) 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 +} + +// NewPcloudPvminstancesConsolePostUnprocessableEntity creates a PcloudPvminstancesConsolePostUnprocessableEntity with default headers values +func NewPcloudPvminstancesConsolePostUnprocessableEntity() *PcloudPvminstancesConsolePostUnprocessableEntity { + return &PcloudPvminstancesConsolePostUnprocessableEntity{} +} + +/* PcloudPvminstancesConsolePostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudPvminstancesConsolePostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesConsolePostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudPvminstancesConsolePostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesConsolePostUnprocessableEntity) 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 +} + +// NewPcloudPvminstancesConsolePostInternalServerError creates a PcloudPvminstancesConsolePostInternalServerError with default headers values +func NewPcloudPvminstancesConsolePostInternalServerError() *PcloudPvminstancesConsolePostInternalServerError { + return &PcloudPvminstancesConsolePostInternalServerError{} +} + +/* PcloudPvminstancesConsolePostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesConsolePostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesConsolePostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesConsolePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesConsolePostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_put_parameters.go new file mode 100644 index 00000000000..a6f703784f5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_put_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesConsolePutParams creates a new PcloudPvminstancesConsolePutParams 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 NewPcloudPvminstancesConsolePutParams() *PcloudPvminstancesConsolePutParams { + return &PcloudPvminstancesConsolePutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesConsolePutParamsWithTimeout creates a new PcloudPvminstancesConsolePutParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesConsolePutParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesConsolePutParams { + return &PcloudPvminstancesConsolePutParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesConsolePutParamsWithContext creates a new PcloudPvminstancesConsolePutParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesConsolePutParamsWithContext(ctx context.Context) *PcloudPvminstancesConsolePutParams { + return &PcloudPvminstancesConsolePutParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesConsolePutParamsWithHTTPClient creates a new PcloudPvminstancesConsolePutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesConsolePutParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesConsolePutParams { + return &PcloudPvminstancesConsolePutParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesConsolePutParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances console put operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesConsolePutParams struct { + + /* Body. + + Parameters to update a PVMInstance console required codepage + */ + Body *models.ConsoleLanguage + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances console put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesConsolePutParams) WithDefaults() *PcloudPvminstancesConsolePutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances console put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesConsolePutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances console put params +func (o *PcloudPvminstancesConsolePutParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesConsolePutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances console put params +func (o *PcloudPvminstancesConsolePutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances console put params +func (o *PcloudPvminstancesConsolePutParams) WithContext(ctx context.Context) *PcloudPvminstancesConsolePutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances console put params +func (o *PcloudPvminstancesConsolePutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances console put params +func (o *PcloudPvminstancesConsolePutParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesConsolePutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances console put params +func (o *PcloudPvminstancesConsolePutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud pvminstances console put params +func (o *PcloudPvminstancesConsolePutParams) WithBody(body *models.ConsoleLanguage) *PcloudPvminstancesConsolePutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances console put params +func (o *PcloudPvminstancesConsolePutParams) SetBody(body *models.ConsoleLanguage) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances console put params +func (o *PcloudPvminstancesConsolePutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesConsolePutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances console put params +func (o *PcloudPvminstancesConsolePutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances console put params +func (o *PcloudPvminstancesConsolePutParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesConsolePutParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances console put params +func (o *PcloudPvminstancesConsolePutParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesConsolePutParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_put_responses.go new file mode 100644 index 00000000000..c3331bef565 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_console_put_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesConsolePutReader is a Reader for the PcloudPvminstancesConsolePut structure. +type PcloudPvminstancesConsolePutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesConsolePutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesConsolePutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesConsolePutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesConsolePutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesConsolePutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesConsolePutOK creates a PcloudPvminstancesConsolePutOK with default headers values +func NewPcloudPvminstancesConsolePutOK() *PcloudPvminstancesConsolePutOK { + return &PcloudPvminstancesConsolePutOK{} +} + +/* PcloudPvminstancesConsolePutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesConsolePutOK struct { + Payload *models.ConsoleLanguage +} + +func (o *PcloudPvminstancesConsolePutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePutOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesConsolePutOK) GetPayload() *models.ConsoleLanguage { + return o.Payload +} + +func (o *PcloudPvminstancesConsolePutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ConsoleLanguage) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesConsolePutBadRequest creates a PcloudPvminstancesConsolePutBadRequest with default headers values +func NewPcloudPvminstancesConsolePutBadRequest() *PcloudPvminstancesConsolePutBadRequest { + return &PcloudPvminstancesConsolePutBadRequest{} +} + +/* PcloudPvminstancesConsolePutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesConsolePutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesConsolePutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesConsolePutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesConsolePutBadRequest) 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 +} + +// NewPcloudPvminstancesConsolePutUnauthorized creates a PcloudPvminstancesConsolePutUnauthorized with default headers values +func NewPcloudPvminstancesConsolePutUnauthorized() *PcloudPvminstancesConsolePutUnauthorized { + return &PcloudPvminstancesConsolePutUnauthorized{} +} + +/* PcloudPvminstancesConsolePutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesConsolePutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesConsolePutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesConsolePutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesConsolePutUnauthorized) 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 +} + +// NewPcloudPvminstancesConsolePutInternalServerError creates a PcloudPvminstancesConsolePutInternalServerError with default headers values +func NewPcloudPvminstancesConsolePutInternalServerError() *PcloudPvminstancesConsolePutInternalServerError { + return &PcloudPvminstancesConsolePutInternalServerError{} +} + +/* PcloudPvminstancesConsolePutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesConsolePutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesConsolePutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/console][%d] pcloudPvminstancesConsolePutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesConsolePutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesConsolePutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_parameters.go new file mode 100644 index 00000000000..8c369a0106d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_parameters.go @@ -0,0 +1,206 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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/go-openapi/swag" +) + +// NewPcloudPvminstancesDeleteParams creates a new PcloudPvminstancesDeleteParams 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 NewPcloudPvminstancesDeleteParams() *PcloudPvminstancesDeleteParams { + return &PcloudPvminstancesDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesDeleteParamsWithTimeout creates a new PcloudPvminstancesDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesDeleteParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesDeleteParams { + return &PcloudPvminstancesDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesDeleteParamsWithContext creates a new PcloudPvminstancesDeleteParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesDeleteParamsWithContext(ctx context.Context) *PcloudPvminstancesDeleteParams { + return &PcloudPvminstancesDeleteParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesDeleteParamsWithHTTPClient creates a new PcloudPvminstancesDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesDeleteParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesDeleteParams { + return &PcloudPvminstancesDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesDeleteParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesDeleteParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* DeleteDataVolumes. + + Indicates if all data volumes attached to the PVMInstance should be deleted when deleting the PVMInstance. Shared data volumes will be deleted if there are no other PVMInstances attached. + */ + DeleteDataVolumes *bool + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesDeleteParams) WithDefaults() *PcloudPvminstancesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances delete params +func (o *PcloudPvminstancesDeleteParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances delete params +func (o *PcloudPvminstancesDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances delete params +func (o *PcloudPvminstancesDeleteParams) WithContext(ctx context.Context) *PcloudPvminstancesDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances delete params +func (o *PcloudPvminstancesDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances delete params +func (o *PcloudPvminstancesDeleteParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances delete params +func (o *PcloudPvminstancesDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances delete params +func (o *PcloudPvminstancesDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances delete params +func (o *PcloudPvminstancesDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithDeleteDataVolumes adds the deleteDataVolumes to the pcloud pvminstances delete params +func (o *PcloudPvminstancesDeleteParams) WithDeleteDataVolumes(deleteDataVolumes *bool) *PcloudPvminstancesDeleteParams { + o.SetDeleteDataVolumes(deleteDataVolumes) + return o +} + +// SetDeleteDataVolumes adds the deleteDataVolumes to the pcloud pvminstances delete params +func (o *PcloudPvminstancesDeleteParams) SetDeleteDataVolumes(deleteDataVolumes *bool) { + o.DeleteDataVolumes = deleteDataVolumes +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances delete params +func (o *PcloudPvminstancesDeleteParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesDeleteParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances delete params +func (o *PcloudPvminstancesDeleteParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if o.DeleteDataVolumes != nil { + + // query param delete_data_volumes + var qrDeleteDataVolumes bool + + if o.DeleteDataVolumes != nil { + qrDeleteDataVolumes = *o.DeleteDataVolumes + } + qDeleteDataVolumes := swag.FormatBool(qrDeleteDataVolumes) + if qDeleteDataVolumes != "" { + + if err := r.SetQueryParam("delete_data_volumes", qDeleteDataVolumes); err != nil { + return err + } + } + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_responses.go new file mode 100644 index 00000000000..18189dcdeb9 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_delete_responses.go @@ -0,0 +1,255 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesDeleteReader is a Reader for the PcloudPvminstancesDelete structure. +type PcloudPvminstancesDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewPcloudPvminstancesDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesDeleteOK creates a PcloudPvminstancesDeleteOK with default headers values +func NewPcloudPvminstancesDeleteOK() *PcloudPvminstancesDeleteOK { + return &PcloudPvminstancesDeleteOK{} +} + +/* PcloudPvminstancesDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesDeleteOK struct { + Payload models.Object +} + +func (o *PcloudPvminstancesDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudPvminstancesDeleteOK) 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 +} + +// NewPcloudPvminstancesDeleteBadRequest creates a PcloudPvminstancesDeleteBadRequest with default headers values +func NewPcloudPvminstancesDeleteBadRequest() *PcloudPvminstancesDeleteBadRequest { + return &PcloudPvminstancesDeleteBadRequest{} +} + +/* PcloudPvminstancesDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesDeleteBadRequest) 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 +} + +// NewPcloudPvminstancesDeleteUnauthorized creates a PcloudPvminstancesDeleteUnauthorized with default headers values +func NewPcloudPvminstancesDeleteUnauthorized() *PcloudPvminstancesDeleteUnauthorized { + return &PcloudPvminstancesDeleteUnauthorized{} +} + +/* PcloudPvminstancesDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesDeleteUnauthorized) 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 +} + +// NewPcloudPvminstancesDeleteNotFound creates a PcloudPvminstancesDeleteNotFound with default headers values +func NewPcloudPvminstancesDeleteNotFound() *PcloudPvminstancesDeleteNotFound { + return &PcloudPvminstancesDeleteNotFound{} +} + +/* PcloudPvminstancesDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesDeleteNotFound struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesDeleteNotFound %+v", 404, o.Payload) +} +func (o *PcloudPvminstancesDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesDeleteNotFound) 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 +} + +// NewPcloudPvminstancesDeleteGone creates a PcloudPvminstancesDeleteGone with default headers values +func NewPcloudPvminstancesDeleteGone() *PcloudPvminstancesDeleteGone { + return &PcloudPvminstancesDeleteGone{} +} + +/* PcloudPvminstancesDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudPvminstancesDeleteGone struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesDeleteGone) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesDeleteGone %+v", 410, o.Payload) +} +func (o *PcloudPvminstancesDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesDeleteGone) 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 +} + +// NewPcloudPvminstancesDeleteInternalServerError creates a PcloudPvminstancesDeleteInternalServerError with default headers values +func NewPcloudPvminstancesDeleteInternalServerError() *PcloudPvminstancesDeleteInternalServerError { + return &PcloudPvminstancesDeleteInternalServerError{} +} + +/* PcloudPvminstancesDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_get_parameters.go new file mode 100644 index 00000000000..ebbc6f4a779 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesGetParams creates a new PcloudPvminstancesGetParams 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 NewPcloudPvminstancesGetParams() *PcloudPvminstancesGetParams { + return &PcloudPvminstancesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesGetParamsWithTimeout creates a new PcloudPvminstancesGetParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesGetParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesGetParams { + return &PcloudPvminstancesGetParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesGetParamsWithContext creates a new PcloudPvminstancesGetParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesGetParamsWithContext(ctx context.Context) *PcloudPvminstancesGetParams { + return &PcloudPvminstancesGetParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesGetParamsWithHTTPClient creates a new PcloudPvminstancesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesGetParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesGetParams { + return &PcloudPvminstancesGetParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesGetParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances get operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesGetParams) WithDefaults() *PcloudPvminstancesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances get params +func (o *PcloudPvminstancesGetParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances get params +func (o *PcloudPvminstancesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances get params +func (o *PcloudPvminstancesGetParams) WithContext(ctx context.Context) *PcloudPvminstancesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances get params +func (o *PcloudPvminstancesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances get params +func (o *PcloudPvminstancesGetParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances get params +func (o *PcloudPvminstancesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances get params +func (o *PcloudPvminstancesGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances get params +func (o *PcloudPvminstancesGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances get params +func (o *PcloudPvminstancesGetParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesGetParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances get params +func (o *PcloudPvminstancesGetParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_get_responses.go new file mode 100644 index 00000000000..ddd375ee49b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesGetReader is a Reader for the PcloudPvminstancesGet structure. +type PcloudPvminstancesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesGetOK creates a PcloudPvminstancesGetOK with default headers values +func NewPcloudPvminstancesGetOK() *PcloudPvminstancesGetOK { + return &PcloudPvminstancesGetOK{} +} + +/* PcloudPvminstancesGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesGetOK struct { + Payload *models.PVMInstance +} + +func (o *PcloudPvminstancesGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesGetOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesGetOK) GetPayload() *models.PVMInstance { + return o.Payload +} + +func (o *PcloudPvminstancesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PVMInstance) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesGetBadRequest creates a PcloudPvminstancesGetBadRequest with default headers values +func NewPcloudPvminstancesGetBadRequest() *PcloudPvminstancesGetBadRequest { + return &PcloudPvminstancesGetBadRequest{} +} + +/* PcloudPvminstancesGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesGetBadRequest) 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 +} + +// NewPcloudPvminstancesGetUnauthorized creates a PcloudPvminstancesGetUnauthorized with default headers values +func NewPcloudPvminstancesGetUnauthorized() *PcloudPvminstancesGetUnauthorized { + return &PcloudPvminstancesGetUnauthorized{} +} + +/* PcloudPvminstancesGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesGetUnauthorized) 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 +} + +// NewPcloudPvminstancesGetNotFound creates a PcloudPvminstancesGetNotFound with default headers values +func NewPcloudPvminstancesGetNotFound() *PcloudPvminstancesGetNotFound { + return &PcloudPvminstancesGetNotFound{} +} + +/* PcloudPvminstancesGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudPvminstancesGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesGetNotFound) 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 +} + +// NewPcloudPvminstancesGetInternalServerError creates a PcloudPvminstancesGetInternalServerError with default headers values +func NewPcloudPvminstancesGetInternalServerError() *PcloudPvminstancesGetInternalServerError { + return &PcloudPvminstancesGetInternalServerError{} +} + +/* PcloudPvminstancesGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_getall_parameters.go new file mode 100644 index 00000000000..88205d338e5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_getall_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesGetallParams creates a new PcloudPvminstancesGetallParams 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 NewPcloudPvminstancesGetallParams() *PcloudPvminstancesGetallParams { + return &PcloudPvminstancesGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesGetallParamsWithTimeout creates a new PcloudPvminstancesGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesGetallParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesGetallParams { + return &PcloudPvminstancesGetallParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesGetallParamsWithContext creates a new PcloudPvminstancesGetallParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesGetallParamsWithContext(ctx context.Context) *PcloudPvminstancesGetallParams { + return &PcloudPvminstancesGetallParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesGetallParamsWithHTTPClient creates a new PcloudPvminstancesGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesGetallParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesGetallParams { + return &PcloudPvminstancesGetallParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesGetallParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesGetallParams) WithDefaults() *PcloudPvminstancesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances getall params +func (o *PcloudPvminstancesGetallParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances getall params +func (o *PcloudPvminstancesGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances getall params +func (o *PcloudPvminstancesGetallParams) WithContext(ctx context.Context) *PcloudPvminstancesGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances getall params +func (o *PcloudPvminstancesGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances getall params +func (o *PcloudPvminstancesGetallParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances getall params +func (o *PcloudPvminstancesGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances getall params +func (o *PcloudPvminstancesGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances getall params +func (o *PcloudPvminstancesGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_getall_responses.go new file mode 100644 index 00000000000..f55d76239f3 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_getall_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesGetallReader is a Reader for the PcloudPvminstancesGetall structure. +type PcloudPvminstancesGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesGetallOK creates a PcloudPvminstancesGetallOK with default headers values +func NewPcloudPvminstancesGetallOK() *PcloudPvminstancesGetallOK { + return &PcloudPvminstancesGetallOK{} +} + +/* PcloudPvminstancesGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesGetallOK struct { + Payload *models.PVMInstances +} + +func (o *PcloudPvminstancesGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesGetallOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesGetallOK) GetPayload() *models.PVMInstances { + return o.Payload +} + +func (o *PcloudPvminstancesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PVMInstances) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesGetallBadRequest creates a PcloudPvminstancesGetallBadRequest with default headers values +func NewPcloudPvminstancesGetallBadRequest() *PcloudPvminstancesGetallBadRequest { + return &PcloudPvminstancesGetallBadRequest{} +} + +/* PcloudPvminstancesGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesGetallBadRequest) 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 +} + +// NewPcloudPvminstancesGetallUnauthorized creates a PcloudPvminstancesGetallUnauthorized with default headers values +func NewPcloudPvminstancesGetallUnauthorized() *PcloudPvminstancesGetallUnauthorized { + return &PcloudPvminstancesGetallUnauthorized{} +} + +/* PcloudPvminstancesGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesGetallUnauthorized) 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 +} + +// NewPcloudPvminstancesGetallInternalServerError creates a PcloudPvminstancesGetallInternalServerError with default headers values +func NewPcloudPvminstancesGetallInternalServerError() *PcloudPvminstancesGetallInternalServerError { + return &PcloudPvminstancesGetallInternalServerError{} +} + +/* PcloudPvminstancesGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_delete_parameters.go new file mode 100644 index 00000000000..5b6b0ee46c5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_delete_parameters.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesNetworksDeleteParams creates a new PcloudPvminstancesNetworksDeleteParams 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 NewPcloudPvminstancesNetworksDeleteParams() *PcloudPvminstancesNetworksDeleteParams { + return &PcloudPvminstancesNetworksDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesNetworksDeleteParamsWithTimeout creates a new PcloudPvminstancesNetworksDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesNetworksDeleteParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksDeleteParams { + return &PcloudPvminstancesNetworksDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesNetworksDeleteParamsWithContext creates a new PcloudPvminstancesNetworksDeleteParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesNetworksDeleteParamsWithContext(ctx context.Context) *PcloudPvminstancesNetworksDeleteParams { + return &PcloudPvminstancesNetworksDeleteParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesNetworksDeleteParamsWithHTTPClient creates a new PcloudPvminstancesNetworksDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesNetworksDeleteParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesNetworksDeleteParams { + return &PcloudPvminstancesNetworksDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesNetworksDeleteParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances networks delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesNetworksDeleteParams struct { + + /* Body. + + Remove a network from PVM Instance parameters + */ + Body *models.PVMInstanceRemoveNetwork + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* NetworkID. + + Network ID + */ + NetworkID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksDeleteParams) WithDefaults() *PcloudPvminstancesNetworksDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances networks delete params +func (o *PcloudPvminstancesNetworksDeleteParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances networks delete params +func (o *PcloudPvminstancesNetworksDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances networks delete params +func (o *PcloudPvminstancesNetworksDeleteParams) WithContext(ctx context.Context) *PcloudPvminstancesNetworksDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances networks delete params +func (o *PcloudPvminstancesNetworksDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances networks delete params +func (o *PcloudPvminstancesNetworksDeleteParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesNetworksDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances networks delete params +func (o *PcloudPvminstancesNetworksDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud pvminstances networks delete params +func (o *PcloudPvminstancesNetworksDeleteParams) WithBody(body *models.PVMInstanceRemoveNetwork) *PcloudPvminstancesNetworksDeleteParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances networks delete params +func (o *PcloudPvminstancesNetworksDeleteParams) SetBody(body *models.PVMInstanceRemoveNetwork) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances networks delete params +func (o *PcloudPvminstancesNetworksDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesNetworksDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances networks delete params +func (o *PcloudPvminstancesNetworksDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithNetworkID adds the networkID to the pcloud pvminstances networks delete params +func (o *PcloudPvminstancesNetworksDeleteParams) WithNetworkID(networkID string) *PcloudPvminstancesNetworksDeleteParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the pcloud pvminstances networks delete params +func (o *PcloudPvminstancesNetworksDeleteParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances networks delete params +func (o *PcloudPvminstancesNetworksDeleteParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesNetworksDeleteParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances networks delete params +func (o *PcloudPvminstancesNetworksDeleteParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesNetworksDeleteParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_delete_responses.go new file mode 100644 index 00000000000..e3ce9d7eae7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_delete_responses.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesNetworksDeleteReader is a Reader for the PcloudPvminstancesNetworksDelete structure. +type PcloudPvminstancesNetworksDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesNetworksDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesNetworksDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesNetworksDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesNetworksDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewPcloudPvminstancesNetworksDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesNetworksDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesNetworksDeleteOK creates a PcloudPvminstancesNetworksDeleteOK with default headers values +func NewPcloudPvminstancesNetworksDeleteOK() *PcloudPvminstancesNetworksDeleteOK { + return &PcloudPvminstancesNetworksDeleteOK{} +} + +/* PcloudPvminstancesNetworksDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesNetworksDeleteOK struct { + Payload models.Object +} + +func (o *PcloudPvminstancesNetworksDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesNetworksDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksDeleteOK) 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 +} + +// NewPcloudPvminstancesNetworksDeleteBadRequest creates a PcloudPvminstancesNetworksDeleteBadRequest with default headers values +func NewPcloudPvminstancesNetworksDeleteBadRequest() *PcloudPvminstancesNetworksDeleteBadRequest { + return &PcloudPvminstancesNetworksDeleteBadRequest{} +} + +/* PcloudPvminstancesNetworksDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesNetworksDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesNetworksDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesNetworksDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksDeleteBadRequest) 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 +} + +// NewPcloudPvminstancesNetworksDeleteUnauthorized creates a PcloudPvminstancesNetworksDeleteUnauthorized with default headers values +func NewPcloudPvminstancesNetworksDeleteUnauthorized() *PcloudPvminstancesNetworksDeleteUnauthorized { + return &PcloudPvminstancesNetworksDeleteUnauthorized{} +} + +/* PcloudPvminstancesNetworksDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesNetworksDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesNetworksDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesNetworksDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksDeleteUnauthorized) 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 +} + +// NewPcloudPvminstancesNetworksDeleteGone creates a PcloudPvminstancesNetworksDeleteGone with default headers values +func NewPcloudPvminstancesNetworksDeleteGone() *PcloudPvminstancesNetworksDeleteGone { + return &PcloudPvminstancesNetworksDeleteGone{} +} + +/* PcloudPvminstancesNetworksDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudPvminstancesNetworksDeleteGone struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesNetworksDeleteGone) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksDeleteGone %+v", 410, o.Payload) +} +func (o *PcloudPvminstancesNetworksDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksDeleteGone) 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 +} + +// NewPcloudPvminstancesNetworksDeleteInternalServerError creates a PcloudPvminstancesNetworksDeleteInternalServerError with default headers values +func NewPcloudPvminstancesNetworksDeleteInternalServerError() *PcloudPvminstancesNetworksDeleteInternalServerError { + return &PcloudPvminstancesNetworksDeleteInternalServerError{} +} + +/* PcloudPvminstancesNetworksDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesNetworksDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesNetworksDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesNetworksDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_get_parameters.go new file mode 100644 index 00000000000..c9a444ef56d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_get_parameters.go @@ -0,0 +1,193 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesNetworksGetParams creates a new PcloudPvminstancesNetworksGetParams 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 NewPcloudPvminstancesNetworksGetParams() *PcloudPvminstancesNetworksGetParams { + return &PcloudPvminstancesNetworksGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesNetworksGetParamsWithTimeout creates a new PcloudPvminstancesNetworksGetParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesNetworksGetParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksGetParams { + return &PcloudPvminstancesNetworksGetParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesNetworksGetParamsWithContext creates a new PcloudPvminstancesNetworksGetParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesNetworksGetParamsWithContext(ctx context.Context) *PcloudPvminstancesNetworksGetParams { + return &PcloudPvminstancesNetworksGetParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesNetworksGetParamsWithHTTPClient creates a new PcloudPvminstancesNetworksGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesNetworksGetParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesNetworksGetParams { + return &PcloudPvminstancesNetworksGetParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesNetworksGetParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances networks get operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesNetworksGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* NetworkID. + + Network ID + */ + NetworkID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances networks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksGetParams) WithDefaults() *PcloudPvminstancesNetworksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances networks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances networks get params +func (o *PcloudPvminstancesNetworksGetParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances networks get params +func (o *PcloudPvminstancesNetworksGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances networks get params +func (o *PcloudPvminstancesNetworksGetParams) WithContext(ctx context.Context) *PcloudPvminstancesNetworksGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances networks get params +func (o *PcloudPvminstancesNetworksGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances networks get params +func (o *PcloudPvminstancesNetworksGetParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesNetworksGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances networks get params +func (o *PcloudPvminstancesNetworksGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances networks get params +func (o *PcloudPvminstancesNetworksGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesNetworksGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances networks get params +func (o *PcloudPvminstancesNetworksGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithNetworkID adds the networkID to the pcloud pvminstances networks get params +func (o *PcloudPvminstancesNetworksGetParams) WithNetworkID(networkID string) *PcloudPvminstancesNetworksGetParams { + o.SetNetworkID(networkID) + return o +} + +// SetNetworkID adds the networkId to the pcloud pvminstances networks get params +func (o *PcloudPvminstancesNetworksGetParams) SetNetworkID(networkID string) { + o.NetworkID = networkID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances networks get params +func (o *PcloudPvminstancesNetworksGetParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesNetworksGetParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances networks get params +func (o *PcloudPvminstancesNetworksGetParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesNetworksGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param network_id + if err := r.SetPathParam("network_id", o.NetworkID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_get_responses.go new file mode 100644 index 00000000000..1587866e424 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_get_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesNetworksGetReader is a Reader for the PcloudPvminstancesNetworksGet structure. +type PcloudPvminstancesNetworksGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesNetworksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesNetworksGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPcloudPvminstancesNetworksGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesNetworksGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesNetworksGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesNetworksGetOK creates a PcloudPvminstancesNetworksGetOK with default headers values +func NewPcloudPvminstancesNetworksGetOK() *PcloudPvminstancesNetworksGetOK { + return &PcloudPvminstancesNetworksGetOK{} +} + +/* PcloudPvminstancesNetworksGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesNetworksGetOK struct { + Payload *models.PVMInstanceNetworks +} + +func (o *PcloudPvminstancesNetworksGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksGetOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesNetworksGetOK) GetPayload() *models.PVMInstanceNetworks { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PVMInstanceNetworks) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesNetworksGetUnauthorized creates a PcloudPvminstancesNetworksGetUnauthorized with default headers values +func NewPcloudPvminstancesNetworksGetUnauthorized() *PcloudPvminstancesNetworksGetUnauthorized { + return &PcloudPvminstancesNetworksGetUnauthorized{} +} + +/* PcloudPvminstancesNetworksGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesNetworksGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesNetworksGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesNetworksGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksGetUnauthorized) 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 +} + +// NewPcloudPvminstancesNetworksGetNotFound creates a PcloudPvminstancesNetworksGetNotFound with default headers values +func NewPcloudPvminstancesNetworksGetNotFound() *PcloudPvminstancesNetworksGetNotFound { + return &PcloudPvminstancesNetworksGetNotFound{} +} + +/* PcloudPvminstancesNetworksGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesNetworksGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesNetworksGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudPvminstancesNetworksGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksGetNotFound) 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 +} + +// NewPcloudPvminstancesNetworksGetInternalServerError creates a PcloudPvminstancesNetworksGetInternalServerError with default headers values +func NewPcloudPvminstancesNetworksGetInternalServerError() *PcloudPvminstancesNetworksGetInternalServerError { + return &PcloudPvminstancesNetworksGetInternalServerError{} +} + +/* PcloudPvminstancesNetworksGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesNetworksGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesNetworksGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks/{network_id}][%d] pcloudPvminstancesNetworksGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesNetworksGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_getall_parameters.go new file mode 100644 index 00000000000..97fe7898ddb --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_getall_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesNetworksGetallParams creates a new PcloudPvminstancesNetworksGetallParams 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 NewPcloudPvminstancesNetworksGetallParams() *PcloudPvminstancesNetworksGetallParams { + return &PcloudPvminstancesNetworksGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesNetworksGetallParamsWithTimeout creates a new PcloudPvminstancesNetworksGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesNetworksGetallParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksGetallParams { + return &PcloudPvminstancesNetworksGetallParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesNetworksGetallParamsWithContext creates a new PcloudPvminstancesNetworksGetallParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesNetworksGetallParamsWithContext(ctx context.Context) *PcloudPvminstancesNetworksGetallParams { + return &PcloudPvminstancesNetworksGetallParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesNetworksGetallParamsWithHTTPClient creates a new PcloudPvminstancesNetworksGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesNetworksGetallParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesNetworksGetallParams { + return &PcloudPvminstancesNetworksGetallParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesNetworksGetallParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances networks getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesNetworksGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances networks getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksGetallParams) WithDefaults() *PcloudPvminstancesNetworksGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances networks getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances networks getall params +func (o *PcloudPvminstancesNetworksGetallParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances networks getall params +func (o *PcloudPvminstancesNetworksGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances networks getall params +func (o *PcloudPvminstancesNetworksGetallParams) WithContext(ctx context.Context) *PcloudPvminstancesNetworksGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances networks getall params +func (o *PcloudPvminstancesNetworksGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances networks getall params +func (o *PcloudPvminstancesNetworksGetallParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesNetworksGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances networks getall params +func (o *PcloudPvminstancesNetworksGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances networks getall params +func (o *PcloudPvminstancesNetworksGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesNetworksGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances networks getall params +func (o *PcloudPvminstancesNetworksGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances networks getall params +func (o *PcloudPvminstancesNetworksGetallParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesNetworksGetallParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances networks getall params +func (o *PcloudPvminstancesNetworksGetallParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesNetworksGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_getall_responses.go new file mode 100644 index 00000000000..79103867be2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_getall_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesNetworksGetallReader is a Reader for the PcloudPvminstancesNetworksGetall structure. +type PcloudPvminstancesNetworksGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesNetworksGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesNetworksGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesNetworksGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesNetworksGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesNetworksGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesNetworksGetallOK creates a PcloudPvminstancesNetworksGetallOK with default headers values +func NewPcloudPvminstancesNetworksGetallOK() *PcloudPvminstancesNetworksGetallOK { + return &PcloudPvminstancesNetworksGetallOK{} +} + +/* PcloudPvminstancesNetworksGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesNetworksGetallOK struct { + Payload *models.PVMInstanceNetworks +} + +func (o *PcloudPvminstancesNetworksGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksGetallOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesNetworksGetallOK) GetPayload() *models.PVMInstanceNetworks { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PVMInstanceNetworks) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesNetworksGetallBadRequest creates a PcloudPvminstancesNetworksGetallBadRequest with default headers values +func NewPcloudPvminstancesNetworksGetallBadRequest() *PcloudPvminstancesNetworksGetallBadRequest { + return &PcloudPvminstancesNetworksGetallBadRequest{} +} + +/* PcloudPvminstancesNetworksGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesNetworksGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesNetworksGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesNetworksGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksGetallBadRequest) 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 +} + +// NewPcloudPvminstancesNetworksGetallUnauthorized creates a PcloudPvminstancesNetworksGetallUnauthorized with default headers values +func NewPcloudPvminstancesNetworksGetallUnauthorized() *PcloudPvminstancesNetworksGetallUnauthorized { + return &PcloudPvminstancesNetworksGetallUnauthorized{} +} + +/* PcloudPvminstancesNetworksGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesNetworksGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesNetworksGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesNetworksGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksGetallUnauthorized) 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 +} + +// NewPcloudPvminstancesNetworksGetallInternalServerError creates a PcloudPvminstancesNetworksGetallInternalServerError with default headers values +func NewPcloudPvminstancesNetworksGetallInternalServerError() *PcloudPvminstancesNetworksGetallInternalServerError { + return &PcloudPvminstancesNetworksGetallInternalServerError{} +} + +/* PcloudPvminstancesNetworksGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesNetworksGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesNetworksGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesNetworksGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_post_parameters.go new file mode 100644 index 00000000000..23c0b0d4828 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_post_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesNetworksPostParams creates a new PcloudPvminstancesNetworksPostParams 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 NewPcloudPvminstancesNetworksPostParams() *PcloudPvminstancesNetworksPostParams { + return &PcloudPvminstancesNetworksPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesNetworksPostParamsWithTimeout creates a new PcloudPvminstancesNetworksPostParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesNetworksPostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksPostParams { + return &PcloudPvminstancesNetworksPostParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesNetworksPostParamsWithContext creates a new PcloudPvminstancesNetworksPostParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesNetworksPostParamsWithContext(ctx context.Context) *PcloudPvminstancesNetworksPostParams { + return &PcloudPvminstancesNetworksPostParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesNetworksPostParamsWithHTTPClient creates a new PcloudPvminstancesNetworksPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesNetworksPostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesNetworksPostParams { + return &PcloudPvminstancesNetworksPostParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesNetworksPostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances networks post operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesNetworksPostParams struct { + + /* Body. + + Add network to PVM Instance parameters + */ + Body *models.PVMInstanceAddNetwork + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances networks post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksPostParams) WithDefaults() *PcloudPvminstancesNetworksPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances networks post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesNetworksPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances networks post params +func (o *PcloudPvminstancesNetworksPostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesNetworksPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances networks post params +func (o *PcloudPvminstancesNetworksPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances networks post params +func (o *PcloudPvminstancesNetworksPostParams) WithContext(ctx context.Context) *PcloudPvminstancesNetworksPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances networks post params +func (o *PcloudPvminstancesNetworksPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances networks post params +func (o *PcloudPvminstancesNetworksPostParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesNetworksPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances networks post params +func (o *PcloudPvminstancesNetworksPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud pvminstances networks post params +func (o *PcloudPvminstancesNetworksPostParams) WithBody(body *models.PVMInstanceAddNetwork) *PcloudPvminstancesNetworksPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances networks post params +func (o *PcloudPvminstancesNetworksPostParams) SetBody(body *models.PVMInstanceAddNetwork) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances networks post params +func (o *PcloudPvminstancesNetworksPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesNetworksPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances networks post params +func (o *PcloudPvminstancesNetworksPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances networks post params +func (o *PcloudPvminstancesNetworksPostParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesNetworksPostParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances networks post params +func (o *PcloudPvminstancesNetworksPostParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesNetworksPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_post_responses.go new file mode 100644 index 00000000000..4bd3ed07c33 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_networks_post_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesNetworksPostReader is a Reader for the PcloudPvminstancesNetworksPost structure. +type PcloudPvminstancesNetworksPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesNetworksPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 201: + result := NewPcloudPvminstancesNetworksPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesNetworksPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesNetworksPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudPvminstancesNetworksPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudPvminstancesNetworksPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesNetworksPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesNetworksPostCreated creates a PcloudPvminstancesNetworksPostCreated with default headers values +func NewPcloudPvminstancesNetworksPostCreated() *PcloudPvminstancesNetworksPostCreated { + return &PcloudPvminstancesNetworksPostCreated{} +} + +/* PcloudPvminstancesNetworksPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type PcloudPvminstancesNetworksPostCreated struct { + Payload *models.PVMInstanceNetwork +} + +func (o *PcloudPvminstancesNetworksPostCreated) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksPostCreated %+v", 201, o.Payload) +} +func (o *PcloudPvminstancesNetworksPostCreated) GetPayload() *models.PVMInstanceNetwork { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PVMInstanceNetwork) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesNetworksPostBadRequest creates a PcloudPvminstancesNetworksPostBadRequest with default headers values +func NewPcloudPvminstancesNetworksPostBadRequest() *PcloudPvminstancesNetworksPostBadRequest { + return &PcloudPvminstancesNetworksPostBadRequest{} +} + +/* PcloudPvminstancesNetworksPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesNetworksPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesNetworksPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesNetworksPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksPostBadRequest) 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 +} + +// NewPcloudPvminstancesNetworksPostUnauthorized creates a PcloudPvminstancesNetworksPostUnauthorized with default headers values +func NewPcloudPvminstancesNetworksPostUnauthorized() *PcloudPvminstancesNetworksPostUnauthorized { + return &PcloudPvminstancesNetworksPostUnauthorized{} +} + +/* PcloudPvminstancesNetworksPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesNetworksPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesNetworksPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesNetworksPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksPostUnauthorized) 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 +} + +// NewPcloudPvminstancesNetworksPostConflict creates a PcloudPvminstancesNetworksPostConflict with default headers values +func NewPcloudPvminstancesNetworksPostConflict() *PcloudPvminstancesNetworksPostConflict { + return &PcloudPvminstancesNetworksPostConflict{} +} + +/* PcloudPvminstancesNetworksPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudPvminstancesNetworksPostConflict struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesNetworksPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksPostConflict %+v", 409, o.Payload) +} +func (o *PcloudPvminstancesNetworksPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksPostConflict) 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 +} + +// NewPcloudPvminstancesNetworksPostUnprocessableEntity creates a PcloudPvminstancesNetworksPostUnprocessableEntity with default headers values +func NewPcloudPvminstancesNetworksPostUnprocessableEntity() *PcloudPvminstancesNetworksPostUnprocessableEntity { + return &PcloudPvminstancesNetworksPostUnprocessableEntity{} +} + +/* PcloudPvminstancesNetworksPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudPvminstancesNetworksPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesNetworksPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudPvminstancesNetworksPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksPostUnprocessableEntity) 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 +} + +// NewPcloudPvminstancesNetworksPostInternalServerError creates a PcloudPvminstancesNetworksPostInternalServerError with default headers values +func NewPcloudPvminstancesNetworksPostInternalServerError() *PcloudPvminstancesNetworksPostInternalServerError { + return &PcloudPvminstancesNetworksPostInternalServerError{} +} + +/* PcloudPvminstancesNetworksPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesNetworksPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesNetworksPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/networks][%d] pcloudPvminstancesNetworksPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesNetworksPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesNetworksPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_operations_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_operations_post_parameters.go new file mode 100644 index 00000000000..adf9227844c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_operations_post_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesOperationsPostParams creates a new PcloudPvminstancesOperationsPostParams 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 NewPcloudPvminstancesOperationsPostParams() *PcloudPvminstancesOperationsPostParams { + return &PcloudPvminstancesOperationsPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesOperationsPostParamsWithTimeout creates a new PcloudPvminstancesOperationsPostParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesOperationsPostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesOperationsPostParams { + return &PcloudPvminstancesOperationsPostParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesOperationsPostParamsWithContext creates a new PcloudPvminstancesOperationsPostParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesOperationsPostParamsWithContext(ctx context.Context) *PcloudPvminstancesOperationsPostParams { + return &PcloudPvminstancesOperationsPostParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesOperationsPostParamsWithHTTPClient creates a new PcloudPvminstancesOperationsPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesOperationsPostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesOperationsPostParams { + return &PcloudPvminstancesOperationsPostParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesOperationsPostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances operations post operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesOperationsPostParams struct { + + /* Body. + + Parameters for the desired operations + */ + Body *models.PVMInstanceOperation + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances operations post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesOperationsPostParams) WithDefaults() *PcloudPvminstancesOperationsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances operations post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesOperationsPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances operations post params +func (o *PcloudPvminstancesOperationsPostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesOperationsPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances operations post params +func (o *PcloudPvminstancesOperationsPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances operations post params +func (o *PcloudPvminstancesOperationsPostParams) WithContext(ctx context.Context) *PcloudPvminstancesOperationsPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances operations post params +func (o *PcloudPvminstancesOperationsPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances operations post params +func (o *PcloudPvminstancesOperationsPostParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesOperationsPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances operations post params +func (o *PcloudPvminstancesOperationsPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud pvminstances operations post params +func (o *PcloudPvminstancesOperationsPostParams) WithBody(body *models.PVMInstanceOperation) *PcloudPvminstancesOperationsPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances operations post params +func (o *PcloudPvminstancesOperationsPostParams) SetBody(body *models.PVMInstanceOperation) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances operations post params +func (o *PcloudPvminstancesOperationsPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesOperationsPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances operations post params +func (o *PcloudPvminstancesOperationsPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances operations post params +func (o *PcloudPvminstancesOperationsPostParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesOperationsPostParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances operations post params +func (o *PcloudPvminstancesOperationsPostParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesOperationsPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_operations_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_operations_post_responses.go new file mode 100644 index 00000000000..a68b4319111 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_operations_post_responses.go @@ -0,0 +1,255 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesOperationsPostReader is a Reader for the PcloudPvminstancesOperationsPost structure. +type PcloudPvminstancesOperationsPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesOperationsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesOperationsPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesOperationsPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesOperationsPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesOperationsPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudPvminstancesOperationsPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesOperationsPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesOperationsPostOK creates a PcloudPvminstancesOperationsPostOK with default headers values +func NewPcloudPvminstancesOperationsPostOK() *PcloudPvminstancesOperationsPostOK { + return &PcloudPvminstancesOperationsPostOK{} +} + +/* PcloudPvminstancesOperationsPostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesOperationsPostOK struct { + Payload models.Object +} + +func (o *PcloudPvminstancesOperationsPostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/operations][%d] pcloudPvminstancesOperationsPostOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesOperationsPostOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudPvminstancesOperationsPostOK) 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 +} + +// NewPcloudPvminstancesOperationsPostBadRequest creates a PcloudPvminstancesOperationsPostBadRequest with default headers values +func NewPcloudPvminstancesOperationsPostBadRequest() *PcloudPvminstancesOperationsPostBadRequest { + return &PcloudPvminstancesOperationsPostBadRequest{} +} + +/* PcloudPvminstancesOperationsPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesOperationsPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesOperationsPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/operations][%d] pcloudPvminstancesOperationsPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesOperationsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesOperationsPostBadRequest) 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 +} + +// NewPcloudPvminstancesOperationsPostUnauthorized creates a PcloudPvminstancesOperationsPostUnauthorized with default headers values +func NewPcloudPvminstancesOperationsPostUnauthorized() *PcloudPvminstancesOperationsPostUnauthorized { + return &PcloudPvminstancesOperationsPostUnauthorized{} +} + +/* PcloudPvminstancesOperationsPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesOperationsPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesOperationsPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/operations][%d] pcloudPvminstancesOperationsPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesOperationsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesOperationsPostUnauthorized) 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 +} + +// NewPcloudPvminstancesOperationsPostNotFound creates a PcloudPvminstancesOperationsPostNotFound with default headers values +func NewPcloudPvminstancesOperationsPostNotFound() *PcloudPvminstancesOperationsPostNotFound { + return &PcloudPvminstancesOperationsPostNotFound{} +} + +/* PcloudPvminstancesOperationsPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesOperationsPostNotFound struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesOperationsPostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/operations][%d] pcloudPvminstancesOperationsPostNotFound %+v", 404, o.Payload) +} +func (o *PcloudPvminstancesOperationsPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesOperationsPostNotFound) 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 +} + +// NewPcloudPvminstancesOperationsPostUnprocessableEntity creates a PcloudPvminstancesOperationsPostUnprocessableEntity with default headers values +func NewPcloudPvminstancesOperationsPostUnprocessableEntity() *PcloudPvminstancesOperationsPostUnprocessableEntity { + return &PcloudPvminstancesOperationsPostUnprocessableEntity{} +} + +/* PcloudPvminstancesOperationsPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudPvminstancesOperationsPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesOperationsPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/operations][%d] pcloudPvminstancesOperationsPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudPvminstancesOperationsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesOperationsPostUnprocessableEntity) 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 +} + +// NewPcloudPvminstancesOperationsPostInternalServerError creates a PcloudPvminstancesOperationsPostInternalServerError with default headers values +func NewPcloudPvminstancesOperationsPostInternalServerError() *PcloudPvminstancesOperationsPostInternalServerError { + return &PcloudPvminstancesOperationsPostInternalServerError{} +} + +/* PcloudPvminstancesOperationsPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesOperationsPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesOperationsPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/operations][%d] pcloudPvminstancesOperationsPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesOperationsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesOperationsPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_post_parameters.go new file mode 100644 index 00000000000..4720dc28ac5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_post_parameters.go @@ -0,0 +1,208 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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/go-openapi/swag" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// NewPcloudPvminstancesPostParams creates a new PcloudPvminstancesPostParams 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 NewPcloudPvminstancesPostParams() *PcloudPvminstancesPostParams { + return &PcloudPvminstancesPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesPostParamsWithTimeout creates a new PcloudPvminstancesPostParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesPostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesPostParams { + return &PcloudPvminstancesPostParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesPostParamsWithContext creates a new PcloudPvminstancesPostParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesPostParamsWithContext(ctx context.Context) *PcloudPvminstancesPostParams { + return &PcloudPvminstancesPostParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesPostParamsWithHTTPClient creates a new PcloudPvminstancesPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesPostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesPostParams { + return &PcloudPvminstancesPostParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesPostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances post operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesPostParams struct { + + /* Body. + + Parameters for the creation of a new Power VM Instance + */ + Body *models.PVMInstanceCreate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* SkipHostValidation. + + Option to skip host validation on PVMInstance Create API + */ + SkipHostValidation *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesPostParams) WithDefaults() *PcloudPvminstancesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances post params +func (o *PcloudPvminstancesPostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances post params +func (o *PcloudPvminstancesPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances post params +func (o *PcloudPvminstancesPostParams) WithContext(ctx context.Context) *PcloudPvminstancesPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances post params +func (o *PcloudPvminstancesPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances post params +func (o *PcloudPvminstancesPostParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances post params +func (o *PcloudPvminstancesPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud pvminstances post params +func (o *PcloudPvminstancesPostParams) WithBody(body *models.PVMInstanceCreate) *PcloudPvminstancesPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances post params +func (o *PcloudPvminstancesPostParams) SetBody(body *models.PVMInstanceCreate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances post params +func (o *PcloudPvminstancesPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances post params +func (o *PcloudPvminstancesPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithSkipHostValidation adds the skipHostValidation to the pcloud pvminstances post params +func (o *PcloudPvminstancesPostParams) WithSkipHostValidation(skipHostValidation *bool) *PcloudPvminstancesPostParams { + o.SetSkipHostValidation(skipHostValidation) + return o +} + +// SetSkipHostValidation adds the skipHostValidation to the pcloud pvminstances post params +func (o *PcloudPvminstancesPostParams) SetSkipHostValidation(skipHostValidation *bool) { + o.SkipHostValidation = skipHostValidation +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if o.SkipHostValidation != nil { + + // query param skipHostValidation + var qrSkipHostValidation bool + + if o.SkipHostValidation != nil { + qrSkipHostValidation = *o.SkipHostValidation + } + qSkipHostValidation := swag.FormatBool(qrSkipHostValidation) + if qSkipHostValidation != "" { + + if err := r.SetQueryParam("skipHostValidation", qSkipHostValidation); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_post_responses.go new file mode 100644 index 00000000000..79011037442 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_post_responses.go @@ -0,0 +1,365 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesPostReader is a Reader for the PcloudPvminstancesPost structure. +type PcloudPvminstancesPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 201: + result := NewPcloudPvminstancesPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 202: + result := NewPcloudPvminstancesPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudPvminstancesPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudPvminstancesPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 504: + result := NewPcloudPvminstancesPostGatewayTimeout() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesPostOK creates a PcloudPvminstancesPostOK with default headers values +func NewPcloudPvminstancesPostOK() *PcloudPvminstancesPostOK { + return &PcloudPvminstancesPostOK{} +} + +/* PcloudPvminstancesPostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesPostOK struct { + Payload models.PVMInstanceList +} + +func (o *PcloudPvminstancesPostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesPostOK) GetPayload() models.PVMInstanceList { + return o.Payload +} + +func (o *PcloudPvminstancesPostOK) 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 +} + +// NewPcloudPvminstancesPostCreated creates a PcloudPvminstancesPostCreated with default headers values +func NewPcloudPvminstancesPostCreated() *PcloudPvminstancesPostCreated { + return &PcloudPvminstancesPostCreated{} +} + +/* PcloudPvminstancesPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type PcloudPvminstancesPostCreated struct { + Payload models.PVMInstanceList +} + +func (o *PcloudPvminstancesPostCreated) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostCreated %+v", 201, o.Payload) +} +func (o *PcloudPvminstancesPostCreated) GetPayload() models.PVMInstanceList { + return o.Payload +} + +func (o *PcloudPvminstancesPostCreated) 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 +} + +// NewPcloudPvminstancesPostAccepted creates a PcloudPvminstancesPostAccepted with default headers values +func NewPcloudPvminstancesPostAccepted() *PcloudPvminstancesPostAccepted { + return &PcloudPvminstancesPostAccepted{} +} + +/* PcloudPvminstancesPostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudPvminstancesPostAccepted struct { + Payload models.PVMInstanceList +} + +func (o *PcloudPvminstancesPostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostAccepted %+v", 202, o.Payload) +} +func (o *PcloudPvminstancesPostAccepted) GetPayload() models.PVMInstanceList { + return o.Payload +} + +func (o *PcloudPvminstancesPostAccepted) 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 +} + +// NewPcloudPvminstancesPostBadRequest creates a PcloudPvminstancesPostBadRequest with default headers values +func NewPcloudPvminstancesPostBadRequest() *PcloudPvminstancesPostBadRequest { + return &PcloudPvminstancesPostBadRequest{} +} + +/* PcloudPvminstancesPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesPostBadRequest) 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 +} + +// NewPcloudPvminstancesPostUnauthorized creates a PcloudPvminstancesPostUnauthorized with default headers values +func NewPcloudPvminstancesPostUnauthorized() *PcloudPvminstancesPostUnauthorized { + return &PcloudPvminstancesPostUnauthorized{} +} + +/* PcloudPvminstancesPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesPostUnauthorized) 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 +} + +// NewPcloudPvminstancesPostConflict creates a PcloudPvminstancesPostConflict with default headers values +func NewPcloudPvminstancesPostConflict() *PcloudPvminstancesPostConflict { + return &PcloudPvminstancesPostConflict{} +} + +/* PcloudPvminstancesPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudPvminstancesPostConflict struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostConflict %+v", 409, o.Payload) +} +func (o *PcloudPvminstancesPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesPostConflict) 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 +} + +// NewPcloudPvminstancesPostUnprocessableEntity creates a PcloudPvminstancesPostUnprocessableEntity with default headers values +func NewPcloudPvminstancesPostUnprocessableEntity() *PcloudPvminstancesPostUnprocessableEntity { + return &PcloudPvminstancesPostUnprocessableEntity{} +} + +/* PcloudPvminstancesPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudPvminstancesPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudPvminstancesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesPostUnprocessableEntity) 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 +} + +// NewPcloudPvminstancesPostInternalServerError creates a PcloudPvminstancesPostInternalServerError with default headers values +func NewPcloudPvminstancesPostInternalServerError() *PcloudPvminstancesPostInternalServerError { + return &PcloudPvminstancesPostInternalServerError{} +} + +/* PcloudPvminstancesPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesPostInternalServerError) 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 +} + +// NewPcloudPvminstancesPostGatewayTimeout creates a PcloudPvminstancesPostGatewayTimeout with default headers values +func NewPcloudPvminstancesPostGatewayTimeout() *PcloudPvminstancesPostGatewayTimeout { + return &PcloudPvminstancesPostGatewayTimeout{} +} + +/* PcloudPvminstancesPostGatewayTimeout describes a response with status code 504, with default header values. + +Gateway Timeout. Request is still processing and taking longer than expected. +*/ +type PcloudPvminstancesPostGatewayTimeout struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesPostGatewayTimeout) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances][%d] pcloudPvminstancesPostGatewayTimeout %+v", 504, o.Payload) +} +func (o *PcloudPvminstancesPostGatewayTimeout) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesPostGatewayTimeout) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_put_parameters.go new file mode 100644 index 00000000000..48b71a21d9e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_put_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesPutParams creates a new PcloudPvminstancesPutParams 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 NewPcloudPvminstancesPutParams() *PcloudPvminstancesPutParams { + return &PcloudPvminstancesPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesPutParamsWithTimeout creates a new PcloudPvminstancesPutParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesPutParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesPutParams { + return &PcloudPvminstancesPutParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesPutParamsWithContext creates a new PcloudPvminstancesPutParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesPutParamsWithContext(ctx context.Context) *PcloudPvminstancesPutParams { + return &PcloudPvminstancesPutParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesPutParamsWithHTTPClient creates a new PcloudPvminstancesPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesPutParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesPutParams { + return &PcloudPvminstancesPutParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesPutParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances put operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesPutParams struct { + + /* Body. + + Parameters to update a PCloud PVM Instance + */ + Body *models.PVMInstanceUpdate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesPutParams) WithDefaults() *PcloudPvminstancesPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances put params +func (o *PcloudPvminstancesPutParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances put params +func (o *PcloudPvminstancesPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances put params +func (o *PcloudPvminstancesPutParams) WithContext(ctx context.Context) *PcloudPvminstancesPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances put params +func (o *PcloudPvminstancesPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances put params +func (o *PcloudPvminstancesPutParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances put params +func (o *PcloudPvminstancesPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud pvminstances put params +func (o *PcloudPvminstancesPutParams) WithBody(body *models.PVMInstanceUpdate) *PcloudPvminstancesPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances put params +func (o *PcloudPvminstancesPutParams) SetBody(body *models.PVMInstanceUpdate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances put params +func (o *PcloudPvminstancesPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances put params +func (o *PcloudPvminstancesPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances put params +func (o *PcloudPvminstancesPutParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesPutParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances put params +func (o *PcloudPvminstancesPutParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesPutParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_put_responses.go new file mode 100644 index 00000000000..c88a794f302 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_put_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesPutReader is a Reader for the PcloudPvminstancesPut structure. +type PcloudPvminstancesPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudPvminstancesPutAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudPvminstancesPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesPutAccepted creates a PcloudPvminstancesPutAccepted with default headers values +func NewPcloudPvminstancesPutAccepted() *PcloudPvminstancesPutAccepted { + return &PcloudPvminstancesPutAccepted{} +} + +/* PcloudPvminstancesPutAccepted describes a response with status code 202, with default header values. + +Accepted (this is a long running operation) +*/ +type PcloudPvminstancesPutAccepted struct { + Payload *models.PVMInstanceUpdateResponse +} + +func (o *PcloudPvminstancesPutAccepted) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesPutAccepted %+v", 202, o.Payload) +} +func (o *PcloudPvminstancesPutAccepted) GetPayload() *models.PVMInstanceUpdateResponse { + return o.Payload +} + +func (o *PcloudPvminstancesPutAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PVMInstanceUpdateResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesPutBadRequest creates a PcloudPvminstancesPutBadRequest with default headers values +func NewPcloudPvminstancesPutBadRequest() *PcloudPvminstancesPutBadRequest { + return &PcloudPvminstancesPutBadRequest{} +} + +/* PcloudPvminstancesPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesPutBadRequest) 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 +} + +// NewPcloudPvminstancesPutUnauthorized creates a PcloudPvminstancesPutUnauthorized with default headers values +func NewPcloudPvminstancesPutUnauthorized() *PcloudPvminstancesPutUnauthorized { + return &PcloudPvminstancesPutUnauthorized{} +} + +/* PcloudPvminstancesPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesPutUnauthorized) 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 +} + +// NewPcloudPvminstancesPutUnprocessableEntity creates a PcloudPvminstancesPutUnprocessableEntity with default headers values +func NewPcloudPvminstancesPutUnprocessableEntity() *PcloudPvminstancesPutUnprocessableEntity { + return &PcloudPvminstancesPutUnprocessableEntity{} +} + +/* PcloudPvminstancesPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudPvminstancesPutUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesPutUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudPvminstancesPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesPutUnprocessableEntity) 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 +} + +// NewPcloudPvminstancesPutInternalServerError creates a PcloudPvminstancesPutInternalServerError with default headers values +func NewPcloudPvminstancesPutInternalServerError() *PcloudPvminstancesPutInternalServerError { + return &PcloudPvminstancesPutInternalServerError{} +} + +/* PcloudPvminstancesPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}][%d] pcloudPvminstancesPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_getall_parameters.go new file mode 100644 index 00000000000..6441ed24abd --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_getall_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesSnapshotsGetallParams creates a new PcloudPvminstancesSnapshotsGetallParams 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 NewPcloudPvminstancesSnapshotsGetallParams() *PcloudPvminstancesSnapshotsGetallParams { + return &PcloudPvminstancesSnapshotsGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesSnapshotsGetallParamsWithTimeout creates a new PcloudPvminstancesSnapshotsGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesSnapshotsGetallParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesSnapshotsGetallParams { + return &PcloudPvminstancesSnapshotsGetallParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesSnapshotsGetallParamsWithContext creates a new PcloudPvminstancesSnapshotsGetallParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesSnapshotsGetallParamsWithContext(ctx context.Context) *PcloudPvminstancesSnapshotsGetallParams { + return &PcloudPvminstancesSnapshotsGetallParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesSnapshotsGetallParamsWithHTTPClient creates a new PcloudPvminstancesSnapshotsGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesSnapshotsGetallParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesSnapshotsGetallParams { + return &PcloudPvminstancesSnapshotsGetallParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesSnapshotsGetallParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances snapshots getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesSnapshotsGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances snapshots getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesSnapshotsGetallParams) WithDefaults() *PcloudPvminstancesSnapshotsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances snapshots getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesSnapshotsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances snapshots getall params +func (o *PcloudPvminstancesSnapshotsGetallParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesSnapshotsGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances snapshots getall params +func (o *PcloudPvminstancesSnapshotsGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances snapshots getall params +func (o *PcloudPvminstancesSnapshotsGetallParams) WithContext(ctx context.Context) *PcloudPvminstancesSnapshotsGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances snapshots getall params +func (o *PcloudPvminstancesSnapshotsGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances snapshots getall params +func (o *PcloudPvminstancesSnapshotsGetallParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesSnapshotsGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances snapshots getall params +func (o *PcloudPvminstancesSnapshotsGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances snapshots getall params +func (o *PcloudPvminstancesSnapshotsGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesSnapshotsGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances snapshots getall params +func (o *PcloudPvminstancesSnapshotsGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances snapshots getall params +func (o *PcloudPvminstancesSnapshotsGetallParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesSnapshotsGetallParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances snapshots getall params +func (o *PcloudPvminstancesSnapshotsGetallParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesSnapshotsGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_getall_responses.go new file mode 100644 index 00000000000..9b257b3e2b7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_getall_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesSnapshotsGetallReader is a Reader for the PcloudPvminstancesSnapshotsGetall structure. +type PcloudPvminstancesSnapshotsGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesSnapshotsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesSnapshotsGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesSnapshotsGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesSnapshotsGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesSnapshotsGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesSnapshotsGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesSnapshotsGetallOK creates a PcloudPvminstancesSnapshotsGetallOK with default headers values +func NewPcloudPvminstancesSnapshotsGetallOK() *PcloudPvminstancesSnapshotsGetallOK { + return &PcloudPvminstancesSnapshotsGetallOK{} +} + +/* PcloudPvminstancesSnapshotsGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesSnapshotsGetallOK struct { + Payload *models.Snapshots +} + +func (o *PcloudPvminstancesSnapshotsGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsGetallOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsGetallOK) GetPayload() *models.Snapshots { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Snapshots) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesSnapshotsGetallBadRequest creates a PcloudPvminstancesSnapshotsGetallBadRequest with default headers values +func NewPcloudPvminstancesSnapshotsGetallBadRequest() *PcloudPvminstancesSnapshotsGetallBadRequest { + return &PcloudPvminstancesSnapshotsGetallBadRequest{} +} + +/* PcloudPvminstancesSnapshotsGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesSnapshotsGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesSnapshotsGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsGetallBadRequest) 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 +} + +// NewPcloudPvminstancesSnapshotsGetallUnauthorized creates a PcloudPvminstancesSnapshotsGetallUnauthorized with default headers values +func NewPcloudPvminstancesSnapshotsGetallUnauthorized() *PcloudPvminstancesSnapshotsGetallUnauthorized { + return &PcloudPvminstancesSnapshotsGetallUnauthorized{} +} + +/* PcloudPvminstancesSnapshotsGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesSnapshotsGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesSnapshotsGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsGetallUnauthorized) 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 +} + +// NewPcloudPvminstancesSnapshotsGetallNotFound creates a PcloudPvminstancesSnapshotsGetallNotFound with default headers values +func NewPcloudPvminstancesSnapshotsGetallNotFound() *PcloudPvminstancesSnapshotsGetallNotFound { + return &PcloudPvminstancesSnapshotsGetallNotFound{} +} + +/* PcloudPvminstancesSnapshotsGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesSnapshotsGetallNotFound struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesSnapshotsGetallNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsGetallNotFound %+v", 404, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsGetallNotFound) 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 +} + +// NewPcloudPvminstancesSnapshotsGetallInternalServerError creates a PcloudPvminstancesSnapshotsGetallInternalServerError with default headers values +func NewPcloudPvminstancesSnapshotsGetallInternalServerError() *PcloudPvminstancesSnapshotsGetallInternalServerError { + return &PcloudPvminstancesSnapshotsGetallInternalServerError{} +} + +/* PcloudPvminstancesSnapshotsGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesSnapshotsGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesSnapshotsGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_post_parameters.go new file mode 100644 index 00000000000..551a20e44af --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_post_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesSnapshotsPostParams creates a new PcloudPvminstancesSnapshotsPostParams 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 NewPcloudPvminstancesSnapshotsPostParams() *PcloudPvminstancesSnapshotsPostParams { + return &PcloudPvminstancesSnapshotsPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesSnapshotsPostParamsWithTimeout creates a new PcloudPvminstancesSnapshotsPostParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesSnapshotsPostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesSnapshotsPostParams { + return &PcloudPvminstancesSnapshotsPostParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesSnapshotsPostParamsWithContext creates a new PcloudPvminstancesSnapshotsPostParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesSnapshotsPostParamsWithContext(ctx context.Context) *PcloudPvminstancesSnapshotsPostParams { + return &PcloudPvminstancesSnapshotsPostParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesSnapshotsPostParamsWithHTTPClient creates a new PcloudPvminstancesSnapshotsPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesSnapshotsPostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesSnapshotsPostParams { + return &PcloudPvminstancesSnapshotsPostParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesSnapshotsPostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances snapshots post operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesSnapshotsPostParams struct { + + /* Body. + + PVM Instance snapshot create parameters + */ + Body *models.SnapshotCreate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances snapshots post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesSnapshotsPostParams) WithDefaults() *PcloudPvminstancesSnapshotsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances snapshots post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesSnapshotsPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances snapshots post params +func (o *PcloudPvminstancesSnapshotsPostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesSnapshotsPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances snapshots post params +func (o *PcloudPvminstancesSnapshotsPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances snapshots post params +func (o *PcloudPvminstancesSnapshotsPostParams) WithContext(ctx context.Context) *PcloudPvminstancesSnapshotsPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances snapshots post params +func (o *PcloudPvminstancesSnapshotsPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances snapshots post params +func (o *PcloudPvminstancesSnapshotsPostParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesSnapshotsPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances snapshots post params +func (o *PcloudPvminstancesSnapshotsPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud pvminstances snapshots post params +func (o *PcloudPvminstancesSnapshotsPostParams) WithBody(body *models.SnapshotCreate) *PcloudPvminstancesSnapshotsPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances snapshots post params +func (o *PcloudPvminstancesSnapshotsPostParams) SetBody(body *models.SnapshotCreate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances snapshots post params +func (o *PcloudPvminstancesSnapshotsPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesSnapshotsPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances snapshots post params +func (o *PcloudPvminstancesSnapshotsPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances snapshots post params +func (o *PcloudPvminstancesSnapshotsPostParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesSnapshotsPostParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances snapshots post params +func (o *PcloudPvminstancesSnapshotsPostParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesSnapshotsPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_post_responses.go new file mode 100644 index 00000000000..a1f957222e6 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_post_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesSnapshotsPostReader is a Reader for the PcloudPvminstancesSnapshotsPost structure. +type PcloudPvminstancesSnapshotsPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesSnapshotsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudPvminstancesSnapshotsPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesSnapshotsPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesSnapshotsPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesSnapshotsPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudPvminstancesSnapshotsPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesSnapshotsPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesSnapshotsPostAccepted creates a PcloudPvminstancesSnapshotsPostAccepted with default headers values +func NewPcloudPvminstancesSnapshotsPostAccepted() *PcloudPvminstancesSnapshotsPostAccepted { + return &PcloudPvminstancesSnapshotsPostAccepted{} +} + +/* PcloudPvminstancesSnapshotsPostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudPvminstancesSnapshotsPostAccepted struct { + Payload *models.SnapshotCreateResponse +} + +func (o *PcloudPvminstancesSnapshotsPostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsPostAccepted %+v", 202, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsPostAccepted) GetPayload() *models.SnapshotCreateResponse { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SnapshotCreateResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesSnapshotsPostBadRequest creates a PcloudPvminstancesSnapshotsPostBadRequest with default headers values +func NewPcloudPvminstancesSnapshotsPostBadRequest() *PcloudPvminstancesSnapshotsPostBadRequest { + return &PcloudPvminstancesSnapshotsPostBadRequest{} +} + +/* PcloudPvminstancesSnapshotsPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesSnapshotsPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesSnapshotsPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsPostBadRequest) 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 +} + +// NewPcloudPvminstancesSnapshotsPostUnauthorized creates a PcloudPvminstancesSnapshotsPostUnauthorized with default headers values +func NewPcloudPvminstancesSnapshotsPostUnauthorized() *PcloudPvminstancesSnapshotsPostUnauthorized { + return &PcloudPvminstancesSnapshotsPostUnauthorized{} +} + +/* PcloudPvminstancesSnapshotsPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesSnapshotsPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesSnapshotsPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsPostUnauthorized) 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 +} + +// NewPcloudPvminstancesSnapshotsPostNotFound creates a PcloudPvminstancesSnapshotsPostNotFound with default headers values +func NewPcloudPvminstancesSnapshotsPostNotFound() *PcloudPvminstancesSnapshotsPostNotFound { + return &PcloudPvminstancesSnapshotsPostNotFound{} +} + +/* PcloudPvminstancesSnapshotsPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesSnapshotsPostNotFound struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesSnapshotsPostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsPostNotFound %+v", 404, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsPostNotFound) 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 +} + +// NewPcloudPvminstancesSnapshotsPostConflict creates a PcloudPvminstancesSnapshotsPostConflict with default headers values +func NewPcloudPvminstancesSnapshotsPostConflict() *PcloudPvminstancesSnapshotsPostConflict { + return &PcloudPvminstancesSnapshotsPostConflict{} +} + +/* PcloudPvminstancesSnapshotsPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudPvminstancesSnapshotsPostConflict struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesSnapshotsPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsPostConflict %+v", 409, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsPostConflict) 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 +} + +// NewPcloudPvminstancesSnapshotsPostInternalServerError creates a PcloudPvminstancesSnapshotsPostInternalServerError with default headers values +func NewPcloudPvminstancesSnapshotsPostInternalServerError() *PcloudPvminstancesSnapshotsPostInternalServerError { + return &PcloudPvminstancesSnapshotsPostInternalServerError{} +} + +/* PcloudPvminstancesSnapshotsPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesSnapshotsPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesSnapshotsPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots][%d] pcloudPvminstancesSnapshotsPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_restore_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_restore_post_parameters.go new file mode 100644 index 00000000000..9a56a1f7a5b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_restore_post_parameters.go @@ -0,0 +1,251 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudPvminstancesSnapshotsRestorePostParams creates a new PcloudPvminstancesSnapshotsRestorePostParams 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 NewPcloudPvminstancesSnapshotsRestorePostParams() *PcloudPvminstancesSnapshotsRestorePostParams { + return &PcloudPvminstancesSnapshotsRestorePostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesSnapshotsRestorePostParamsWithTimeout creates a new PcloudPvminstancesSnapshotsRestorePostParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesSnapshotsRestorePostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesSnapshotsRestorePostParams { + return &PcloudPvminstancesSnapshotsRestorePostParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesSnapshotsRestorePostParamsWithContext creates a new PcloudPvminstancesSnapshotsRestorePostParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesSnapshotsRestorePostParamsWithContext(ctx context.Context) *PcloudPvminstancesSnapshotsRestorePostParams { + return &PcloudPvminstancesSnapshotsRestorePostParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesSnapshotsRestorePostParamsWithHTTPClient creates a new PcloudPvminstancesSnapshotsRestorePostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesSnapshotsRestorePostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesSnapshotsRestorePostParams { + return &PcloudPvminstancesSnapshotsRestorePostParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesSnapshotsRestorePostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances snapshots restore post operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesSnapshotsRestorePostParams struct { + + /* Body. + + PVM Instance snapshot restore parameters + */ + Body *models.SnapshotRestore + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + /* RestoreFailAction. + + Action to take on a failed snapshot restore + */ + RestoreFailAction *string + + /* SnapshotID. + + PVM Instance snapshot id + */ + SnapshotID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances snapshots restore post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesSnapshotsRestorePostParams) WithDefaults() *PcloudPvminstancesSnapshotsRestorePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances snapshots restore post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesSnapshotsRestorePostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesSnapshotsRestorePostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) WithContext(ctx context.Context) *PcloudPvminstancesSnapshotsRestorePostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesSnapshotsRestorePostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) WithBody(body *models.SnapshotRestore) *PcloudPvminstancesSnapshotsRestorePostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) SetBody(body *models.SnapshotRestore) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesSnapshotsRestorePostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesSnapshotsRestorePostParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WithRestoreFailAction adds the restoreFailAction to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) WithRestoreFailAction(restoreFailAction *string) *PcloudPvminstancesSnapshotsRestorePostParams { + o.SetRestoreFailAction(restoreFailAction) + return o +} + +// SetRestoreFailAction adds the restoreFailAction to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) SetRestoreFailAction(restoreFailAction *string) { + o.RestoreFailAction = restoreFailAction +} + +// WithSnapshotID adds the snapshotID to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) WithSnapshotID(snapshotID string) *PcloudPvminstancesSnapshotsRestorePostParams { + o.SetSnapshotID(snapshotID) + return o +} + +// SetSnapshotID adds the snapshotId to the pcloud pvminstances snapshots restore post params +func (o *PcloudPvminstancesSnapshotsRestorePostParams) SetSnapshotID(snapshotID string) { + o.SnapshotID = snapshotID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesSnapshotsRestorePostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if o.RestoreFailAction != nil { + + // query param restore_fail_action + var qrRestoreFailAction string + + if o.RestoreFailAction != nil { + qrRestoreFailAction = *o.RestoreFailAction + } + qRestoreFailAction := qrRestoreFailAction + if qRestoreFailAction != "" { + + if err := r.SetQueryParam("restore_fail_action", qRestoreFailAction); err != nil { + return err + } + } + } + + // path param snapshot_id + if err := r.SetPathParam("snapshot_id", o.SnapshotID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_restore_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_restore_post_responses.go new file mode 100644 index 00000000000..5dbfbac8bbf --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_pvminstances_snapshots_restore_post_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesSnapshotsRestorePostReader is a Reader for the PcloudPvminstancesSnapshotsRestorePost structure. +type PcloudPvminstancesSnapshotsRestorePostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesSnapshotsRestorePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudPvminstancesSnapshotsRestorePostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesSnapshotsRestorePostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesSnapshotsRestorePostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudPvminstancesSnapshotsRestorePostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesSnapshotsRestorePostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesSnapshotsRestorePostAccepted creates a PcloudPvminstancesSnapshotsRestorePostAccepted with default headers values +func NewPcloudPvminstancesSnapshotsRestorePostAccepted() *PcloudPvminstancesSnapshotsRestorePostAccepted { + return &PcloudPvminstancesSnapshotsRestorePostAccepted{} +} + +/* PcloudPvminstancesSnapshotsRestorePostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudPvminstancesSnapshotsRestorePostAccepted struct { + Payload *models.Snapshot +} + +func (o *PcloudPvminstancesSnapshotsRestorePostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots/{snapshot_id}/restore][%d] pcloudPvminstancesSnapshotsRestorePostAccepted %+v", 202, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsRestorePostAccepted) GetPayload() *models.Snapshot { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsRestorePostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Snapshot) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesSnapshotsRestorePostBadRequest creates a PcloudPvminstancesSnapshotsRestorePostBadRequest with default headers values +func NewPcloudPvminstancesSnapshotsRestorePostBadRequest() *PcloudPvminstancesSnapshotsRestorePostBadRequest { + return &PcloudPvminstancesSnapshotsRestorePostBadRequest{} +} + +/* PcloudPvminstancesSnapshotsRestorePostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesSnapshotsRestorePostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesSnapshotsRestorePostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots/{snapshot_id}/restore][%d] pcloudPvminstancesSnapshotsRestorePostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsRestorePostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsRestorePostBadRequest) 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 +} + +// NewPcloudPvminstancesSnapshotsRestorePostUnauthorized creates a PcloudPvminstancesSnapshotsRestorePostUnauthorized with default headers values +func NewPcloudPvminstancesSnapshotsRestorePostUnauthorized() *PcloudPvminstancesSnapshotsRestorePostUnauthorized { + return &PcloudPvminstancesSnapshotsRestorePostUnauthorized{} +} + +/* PcloudPvminstancesSnapshotsRestorePostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesSnapshotsRestorePostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesSnapshotsRestorePostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots/{snapshot_id}/restore][%d] pcloudPvminstancesSnapshotsRestorePostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsRestorePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsRestorePostUnauthorized) 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 +} + +// NewPcloudPvminstancesSnapshotsRestorePostConflict creates a PcloudPvminstancesSnapshotsRestorePostConflict with default headers values +func NewPcloudPvminstancesSnapshotsRestorePostConflict() *PcloudPvminstancesSnapshotsRestorePostConflict { + return &PcloudPvminstancesSnapshotsRestorePostConflict{} +} + +/* PcloudPvminstancesSnapshotsRestorePostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudPvminstancesSnapshotsRestorePostConflict struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesSnapshotsRestorePostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots/{snapshot_id}/restore][%d] pcloudPvminstancesSnapshotsRestorePostConflict %+v", 409, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsRestorePostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsRestorePostConflict) 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 +} + +// NewPcloudPvminstancesSnapshotsRestorePostInternalServerError creates a PcloudPvminstancesSnapshotsRestorePostInternalServerError with default headers values +func NewPcloudPvminstancesSnapshotsRestorePostInternalServerError() *PcloudPvminstancesSnapshotsRestorePostInternalServerError { + return &PcloudPvminstancesSnapshotsRestorePostInternalServerError{} +} + +/* PcloudPvminstancesSnapshotsRestorePostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesSnapshotsRestorePostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesSnapshotsRestorePostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/snapshots/{snapshot_id}/restore][%d] pcloudPvminstancesSnapshotsRestorePostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesSnapshotsRestorePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesSnapshotsRestorePostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_get_parameters.go new file mode 100644 index 00000000000..8519057ed01 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudV2PvminstancesCaptureGetParams creates a new PcloudV2PvminstancesCaptureGetParams 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 NewPcloudV2PvminstancesCaptureGetParams() *PcloudV2PvminstancesCaptureGetParams { + return &PcloudV2PvminstancesCaptureGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2PvminstancesCaptureGetParamsWithTimeout creates a new PcloudV2PvminstancesCaptureGetParams object +// with the ability to set a timeout on a request. +func NewPcloudV2PvminstancesCaptureGetParamsWithTimeout(timeout time.Duration) *PcloudV2PvminstancesCaptureGetParams { + return &PcloudV2PvminstancesCaptureGetParams{ + timeout: timeout, + } +} + +// NewPcloudV2PvminstancesCaptureGetParamsWithContext creates a new PcloudV2PvminstancesCaptureGetParams object +// with the ability to set a context for a request. +func NewPcloudV2PvminstancesCaptureGetParamsWithContext(ctx context.Context) *PcloudV2PvminstancesCaptureGetParams { + return &PcloudV2PvminstancesCaptureGetParams{ + Context: ctx, + } +} + +// NewPcloudV2PvminstancesCaptureGetParamsWithHTTPClient creates a new PcloudV2PvminstancesCaptureGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2PvminstancesCaptureGetParamsWithHTTPClient(client *http.Client) *PcloudV2PvminstancesCaptureGetParams { + return &PcloudV2PvminstancesCaptureGetParams{ + HTTPClient: client, + } +} + +/* PcloudV2PvminstancesCaptureGetParams contains all the parameters to send to the API endpoint + for the pcloud v2 pvminstances capture get operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2PvminstancesCaptureGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 pvminstances capture get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2PvminstancesCaptureGetParams) WithDefaults() *PcloudV2PvminstancesCaptureGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 pvminstances capture get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2PvminstancesCaptureGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 pvminstances capture get params +func (o *PcloudV2PvminstancesCaptureGetParams) WithTimeout(timeout time.Duration) *PcloudV2PvminstancesCaptureGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 pvminstances capture get params +func (o *PcloudV2PvminstancesCaptureGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 pvminstances capture get params +func (o *PcloudV2PvminstancesCaptureGetParams) WithContext(ctx context.Context) *PcloudV2PvminstancesCaptureGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 pvminstances capture get params +func (o *PcloudV2PvminstancesCaptureGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 pvminstances capture get params +func (o *PcloudV2PvminstancesCaptureGetParams) WithHTTPClient(client *http.Client) *PcloudV2PvminstancesCaptureGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 pvminstances capture get params +func (o *PcloudV2PvminstancesCaptureGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 pvminstances capture get params +func (o *PcloudV2PvminstancesCaptureGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2PvminstancesCaptureGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 pvminstances capture get params +func (o *PcloudV2PvminstancesCaptureGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud v2 pvminstances capture get params +func (o *PcloudV2PvminstancesCaptureGetParams) WithPvmInstanceID(pvmInstanceID string) *PcloudV2PvminstancesCaptureGetParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud v2 pvminstances capture get params +func (o *PcloudV2PvminstancesCaptureGetParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2PvminstancesCaptureGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_get_responses.go new file mode 100644 index 00000000000..d53cfa0b720 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_get_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV2PvminstancesCaptureGetReader is a Reader for the PcloudV2PvminstancesCaptureGet structure. +type PcloudV2PvminstancesCaptureGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2PvminstancesCaptureGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudV2PvminstancesCaptureGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPcloudV2PvminstancesCaptureGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2PvminstancesCaptureGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2PvminstancesCaptureGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV2PvminstancesCaptureGetOK creates a PcloudV2PvminstancesCaptureGetOK with default headers values +func NewPcloudV2PvminstancesCaptureGetOK() *PcloudV2PvminstancesCaptureGetOK { + return &PcloudV2PvminstancesCaptureGetOK{} +} + +/* PcloudV2PvminstancesCaptureGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudV2PvminstancesCaptureGetOK struct { + Payload *models.Job +} + +func (o *PcloudV2PvminstancesCaptureGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCaptureGetOK %+v", 200, o.Payload) +} +func (o *PcloudV2PvminstancesCaptureGetOK) GetPayload() *models.Job { + return o.Payload +} + +func (o *PcloudV2PvminstancesCaptureGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Job) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2PvminstancesCaptureGetUnauthorized creates a PcloudV2PvminstancesCaptureGetUnauthorized with default headers values +func NewPcloudV2PvminstancesCaptureGetUnauthorized() *PcloudV2PvminstancesCaptureGetUnauthorized { + return &PcloudV2PvminstancesCaptureGetUnauthorized{} +} + +/* PcloudV2PvminstancesCaptureGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2PvminstancesCaptureGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV2PvminstancesCaptureGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCaptureGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV2PvminstancesCaptureGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2PvminstancesCaptureGetUnauthorized) 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 +} + +// NewPcloudV2PvminstancesCaptureGetNotFound creates a PcloudV2PvminstancesCaptureGetNotFound with default headers values +func NewPcloudV2PvminstancesCaptureGetNotFound() *PcloudV2PvminstancesCaptureGetNotFound { + return &PcloudV2PvminstancesCaptureGetNotFound{} +} + +/* PcloudV2PvminstancesCaptureGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudV2PvminstancesCaptureGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudV2PvminstancesCaptureGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCaptureGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudV2PvminstancesCaptureGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2PvminstancesCaptureGetNotFound) 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 +} + +// NewPcloudV2PvminstancesCaptureGetInternalServerError creates a PcloudV2PvminstancesCaptureGetInternalServerError with default headers values +func NewPcloudV2PvminstancesCaptureGetInternalServerError() *PcloudV2PvminstancesCaptureGetInternalServerError { + return &PcloudV2PvminstancesCaptureGetInternalServerError{} +} + +/* PcloudV2PvminstancesCaptureGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2PvminstancesCaptureGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV2PvminstancesCaptureGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCaptureGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV2PvminstancesCaptureGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2PvminstancesCaptureGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_post_parameters.go new file mode 100644 index 00000000000..2a09a266f53 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_post_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// 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" +) + +// NewPcloudV2PvminstancesCapturePostParams creates a new PcloudV2PvminstancesCapturePostParams 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 NewPcloudV2PvminstancesCapturePostParams() *PcloudV2PvminstancesCapturePostParams { + return &PcloudV2PvminstancesCapturePostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2PvminstancesCapturePostParamsWithTimeout creates a new PcloudV2PvminstancesCapturePostParams object +// with the ability to set a timeout on a request. +func NewPcloudV2PvminstancesCapturePostParamsWithTimeout(timeout time.Duration) *PcloudV2PvminstancesCapturePostParams { + return &PcloudV2PvminstancesCapturePostParams{ + timeout: timeout, + } +} + +// NewPcloudV2PvminstancesCapturePostParamsWithContext creates a new PcloudV2PvminstancesCapturePostParams object +// with the ability to set a context for a request. +func NewPcloudV2PvminstancesCapturePostParamsWithContext(ctx context.Context) *PcloudV2PvminstancesCapturePostParams { + return &PcloudV2PvminstancesCapturePostParams{ + Context: ctx, + } +} + +// NewPcloudV2PvminstancesCapturePostParamsWithHTTPClient creates a new PcloudV2PvminstancesCapturePostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2PvminstancesCapturePostParamsWithHTTPClient(client *http.Client) *PcloudV2PvminstancesCapturePostParams { + return &PcloudV2PvminstancesCapturePostParams{ + HTTPClient: client, + } +} + +/* PcloudV2PvminstancesCapturePostParams contains all the parameters to send to the API endpoint + for the pcloud v2 pvminstances capture post operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2PvminstancesCapturePostParams struct { + + /* Body. + + Parameters for the capture + */ + Body *models.PVMInstanceCapture + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 pvminstances capture post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2PvminstancesCapturePostParams) WithDefaults() *PcloudV2PvminstancesCapturePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 pvminstances capture post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2PvminstancesCapturePostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 pvminstances capture post params +func (o *PcloudV2PvminstancesCapturePostParams) WithTimeout(timeout time.Duration) *PcloudV2PvminstancesCapturePostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 pvminstances capture post params +func (o *PcloudV2PvminstancesCapturePostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 pvminstances capture post params +func (o *PcloudV2PvminstancesCapturePostParams) WithContext(ctx context.Context) *PcloudV2PvminstancesCapturePostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 pvminstances capture post params +func (o *PcloudV2PvminstancesCapturePostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 pvminstances capture post params +func (o *PcloudV2PvminstancesCapturePostParams) WithHTTPClient(client *http.Client) *PcloudV2PvminstancesCapturePostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 pvminstances capture post params +func (o *PcloudV2PvminstancesCapturePostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud v2 pvminstances capture post params +func (o *PcloudV2PvminstancesCapturePostParams) WithBody(body *models.PVMInstanceCapture) *PcloudV2PvminstancesCapturePostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud v2 pvminstances capture post params +func (o *PcloudV2PvminstancesCapturePostParams) SetBody(body *models.PVMInstanceCapture) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 pvminstances capture post params +func (o *PcloudV2PvminstancesCapturePostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2PvminstancesCapturePostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 pvminstances capture post params +func (o *PcloudV2PvminstancesCapturePostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud v2 pvminstances capture post params +func (o *PcloudV2PvminstancesCapturePostParams) WithPvmInstanceID(pvmInstanceID string) *PcloudV2PvminstancesCapturePostParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud v2 pvminstances capture post params +func (o *PcloudV2PvminstancesCapturePostParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2PvminstancesCapturePostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_post_responses.go new file mode 100644 index 00000000000..787b81faa37 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances/pcloud_v2_pvminstances_capture_post_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_p_vm_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV2PvminstancesCapturePostReader is a Reader for the PcloudV2PvminstancesCapturePost structure. +type PcloudV2PvminstancesCapturePostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2PvminstancesCapturePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudV2PvminstancesCapturePostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudV2PvminstancesCapturePostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudV2PvminstancesCapturePostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2PvminstancesCapturePostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudV2PvminstancesCapturePostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudV2PvminstancesCapturePostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2PvminstancesCapturePostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV2PvminstancesCapturePostAccepted creates a PcloudV2PvminstancesCapturePostAccepted with default headers values +func NewPcloudV2PvminstancesCapturePostAccepted() *PcloudV2PvminstancesCapturePostAccepted { + return &PcloudV2PvminstancesCapturePostAccepted{} +} + +/* PcloudV2PvminstancesCapturePostAccepted describes a response with status code 202, with default header values. + +Accepted, pvm-instance capture successfully added to the jobs queue +*/ +type PcloudV2PvminstancesCapturePostAccepted struct { + Payload *models.JobReference +} + +func (o *PcloudV2PvminstancesCapturePostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCapturePostAccepted %+v", 202, o.Payload) +} +func (o *PcloudV2PvminstancesCapturePostAccepted) GetPayload() *models.JobReference { + return o.Payload +} + +func (o *PcloudV2PvminstancesCapturePostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.JobReference) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2PvminstancesCapturePostBadRequest creates a PcloudV2PvminstancesCapturePostBadRequest with default headers values +func NewPcloudV2PvminstancesCapturePostBadRequest() *PcloudV2PvminstancesCapturePostBadRequest { + return &PcloudV2PvminstancesCapturePostBadRequest{} +} + +/* PcloudV2PvminstancesCapturePostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudV2PvminstancesCapturePostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudV2PvminstancesCapturePostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCapturePostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudV2PvminstancesCapturePostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2PvminstancesCapturePostBadRequest) 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 +} + +// NewPcloudV2PvminstancesCapturePostUnauthorized creates a PcloudV2PvminstancesCapturePostUnauthorized with default headers values +func NewPcloudV2PvminstancesCapturePostUnauthorized() *PcloudV2PvminstancesCapturePostUnauthorized { + return &PcloudV2PvminstancesCapturePostUnauthorized{} +} + +/* PcloudV2PvminstancesCapturePostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2PvminstancesCapturePostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV2PvminstancesCapturePostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCapturePostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV2PvminstancesCapturePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2PvminstancesCapturePostUnauthorized) 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 +} + +// NewPcloudV2PvminstancesCapturePostNotFound creates a PcloudV2PvminstancesCapturePostNotFound with default headers values +func NewPcloudV2PvminstancesCapturePostNotFound() *PcloudV2PvminstancesCapturePostNotFound { + return &PcloudV2PvminstancesCapturePostNotFound{} +} + +/* PcloudV2PvminstancesCapturePostNotFound describes a response with status code 404, with default header values. + +pvm instance id not found +*/ +type PcloudV2PvminstancesCapturePostNotFound struct { + Payload *models.Error +} + +func (o *PcloudV2PvminstancesCapturePostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCapturePostNotFound %+v", 404, o.Payload) +} +func (o *PcloudV2PvminstancesCapturePostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2PvminstancesCapturePostNotFound) 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 +} + +// NewPcloudV2PvminstancesCapturePostConflict creates a PcloudV2PvminstancesCapturePostConflict with default headers values +func NewPcloudV2PvminstancesCapturePostConflict() *PcloudV2PvminstancesCapturePostConflict { + return &PcloudV2PvminstancesCapturePostConflict{} +} + +/* PcloudV2PvminstancesCapturePostConflict describes a response with status code 409, with default header values. + +Conflict, a conflict has prevented adding the pvm-instance capture job +*/ +type PcloudV2PvminstancesCapturePostConflict struct { + Payload *models.Error +} + +func (o *PcloudV2PvminstancesCapturePostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCapturePostConflict %+v", 409, o.Payload) +} +func (o *PcloudV2PvminstancesCapturePostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2PvminstancesCapturePostConflict) 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 +} + +// NewPcloudV2PvminstancesCapturePostUnprocessableEntity creates a PcloudV2PvminstancesCapturePostUnprocessableEntity with default headers values +func NewPcloudV2PvminstancesCapturePostUnprocessableEntity() *PcloudV2PvminstancesCapturePostUnprocessableEntity { + return &PcloudV2PvminstancesCapturePostUnprocessableEntity{} +} + +/* PcloudV2PvminstancesCapturePostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudV2PvminstancesCapturePostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudV2PvminstancesCapturePostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCapturePostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudV2PvminstancesCapturePostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2PvminstancesCapturePostUnprocessableEntity) 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 +} + +// NewPcloudV2PvminstancesCapturePostInternalServerError creates a PcloudV2PvminstancesCapturePostInternalServerError with default headers values +func NewPcloudV2PvminstancesCapturePostInternalServerError() *PcloudV2PvminstancesCapturePostInternalServerError { + return &PcloudV2PvminstancesCapturePostInternalServerError{} +} + +/* PcloudV2PvminstancesCapturePostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2PvminstancesCapturePostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV2PvminstancesCapturePostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/capture][%d] pcloudV2PvminstancesCapturePostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV2PvminstancesCapturePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2PvminstancesCapturePostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/p_cloud_placement_groups_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/p_cloud_placement_groups_client.go new file mode 100644 index 00000000000..85828def897 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/p_cloud_placement_groups_client.go @@ -0,0 +1,285 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_placement_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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud placement groups API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud placement groups API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudPlacementgroupsDelete(params *PcloudPlacementgroupsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsDeleteOK, error) + + PcloudPlacementgroupsGet(params *PcloudPlacementgroupsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsGetOK, error) + + PcloudPlacementgroupsGetall(params *PcloudPlacementgroupsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsGetallOK, error) + + PcloudPlacementgroupsMembersDelete(params *PcloudPlacementgroupsMembersDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsMembersDeleteOK, error) + + PcloudPlacementgroupsMembersPost(params *PcloudPlacementgroupsMembersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsMembersPostOK, error) + + PcloudPlacementgroupsPost(params *PcloudPlacementgroupsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsPostOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudPlacementgroupsDelete deletes server placement group +*/ +func (a *Client) PcloudPlacementgroupsDelete(params *PcloudPlacementgroupsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPlacementgroupsDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.placementgroups.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPlacementgroupsDeleteReader{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.(*PcloudPlacementgroupsDeleteOK) + 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 pcloud.placementgroups.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPlacementgroupsGet gets server placement group detail +*/ +func (a *Client) PcloudPlacementgroupsGet(params *PcloudPlacementgroupsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPlacementgroupsGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.placementgroups.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPlacementgroupsGetReader{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.(*PcloudPlacementgroupsGetOK) + 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 pcloud.placementgroups.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPlacementgroupsGetall gets all server placement groups +*/ +func (a *Client) PcloudPlacementgroupsGetall(params *PcloudPlacementgroupsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPlacementgroupsGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.placementgroups.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPlacementgroupsGetallReader{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.(*PcloudPlacementgroupsGetallOK) + 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 pcloud.placementgroups.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPlacementgroupsMembersDelete removes server from placement group +*/ +func (a *Client) PcloudPlacementgroupsMembersDelete(params *PcloudPlacementgroupsMembersDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsMembersDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPlacementgroupsMembersDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.placementgroups.members.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPlacementgroupsMembersDeleteReader{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.(*PcloudPlacementgroupsMembersDeleteOK) + 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 pcloud.placementgroups.members.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPlacementgroupsMembersPost adds server to placement group +*/ +func (a *Client) PcloudPlacementgroupsMembersPost(params *PcloudPlacementgroupsMembersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsMembersPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPlacementgroupsMembersPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.placementgroups.members.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPlacementgroupsMembersPostReader{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.(*PcloudPlacementgroupsMembersPostOK) + 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 pcloud.placementgroups.members.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPlacementgroupsPost creates a new server placement group +*/ +func (a *Client) PcloudPlacementgroupsPost(params *PcloudPlacementgroupsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPlacementgroupsPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPlacementgroupsPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.placementgroups.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPlacementgroupsPostReader{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.(*PcloudPlacementgroupsPostOK) + 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 pcloud.placementgroups.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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_delete_parameters.go new file mode 100644 index 00000000000..a81176ab48f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_delete_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_placement_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" +) + +// NewPcloudPlacementgroupsDeleteParams creates a new PcloudPlacementgroupsDeleteParams 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 NewPcloudPlacementgroupsDeleteParams() *PcloudPlacementgroupsDeleteParams { + return &PcloudPlacementgroupsDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPlacementgroupsDeleteParamsWithTimeout creates a new PcloudPlacementgroupsDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudPlacementgroupsDeleteParamsWithTimeout(timeout time.Duration) *PcloudPlacementgroupsDeleteParams { + return &PcloudPlacementgroupsDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudPlacementgroupsDeleteParamsWithContext creates a new PcloudPlacementgroupsDeleteParams object +// with the ability to set a context for a request. +func NewPcloudPlacementgroupsDeleteParamsWithContext(ctx context.Context) *PcloudPlacementgroupsDeleteParams { + return &PcloudPlacementgroupsDeleteParams{ + Context: ctx, + } +} + +// NewPcloudPlacementgroupsDeleteParamsWithHTTPClient creates a new PcloudPlacementgroupsDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPlacementgroupsDeleteParamsWithHTTPClient(client *http.Client) *PcloudPlacementgroupsDeleteParams { + return &PcloudPlacementgroupsDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudPlacementgroupsDeleteParams contains all the parameters to send to the API endpoint + for the pcloud placementgroups delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudPlacementgroupsDeleteParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PlacementGroupID. + + Placement Group ID + */ + PlacementGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud placementgroups delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsDeleteParams) WithDefaults() *PcloudPlacementgroupsDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud placementgroups delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud placementgroups delete params +func (o *PcloudPlacementgroupsDeleteParams) WithTimeout(timeout time.Duration) *PcloudPlacementgroupsDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud placementgroups delete params +func (o *PcloudPlacementgroupsDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud placementgroups delete params +func (o *PcloudPlacementgroupsDeleteParams) WithContext(ctx context.Context) *PcloudPlacementgroupsDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud placementgroups delete params +func (o *PcloudPlacementgroupsDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud placementgroups delete params +func (o *PcloudPlacementgroupsDeleteParams) WithHTTPClient(client *http.Client) *PcloudPlacementgroupsDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud placementgroups delete params +func (o *PcloudPlacementgroupsDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud placementgroups delete params +func (o *PcloudPlacementgroupsDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPlacementgroupsDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud placementgroups delete params +func (o *PcloudPlacementgroupsDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPlacementGroupID adds the placementGroupID to the pcloud placementgroups delete params +func (o *PcloudPlacementgroupsDeleteParams) WithPlacementGroupID(placementGroupID string) *PcloudPlacementgroupsDeleteParams { + o.SetPlacementGroupID(placementGroupID) + return o +} + +// SetPlacementGroupID adds the placementGroupId to the pcloud placementgroups delete params +func (o *PcloudPlacementgroupsDeleteParams) SetPlacementGroupID(placementGroupID string) { + o.PlacementGroupID = placementGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPlacementgroupsDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param placement_group_id + if err := r.SetPathParam("placement_group_id", o.PlacementGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_delete_responses.go new file mode 100644 index 00000000000..7052f606440 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_delete_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_placement_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" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPlacementgroupsDeleteReader is a Reader for the PcloudPlacementgroupsDelete structure. +type PcloudPlacementgroupsDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPlacementgroupsDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPlacementgroupsDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPlacementgroupsDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPlacementgroupsDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPlacementgroupsDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPlacementgroupsDeleteOK creates a PcloudPlacementgroupsDeleteOK with default headers values +func NewPcloudPlacementgroupsDeleteOK() *PcloudPlacementgroupsDeleteOK { + return &PcloudPlacementgroupsDeleteOK{} +} + +/* PcloudPlacementgroupsDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPlacementgroupsDeleteOK struct { + Payload models.Object +} + +func (o *PcloudPlacementgroupsDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudPlacementgroupsDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudPlacementgroupsDeleteOK) 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 +} + +// NewPcloudPlacementgroupsDeleteBadRequest creates a PcloudPlacementgroupsDeleteBadRequest with default headers values +func NewPcloudPlacementgroupsDeleteBadRequest() *PcloudPlacementgroupsDeleteBadRequest { + return &PcloudPlacementgroupsDeleteBadRequest{} +} + +/* PcloudPlacementgroupsDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPlacementgroupsDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPlacementgroupsDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsDeleteBadRequest) 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 +} + +// NewPcloudPlacementgroupsDeleteNotFound creates a PcloudPlacementgroupsDeleteNotFound with default headers values +func NewPcloudPlacementgroupsDeleteNotFound() *PcloudPlacementgroupsDeleteNotFound { + return &PcloudPlacementgroupsDeleteNotFound{} +} + +/* PcloudPlacementgroupsDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPlacementgroupsDeleteNotFound struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsDeleteNotFound %+v", 404, o.Payload) +} +func (o *PcloudPlacementgroupsDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsDeleteNotFound) 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 +} + +// NewPcloudPlacementgroupsDeleteInternalServerError creates a PcloudPlacementgroupsDeleteInternalServerError with default headers values +func NewPcloudPlacementgroupsDeleteInternalServerError() *PcloudPlacementgroupsDeleteInternalServerError { + return &PcloudPlacementgroupsDeleteInternalServerError{} +} + +/* PcloudPlacementgroupsDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPlacementgroupsDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPlacementgroupsDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_get_parameters.go new file mode 100644 index 00000000000..7c9106fc5c8 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_placement_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" +) + +// NewPcloudPlacementgroupsGetParams creates a new PcloudPlacementgroupsGetParams 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 NewPcloudPlacementgroupsGetParams() *PcloudPlacementgroupsGetParams { + return &PcloudPlacementgroupsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPlacementgroupsGetParamsWithTimeout creates a new PcloudPlacementgroupsGetParams object +// with the ability to set a timeout on a request. +func NewPcloudPlacementgroupsGetParamsWithTimeout(timeout time.Duration) *PcloudPlacementgroupsGetParams { + return &PcloudPlacementgroupsGetParams{ + timeout: timeout, + } +} + +// NewPcloudPlacementgroupsGetParamsWithContext creates a new PcloudPlacementgroupsGetParams object +// with the ability to set a context for a request. +func NewPcloudPlacementgroupsGetParamsWithContext(ctx context.Context) *PcloudPlacementgroupsGetParams { + return &PcloudPlacementgroupsGetParams{ + Context: ctx, + } +} + +// NewPcloudPlacementgroupsGetParamsWithHTTPClient creates a new PcloudPlacementgroupsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPlacementgroupsGetParamsWithHTTPClient(client *http.Client) *PcloudPlacementgroupsGetParams { + return &PcloudPlacementgroupsGetParams{ + HTTPClient: client, + } +} + +/* PcloudPlacementgroupsGetParams contains all the parameters to send to the API endpoint + for the pcloud placementgroups get operation. + + Typically these are written to a http.Request. +*/ +type PcloudPlacementgroupsGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PlacementGroupID. + + Placement Group ID + */ + PlacementGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud placementgroups get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsGetParams) WithDefaults() *PcloudPlacementgroupsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud placementgroups get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud placementgroups get params +func (o *PcloudPlacementgroupsGetParams) WithTimeout(timeout time.Duration) *PcloudPlacementgroupsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud placementgroups get params +func (o *PcloudPlacementgroupsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud placementgroups get params +func (o *PcloudPlacementgroupsGetParams) WithContext(ctx context.Context) *PcloudPlacementgroupsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud placementgroups get params +func (o *PcloudPlacementgroupsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud placementgroups get params +func (o *PcloudPlacementgroupsGetParams) WithHTTPClient(client *http.Client) *PcloudPlacementgroupsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud placementgroups get params +func (o *PcloudPlacementgroupsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud placementgroups get params +func (o *PcloudPlacementgroupsGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPlacementgroupsGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud placementgroups get params +func (o *PcloudPlacementgroupsGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPlacementGroupID adds the placementGroupID to the pcloud placementgroups get params +func (o *PcloudPlacementgroupsGetParams) WithPlacementGroupID(placementGroupID string) *PcloudPlacementgroupsGetParams { + o.SetPlacementGroupID(placementGroupID) + return o +} + +// SetPlacementGroupID adds the placementGroupId to the pcloud placementgroups get params +func (o *PcloudPlacementgroupsGetParams) SetPlacementGroupID(placementGroupID string) { + o.PlacementGroupID = placementGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPlacementgroupsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param placement_group_id + if err := r.SetPathParam("placement_group_id", o.PlacementGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_get_responses.go new file mode 100644 index 00000000000..8a3a7acf9b9 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_get_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_placement_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" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPlacementgroupsGetReader is a Reader for the PcloudPlacementgroupsGet structure. +type PcloudPlacementgroupsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPlacementgroupsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPlacementgroupsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPlacementgroupsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPlacementgroupsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPlacementgroupsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPlacementgroupsGetOK creates a PcloudPlacementgroupsGetOK with default headers values +func NewPcloudPlacementgroupsGetOK() *PcloudPlacementgroupsGetOK { + return &PcloudPlacementgroupsGetOK{} +} + +/* PcloudPlacementgroupsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPlacementgroupsGetOK struct { + Payload *models.PlacementGroup +} + +func (o *PcloudPlacementgroupsGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsGetOK %+v", 200, o.Payload) +} +func (o *PcloudPlacementgroupsGetOK) GetPayload() *models.PlacementGroup { + return o.Payload +} + +func (o *PcloudPlacementgroupsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PlacementGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPlacementgroupsGetBadRequest creates a PcloudPlacementgroupsGetBadRequest with default headers values +func NewPcloudPlacementgroupsGetBadRequest() *PcloudPlacementgroupsGetBadRequest { + return &PcloudPlacementgroupsGetBadRequest{} +} + +/* PcloudPlacementgroupsGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPlacementgroupsGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPlacementgroupsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsGetBadRequest) 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 +} + +// NewPcloudPlacementgroupsGetNotFound creates a PcloudPlacementgroupsGetNotFound with default headers values +func NewPcloudPlacementgroupsGetNotFound() *PcloudPlacementgroupsGetNotFound { + return &PcloudPlacementgroupsGetNotFound{} +} + +/* PcloudPlacementgroupsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPlacementgroupsGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudPlacementgroupsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsGetNotFound) 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 +} + +// NewPcloudPlacementgroupsGetInternalServerError creates a PcloudPlacementgroupsGetInternalServerError with default headers values +func NewPcloudPlacementgroupsGetInternalServerError() *PcloudPlacementgroupsGetInternalServerError { + return &PcloudPlacementgroupsGetInternalServerError{} +} + +/* PcloudPlacementgroupsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPlacementgroupsGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}][%d] pcloudPlacementgroupsGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPlacementgroupsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_getall_parameters.go new file mode 100644 index 00000000000..07366c2d8b1 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_getall_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_placement_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" +) + +// NewPcloudPlacementgroupsGetallParams creates a new PcloudPlacementgroupsGetallParams 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 NewPcloudPlacementgroupsGetallParams() *PcloudPlacementgroupsGetallParams { + return &PcloudPlacementgroupsGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPlacementgroupsGetallParamsWithTimeout creates a new PcloudPlacementgroupsGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudPlacementgroupsGetallParamsWithTimeout(timeout time.Duration) *PcloudPlacementgroupsGetallParams { + return &PcloudPlacementgroupsGetallParams{ + timeout: timeout, + } +} + +// NewPcloudPlacementgroupsGetallParamsWithContext creates a new PcloudPlacementgroupsGetallParams object +// with the ability to set a context for a request. +func NewPcloudPlacementgroupsGetallParamsWithContext(ctx context.Context) *PcloudPlacementgroupsGetallParams { + return &PcloudPlacementgroupsGetallParams{ + Context: ctx, + } +} + +// NewPcloudPlacementgroupsGetallParamsWithHTTPClient creates a new PcloudPlacementgroupsGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPlacementgroupsGetallParamsWithHTTPClient(client *http.Client) *PcloudPlacementgroupsGetallParams { + return &PcloudPlacementgroupsGetallParams{ + HTTPClient: client, + } +} + +/* PcloudPlacementgroupsGetallParams contains all the parameters to send to the API endpoint + for the pcloud placementgroups getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudPlacementgroupsGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud placementgroups getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsGetallParams) WithDefaults() *PcloudPlacementgroupsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud placementgroups getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud placementgroups getall params +func (o *PcloudPlacementgroupsGetallParams) WithTimeout(timeout time.Duration) *PcloudPlacementgroupsGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud placementgroups getall params +func (o *PcloudPlacementgroupsGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud placementgroups getall params +func (o *PcloudPlacementgroupsGetallParams) WithContext(ctx context.Context) *PcloudPlacementgroupsGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud placementgroups getall params +func (o *PcloudPlacementgroupsGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud placementgroups getall params +func (o *PcloudPlacementgroupsGetallParams) WithHTTPClient(client *http.Client) *PcloudPlacementgroupsGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud placementgroups getall params +func (o *PcloudPlacementgroupsGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud placementgroups getall params +func (o *PcloudPlacementgroupsGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPlacementgroupsGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud placementgroups getall params +func (o *PcloudPlacementgroupsGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPlacementgroupsGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_getall_responses.go new file mode 100644 index 00000000000..7263ac5fa8e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_getall_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_placement_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" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPlacementgroupsGetallReader is a Reader for the PcloudPlacementgroupsGetall structure. +type PcloudPlacementgroupsGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPlacementgroupsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPlacementgroupsGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPlacementgroupsGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPlacementgroupsGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPlacementgroupsGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPlacementgroupsGetallOK creates a PcloudPlacementgroupsGetallOK with default headers values +func NewPcloudPlacementgroupsGetallOK() *PcloudPlacementgroupsGetallOK { + return &PcloudPlacementgroupsGetallOK{} +} + +/* PcloudPlacementgroupsGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPlacementgroupsGetallOK struct { + Payload *models.PlacementGroups +} + +func (o *PcloudPlacementgroupsGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsGetallOK %+v", 200, o.Payload) +} +func (o *PcloudPlacementgroupsGetallOK) GetPayload() *models.PlacementGroups { + return o.Payload +} + +func (o *PcloudPlacementgroupsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PlacementGroups) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPlacementgroupsGetallBadRequest creates a PcloudPlacementgroupsGetallBadRequest with default headers values +func NewPcloudPlacementgroupsGetallBadRequest() *PcloudPlacementgroupsGetallBadRequest { + return &PcloudPlacementgroupsGetallBadRequest{} +} + +/* PcloudPlacementgroupsGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPlacementgroupsGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPlacementgroupsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsGetallBadRequest) 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 +} + +// NewPcloudPlacementgroupsGetallUnauthorized creates a PcloudPlacementgroupsGetallUnauthorized with default headers values +func NewPcloudPlacementgroupsGetallUnauthorized() *PcloudPlacementgroupsGetallUnauthorized { + return &PcloudPlacementgroupsGetallUnauthorized{} +} + +/* PcloudPlacementgroupsGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPlacementgroupsGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPlacementgroupsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsGetallUnauthorized) 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 +} + +// NewPcloudPlacementgroupsGetallInternalServerError creates a PcloudPlacementgroupsGetallInternalServerError with default headers values +func NewPcloudPlacementgroupsGetallInternalServerError() *PcloudPlacementgroupsGetallInternalServerError { + return &PcloudPlacementgroupsGetallInternalServerError{} +} + +/* PcloudPlacementgroupsGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPlacementgroupsGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPlacementgroupsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_delete_parameters.go new file mode 100644 index 00000000000..c860277a23c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_delete_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_placement_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" +) + +// NewPcloudPlacementgroupsMembersDeleteParams creates a new PcloudPlacementgroupsMembersDeleteParams 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 NewPcloudPlacementgroupsMembersDeleteParams() *PcloudPlacementgroupsMembersDeleteParams { + return &PcloudPlacementgroupsMembersDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPlacementgroupsMembersDeleteParamsWithTimeout creates a new PcloudPlacementgroupsMembersDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudPlacementgroupsMembersDeleteParamsWithTimeout(timeout time.Duration) *PcloudPlacementgroupsMembersDeleteParams { + return &PcloudPlacementgroupsMembersDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudPlacementgroupsMembersDeleteParamsWithContext creates a new PcloudPlacementgroupsMembersDeleteParams object +// with the ability to set a context for a request. +func NewPcloudPlacementgroupsMembersDeleteParamsWithContext(ctx context.Context) *PcloudPlacementgroupsMembersDeleteParams { + return &PcloudPlacementgroupsMembersDeleteParams{ + Context: ctx, + } +} + +// NewPcloudPlacementgroupsMembersDeleteParamsWithHTTPClient creates a new PcloudPlacementgroupsMembersDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPlacementgroupsMembersDeleteParamsWithHTTPClient(client *http.Client) *PcloudPlacementgroupsMembersDeleteParams { + return &PcloudPlacementgroupsMembersDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudPlacementgroupsMembersDeleteParams contains all the parameters to send to the API endpoint + for the pcloud placementgroups members delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudPlacementgroupsMembersDeleteParams struct { + + /* Body. + + Parameters for removing a Server in a Placement Group + */ + Body *models.PlacementGroupServer + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PlacementGroupID. + + Placement Group ID + */ + PlacementGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud placementgroups members delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsMembersDeleteParams) WithDefaults() *PcloudPlacementgroupsMembersDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud placementgroups members delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsMembersDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud placementgroups members delete params +func (o *PcloudPlacementgroupsMembersDeleteParams) WithTimeout(timeout time.Duration) *PcloudPlacementgroupsMembersDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud placementgroups members delete params +func (o *PcloudPlacementgroupsMembersDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud placementgroups members delete params +func (o *PcloudPlacementgroupsMembersDeleteParams) WithContext(ctx context.Context) *PcloudPlacementgroupsMembersDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud placementgroups members delete params +func (o *PcloudPlacementgroupsMembersDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud placementgroups members delete params +func (o *PcloudPlacementgroupsMembersDeleteParams) WithHTTPClient(client *http.Client) *PcloudPlacementgroupsMembersDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud placementgroups members delete params +func (o *PcloudPlacementgroupsMembersDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud placementgroups members delete params +func (o *PcloudPlacementgroupsMembersDeleteParams) WithBody(body *models.PlacementGroupServer) *PcloudPlacementgroupsMembersDeleteParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud placementgroups members delete params +func (o *PcloudPlacementgroupsMembersDeleteParams) SetBody(body *models.PlacementGroupServer) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud placementgroups members delete params +func (o *PcloudPlacementgroupsMembersDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPlacementgroupsMembersDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud placementgroups members delete params +func (o *PcloudPlacementgroupsMembersDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPlacementGroupID adds the placementGroupID to the pcloud placementgroups members delete params +func (o *PcloudPlacementgroupsMembersDeleteParams) WithPlacementGroupID(placementGroupID string) *PcloudPlacementgroupsMembersDeleteParams { + o.SetPlacementGroupID(placementGroupID) + return o +} + +// SetPlacementGroupID adds the placementGroupId to the pcloud placementgroups members delete params +func (o *PcloudPlacementgroupsMembersDeleteParams) SetPlacementGroupID(placementGroupID string) { + o.PlacementGroupID = placementGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPlacementgroupsMembersDeleteParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param placement_group_id + if err := r.SetPathParam("placement_group_id", o.PlacementGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_delete_responses.go new file mode 100644 index 00000000000..513178760f2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_delete_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_placement_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" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPlacementgroupsMembersDeleteReader is a Reader for the PcloudPlacementgroupsMembersDelete structure. +type PcloudPlacementgroupsMembersDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPlacementgroupsMembersDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPlacementgroupsMembersDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPlacementgroupsMembersDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPlacementgroupsMembersDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudPlacementgroupsMembersDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudPlacementgroupsMembersDeleteUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPlacementgroupsMembersDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPlacementgroupsMembersDeleteOK creates a PcloudPlacementgroupsMembersDeleteOK with default headers values +func NewPcloudPlacementgroupsMembersDeleteOK() *PcloudPlacementgroupsMembersDeleteOK { + return &PcloudPlacementgroupsMembersDeleteOK{} +} + +/* PcloudPlacementgroupsMembersDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPlacementgroupsMembersDeleteOK struct { + Payload *models.PlacementGroup +} + +func (o *PcloudPlacementgroupsMembersDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudPlacementgroupsMembersDeleteOK) GetPayload() *models.PlacementGroup { + return o.Payload +} + +func (o *PcloudPlacementgroupsMembersDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PlacementGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPlacementgroupsMembersDeleteBadRequest creates a PcloudPlacementgroupsMembersDeleteBadRequest with default headers values +func NewPcloudPlacementgroupsMembersDeleteBadRequest() *PcloudPlacementgroupsMembersDeleteBadRequest { + return &PcloudPlacementgroupsMembersDeleteBadRequest{} +} + +/* PcloudPlacementgroupsMembersDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPlacementgroupsMembersDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsMembersDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPlacementgroupsMembersDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsMembersDeleteBadRequest) 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 +} + +// NewPcloudPlacementgroupsMembersDeleteNotFound creates a PcloudPlacementgroupsMembersDeleteNotFound with default headers values +func NewPcloudPlacementgroupsMembersDeleteNotFound() *PcloudPlacementgroupsMembersDeleteNotFound { + return &PcloudPlacementgroupsMembersDeleteNotFound{} +} + +/* PcloudPlacementgroupsMembersDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPlacementgroupsMembersDeleteNotFound struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsMembersDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersDeleteNotFound %+v", 404, o.Payload) +} +func (o *PcloudPlacementgroupsMembersDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsMembersDeleteNotFound) 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 +} + +// NewPcloudPlacementgroupsMembersDeleteConflict creates a PcloudPlacementgroupsMembersDeleteConflict with default headers values +func NewPcloudPlacementgroupsMembersDeleteConflict() *PcloudPlacementgroupsMembersDeleteConflict { + return &PcloudPlacementgroupsMembersDeleteConflict{} +} + +/* PcloudPlacementgroupsMembersDeleteConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudPlacementgroupsMembersDeleteConflict struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsMembersDeleteConflict) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersDeleteConflict %+v", 409, o.Payload) +} +func (o *PcloudPlacementgroupsMembersDeleteConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsMembersDeleteConflict) 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 +} + +// NewPcloudPlacementgroupsMembersDeleteUnprocessableEntity creates a PcloudPlacementgroupsMembersDeleteUnprocessableEntity with default headers values +func NewPcloudPlacementgroupsMembersDeleteUnprocessableEntity() *PcloudPlacementgroupsMembersDeleteUnprocessableEntity { + return &PcloudPlacementgroupsMembersDeleteUnprocessableEntity{} +} + +/* PcloudPlacementgroupsMembersDeleteUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudPlacementgroupsMembersDeleteUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsMembersDeleteUnprocessableEntity) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersDeleteUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudPlacementgroupsMembersDeleteUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsMembersDeleteUnprocessableEntity) 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 +} + +// NewPcloudPlacementgroupsMembersDeleteInternalServerError creates a PcloudPlacementgroupsMembersDeleteInternalServerError with default headers values +func NewPcloudPlacementgroupsMembersDeleteInternalServerError() *PcloudPlacementgroupsMembersDeleteInternalServerError { + return &PcloudPlacementgroupsMembersDeleteInternalServerError{} +} + +/* PcloudPlacementgroupsMembersDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPlacementgroupsMembersDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsMembersDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPlacementgroupsMembersDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsMembersDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_post_parameters.go new file mode 100644 index 00000000000..8f9106c1834 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_post_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_placement_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" +) + +// NewPcloudPlacementgroupsMembersPostParams creates a new PcloudPlacementgroupsMembersPostParams 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 NewPcloudPlacementgroupsMembersPostParams() *PcloudPlacementgroupsMembersPostParams { + return &PcloudPlacementgroupsMembersPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPlacementgroupsMembersPostParamsWithTimeout creates a new PcloudPlacementgroupsMembersPostParams object +// with the ability to set a timeout on a request. +func NewPcloudPlacementgroupsMembersPostParamsWithTimeout(timeout time.Duration) *PcloudPlacementgroupsMembersPostParams { + return &PcloudPlacementgroupsMembersPostParams{ + timeout: timeout, + } +} + +// NewPcloudPlacementgroupsMembersPostParamsWithContext creates a new PcloudPlacementgroupsMembersPostParams object +// with the ability to set a context for a request. +func NewPcloudPlacementgroupsMembersPostParamsWithContext(ctx context.Context) *PcloudPlacementgroupsMembersPostParams { + return &PcloudPlacementgroupsMembersPostParams{ + Context: ctx, + } +} + +// NewPcloudPlacementgroupsMembersPostParamsWithHTTPClient creates a new PcloudPlacementgroupsMembersPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPlacementgroupsMembersPostParamsWithHTTPClient(client *http.Client) *PcloudPlacementgroupsMembersPostParams { + return &PcloudPlacementgroupsMembersPostParams{ + HTTPClient: client, + } +} + +/* PcloudPlacementgroupsMembersPostParams contains all the parameters to send to the API endpoint + for the pcloud placementgroups members post operation. + + Typically these are written to a http.Request. +*/ +type PcloudPlacementgroupsMembersPostParams struct { + + /* Body. + + Parameters for adding a server to a Server Placement Group + */ + Body *models.PlacementGroupServer + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PlacementGroupID. + + Placement Group ID + */ + PlacementGroupID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud placementgroups members post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsMembersPostParams) WithDefaults() *PcloudPlacementgroupsMembersPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud placementgroups members post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsMembersPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud placementgroups members post params +func (o *PcloudPlacementgroupsMembersPostParams) WithTimeout(timeout time.Duration) *PcloudPlacementgroupsMembersPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud placementgroups members post params +func (o *PcloudPlacementgroupsMembersPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud placementgroups members post params +func (o *PcloudPlacementgroupsMembersPostParams) WithContext(ctx context.Context) *PcloudPlacementgroupsMembersPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud placementgroups members post params +func (o *PcloudPlacementgroupsMembersPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud placementgroups members post params +func (o *PcloudPlacementgroupsMembersPostParams) WithHTTPClient(client *http.Client) *PcloudPlacementgroupsMembersPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud placementgroups members post params +func (o *PcloudPlacementgroupsMembersPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud placementgroups members post params +func (o *PcloudPlacementgroupsMembersPostParams) WithBody(body *models.PlacementGroupServer) *PcloudPlacementgroupsMembersPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud placementgroups members post params +func (o *PcloudPlacementgroupsMembersPostParams) SetBody(body *models.PlacementGroupServer) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud placementgroups members post params +func (o *PcloudPlacementgroupsMembersPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPlacementgroupsMembersPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud placementgroups members post params +func (o *PcloudPlacementgroupsMembersPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPlacementGroupID adds the placementGroupID to the pcloud placementgroups members post params +func (o *PcloudPlacementgroupsMembersPostParams) WithPlacementGroupID(placementGroupID string) *PcloudPlacementgroupsMembersPostParams { + o.SetPlacementGroupID(placementGroupID) + return o +} + +// SetPlacementGroupID adds the placementGroupId to the pcloud placementgroups members post params +func (o *PcloudPlacementgroupsMembersPostParams) SetPlacementGroupID(placementGroupID string) { + o.PlacementGroupID = placementGroupID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPlacementgroupsMembersPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param placement_group_id + if err := r.SetPathParam("placement_group_id", o.PlacementGroupID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_post_responses.go new file mode 100644 index 00000000000..c7d53f939b8 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_members_post_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_placement_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" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPlacementgroupsMembersPostReader is a Reader for the PcloudPlacementgroupsMembersPost structure. +type PcloudPlacementgroupsMembersPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPlacementgroupsMembersPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPlacementgroupsMembersPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPlacementgroupsMembersPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPlacementgroupsMembersPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudPlacementgroupsMembersPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudPlacementgroupsMembersPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPlacementgroupsMembersPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPlacementgroupsMembersPostOK creates a PcloudPlacementgroupsMembersPostOK with default headers values +func NewPcloudPlacementgroupsMembersPostOK() *PcloudPlacementgroupsMembersPostOK { + return &PcloudPlacementgroupsMembersPostOK{} +} + +/* PcloudPlacementgroupsMembersPostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPlacementgroupsMembersPostOK struct { + Payload *models.PlacementGroup +} + +func (o *PcloudPlacementgroupsMembersPostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersPostOK %+v", 200, o.Payload) +} +func (o *PcloudPlacementgroupsMembersPostOK) GetPayload() *models.PlacementGroup { + return o.Payload +} + +func (o *PcloudPlacementgroupsMembersPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PlacementGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPlacementgroupsMembersPostBadRequest creates a PcloudPlacementgroupsMembersPostBadRequest with default headers values +func NewPcloudPlacementgroupsMembersPostBadRequest() *PcloudPlacementgroupsMembersPostBadRequest { + return &PcloudPlacementgroupsMembersPostBadRequest{} +} + +/* PcloudPlacementgroupsMembersPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPlacementgroupsMembersPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsMembersPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPlacementgroupsMembersPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsMembersPostBadRequest) 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 +} + +// NewPcloudPlacementgroupsMembersPostNotFound creates a PcloudPlacementgroupsMembersPostNotFound with default headers values +func NewPcloudPlacementgroupsMembersPostNotFound() *PcloudPlacementgroupsMembersPostNotFound { + return &PcloudPlacementgroupsMembersPostNotFound{} +} + +/* PcloudPlacementgroupsMembersPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPlacementgroupsMembersPostNotFound struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsMembersPostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersPostNotFound %+v", 404, o.Payload) +} +func (o *PcloudPlacementgroupsMembersPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsMembersPostNotFound) 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 +} + +// NewPcloudPlacementgroupsMembersPostConflict creates a PcloudPlacementgroupsMembersPostConflict with default headers values +func NewPcloudPlacementgroupsMembersPostConflict() *PcloudPlacementgroupsMembersPostConflict { + return &PcloudPlacementgroupsMembersPostConflict{} +} + +/* PcloudPlacementgroupsMembersPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudPlacementgroupsMembersPostConflict struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsMembersPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersPostConflict %+v", 409, o.Payload) +} +func (o *PcloudPlacementgroupsMembersPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsMembersPostConflict) 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 +} + +// NewPcloudPlacementgroupsMembersPostUnprocessableEntity creates a PcloudPlacementgroupsMembersPostUnprocessableEntity with default headers values +func NewPcloudPlacementgroupsMembersPostUnprocessableEntity() *PcloudPlacementgroupsMembersPostUnprocessableEntity { + return &PcloudPlacementgroupsMembersPostUnprocessableEntity{} +} + +/* PcloudPlacementgroupsMembersPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudPlacementgroupsMembersPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsMembersPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudPlacementgroupsMembersPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsMembersPostUnprocessableEntity) 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 +} + +// NewPcloudPlacementgroupsMembersPostInternalServerError creates a PcloudPlacementgroupsMembersPostInternalServerError with default headers values +func NewPcloudPlacementgroupsMembersPostInternalServerError() *PcloudPlacementgroupsMembersPostInternalServerError { + return &PcloudPlacementgroupsMembersPostInternalServerError{} +} + +/* PcloudPlacementgroupsMembersPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPlacementgroupsMembersPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsMembersPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups/{placement_group_id}/members][%d] pcloudPlacementgroupsMembersPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPlacementgroupsMembersPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsMembersPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_post_parameters.go new file mode 100644 index 00000000000..2bb2348af3a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_placement_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" +) + +// NewPcloudPlacementgroupsPostParams creates a new PcloudPlacementgroupsPostParams 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 NewPcloudPlacementgroupsPostParams() *PcloudPlacementgroupsPostParams { + return &PcloudPlacementgroupsPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPlacementgroupsPostParamsWithTimeout creates a new PcloudPlacementgroupsPostParams object +// with the ability to set a timeout on a request. +func NewPcloudPlacementgroupsPostParamsWithTimeout(timeout time.Duration) *PcloudPlacementgroupsPostParams { + return &PcloudPlacementgroupsPostParams{ + timeout: timeout, + } +} + +// NewPcloudPlacementgroupsPostParamsWithContext creates a new PcloudPlacementgroupsPostParams object +// with the ability to set a context for a request. +func NewPcloudPlacementgroupsPostParamsWithContext(ctx context.Context) *PcloudPlacementgroupsPostParams { + return &PcloudPlacementgroupsPostParams{ + Context: ctx, + } +} + +// NewPcloudPlacementgroupsPostParamsWithHTTPClient creates a new PcloudPlacementgroupsPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPlacementgroupsPostParamsWithHTTPClient(client *http.Client) *PcloudPlacementgroupsPostParams { + return &PcloudPlacementgroupsPostParams{ + HTTPClient: client, + } +} + +/* PcloudPlacementgroupsPostParams contains all the parameters to send to the API endpoint + for the pcloud placementgroups post operation. + + Typically these are written to a http.Request. +*/ +type PcloudPlacementgroupsPostParams struct { + + /* Body. + + Parameters for the creation of a new Server Placement Group + */ + Body *models.PlacementGroupCreate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud placementgroups post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsPostParams) WithDefaults() *PcloudPlacementgroupsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud placementgroups post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPlacementgroupsPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud placementgroups post params +func (o *PcloudPlacementgroupsPostParams) WithTimeout(timeout time.Duration) *PcloudPlacementgroupsPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud placementgroups post params +func (o *PcloudPlacementgroupsPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud placementgroups post params +func (o *PcloudPlacementgroupsPostParams) WithContext(ctx context.Context) *PcloudPlacementgroupsPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud placementgroups post params +func (o *PcloudPlacementgroupsPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud placementgroups post params +func (o *PcloudPlacementgroupsPostParams) WithHTTPClient(client *http.Client) *PcloudPlacementgroupsPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud placementgroups post params +func (o *PcloudPlacementgroupsPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud placementgroups post params +func (o *PcloudPlacementgroupsPostParams) WithBody(body *models.PlacementGroupCreate) *PcloudPlacementgroupsPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud placementgroups post params +func (o *PcloudPlacementgroupsPostParams) SetBody(body *models.PlacementGroupCreate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud placementgroups post params +func (o *PcloudPlacementgroupsPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPlacementgroupsPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud placementgroups post params +func (o *PcloudPlacementgroupsPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPlacementgroupsPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_post_responses.go new file mode 100644 index 00000000000..448359f1992 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups/pcloud_placementgroups_post_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_placement_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" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPlacementgroupsPostReader is a Reader for the PcloudPlacementgroupsPost structure. +type PcloudPlacementgroupsPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPlacementgroupsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPlacementgroupsPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPlacementgroupsPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudPlacementgroupsPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudPlacementgroupsPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPlacementgroupsPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPlacementgroupsPostOK creates a PcloudPlacementgroupsPostOK with default headers values +func NewPcloudPlacementgroupsPostOK() *PcloudPlacementgroupsPostOK { + return &PcloudPlacementgroupsPostOK{} +} + +/* PcloudPlacementgroupsPostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPlacementgroupsPostOK struct { + Payload *models.PlacementGroup +} + +func (o *PcloudPlacementgroupsPostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsPostOK %+v", 200, o.Payload) +} +func (o *PcloudPlacementgroupsPostOK) GetPayload() *models.PlacementGroup { + return o.Payload +} + +func (o *PcloudPlacementgroupsPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PlacementGroup) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPlacementgroupsPostBadRequest creates a PcloudPlacementgroupsPostBadRequest with default headers values +func NewPcloudPlacementgroupsPostBadRequest() *PcloudPlacementgroupsPostBadRequest { + return &PcloudPlacementgroupsPostBadRequest{} +} + +/* PcloudPlacementgroupsPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPlacementgroupsPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPlacementgroupsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsPostBadRequest) 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 +} + +// NewPcloudPlacementgroupsPostConflict creates a PcloudPlacementgroupsPostConflict with default headers values +func NewPcloudPlacementgroupsPostConflict() *PcloudPlacementgroupsPostConflict { + return &PcloudPlacementgroupsPostConflict{} +} + +/* PcloudPlacementgroupsPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudPlacementgroupsPostConflict struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsPostConflict %+v", 409, o.Payload) +} +func (o *PcloudPlacementgroupsPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsPostConflict) 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 +} + +// NewPcloudPlacementgroupsPostUnprocessableEntity creates a PcloudPlacementgroupsPostUnprocessableEntity with default headers values +func NewPcloudPlacementgroupsPostUnprocessableEntity() *PcloudPlacementgroupsPostUnprocessableEntity { + return &PcloudPlacementgroupsPostUnprocessableEntity{} +} + +/* PcloudPlacementgroupsPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudPlacementgroupsPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudPlacementgroupsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsPostUnprocessableEntity) 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 +} + +// NewPcloudPlacementgroupsPostInternalServerError creates a PcloudPlacementgroupsPostInternalServerError with default headers values +func NewPcloudPlacementgroupsPostInternalServerError() *PcloudPlacementgroupsPostInternalServerError { + return &PcloudPlacementgroupsPostInternalServerError{} +} + +/* PcloudPlacementgroupsPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPlacementgroupsPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPlacementgroupsPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/placement-groups][%d] pcloudPlacementgroupsPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPlacementgroupsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPlacementgroupsPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/p_cloudsap_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/p_cloudsap_client.go new file mode 100644 index 00000000000..0504c37c91e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/p_cloudsap_client.go @@ -0,0 +1,165 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_s_a_p + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud s a p API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud s a p API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudSapGet(params *PcloudSapGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSapGetOK, error) + + PcloudSapGetall(params *PcloudSapGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSapGetallOK, error) + + PcloudSapPost(params *PcloudSapPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSapPostOK, *PcloudSapPostCreated, *PcloudSapPostAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudSapGet gets the information on an s a p profile +*/ +func (a *Client) PcloudSapGet(params *PcloudSapGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSapGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudSapGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.sap.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/sap/{sap_profile_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudSapGetReader{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.(*PcloudSapGetOK) + 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 pcloud.sap.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudSapGetall gets list of s a p profiles +*/ +func (a *Client) PcloudSapGetall(params *PcloudSapGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSapGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudSapGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.sap.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/sap", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudSapGetallReader{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.(*PcloudSapGetallOK) + 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 pcloud.sap.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudSapPost creates a new s a p p VM instance +*/ +func (a *Client) PcloudSapPost(params *PcloudSapPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSapPostOK, *PcloudSapPostCreated, *PcloudSapPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudSapPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.sap.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/sap", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudSapPostReader{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, nil, err + } + switch value := result.(type) { + case *PcloudSapPostOK: + return value, nil, nil, nil + case *PcloudSapPostCreated: + return nil, value, nil, nil + case *PcloudSapPostAccepted: + return nil, 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 p_cloud_s_a_p: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_get_parameters.go new file mode 100644 index 00000000000..76081ddb140 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_s_a_p + +// 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" +) + +// NewPcloudSapGetParams creates a new PcloudSapGetParams 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 NewPcloudSapGetParams() *PcloudSapGetParams { + return &PcloudSapGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudSapGetParamsWithTimeout creates a new PcloudSapGetParams object +// with the ability to set a timeout on a request. +func NewPcloudSapGetParamsWithTimeout(timeout time.Duration) *PcloudSapGetParams { + return &PcloudSapGetParams{ + timeout: timeout, + } +} + +// NewPcloudSapGetParamsWithContext creates a new PcloudSapGetParams object +// with the ability to set a context for a request. +func NewPcloudSapGetParamsWithContext(ctx context.Context) *PcloudSapGetParams { + return &PcloudSapGetParams{ + Context: ctx, + } +} + +// NewPcloudSapGetParamsWithHTTPClient creates a new PcloudSapGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudSapGetParamsWithHTTPClient(client *http.Client) *PcloudSapGetParams { + return &PcloudSapGetParams{ + HTTPClient: client, + } +} + +/* PcloudSapGetParams contains all the parameters to send to the API endpoint + for the pcloud sap get operation. + + Typically these are written to a http.Request. +*/ +type PcloudSapGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* SapProfileID. + + SAP Profile ID + */ + SapProfileID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud sap get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSapGetParams) WithDefaults() *PcloudSapGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud sap get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSapGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud sap get params +func (o *PcloudSapGetParams) WithTimeout(timeout time.Duration) *PcloudSapGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud sap get params +func (o *PcloudSapGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud sap get params +func (o *PcloudSapGetParams) WithContext(ctx context.Context) *PcloudSapGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud sap get params +func (o *PcloudSapGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud sap get params +func (o *PcloudSapGetParams) WithHTTPClient(client *http.Client) *PcloudSapGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud sap get params +func (o *PcloudSapGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud sap get params +func (o *PcloudSapGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudSapGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud sap get params +func (o *PcloudSapGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithSapProfileID adds the sapProfileID to the pcloud sap get params +func (o *PcloudSapGetParams) WithSapProfileID(sapProfileID string) *PcloudSapGetParams { + o.SetSapProfileID(sapProfileID) + return o +} + +// SetSapProfileID adds the sapProfileId to the pcloud sap get params +func (o *PcloudSapGetParams) SetSapProfileID(sapProfileID string) { + o.SapProfileID = sapProfileID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudSapGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param sap_profile_id + if err := r.SetPathParam("sap_profile_id", o.SapProfileID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_get_responses.go new file mode 100644 index 00000000000..395448fd440 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_s_a_p + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudSapGetReader is a Reader for the PcloudSapGet structure. +type PcloudSapGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudSapGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudSapGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudSapGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudSapGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudSapGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudSapGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudSapGetOK creates a PcloudSapGetOK with default headers values +func NewPcloudSapGetOK() *PcloudSapGetOK { + return &PcloudSapGetOK{} +} + +/* PcloudSapGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudSapGetOK struct { + Payload *models.SAPProfile +} + +func (o *PcloudSapGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap/{sap_profile_id}][%d] pcloudSapGetOK %+v", 200, o.Payload) +} +func (o *PcloudSapGetOK) GetPayload() *models.SAPProfile { + return o.Payload +} + +func (o *PcloudSapGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SAPProfile) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudSapGetBadRequest creates a PcloudSapGetBadRequest with default headers values +func NewPcloudSapGetBadRequest() *PcloudSapGetBadRequest { + return &PcloudSapGetBadRequest{} +} + +/* PcloudSapGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudSapGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudSapGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap/{sap_profile_id}][%d] pcloudSapGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudSapGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudSapGetBadRequest) 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 +} + +// NewPcloudSapGetUnauthorized creates a PcloudSapGetUnauthorized with default headers values +func NewPcloudSapGetUnauthorized() *PcloudSapGetUnauthorized { + return &PcloudSapGetUnauthorized{} +} + +/* PcloudSapGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudSapGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudSapGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap/{sap_profile_id}][%d] pcloudSapGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudSapGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudSapGetUnauthorized) 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 +} + +// NewPcloudSapGetNotFound creates a PcloudSapGetNotFound with default headers values +func NewPcloudSapGetNotFound() *PcloudSapGetNotFound { + return &PcloudSapGetNotFound{} +} + +/* PcloudSapGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudSapGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudSapGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap/{sap_profile_id}][%d] pcloudSapGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudSapGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudSapGetNotFound) 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 +} + +// NewPcloudSapGetInternalServerError creates a PcloudSapGetInternalServerError with default headers values +func NewPcloudSapGetInternalServerError() *PcloudSapGetInternalServerError { + return &PcloudSapGetInternalServerError{} +} + +/* PcloudSapGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudSapGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudSapGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap/{sap_profile_id}][%d] pcloudSapGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudSapGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudSapGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_getall_parameters.go new file mode 100644 index 00000000000..725a1afc583 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_getall_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_s_a_p + +// 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" +) + +// NewPcloudSapGetallParams creates a new PcloudSapGetallParams 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 NewPcloudSapGetallParams() *PcloudSapGetallParams { + return &PcloudSapGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudSapGetallParamsWithTimeout creates a new PcloudSapGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudSapGetallParamsWithTimeout(timeout time.Duration) *PcloudSapGetallParams { + return &PcloudSapGetallParams{ + timeout: timeout, + } +} + +// NewPcloudSapGetallParamsWithContext creates a new PcloudSapGetallParams object +// with the ability to set a context for a request. +func NewPcloudSapGetallParamsWithContext(ctx context.Context) *PcloudSapGetallParams { + return &PcloudSapGetallParams{ + Context: ctx, + } +} + +// NewPcloudSapGetallParamsWithHTTPClient creates a new PcloudSapGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudSapGetallParamsWithHTTPClient(client *http.Client) *PcloudSapGetallParams { + return &PcloudSapGetallParams{ + HTTPClient: client, + } +} + +/* PcloudSapGetallParams contains all the parameters to send to the API endpoint + for the pcloud sap getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudSapGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud sap getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSapGetallParams) WithDefaults() *PcloudSapGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud sap getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSapGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud sap getall params +func (o *PcloudSapGetallParams) WithTimeout(timeout time.Duration) *PcloudSapGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud sap getall params +func (o *PcloudSapGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud sap getall params +func (o *PcloudSapGetallParams) WithContext(ctx context.Context) *PcloudSapGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud sap getall params +func (o *PcloudSapGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud sap getall params +func (o *PcloudSapGetallParams) WithHTTPClient(client *http.Client) *PcloudSapGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud sap getall params +func (o *PcloudSapGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud sap getall params +func (o *PcloudSapGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudSapGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud sap getall params +func (o *PcloudSapGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudSapGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_getall_responses.go new file mode 100644 index 00000000000..97b35e04c1a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_getall_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_s_a_p + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudSapGetallReader is a Reader for the PcloudSapGetall structure. +type PcloudSapGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudSapGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudSapGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudSapGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudSapGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudSapGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudSapGetallOK creates a PcloudSapGetallOK with default headers values +func NewPcloudSapGetallOK() *PcloudSapGetallOK { + return &PcloudSapGetallOK{} +} + +/* PcloudSapGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudSapGetallOK struct { + Payload *models.SAPProfiles +} + +func (o *PcloudSapGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapGetallOK %+v", 200, o.Payload) +} +func (o *PcloudSapGetallOK) GetPayload() *models.SAPProfiles { + return o.Payload +} + +func (o *PcloudSapGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SAPProfiles) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudSapGetallBadRequest creates a PcloudSapGetallBadRequest with default headers values +func NewPcloudSapGetallBadRequest() *PcloudSapGetallBadRequest { + return &PcloudSapGetallBadRequest{} +} + +/* PcloudSapGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudSapGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudSapGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudSapGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudSapGetallBadRequest) 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 +} + +// NewPcloudSapGetallUnauthorized creates a PcloudSapGetallUnauthorized with default headers values +func NewPcloudSapGetallUnauthorized() *PcloudSapGetallUnauthorized { + return &PcloudSapGetallUnauthorized{} +} + +/* PcloudSapGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudSapGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudSapGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudSapGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudSapGetallUnauthorized) 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 +} + +// NewPcloudSapGetallInternalServerError creates a PcloudSapGetallInternalServerError with default headers values +func NewPcloudSapGetallInternalServerError() *PcloudSapGetallInternalServerError { + return &PcloudSapGetallInternalServerError{} +} + +/* PcloudSapGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudSapGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudSapGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudSapGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudSapGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_post_parameters.go new file mode 100644 index 00000000000..1b8ad094aa3 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_s_a_p + +// 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" +) + +// NewPcloudSapPostParams creates a new PcloudSapPostParams 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 NewPcloudSapPostParams() *PcloudSapPostParams { + return &PcloudSapPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudSapPostParamsWithTimeout creates a new PcloudSapPostParams object +// with the ability to set a timeout on a request. +func NewPcloudSapPostParamsWithTimeout(timeout time.Duration) *PcloudSapPostParams { + return &PcloudSapPostParams{ + timeout: timeout, + } +} + +// NewPcloudSapPostParamsWithContext creates a new PcloudSapPostParams object +// with the ability to set a context for a request. +func NewPcloudSapPostParamsWithContext(ctx context.Context) *PcloudSapPostParams { + return &PcloudSapPostParams{ + Context: ctx, + } +} + +// NewPcloudSapPostParamsWithHTTPClient creates a new PcloudSapPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudSapPostParamsWithHTTPClient(client *http.Client) *PcloudSapPostParams { + return &PcloudSapPostParams{ + HTTPClient: client, + } +} + +/* PcloudSapPostParams contains all the parameters to send to the API endpoint + for the pcloud sap post operation. + + Typically these are written to a http.Request. +*/ +type PcloudSapPostParams struct { + + /* Body. + + Parameters for the creation of a new SAP PVM Instance + */ + Body *models.SAPCreate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud sap post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSapPostParams) WithDefaults() *PcloudSapPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud sap post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSapPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud sap post params +func (o *PcloudSapPostParams) WithTimeout(timeout time.Duration) *PcloudSapPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud sap post params +func (o *PcloudSapPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud sap post params +func (o *PcloudSapPostParams) WithContext(ctx context.Context) *PcloudSapPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud sap post params +func (o *PcloudSapPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud sap post params +func (o *PcloudSapPostParams) WithHTTPClient(client *http.Client) *PcloudSapPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud sap post params +func (o *PcloudSapPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud sap post params +func (o *PcloudSapPostParams) WithBody(body *models.SAPCreate) *PcloudSapPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud sap post params +func (o *PcloudSapPostParams) SetBody(body *models.SAPCreate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud sap post params +func (o *PcloudSapPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudSapPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud sap post params +func (o *PcloudSapPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudSapPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_post_responses.go new file mode 100644 index 00000000000..802291ee218 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p/pcloud_sap_post_responses.go @@ -0,0 +1,327 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_s_a_p + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudSapPostReader is a Reader for the PcloudSapPost structure. +type PcloudSapPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudSapPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudSapPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 201: + result := NewPcloudSapPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 202: + result := NewPcloudSapPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudSapPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudSapPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudSapPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudSapPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudSapPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudSapPostOK creates a PcloudSapPostOK with default headers values +func NewPcloudSapPostOK() *PcloudSapPostOK { + return &PcloudSapPostOK{} +} + +/* PcloudSapPostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudSapPostOK struct { + Payload models.PVMInstanceList +} + +func (o *PcloudSapPostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostOK %+v", 200, o.Payload) +} +func (o *PcloudSapPostOK) GetPayload() models.PVMInstanceList { + return o.Payload +} + +func (o *PcloudSapPostOK) 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 +} + +// NewPcloudSapPostCreated creates a PcloudSapPostCreated with default headers values +func NewPcloudSapPostCreated() *PcloudSapPostCreated { + return &PcloudSapPostCreated{} +} + +/* PcloudSapPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type PcloudSapPostCreated struct { + Payload models.PVMInstanceList +} + +func (o *PcloudSapPostCreated) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostCreated %+v", 201, o.Payload) +} +func (o *PcloudSapPostCreated) GetPayload() models.PVMInstanceList { + return o.Payload +} + +func (o *PcloudSapPostCreated) 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 +} + +// NewPcloudSapPostAccepted creates a PcloudSapPostAccepted with default headers values +func NewPcloudSapPostAccepted() *PcloudSapPostAccepted { + return &PcloudSapPostAccepted{} +} + +/* PcloudSapPostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudSapPostAccepted struct { + Payload models.PVMInstanceList +} + +func (o *PcloudSapPostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostAccepted %+v", 202, o.Payload) +} +func (o *PcloudSapPostAccepted) GetPayload() models.PVMInstanceList { + return o.Payload +} + +func (o *PcloudSapPostAccepted) 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 +} + +// NewPcloudSapPostBadRequest creates a PcloudSapPostBadRequest with default headers values +func NewPcloudSapPostBadRequest() *PcloudSapPostBadRequest { + return &PcloudSapPostBadRequest{} +} + +/* PcloudSapPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudSapPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudSapPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudSapPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudSapPostBadRequest) 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 +} + +// NewPcloudSapPostUnauthorized creates a PcloudSapPostUnauthorized with default headers values +func NewPcloudSapPostUnauthorized() *PcloudSapPostUnauthorized { + return &PcloudSapPostUnauthorized{} +} + +/* PcloudSapPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudSapPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudSapPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudSapPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudSapPostUnauthorized) 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 +} + +// NewPcloudSapPostConflict creates a PcloudSapPostConflict with default headers values +func NewPcloudSapPostConflict() *PcloudSapPostConflict { + return &PcloudSapPostConflict{} +} + +/* PcloudSapPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudSapPostConflict struct { + Payload *models.Error +} + +func (o *PcloudSapPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostConflict %+v", 409, o.Payload) +} +func (o *PcloudSapPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudSapPostConflict) 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 +} + +// NewPcloudSapPostUnprocessableEntity creates a PcloudSapPostUnprocessableEntity with default headers values +func NewPcloudSapPostUnprocessableEntity() *PcloudSapPostUnprocessableEntity { + return &PcloudSapPostUnprocessableEntity{} +} + +/* PcloudSapPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudSapPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudSapPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudSapPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudSapPostUnprocessableEntity) 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 +} + +// NewPcloudSapPostInternalServerError creates a PcloudSapPostInternalServerError with default headers values +func NewPcloudSapPostInternalServerError() *PcloudSapPostInternalServerError { + return &PcloudSapPostInternalServerError{} +} + +/* PcloudSapPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudSapPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudSapPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/sap][%d] pcloudSapPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudSapPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudSapPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/p_cloud_servicedhcp_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/p_cloud_servicedhcp_client.go new file mode 100644 index 00000000000..ddf143b6cfb --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/p_cloud_servicedhcp_client.go @@ -0,0 +1,203 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_service_d_h_c_p + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud service d h c p API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud service d h c p API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudDhcpDelete(params *PcloudDhcpDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpDeleteAccepted, error) + + PcloudDhcpGet(params *PcloudDhcpGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpGetOK, error) + + PcloudDhcpGetall(params *PcloudDhcpGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpGetallOK, error) + + PcloudDhcpPost(params *PcloudDhcpPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpPostAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudDhcpDelete deletes d h c p server open shift internal use only +*/ +func (a *Client) PcloudDhcpDelete(params *PcloudDhcpDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudDhcpDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.dhcp.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudDhcpDeleteReader{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.(*PcloudDhcpDeleteAccepted) + 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 pcloud.dhcp.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudDhcpGet gets d h c p server information open shift internal use only +*/ +func (a *Client) PcloudDhcpGet(params *PcloudDhcpGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudDhcpGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.dhcp.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudDhcpGetReader{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.(*PcloudDhcpGetOK) + 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 pcloud.dhcp.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudDhcpGetall gets all d h c p servers information open shift internal use only +*/ +func (a *Client) PcloudDhcpGetall(params *PcloudDhcpGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudDhcpGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.dhcp.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudDhcpGetallReader{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.(*PcloudDhcpGetallOK) + 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 pcloud.dhcp.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudDhcpPost creates a d h c p server open shift internal use only +*/ +func (a *Client) PcloudDhcpPost(params *PcloudDhcpPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudDhcpPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudDhcpPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.dhcp.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudDhcpPostReader{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.(*PcloudDhcpPostAccepted) + 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 pcloud.dhcp.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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_delete_parameters.go new file mode 100644 index 00000000000..3869c75667f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_delete_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_service_d_h_c_p + +// 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" +) + +// NewPcloudDhcpDeleteParams creates a new PcloudDhcpDeleteParams 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 NewPcloudDhcpDeleteParams() *PcloudDhcpDeleteParams { + return &PcloudDhcpDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudDhcpDeleteParamsWithTimeout creates a new PcloudDhcpDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudDhcpDeleteParamsWithTimeout(timeout time.Duration) *PcloudDhcpDeleteParams { + return &PcloudDhcpDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudDhcpDeleteParamsWithContext creates a new PcloudDhcpDeleteParams object +// with the ability to set a context for a request. +func NewPcloudDhcpDeleteParamsWithContext(ctx context.Context) *PcloudDhcpDeleteParams { + return &PcloudDhcpDeleteParams{ + Context: ctx, + } +} + +// NewPcloudDhcpDeleteParamsWithHTTPClient creates a new PcloudDhcpDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudDhcpDeleteParamsWithHTTPClient(client *http.Client) *PcloudDhcpDeleteParams { + return &PcloudDhcpDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudDhcpDeleteParams contains all the parameters to send to the API endpoint + for the pcloud dhcp delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudDhcpDeleteParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* DhcpID. + + The ID of the DHCP Server + */ + DhcpID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud dhcp delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpDeleteParams) WithDefaults() *PcloudDhcpDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud dhcp delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud dhcp delete params +func (o *PcloudDhcpDeleteParams) WithTimeout(timeout time.Duration) *PcloudDhcpDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud dhcp delete params +func (o *PcloudDhcpDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud dhcp delete params +func (o *PcloudDhcpDeleteParams) WithContext(ctx context.Context) *PcloudDhcpDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud dhcp delete params +func (o *PcloudDhcpDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud dhcp delete params +func (o *PcloudDhcpDeleteParams) WithHTTPClient(client *http.Client) *PcloudDhcpDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud dhcp delete params +func (o *PcloudDhcpDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud dhcp delete params +func (o *PcloudDhcpDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudDhcpDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud dhcp delete params +func (o *PcloudDhcpDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithDhcpID adds the dhcpID to the pcloud dhcp delete params +func (o *PcloudDhcpDeleteParams) WithDhcpID(dhcpID string) *PcloudDhcpDeleteParams { + o.SetDhcpID(dhcpID) + return o +} + +// SetDhcpID adds the dhcpId to the pcloud dhcp delete params +func (o *PcloudDhcpDeleteParams) SetDhcpID(dhcpID string) { + o.DhcpID = dhcpID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudDhcpDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param dhcp_id + if err := r.SetPathParam("dhcp_id", o.DhcpID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_delete_responses.go new file mode 100644 index 00000000000..f108dadaa2d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_delete_responses.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_service_d_h_c_p + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudDhcpDeleteReader is a Reader for the PcloudDhcpDelete structure. +type PcloudDhcpDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudDhcpDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudDhcpDeleteAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudDhcpDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudDhcpDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudDhcpDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudDhcpDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudDhcpDeleteAccepted creates a PcloudDhcpDeleteAccepted with default headers values +func NewPcloudDhcpDeleteAccepted() *PcloudDhcpDeleteAccepted { + return &PcloudDhcpDeleteAccepted{} +} + +/* PcloudDhcpDeleteAccepted describes a response with status code 202, with default header values. + +OK +*/ +type PcloudDhcpDeleteAccepted struct { + Payload models.Object +} + +func (o *PcloudDhcpDeleteAccepted) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpDeleteAccepted %+v", 202, o.Payload) +} +func (o *PcloudDhcpDeleteAccepted) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudDhcpDeleteAccepted) 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 +} + +// NewPcloudDhcpDeleteBadRequest creates a PcloudDhcpDeleteBadRequest with default headers values +func NewPcloudDhcpDeleteBadRequest() *PcloudDhcpDeleteBadRequest { + return &PcloudDhcpDeleteBadRequest{} +} + +/* PcloudDhcpDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudDhcpDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudDhcpDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudDhcpDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudDhcpDeleteBadRequest) 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 +} + +// NewPcloudDhcpDeleteForbidden creates a PcloudDhcpDeleteForbidden with default headers values +func NewPcloudDhcpDeleteForbidden() *PcloudDhcpDeleteForbidden { + return &PcloudDhcpDeleteForbidden{} +} + +/* PcloudDhcpDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudDhcpDeleteForbidden struct { + Payload *models.Error +} + +func (o *PcloudDhcpDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpDeleteForbidden %+v", 403, o.Payload) +} +func (o *PcloudDhcpDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudDhcpDeleteForbidden) 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 +} + +// NewPcloudDhcpDeleteNotFound creates a PcloudDhcpDeleteNotFound with default headers values +func NewPcloudDhcpDeleteNotFound() *PcloudDhcpDeleteNotFound { + return &PcloudDhcpDeleteNotFound{} +} + +/* PcloudDhcpDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudDhcpDeleteNotFound struct { + Payload *models.Error +} + +func (o *PcloudDhcpDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpDeleteNotFound %+v", 404, o.Payload) +} +func (o *PcloudDhcpDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudDhcpDeleteNotFound) 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 +} + +// NewPcloudDhcpDeleteInternalServerError creates a PcloudDhcpDeleteInternalServerError with default headers values +func NewPcloudDhcpDeleteInternalServerError() *PcloudDhcpDeleteInternalServerError { + return &PcloudDhcpDeleteInternalServerError{} +} + +/* PcloudDhcpDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudDhcpDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudDhcpDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudDhcpDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudDhcpDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_get_parameters.go new file mode 100644 index 00000000000..341c63d4778 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_service_d_h_c_p + +// 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" +) + +// NewPcloudDhcpGetParams creates a new PcloudDhcpGetParams 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 NewPcloudDhcpGetParams() *PcloudDhcpGetParams { + return &PcloudDhcpGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudDhcpGetParamsWithTimeout creates a new PcloudDhcpGetParams object +// with the ability to set a timeout on a request. +func NewPcloudDhcpGetParamsWithTimeout(timeout time.Duration) *PcloudDhcpGetParams { + return &PcloudDhcpGetParams{ + timeout: timeout, + } +} + +// NewPcloudDhcpGetParamsWithContext creates a new PcloudDhcpGetParams object +// with the ability to set a context for a request. +func NewPcloudDhcpGetParamsWithContext(ctx context.Context) *PcloudDhcpGetParams { + return &PcloudDhcpGetParams{ + Context: ctx, + } +} + +// NewPcloudDhcpGetParamsWithHTTPClient creates a new PcloudDhcpGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudDhcpGetParamsWithHTTPClient(client *http.Client) *PcloudDhcpGetParams { + return &PcloudDhcpGetParams{ + HTTPClient: client, + } +} + +/* PcloudDhcpGetParams contains all the parameters to send to the API endpoint + for the pcloud dhcp get operation. + + Typically these are written to a http.Request. +*/ +type PcloudDhcpGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* DhcpID. + + The ID of the DHCP Server + */ + DhcpID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud dhcp get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpGetParams) WithDefaults() *PcloudDhcpGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud dhcp get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud dhcp get params +func (o *PcloudDhcpGetParams) WithTimeout(timeout time.Duration) *PcloudDhcpGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud dhcp get params +func (o *PcloudDhcpGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud dhcp get params +func (o *PcloudDhcpGetParams) WithContext(ctx context.Context) *PcloudDhcpGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud dhcp get params +func (o *PcloudDhcpGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud dhcp get params +func (o *PcloudDhcpGetParams) WithHTTPClient(client *http.Client) *PcloudDhcpGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud dhcp get params +func (o *PcloudDhcpGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud dhcp get params +func (o *PcloudDhcpGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudDhcpGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud dhcp get params +func (o *PcloudDhcpGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithDhcpID adds the dhcpID to the pcloud dhcp get params +func (o *PcloudDhcpGetParams) WithDhcpID(dhcpID string) *PcloudDhcpGetParams { + o.SetDhcpID(dhcpID) + return o +} + +// SetDhcpID adds the dhcpId to the pcloud dhcp get params +func (o *PcloudDhcpGetParams) SetDhcpID(dhcpID string) { + o.DhcpID = dhcpID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudDhcpGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param dhcp_id + if err := r.SetPathParam("dhcp_id", o.DhcpID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_get_responses.go new file mode 100644 index 00000000000..533dd79a841 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_service_d_h_c_p + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudDhcpGetReader is a Reader for the PcloudDhcpGet structure. +type PcloudDhcpGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudDhcpGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudDhcpGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudDhcpGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudDhcpGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudDhcpGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudDhcpGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudDhcpGetOK creates a PcloudDhcpGetOK with default headers values +func NewPcloudDhcpGetOK() *PcloudDhcpGetOK { + return &PcloudDhcpGetOK{} +} + +/* PcloudDhcpGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudDhcpGetOK struct { + Payload *models.DHCPServerDetail +} + +func (o *PcloudDhcpGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpGetOK %+v", 200, o.Payload) +} +func (o *PcloudDhcpGetOK) GetPayload() *models.DHCPServerDetail { + return o.Payload +} + +func (o *PcloudDhcpGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DHCPServerDetail) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudDhcpGetBadRequest creates a PcloudDhcpGetBadRequest with default headers values +func NewPcloudDhcpGetBadRequest() *PcloudDhcpGetBadRequest { + return &PcloudDhcpGetBadRequest{} +} + +/* PcloudDhcpGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudDhcpGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudDhcpGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudDhcpGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudDhcpGetBadRequest) 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 +} + +// NewPcloudDhcpGetForbidden creates a PcloudDhcpGetForbidden with default headers values +func NewPcloudDhcpGetForbidden() *PcloudDhcpGetForbidden { + return &PcloudDhcpGetForbidden{} +} + +/* PcloudDhcpGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudDhcpGetForbidden struct { + Payload *models.Error +} + +func (o *PcloudDhcpGetForbidden) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpGetForbidden %+v", 403, o.Payload) +} +func (o *PcloudDhcpGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudDhcpGetForbidden) 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 +} + +// NewPcloudDhcpGetNotFound creates a PcloudDhcpGetNotFound with default headers values +func NewPcloudDhcpGetNotFound() *PcloudDhcpGetNotFound { + return &PcloudDhcpGetNotFound{} +} + +/* PcloudDhcpGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudDhcpGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudDhcpGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudDhcpGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudDhcpGetNotFound) 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 +} + +// NewPcloudDhcpGetInternalServerError creates a PcloudDhcpGetInternalServerError with default headers values +func NewPcloudDhcpGetInternalServerError() *PcloudDhcpGetInternalServerError { + return &PcloudDhcpGetInternalServerError{} +} + +/* PcloudDhcpGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudDhcpGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudDhcpGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp/{dhcp_id}][%d] pcloudDhcpGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudDhcpGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudDhcpGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_getall_parameters.go new file mode 100644 index 00000000000..52bbb8487b0 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_getall_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_service_d_h_c_p + +// 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" +) + +// NewPcloudDhcpGetallParams creates a new PcloudDhcpGetallParams 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 NewPcloudDhcpGetallParams() *PcloudDhcpGetallParams { + return &PcloudDhcpGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudDhcpGetallParamsWithTimeout creates a new PcloudDhcpGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudDhcpGetallParamsWithTimeout(timeout time.Duration) *PcloudDhcpGetallParams { + return &PcloudDhcpGetallParams{ + timeout: timeout, + } +} + +// NewPcloudDhcpGetallParamsWithContext creates a new PcloudDhcpGetallParams object +// with the ability to set a context for a request. +func NewPcloudDhcpGetallParamsWithContext(ctx context.Context) *PcloudDhcpGetallParams { + return &PcloudDhcpGetallParams{ + Context: ctx, + } +} + +// NewPcloudDhcpGetallParamsWithHTTPClient creates a new PcloudDhcpGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudDhcpGetallParamsWithHTTPClient(client *http.Client) *PcloudDhcpGetallParams { + return &PcloudDhcpGetallParams{ + HTTPClient: client, + } +} + +/* PcloudDhcpGetallParams contains all the parameters to send to the API endpoint + for the pcloud dhcp getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudDhcpGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud dhcp getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpGetallParams) WithDefaults() *PcloudDhcpGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud dhcp getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud dhcp getall params +func (o *PcloudDhcpGetallParams) WithTimeout(timeout time.Duration) *PcloudDhcpGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud dhcp getall params +func (o *PcloudDhcpGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud dhcp getall params +func (o *PcloudDhcpGetallParams) WithContext(ctx context.Context) *PcloudDhcpGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud dhcp getall params +func (o *PcloudDhcpGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud dhcp getall params +func (o *PcloudDhcpGetallParams) WithHTTPClient(client *http.Client) *PcloudDhcpGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud dhcp getall params +func (o *PcloudDhcpGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud dhcp getall params +func (o *PcloudDhcpGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudDhcpGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud dhcp getall params +func (o *PcloudDhcpGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudDhcpGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_getall_responses.go new file mode 100644 index 00000000000..3aeb4415c33 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_getall_responses.go @@ -0,0 +1,141 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_service_d_h_c_p + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudDhcpGetallReader is a Reader for the PcloudDhcpGetall structure. +type PcloudDhcpGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudDhcpGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudDhcpGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 403: + result := NewPcloudDhcpGetallForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudDhcpGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudDhcpGetallOK creates a PcloudDhcpGetallOK with default headers values +func NewPcloudDhcpGetallOK() *PcloudDhcpGetallOK { + return &PcloudDhcpGetallOK{} +} + +/* PcloudDhcpGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudDhcpGetallOK struct { + Payload models.DHCPServers +} + +func (o *PcloudDhcpGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp][%d] pcloudDhcpGetallOK %+v", 200, o.Payload) +} +func (o *PcloudDhcpGetallOK) GetPayload() models.DHCPServers { + return o.Payload +} + +func (o *PcloudDhcpGetallOK) 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 +} + +// NewPcloudDhcpGetallForbidden creates a PcloudDhcpGetallForbidden with default headers values +func NewPcloudDhcpGetallForbidden() *PcloudDhcpGetallForbidden { + return &PcloudDhcpGetallForbidden{} +} + +/* PcloudDhcpGetallForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudDhcpGetallForbidden struct { + Payload *models.Error +} + +func (o *PcloudDhcpGetallForbidden) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp][%d] pcloudDhcpGetallForbidden %+v", 403, o.Payload) +} +func (o *PcloudDhcpGetallForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudDhcpGetallForbidden) 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 +} + +// NewPcloudDhcpGetallInternalServerError creates a PcloudDhcpGetallInternalServerError with default headers values +func NewPcloudDhcpGetallInternalServerError() *PcloudDhcpGetallInternalServerError { + return &PcloudDhcpGetallInternalServerError{} +} + +/* PcloudDhcpGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudDhcpGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudDhcpGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp][%d] pcloudDhcpGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudDhcpGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudDhcpGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_post_parameters.go new file mode 100644 index 00000000000..d16312a19b3 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_service_d_h_c_p + +// 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" +) + +// NewPcloudDhcpPostParams creates a new PcloudDhcpPostParams 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 NewPcloudDhcpPostParams() *PcloudDhcpPostParams { + return &PcloudDhcpPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudDhcpPostParamsWithTimeout creates a new PcloudDhcpPostParams object +// with the ability to set a timeout on a request. +func NewPcloudDhcpPostParamsWithTimeout(timeout time.Duration) *PcloudDhcpPostParams { + return &PcloudDhcpPostParams{ + timeout: timeout, + } +} + +// NewPcloudDhcpPostParamsWithContext creates a new PcloudDhcpPostParams object +// with the ability to set a context for a request. +func NewPcloudDhcpPostParamsWithContext(ctx context.Context) *PcloudDhcpPostParams { + return &PcloudDhcpPostParams{ + Context: ctx, + } +} + +// NewPcloudDhcpPostParamsWithHTTPClient creates a new PcloudDhcpPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudDhcpPostParamsWithHTTPClient(client *http.Client) *PcloudDhcpPostParams { + return &PcloudDhcpPostParams{ + HTTPClient: client, + } +} + +/* PcloudDhcpPostParams contains all the parameters to send to the API endpoint + for the pcloud dhcp post operation. + + Typically these are written to a http.Request. +*/ +type PcloudDhcpPostParams struct { + + /* Body. + + Parameters used during creation of DHCP service + */ + Body *models.DHCPServerCreate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud dhcp post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpPostParams) WithDefaults() *PcloudDhcpPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud dhcp post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudDhcpPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud dhcp post params +func (o *PcloudDhcpPostParams) WithTimeout(timeout time.Duration) *PcloudDhcpPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud dhcp post params +func (o *PcloudDhcpPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud dhcp post params +func (o *PcloudDhcpPostParams) WithContext(ctx context.Context) *PcloudDhcpPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud dhcp post params +func (o *PcloudDhcpPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud dhcp post params +func (o *PcloudDhcpPostParams) WithHTTPClient(client *http.Client) *PcloudDhcpPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud dhcp post params +func (o *PcloudDhcpPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud dhcp post params +func (o *PcloudDhcpPostParams) WithBody(body *models.DHCPServerCreate) *PcloudDhcpPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud dhcp post params +func (o *PcloudDhcpPostParams) SetBody(body *models.DHCPServerCreate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud dhcp post params +func (o *PcloudDhcpPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudDhcpPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud dhcp post params +func (o *PcloudDhcpPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudDhcpPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_post_responses.go new file mode 100644 index 00000000000..7b5b6850820 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p/pcloud_dhcp_post_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_service_d_h_c_p + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudDhcpPostReader is a Reader for the PcloudDhcpPost structure. +type PcloudDhcpPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudDhcpPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudDhcpPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudDhcpPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudDhcpPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudDhcpPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudDhcpPostAccepted creates a PcloudDhcpPostAccepted with default headers values +func NewPcloudDhcpPostAccepted() *PcloudDhcpPostAccepted { + return &PcloudDhcpPostAccepted{} +} + +/* PcloudDhcpPostAccepted describes a response with status code 202, with default header values. + +OK +*/ +type PcloudDhcpPostAccepted struct { + Payload *models.DHCPServer +} + +func (o *PcloudDhcpPostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp][%d] pcloudDhcpPostAccepted %+v", 202, o.Payload) +} +func (o *PcloudDhcpPostAccepted) GetPayload() *models.DHCPServer { + return o.Payload +} + +func (o *PcloudDhcpPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DHCPServer) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudDhcpPostBadRequest creates a PcloudDhcpPostBadRequest with default headers values +func NewPcloudDhcpPostBadRequest() *PcloudDhcpPostBadRequest { + return &PcloudDhcpPostBadRequest{} +} + +/* PcloudDhcpPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudDhcpPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudDhcpPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp][%d] pcloudDhcpPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudDhcpPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudDhcpPostBadRequest) 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 +} + +// NewPcloudDhcpPostForbidden creates a PcloudDhcpPostForbidden with default headers values +func NewPcloudDhcpPostForbidden() *PcloudDhcpPostForbidden { + return &PcloudDhcpPostForbidden{} +} + +/* PcloudDhcpPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudDhcpPostForbidden struct { + Payload *models.Error +} + +func (o *PcloudDhcpPostForbidden) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp][%d] pcloudDhcpPostForbidden %+v", 403, o.Payload) +} +func (o *PcloudDhcpPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudDhcpPostForbidden) 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 +} + +// NewPcloudDhcpPostInternalServerError creates a PcloudDhcpPostInternalServerError with default headers values +func NewPcloudDhcpPostInternalServerError() *PcloudDhcpPostInternalServerError { + return &PcloudDhcpPostInternalServerError{} +} + +/* PcloudDhcpPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudDhcpPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudDhcpPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/services/dhcp][%d] pcloudDhcpPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudDhcpPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudDhcpPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/p_cloud_snapshots_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/p_cloud_snapshots_client.go new file mode 100644 index 00000000000..173f444230b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/p_cloud_snapshots_client.go @@ -0,0 +1,203 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_snapshots + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud snapshots API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud snapshots API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudCloudinstancesSnapshotsDelete(params *PcloudCloudinstancesSnapshotsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsDeleteAccepted, error) + + PcloudCloudinstancesSnapshotsGet(params *PcloudCloudinstancesSnapshotsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsGetOK, error) + + PcloudCloudinstancesSnapshotsGetall(params *PcloudCloudinstancesSnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsGetallOK, error) + + PcloudCloudinstancesSnapshotsPut(params *PcloudCloudinstancesSnapshotsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudCloudinstancesSnapshotsDelete deletes a p VM instance snapshot of a cloud instance +*/ +func (a *Client) PcloudCloudinstancesSnapshotsDelete(params *PcloudCloudinstancesSnapshotsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesSnapshotsDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.snapshots.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesSnapshotsDeleteReader{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.(*PcloudCloudinstancesSnapshotsDeleteAccepted) + 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 pcloud.cloudinstances.snapshots.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesSnapshotsGet gets the detail of a snapshot +*/ +func (a *Client) PcloudCloudinstancesSnapshotsGet(params *PcloudCloudinstancesSnapshotsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesSnapshotsGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.snapshots.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesSnapshotsGetReader{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.(*PcloudCloudinstancesSnapshotsGetOK) + 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 pcloud.cloudinstances.snapshots.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesSnapshotsGetall lists all p VM instance snapshots for this cloud instance +*/ +func (a *Client) PcloudCloudinstancesSnapshotsGetall(params *PcloudCloudinstancesSnapshotsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesSnapshotsGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.snapshots.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesSnapshotsGetallReader{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.(*PcloudCloudinstancesSnapshotsGetallOK) + 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 pcloud.cloudinstances.snapshots.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesSnapshotsPut updates a p VM instance snapshot +*/ +func (a *Client) PcloudCloudinstancesSnapshotsPut(params *PcloudCloudinstancesSnapshotsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesSnapshotsPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesSnapshotsPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.snapshots.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesSnapshotsPutReader{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.(*PcloudCloudinstancesSnapshotsPutOK) + 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 pcloud.cloudinstances.snapshots.put: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_delete_parameters.go new file mode 100644 index 00000000000..ce1013739d7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_delete_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_snapshots + +// 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" +) + +// NewPcloudCloudinstancesSnapshotsDeleteParams creates a new PcloudCloudinstancesSnapshotsDeleteParams 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 NewPcloudCloudinstancesSnapshotsDeleteParams() *PcloudCloudinstancesSnapshotsDeleteParams { + return &PcloudCloudinstancesSnapshotsDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesSnapshotsDeleteParamsWithTimeout creates a new PcloudCloudinstancesSnapshotsDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesSnapshotsDeleteParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsDeleteParams { + return &PcloudCloudinstancesSnapshotsDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesSnapshotsDeleteParamsWithContext creates a new PcloudCloudinstancesSnapshotsDeleteParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesSnapshotsDeleteParamsWithContext(ctx context.Context) *PcloudCloudinstancesSnapshotsDeleteParams { + return &PcloudCloudinstancesSnapshotsDeleteParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesSnapshotsDeleteParamsWithHTTPClient creates a new PcloudCloudinstancesSnapshotsDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesSnapshotsDeleteParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesSnapshotsDeleteParams { + return &PcloudCloudinstancesSnapshotsDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesSnapshotsDeleteParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances snapshots delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesSnapshotsDeleteParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* SnapshotID. + + PVM Instance snapshot id + */ + SnapshotID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances snapshots delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsDeleteParams) WithDefaults() *PcloudCloudinstancesSnapshotsDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances snapshots delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances snapshots delete params +func (o *PcloudCloudinstancesSnapshotsDeleteParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances snapshots delete params +func (o *PcloudCloudinstancesSnapshotsDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances snapshots delete params +func (o *PcloudCloudinstancesSnapshotsDeleteParams) WithContext(ctx context.Context) *PcloudCloudinstancesSnapshotsDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances snapshots delete params +func (o *PcloudCloudinstancesSnapshotsDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances snapshots delete params +func (o *PcloudCloudinstancesSnapshotsDeleteParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesSnapshotsDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances snapshots delete params +func (o *PcloudCloudinstancesSnapshotsDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances snapshots delete params +func (o *PcloudCloudinstancesSnapshotsDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesSnapshotsDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances snapshots delete params +func (o *PcloudCloudinstancesSnapshotsDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithSnapshotID adds the snapshotID to the pcloud cloudinstances snapshots delete params +func (o *PcloudCloudinstancesSnapshotsDeleteParams) WithSnapshotID(snapshotID string) *PcloudCloudinstancesSnapshotsDeleteParams { + o.SetSnapshotID(snapshotID) + return o +} + +// SetSnapshotID adds the snapshotId to the pcloud cloudinstances snapshots delete params +func (o *PcloudCloudinstancesSnapshotsDeleteParams) SetSnapshotID(snapshotID string) { + o.SnapshotID = snapshotID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesSnapshotsDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param snapshot_id + if err := r.SetPathParam("snapshot_id", o.SnapshotID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_delete_responses.go new file mode 100644 index 00000000000..db473201767 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_delete_responses.go @@ -0,0 +1,255 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_snapshots + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesSnapshotsDeleteReader is a Reader for the PcloudCloudinstancesSnapshotsDelete structure. +type PcloudCloudinstancesSnapshotsDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesSnapshotsDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudCloudinstancesSnapshotsDeleteAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesSnapshotsDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesSnapshotsDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesSnapshotsDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewPcloudCloudinstancesSnapshotsDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesSnapshotsDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesSnapshotsDeleteAccepted creates a PcloudCloudinstancesSnapshotsDeleteAccepted with default headers values +func NewPcloudCloudinstancesSnapshotsDeleteAccepted() *PcloudCloudinstancesSnapshotsDeleteAccepted { + return &PcloudCloudinstancesSnapshotsDeleteAccepted{} +} + +/* PcloudCloudinstancesSnapshotsDeleteAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudCloudinstancesSnapshotsDeleteAccepted struct { + Payload models.Object +} + +func (o *PcloudCloudinstancesSnapshotsDeleteAccepted) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsDeleteAccepted %+v", 202, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsDeleteAccepted) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsDeleteAccepted) 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 +} + +// NewPcloudCloudinstancesSnapshotsDeleteBadRequest creates a PcloudCloudinstancesSnapshotsDeleteBadRequest with default headers values +func NewPcloudCloudinstancesSnapshotsDeleteBadRequest() *PcloudCloudinstancesSnapshotsDeleteBadRequest { + return &PcloudCloudinstancesSnapshotsDeleteBadRequest{} +} + +/* PcloudCloudinstancesSnapshotsDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesSnapshotsDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsDeleteBadRequest) 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 +} + +// NewPcloudCloudinstancesSnapshotsDeleteUnauthorized creates a PcloudCloudinstancesSnapshotsDeleteUnauthorized with default headers values +func NewPcloudCloudinstancesSnapshotsDeleteUnauthorized() *PcloudCloudinstancesSnapshotsDeleteUnauthorized { + return &PcloudCloudinstancesSnapshotsDeleteUnauthorized{} +} + +/* PcloudCloudinstancesSnapshotsDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesSnapshotsDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsDeleteUnauthorized) 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 +} + +// NewPcloudCloudinstancesSnapshotsDeleteNotFound creates a PcloudCloudinstancesSnapshotsDeleteNotFound with default headers values +func NewPcloudCloudinstancesSnapshotsDeleteNotFound() *PcloudCloudinstancesSnapshotsDeleteNotFound { + return &PcloudCloudinstancesSnapshotsDeleteNotFound{} +} + +/* PcloudCloudinstancesSnapshotsDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesSnapshotsDeleteNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsDeleteNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsDeleteNotFound) 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 +} + +// NewPcloudCloudinstancesSnapshotsDeleteGone creates a PcloudCloudinstancesSnapshotsDeleteGone with default headers values +func NewPcloudCloudinstancesSnapshotsDeleteGone() *PcloudCloudinstancesSnapshotsDeleteGone { + return &PcloudCloudinstancesSnapshotsDeleteGone{} +} + +/* PcloudCloudinstancesSnapshotsDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudCloudinstancesSnapshotsDeleteGone struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsDeleteGone) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsDeleteGone %+v", 410, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsDeleteGone) 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 +} + +// NewPcloudCloudinstancesSnapshotsDeleteInternalServerError creates a PcloudCloudinstancesSnapshotsDeleteInternalServerError with default headers values +func NewPcloudCloudinstancesSnapshotsDeleteInternalServerError() *PcloudCloudinstancesSnapshotsDeleteInternalServerError { + return &PcloudCloudinstancesSnapshotsDeleteInternalServerError{} +} + +/* PcloudCloudinstancesSnapshotsDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesSnapshotsDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_get_parameters.go new file mode 100644 index 00000000000..58857dc0eb0 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_snapshots + +// 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" +) + +// NewPcloudCloudinstancesSnapshotsGetParams creates a new PcloudCloudinstancesSnapshotsGetParams 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 NewPcloudCloudinstancesSnapshotsGetParams() *PcloudCloudinstancesSnapshotsGetParams { + return &PcloudCloudinstancesSnapshotsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesSnapshotsGetParamsWithTimeout creates a new PcloudCloudinstancesSnapshotsGetParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesSnapshotsGetParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsGetParams { + return &PcloudCloudinstancesSnapshotsGetParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesSnapshotsGetParamsWithContext creates a new PcloudCloudinstancesSnapshotsGetParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesSnapshotsGetParamsWithContext(ctx context.Context) *PcloudCloudinstancesSnapshotsGetParams { + return &PcloudCloudinstancesSnapshotsGetParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesSnapshotsGetParamsWithHTTPClient creates a new PcloudCloudinstancesSnapshotsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesSnapshotsGetParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesSnapshotsGetParams { + return &PcloudCloudinstancesSnapshotsGetParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesSnapshotsGetParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances snapshots get operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesSnapshotsGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* SnapshotID. + + PVM Instance snapshot id + */ + SnapshotID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances snapshots get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsGetParams) WithDefaults() *PcloudCloudinstancesSnapshotsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances snapshots get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances snapshots get params +func (o *PcloudCloudinstancesSnapshotsGetParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances snapshots get params +func (o *PcloudCloudinstancesSnapshotsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances snapshots get params +func (o *PcloudCloudinstancesSnapshotsGetParams) WithContext(ctx context.Context) *PcloudCloudinstancesSnapshotsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances snapshots get params +func (o *PcloudCloudinstancesSnapshotsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances snapshots get params +func (o *PcloudCloudinstancesSnapshotsGetParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesSnapshotsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances snapshots get params +func (o *PcloudCloudinstancesSnapshotsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances snapshots get params +func (o *PcloudCloudinstancesSnapshotsGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesSnapshotsGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances snapshots get params +func (o *PcloudCloudinstancesSnapshotsGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithSnapshotID adds the snapshotID to the pcloud cloudinstances snapshots get params +func (o *PcloudCloudinstancesSnapshotsGetParams) WithSnapshotID(snapshotID string) *PcloudCloudinstancesSnapshotsGetParams { + o.SetSnapshotID(snapshotID) + return o +} + +// SetSnapshotID adds the snapshotId to the pcloud cloudinstances snapshots get params +func (o *PcloudCloudinstancesSnapshotsGetParams) SetSnapshotID(snapshotID string) { + o.SnapshotID = snapshotID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesSnapshotsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param snapshot_id + if err := r.SetPathParam("snapshot_id", o.SnapshotID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_get_responses.go new file mode 100644 index 00000000000..44ebe00012a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_snapshots + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesSnapshotsGetReader is a Reader for the PcloudCloudinstancesSnapshotsGet structure. +type PcloudCloudinstancesSnapshotsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesSnapshotsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesSnapshotsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesSnapshotsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesSnapshotsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesSnapshotsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesSnapshotsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesSnapshotsGetOK creates a PcloudCloudinstancesSnapshotsGetOK with default headers values +func NewPcloudCloudinstancesSnapshotsGetOK() *PcloudCloudinstancesSnapshotsGetOK { + return &PcloudCloudinstancesSnapshotsGetOK{} +} + +/* PcloudCloudinstancesSnapshotsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesSnapshotsGetOK struct { + Payload *models.Snapshot +} + +func (o *PcloudCloudinstancesSnapshotsGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsGetOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsGetOK) GetPayload() *models.Snapshot { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Snapshot) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesSnapshotsGetBadRequest creates a PcloudCloudinstancesSnapshotsGetBadRequest with default headers values +func NewPcloudCloudinstancesSnapshotsGetBadRequest() *PcloudCloudinstancesSnapshotsGetBadRequest { + return &PcloudCloudinstancesSnapshotsGetBadRequest{} +} + +/* PcloudCloudinstancesSnapshotsGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesSnapshotsGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsGetBadRequest) 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 +} + +// NewPcloudCloudinstancesSnapshotsGetUnauthorized creates a PcloudCloudinstancesSnapshotsGetUnauthorized with default headers values +func NewPcloudCloudinstancesSnapshotsGetUnauthorized() *PcloudCloudinstancesSnapshotsGetUnauthorized { + return &PcloudCloudinstancesSnapshotsGetUnauthorized{} +} + +/* PcloudCloudinstancesSnapshotsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesSnapshotsGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsGetUnauthorized) 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 +} + +// NewPcloudCloudinstancesSnapshotsGetNotFound creates a PcloudCloudinstancesSnapshotsGetNotFound with default headers values +func NewPcloudCloudinstancesSnapshotsGetNotFound() *PcloudCloudinstancesSnapshotsGetNotFound { + return &PcloudCloudinstancesSnapshotsGetNotFound{} +} + +/* PcloudCloudinstancesSnapshotsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesSnapshotsGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsGetNotFound) 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 +} + +// NewPcloudCloudinstancesSnapshotsGetInternalServerError creates a PcloudCloudinstancesSnapshotsGetInternalServerError with default headers values +func NewPcloudCloudinstancesSnapshotsGetInternalServerError() *PcloudCloudinstancesSnapshotsGetInternalServerError { + return &PcloudCloudinstancesSnapshotsGetInternalServerError{} +} + +/* PcloudCloudinstancesSnapshotsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesSnapshotsGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_getall_parameters.go new file mode 100644 index 00000000000..281b70623c3 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_getall_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_snapshots + +// 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" +) + +// NewPcloudCloudinstancesSnapshotsGetallParams creates a new PcloudCloudinstancesSnapshotsGetallParams 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 NewPcloudCloudinstancesSnapshotsGetallParams() *PcloudCloudinstancesSnapshotsGetallParams { + return &PcloudCloudinstancesSnapshotsGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesSnapshotsGetallParamsWithTimeout creates a new PcloudCloudinstancesSnapshotsGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesSnapshotsGetallParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsGetallParams { + return &PcloudCloudinstancesSnapshotsGetallParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesSnapshotsGetallParamsWithContext creates a new PcloudCloudinstancesSnapshotsGetallParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesSnapshotsGetallParamsWithContext(ctx context.Context) *PcloudCloudinstancesSnapshotsGetallParams { + return &PcloudCloudinstancesSnapshotsGetallParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesSnapshotsGetallParamsWithHTTPClient creates a new PcloudCloudinstancesSnapshotsGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesSnapshotsGetallParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesSnapshotsGetallParams { + return &PcloudCloudinstancesSnapshotsGetallParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesSnapshotsGetallParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances snapshots getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesSnapshotsGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances snapshots getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsGetallParams) WithDefaults() *PcloudCloudinstancesSnapshotsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances snapshots getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances snapshots getall params +func (o *PcloudCloudinstancesSnapshotsGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances snapshots getall params +func (o *PcloudCloudinstancesSnapshotsGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances snapshots getall params +func (o *PcloudCloudinstancesSnapshotsGetallParams) WithContext(ctx context.Context) *PcloudCloudinstancesSnapshotsGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances snapshots getall params +func (o *PcloudCloudinstancesSnapshotsGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances snapshots getall params +func (o *PcloudCloudinstancesSnapshotsGetallParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesSnapshotsGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances snapshots getall params +func (o *PcloudCloudinstancesSnapshotsGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances snapshots getall params +func (o *PcloudCloudinstancesSnapshotsGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesSnapshotsGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances snapshots getall params +func (o *PcloudCloudinstancesSnapshotsGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesSnapshotsGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_getall_responses.go new file mode 100644 index 00000000000..c4dee1b560f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_getall_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_snapshots + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesSnapshotsGetallReader is a Reader for the PcloudCloudinstancesSnapshotsGetall structure. +type PcloudCloudinstancesSnapshotsGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesSnapshotsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesSnapshotsGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesSnapshotsGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesSnapshotsGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesSnapshotsGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesSnapshotsGetallOK creates a PcloudCloudinstancesSnapshotsGetallOK with default headers values +func NewPcloudCloudinstancesSnapshotsGetallOK() *PcloudCloudinstancesSnapshotsGetallOK { + return &PcloudCloudinstancesSnapshotsGetallOK{} +} + +/* PcloudCloudinstancesSnapshotsGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesSnapshotsGetallOK struct { + Payload *models.Snapshots +} + +func (o *PcloudCloudinstancesSnapshotsGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots][%d] pcloudCloudinstancesSnapshotsGetallOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsGetallOK) GetPayload() *models.Snapshots { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Snapshots) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesSnapshotsGetallBadRequest creates a PcloudCloudinstancesSnapshotsGetallBadRequest with default headers values +func NewPcloudCloudinstancesSnapshotsGetallBadRequest() *PcloudCloudinstancesSnapshotsGetallBadRequest { + return &PcloudCloudinstancesSnapshotsGetallBadRequest{} +} + +/* PcloudCloudinstancesSnapshotsGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesSnapshotsGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots][%d] pcloudCloudinstancesSnapshotsGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsGetallBadRequest) 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 +} + +// NewPcloudCloudinstancesSnapshotsGetallUnauthorized creates a PcloudCloudinstancesSnapshotsGetallUnauthorized with default headers values +func NewPcloudCloudinstancesSnapshotsGetallUnauthorized() *PcloudCloudinstancesSnapshotsGetallUnauthorized { + return &PcloudCloudinstancesSnapshotsGetallUnauthorized{} +} + +/* PcloudCloudinstancesSnapshotsGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesSnapshotsGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots][%d] pcloudCloudinstancesSnapshotsGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsGetallUnauthorized) 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 +} + +// NewPcloudCloudinstancesSnapshotsGetallInternalServerError creates a PcloudCloudinstancesSnapshotsGetallInternalServerError with default headers values +func NewPcloudCloudinstancesSnapshotsGetallInternalServerError() *PcloudCloudinstancesSnapshotsGetallInternalServerError { + return &PcloudCloudinstancesSnapshotsGetallInternalServerError{} +} + +/* PcloudCloudinstancesSnapshotsGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesSnapshotsGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots][%d] pcloudCloudinstancesSnapshotsGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_put_parameters.go new file mode 100644 index 00000000000..268a2dfe269 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_put_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_snapshots + +// 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" +) + +// NewPcloudCloudinstancesSnapshotsPutParams creates a new PcloudCloudinstancesSnapshotsPutParams 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 NewPcloudCloudinstancesSnapshotsPutParams() *PcloudCloudinstancesSnapshotsPutParams { + return &PcloudCloudinstancesSnapshotsPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesSnapshotsPutParamsWithTimeout creates a new PcloudCloudinstancesSnapshotsPutParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesSnapshotsPutParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsPutParams { + return &PcloudCloudinstancesSnapshotsPutParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesSnapshotsPutParamsWithContext creates a new PcloudCloudinstancesSnapshotsPutParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesSnapshotsPutParamsWithContext(ctx context.Context) *PcloudCloudinstancesSnapshotsPutParams { + return &PcloudCloudinstancesSnapshotsPutParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesSnapshotsPutParamsWithHTTPClient creates a new PcloudCloudinstancesSnapshotsPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesSnapshotsPutParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesSnapshotsPutParams { + return &PcloudCloudinstancesSnapshotsPutParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesSnapshotsPutParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances snapshots put operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesSnapshotsPutParams struct { + + /* Body. + + Parameters for the update of a PVM instance snapshot + */ + Body *models.SnapshotUpdate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* SnapshotID. + + PVM Instance snapshot id + */ + SnapshotID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances snapshots put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsPutParams) WithDefaults() *PcloudCloudinstancesSnapshotsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances snapshots put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesSnapshotsPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances snapshots put params +func (o *PcloudCloudinstancesSnapshotsPutParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesSnapshotsPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances snapshots put params +func (o *PcloudCloudinstancesSnapshotsPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances snapshots put params +func (o *PcloudCloudinstancesSnapshotsPutParams) WithContext(ctx context.Context) *PcloudCloudinstancesSnapshotsPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances snapshots put params +func (o *PcloudCloudinstancesSnapshotsPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances snapshots put params +func (o *PcloudCloudinstancesSnapshotsPutParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesSnapshotsPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances snapshots put params +func (o *PcloudCloudinstancesSnapshotsPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud cloudinstances snapshots put params +func (o *PcloudCloudinstancesSnapshotsPutParams) WithBody(body *models.SnapshotUpdate) *PcloudCloudinstancesSnapshotsPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud cloudinstances snapshots put params +func (o *PcloudCloudinstancesSnapshotsPutParams) SetBody(body *models.SnapshotUpdate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances snapshots put params +func (o *PcloudCloudinstancesSnapshotsPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesSnapshotsPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances snapshots put params +func (o *PcloudCloudinstancesSnapshotsPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithSnapshotID adds the snapshotID to the pcloud cloudinstances snapshots put params +func (o *PcloudCloudinstancesSnapshotsPutParams) WithSnapshotID(snapshotID string) *PcloudCloudinstancesSnapshotsPutParams { + o.SetSnapshotID(snapshotID) + return o +} + +// SetSnapshotID adds the snapshotId to the pcloud cloudinstances snapshots put params +func (o *PcloudCloudinstancesSnapshotsPutParams) SetSnapshotID(snapshotID string) { + o.SnapshotID = snapshotID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesSnapshotsPutParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param snapshot_id + if err := r.SetPathParam("snapshot_id", o.SnapshotID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_put_responses.go new file mode 100644 index 00000000000..5dd9d99fac8 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots/pcloud_cloudinstances_snapshots_put_responses.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_snapshots + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesSnapshotsPutReader is a Reader for the PcloudCloudinstancesSnapshotsPut structure. +type PcloudCloudinstancesSnapshotsPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesSnapshotsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesSnapshotsPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesSnapshotsPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesSnapshotsPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesSnapshotsPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesSnapshotsPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesSnapshotsPutOK creates a PcloudCloudinstancesSnapshotsPutOK with default headers values +func NewPcloudCloudinstancesSnapshotsPutOK() *PcloudCloudinstancesSnapshotsPutOK { + return &PcloudCloudinstancesSnapshotsPutOK{} +} + +/* PcloudCloudinstancesSnapshotsPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesSnapshotsPutOK struct { + Payload models.Object +} + +func (o *PcloudCloudinstancesSnapshotsPutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsPutOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsPutOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsPutOK) 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 +} + +// NewPcloudCloudinstancesSnapshotsPutBadRequest creates a PcloudCloudinstancesSnapshotsPutBadRequest with default headers values +func NewPcloudCloudinstancesSnapshotsPutBadRequest() *PcloudCloudinstancesSnapshotsPutBadRequest { + return &PcloudCloudinstancesSnapshotsPutBadRequest{} +} + +/* PcloudCloudinstancesSnapshotsPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesSnapshotsPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsPutBadRequest) 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 +} + +// NewPcloudCloudinstancesSnapshotsPutUnauthorized creates a PcloudCloudinstancesSnapshotsPutUnauthorized with default headers values +func NewPcloudCloudinstancesSnapshotsPutUnauthorized() *PcloudCloudinstancesSnapshotsPutUnauthorized { + return &PcloudCloudinstancesSnapshotsPutUnauthorized{} +} + +/* PcloudCloudinstancesSnapshotsPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesSnapshotsPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsPutUnauthorized) 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 +} + +// NewPcloudCloudinstancesSnapshotsPutNotFound creates a PcloudCloudinstancesSnapshotsPutNotFound with default headers values +func NewPcloudCloudinstancesSnapshotsPutNotFound() *PcloudCloudinstancesSnapshotsPutNotFound { + return &PcloudCloudinstancesSnapshotsPutNotFound{} +} + +/* PcloudCloudinstancesSnapshotsPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesSnapshotsPutNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsPutNotFound) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsPutNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsPutNotFound) 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 +} + +// NewPcloudCloudinstancesSnapshotsPutInternalServerError creates a PcloudCloudinstancesSnapshotsPutInternalServerError with default headers values +func NewPcloudCloudinstancesSnapshotsPutInternalServerError() *PcloudCloudinstancesSnapshotsPutInternalServerError { + return &PcloudCloudinstancesSnapshotsPutInternalServerError{} +} + +/* PcloudCloudinstancesSnapshotsPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesSnapshotsPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesSnapshotsPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/snapshots/{snapshot_id}][%d] pcloudCloudinstancesSnapshotsPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesSnapshotsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesSnapshotsPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/p_cloud_storage_capacity_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/p_cloud_storage_capacity_client.go new file mode 100644 index 00000000000..061b527297d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/p_cloud_storage_capacity_client.go @@ -0,0 +1,203 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_storage_capacity + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud storage capacity API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud storage capacity API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudStoragecapacityPoolsGet(params *PcloudStoragecapacityPoolsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityPoolsGetOK, error) + + PcloudStoragecapacityPoolsGetall(params *PcloudStoragecapacityPoolsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityPoolsGetallOK, error) + + PcloudStoragecapacityTypesGet(params *PcloudStoragecapacityTypesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityTypesGetOK, error) + + PcloudStoragecapacityTypesGetall(params *PcloudStoragecapacityTypesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityTypesGetallOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudStoragecapacityPoolsGet storages capacity for a storage pool in a region +*/ +func (a *Client) PcloudStoragecapacityPoolsGet(params *PcloudStoragecapacityPoolsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityPoolsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudStoragecapacityPoolsGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.storagecapacity.pools.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools/{storage_pool_name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudStoragecapacityPoolsGetReader{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.(*PcloudStoragecapacityPoolsGetOK) + 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 pcloud.storagecapacity.pools.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudStoragecapacityPoolsGetall storages capacity for all available storage pools in a region +*/ +func (a *Client) PcloudStoragecapacityPoolsGetall(params *PcloudStoragecapacityPoolsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityPoolsGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudStoragecapacityPoolsGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.storagecapacity.pools.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudStoragecapacityPoolsGetallReader{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.(*PcloudStoragecapacityPoolsGetallOK) + 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 pcloud.storagecapacity.pools.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudStoragecapacityTypesGet storages capacity for a storage type in a region +*/ +func (a *Client) PcloudStoragecapacityTypesGet(params *PcloudStoragecapacityTypesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityTypesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudStoragecapacityTypesGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.storagecapacity.types.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types/{storage_type_name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudStoragecapacityTypesGetReader{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.(*PcloudStoragecapacityTypesGetOK) + 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 pcloud.storagecapacity.types.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudStoragecapacityTypesGetall storages capacity for all available storage types in a region +*/ +func (a *Client) PcloudStoragecapacityTypesGetall(params *PcloudStoragecapacityTypesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudStoragecapacityTypesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudStoragecapacityTypesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.storagecapacity.types.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudStoragecapacityTypesGetallReader{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.(*PcloudStoragecapacityTypesGetallOK) + 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 pcloud.storagecapacity.types.getall: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_get_parameters.go new file mode 100644 index 00000000000..c2d5df80832 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_storage_capacity + +// 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" +) + +// NewPcloudStoragecapacityPoolsGetParams creates a new PcloudStoragecapacityPoolsGetParams 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 NewPcloudStoragecapacityPoolsGetParams() *PcloudStoragecapacityPoolsGetParams { + return &PcloudStoragecapacityPoolsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudStoragecapacityPoolsGetParamsWithTimeout creates a new PcloudStoragecapacityPoolsGetParams object +// with the ability to set a timeout on a request. +func NewPcloudStoragecapacityPoolsGetParamsWithTimeout(timeout time.Duration) *PcloudStoragecapacityPoolsGetParams { + return &PcloudStoragecapacityPoolsGetParams{ + timeout: timeout, + } +} + +// NewPcloudStoragecapacityPoolsGetParamsWithContext creates a new PcloudStoragecapacityPoolsGetParams object +// with the ability to set a context for a request. +func NewPcloudStoragecapacityPoolsGetParamsWithContext(ctx context.Context) *PcloudStoragecapacityPoolsGetParams { + return &PcloudStoragecapacityPoolsGetParams{ + Context: ctx, + } +} + +// NewPcloudStoragecapacityPoolsGetParamsWithHTTPClient creates a new PcloudStoragecapacityPoolsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudStoragecapacityPoolsGetParamsWithHTTPClient(client *http.Client) *PcloudStoragecapacityPoolsGetParams { + return &PcloudStoragecapacityPoolsGetParams{ + HTTPClient: client, + } +} + +/* PcloudStoragecapacityPoolsGetParams contains all the parameters to send to the API endpoint + for the pcloud storagecapacity pools get operation. + + Typically these are written to a http.Request. +*/ +type PcloudStoragecapacityPoolsGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* StoragePoolName. + + Storage pool name + */ + StoragePoolName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud storagecapacity pools get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityPoolsGetParams) WithDefaults() *PcloudStoragecapacityPoolsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud storagecapacity pools get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityPoolsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud storagecapacity pools get params +func (o *PcloudStoragecapacityPoolsGetParams) WithTimeout(timeout time.Duration) *PcloudStoragecapacityPoolsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud storagecapacity pools get params +func (o *PcloudStoragecapacityPoolsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud storagecapacity pools get params +func (o *PcloudStoragecapacityPoolsGetParams) WithContext(ctx context.Context) *PcloudStoragecapacityPoolsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud storagecapacity pools get params +func (o *PcloudStoragecapacityPoolsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud storagecapacity pools get params +func (o *PcloudStoragecapacityPoolsGetParams) WithHTTPClient(client *http.Client) *PcloudStoragecapacityPoolsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud storagecapacity pools get params +func (o *PcloudStoragecapacityPoolsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud storagecapacity pools get params +func (o *PcloudStoragecapacityPoolsGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudStoragecapacityPoolsGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud storagecapacity pools get params +func (o *PcloudStoragecapacityPoolsGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithStoragePoolName adds the storagePoolName to the pcloud storagecapacity pools get params +func (o *PcloudStoragecapacityPoolsGetParams) WithStoragePoolName(storagePoolName string) *PcloudStoragecapacityPoolsGetParams { + o.SetStoragePoolName(storagePoolName) + return o +} + +// SetStoragePoolName adds the storagePoolName to the pcloud storagecapacity pools get params +func (o *PcloudStoragecapacityPoolsGetParams) SetStoragePoolName(storagePoolName string) { + o.StoragePoolName = storagePoolName +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudStoragecapacityPoolsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param storage_pool_name + if err := r.SetPathParam("storage_pool_name", o.StoragePoolName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_get_responses.go new file mode 100644 index 00000000000..d6abdcf9b65 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_get_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_storage_capacity + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudStoragecapacityPoolsGetReader is a Reader for the PcloudStoragecapacityPoolsGet structure. +type PcloudStoragecapacityPoolsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudStoragecapacityPoolsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudStoragecapacityPoolsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPcloudStoragecapacityPoolsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudStoragecapacityPoolsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudStoragecapacityPoolsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudStoragecapacityPoolsGetOK creates a PcloudStoragecapacityPoolsGetOK with default headers values +func NewPcloudStoragecapacityPoolsGetOK() *PcloudStoragecapacityPoolsGetOK { + return &PcloudStoragecapacityPoolsGetOK{} +} + +/* PcloudStoragecapacityPoolsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudStoragecapacityPoolsGetOK struct { + Payload *models.StoragePoolCapacity +} + +func (o *PcloudStoragecapacityPoolsGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools/{storage_pool_name}][%d] pcloudStoragecapacityPoolsGetOK %+v", 200, o.Payload) +} +func (o *PcloudStoragecapacityPoolsGetOK) GetPayload() *models.StoragePoolCapacity { + return o.Payload +} + +func (o *PcloudStoragecapacityPoolsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.StoragePoolCapacity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudStoragecapacityPoolsGetUnauthorized creates a PcloudStoragecapacityPoolsGetUnauthorized with default headers values +func NewPcloudStoragecapacityPoolsGetUnauthorized() *PcloudStoragecapacityPoolsGetUnauthorized { + return &PcloudStoragecapacityPoolsGetUnauthorized{} +} + +/* PcloudStoragecapacityPoolsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudStoragecapacityPoolsGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudStoragecapacityPoolsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools/{storage_pool_name}][%d] pcloudStoragecapacityPoolsGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudStoragecapacityPoolsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudStoragecapacityPoolsGetUnauthorized) 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 +} + +// NewPcloudStoragecapacityPoolsGetNotFound creates a PcloudStoragecapacityPoolsGetNotFound with default headers values +func NewPcloudStoragecapacityPoolsGetNotFound() *PcloudStoragecapacityPoolsGetNotFound { + return &PcloudStoragecapacityPoolsGetNotFound{} +} + +/* PcloudStoragecapacityPoolsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudStoragecapacityPoolsGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudStoragecapacityPoolsGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools/{storage_pool_name}][%d] pcloudStoragecapacityPoolsGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudStoragecapacityPoolsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudStoragecapacityPoolsGetNotFound) 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 +} + +// NewPcloudStoragecapacityPoolsGetInternalServerError creates a PcloudStoragecapacityPoolsGetInternalServerError with default headers values +func NewPcloudStoragecapacityPoolsGetInternalServerError() *PcloudStoragecapacityPoolsGetInternalServerError { + return &PcloudStoragecapacityPoolsGetInternalServerError{} +} + +/* PcloudStoragecapacityPoolsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudStoragecapacityPoolsGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudStoragecapacityPoolsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools/{storage_pool_name}][%d] pcloudStoragecapacityPoolsGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudStoragecapacityPoolsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudStoragecapacityPoolsGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_getall_parameters.go new file mode 100644 index 00000000000..e955e007b4b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_getall_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_storage_capacity + +// 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" +) + +// NewPcloudStoragecapacityPoolsGetallParams creates a new PcloudStoragecapacityPoolsGetallParams 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 NewPcloudStoragecapacityPoolsGetallParams() *PcloudStoragecapacityPoolsGetallParams { + return &PcloudStoragecapacityPoolsGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudStoragecapacityPoolsGetallParamsWithTimeout creates a new PcloudStoragecapacityPoolsGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudStoragecapacityPoolsGetallParamsWithTimeout(timeout time.Duration) *PcloudStoragecapacityPoolsGetallParams { + return &PcloudStoragecapacityPoolsGetallParams{ + timeout: timeout, + } +} + +// NewPcloudStoragecapacityPoolsGetallParamsWithContext creates a new PcloudStoragecapacityPoolsGetallParams object +// with the ability to set a context for a request. +func NewPcloudStoragecapacityPoolsGetallParamsWithContext(ctx context.Context) *PcloudStoragecapacityPoolsGetallParams { + return &PcloudStoragecapacityPoolsGetallParams{ + Context: ctx, + } +} + +// NewPcloudStoragecapacityPoolsGetallParamsWithHTTPClient creates a new PcloudStoragecapacityPoolsGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudStoragecapacityPoolsGetallParamsWithHTTPClient(client *http.Client) *PcloudStoragecapacityPoolsGetallParams { + return &PcloudStoragecapacityPoolsGetallParams{ + HTTPClient: client, + } +} + +/* PcloudStoragecapacityPoolsGetallParams contains all the parameters to send to the API endpoint + for the pcloud storagecapacity pools getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudStoragecapacityPoolsGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud storagecapacity pools getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityPoolsGetallParams) WithDefaults() *PcloudStoragecapacityPoolsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud storagecapacity pools getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityPoolsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud storagecapacity pools getall params +func (o *PcloudStoragecapacityPoolsGetallParams) WithTimeout(timeout time.Duration) *PcloudStoragecapacityPoolsGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud storagecapacity pools getall params +func (o *PcloudStoragecapacityPoolsGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud storagecapacity pools getall params +func (o *PcloudStoragecapacityPoolsGetallParams) WithContext(ctx context.Context) *PcloudStoragecapacityPoolsGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud storagecapacity pools getall params +func (o *PcloudStoragecapacityPoolsGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud storagecapacity pools getall params +func (o *PcloudStoragecapacityPoolsGetallParams) WithHTTPClient(client *http.Client) *PcloudStoragecapacityPoolsGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud storagecapacity pools getall params +func (o *PcloudStoragecapacityPoolsGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud storagecapacity pools getall params +func (o *PcloudStoragecapacityPoolsGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudStoragecapacityPoolsGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud storagecapacity pools getall params +func (o *PcloudStoragecapacityPoolsGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudStoragecapacityPoolsGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_getall_responses.go new file mode 100644 index 00000000000..6aa16ffe92c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_pools_getall_responses.go @@ -0,0 +1,143 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_storage_capacity + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudStoragecapacityPoolsGetallReader is a Reader for the PcloudStoragecapacityPoolsGetall structure. +type PcloudStoragecapacityPoolsGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudStoragecapacityPoolsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudStoragecapacityPoolsGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPcloudStoragecapacityPoolsGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudStoragecapacityPoolsGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudStoragecapacityPoolsGetallOK creates a PcloudStoragecapacityPoolsGetallOK with default headers values +func NewPcloudStoragecapacityPoolsGetallOK() *PcloudStoragecapacityPoolsGetallOK { + return &PcloudStoragecapacityPoolsGetallOK{} +} + +/* PcloudStoragecapacityPoolsGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudStoragecapacityPoolsGetallOK struct { + Payload *models.StoragePoolsCapacity +} + +func (o *PcloudStoragecapacityPoolsGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools][%d] pcloudStoragecapacityPoolsGetallOK %+v", 200, o.Payload) +} +func (o *PcloudStoragecapacityPoolsGetallOK) GetPayload() *models.StoragePoolsCapacity { + return o.Payload +} + +func (o *PcloudStoragecapacityPoolsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.StoragePoolsCapacity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudStoragecapacityPoolsGetallUnauthorized creates a PcloudStoragecapacityPoolsGetallUnauthorized with default headers values +func NewPcloudStoragecapacityPoolsGetallUnauthorized() *PcloudStoragecapacityPoolsGetallUnauthorized { + return &PcloudStoragecapacityPoolsGetallUnauthorized{} +} + +/* PcloudStoragecapacityPoolsGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudStoragecapacityPoolsGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudStoragecapacityPoolsGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools][%d] pcloudStoragecapacityPoolsGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudStoragecapacityPoolsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudStoragecapacityPoolsGetallUnauthorized) 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 +} + +// NewPcloudStoragecapacityPoolsGetallInternalServerError creates a PcloudStoragecapacityPoolsGetallInternalServerError with default headers values +func NewPcloudStoragecapacityPoolsGetallInternalServerError() *PcloudStoragecapacityPoolsGetallInternalServerError { + return &PcloudStoragecapacityPoolsGetallInternalServerError{} +} + +/* PcloudStoragecapacityPoolsGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudStoragecapacityPoolsGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudStoragecapacityPoolsGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-pools][%d] pcloudStoragecapacityPoolsGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudStoragecapacityPoolsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudStoragecapacityPoolsGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_get_parameters.go new file mode 100644 index 00000000000..51f3bb9b40d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_storage_capacity + +// 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" +) + +// NewPcloudStoragecapacityTypesGetParams creates a new PcloudStoragecapacityTypesGetParams 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 NewPcloudStoragecapacityTypesGetParams() *PcloudStoragecapacityTypesGetParams { + return &PcloudStoragecapacityTypesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudStoragecapacityTypesGetParamsWithTimeout creates a new PcloudStoragecapacityTypesGetParams object +// with the ability to set a timeout on a request. +func NewPcloudStoragecapacityTypesGetParamsWithTimeout(timeout time.Duration) *PcloudStoragecapacityTypesGetParams { + return &PcloudStoragecapacityTypesGetParams{ + timeout: timeout, + } +} + +// NewPcloudStoragecapacityTypesGetParamsWithContext creates a new PcloudStoragecapacityTypesGetParams object +// with the ability to set a context for a request. +func NewPcloudStoragecapacityTypesGetParamsWithContext(ctx context.Context) *PcloudStoragecapacityTypesGetParams { + return &PcloudStoragecapacityTypesGetParams{ + Context: ctx, + } +} + +// NewPcloudStoragecapacityTypesGetParamsWithHTTPClient creates a new PcloudStoragecapacityTypesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudStoragecapacityTypesGetParamsWithHTTPClient(client *http.Client) *PcloudStoragecapacityTypesGetParams { + return &PcloudStoragecapacityTypesGetParams{ + HTTPClient: client, + } +} + +/* PcloudStoragecapacityTypesGetParams contains all the parameters to send to the API endpoint + for the pcloud storagecapacity types get operation. + + Typically these are written to a http.Request. +*/ +type PcloudStoragecapacityTypesGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* StorageTypeName. + + Storage type name + */ + StorageTypeName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud storagecapacity types get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityTypesGetParams) WithDefaults() *PcloudStoragecapacityTypesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud storagecapacity types get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityTypesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud storagecapacity types get params +func (o *PcloudStoragecapacityTypesGetParams) WithTimeout(timeout time.Duration) *PcloudStoragecapacityTypesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud storagecapacity types get params +func (o *PcloudStoragecapacityTypesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud storagecapacity types get params +func (o *PcloudStoragecapacityTypesGetParams) WithContext(ctx context.Context) *PcloudStoragecapacityTypesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud storagecapacity types get params +func (o *PcloudStoragecapacityTypesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud storagecapacity types get params +func (o *PcloudStoragecapacityTypesGetParams) WithHTTPClient(client *http.Client) *PcloudStoragecapacityTypesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud storagecapacity types get params +func (o *PcloudStoragecapacityTypesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud storagecapacity types get params +func (o *PcloudStoragecapacityTypesGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudStoragecapacityTypesGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud storagecapacity types get params +func (o *PcloudStoragecapacityTypesGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithStorageTypeName adds the storageTypeName to the pcloud storagecapacity types get params +func (o *PcloudStoragecapacityTypesGetParams) WithStorageTypeName(storageTypeName string) *PcloudStoragecapacityTypesGetParams { + o.SetStorageTypeName(storageTypeName) + return o +} + +// SetStorageTypeName adds the storageTypeName to the pcloud storagecapacity types get params +func (o *PcloudStoragecapacityTypesGetParams) SetStorageTypeName(storageTypeName string) { + o.StorageTypeName = storageTypeName +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudStoragecapacityTypesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param storage_type_name + if err := r.SetPathParam("storage_type_name", o.StorageTypeName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_get_responses.go new file mode 100644 index 00000000000..3623f47c005 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_get_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_storage_capacity + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudStoragecapacityTypesGetReader is a Reader for the PcloudStoragecapacityTypesGet structure. +type PcloudStoragecapacityTypesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudStoragecapacityTypesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudStoragecapacityTypesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPcloudStoragecapacityTypesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudStoragecapacityTypesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudStoragecapacityTypesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudStoragecapacityTypesGetOK creates a PcloudStoragecapacityTypesGetOK with default headers values +func NewPcloudStoragecapacityTypesGetOK() *PcloudStoragecapacityTypesGetOK { + return &PcloudStoragecapacityTypesGetOK{} +} + +/* PcloudStoragecapacityTypesGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudStoragecapacityTypesGetOK struct { + Payload *models.StorageTypeCapacity +} + +func (o *PcloudStoragecapacityTypesGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types/{storage_type_name}][%d] pcloudStoragecapacityTypesGetOK %+v", 200, o.Payload) +} +func (o *PcloudStoragecapacityTypesGetOK) GetPayload() *models.StorageTypeCapacity { + return o.Payload +} + +func (o *PcloudStoragecapacityTypesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.StorageTypeCapacity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudStoragecapacityTypesGetUnauthorized creates a PcloudStoragecapacityTypesGetUnauthorized with default headers values +func NewPcloudStoragecapacityTypesGetUnauthorized() *PcloudStoragecapacityTypesGetUnauthorized { + return &PcloudStoragecapacityTypesGetUnauthorized{} +} + +/* PcloudStoragecapacityTypesGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudStoragecapacityTypesGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudStoragecapacityTypesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types/{storage_type_name}][%d] pcloudStoragecapacityTypesGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudStoragecapacityTypesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudStoragecapacityTypesGetUnauthorized) 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 +} + +// NewPcloudStoragecapacityTypesGetNotFound creates a PcloudStoragecapacityTypesGetNotFound with default headers values +func NewPcloudStoragecapacityTypesGetNotFound() *PcloudStoragecapacityTypesGetNotFound { + return &PcloudStoragecapacityTypesGetNotFound{} +} + +/* PcloudStoragecapacityTypesGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudStoragecapacityTypesGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudStoragecapacityTypesGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types/{storage_type_name}][%d] pcloudStoragecapacityTypesGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudStoragecapacityTypesGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudStoragecapacityTypesGetNotFound) 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 +} + +// NewPcloudStoragecapacityTypesGetInternalServerError creates a PcloudStoragecapacityTypesGetInternalServerError with default headers values +func NewPcloudStoragecapacityTypesGetInternalServerError() *PcloudStoragecapacityTypesGetInternalServerError { + return &PcloudStoragecapacityTypesGetInternalServerError{} +} + +/* PcloudStoragecapacityTypesGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudStoragecapacityTypesGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudStoragecapacityTypesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types/{storage_type_name}][%d] pcloudStoragecapacityTypesGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudStoragecapacityTypesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudStoragecapacityTypesGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_getall_parameters.go new file mode 100644 index 00000000000..50519ea2e9a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_getall_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_storage_capacity + +// 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" +) + +// NewPcloudStoragecapacityTypesGetallParams creates a new PcloudStoragecapacityTypesGetallParams 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 NewPcloudStoragecapacityTypesGetallParams() *PcloudStoragecapacityTypesGetallParams { + return &PcloudStoragecapacityTypesGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudStoragecapacityTypesGetallParamsWithTimeout creates a new PcloudStoragecapacityTypesGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudStoragecapacityTypesGetallParamsWithTimeout(timeout time.Duration) *PcloudStoragecapacityTypesGetallParams { + return &PcloudStoragecapacityTypesGetallParams{ + timeout: timeout, + } +} + +// NewPcloudStoragecapacityTypesGetallParamsWithContext creates a new PcloudStoragecapacityTypesGetallParams object +// with the ability to set a context for a request. +func NewPcloudStoragecapacityTypesGetallParamsWithContext(ctx context.Context) *PcloudStoragecapacityTypesGetallParams { + return &PcloudStoragecapacityTypesGetallParams{ + Context: ctx, + } +} + +// NewPcloudStoragecapacityTypesGetallParamsWithHTTPClient creates a new PcloudStoragecapacityTypesGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudStoragecapacityTypesGetallParamsWithHTTPClient(client *http.Client) *PcloudStoragecapacityTypesGetallParams { + return &PcloudStoragecapacityTypesGetallParams{ + HTTPClient: client, + } +} + +/* PcloudStoragecapacityTypesGetallParams contains all the parameters to send to the API endpoint + for the pcloud storagecapacity types getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudStoragecapacityTypesGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud storagecapacity types getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityTypesGetallParams) WithDefaults() *PcloudStoragecapacityTypesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud storagecapacity types getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudStoragecapacityTypesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud storagecapacity types getall params +func (o *PcloudStoragecapacityTypesGetallParams) WithTimeout(timeout time.Duration) *PcloudStoragecapacityTypesGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud storagecapacity types getall params +func (o *PcloudStoragecapacityTypesGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud storagecapacity types getall params +func (o *PcloudStoragecapacityTypesGetallParams) WithContext(ctx context.Context) *PcloudStoragecapacityTypesGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud storagecapacity types getall params +func (o *PcloudStoragecapacityTypesGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud storagecapacity types getall params +func (o *PcloudStoragecapacityTypesGetallParams) WithHTTPClient(client *http.Client) *PcloudStoragecapacityTypesGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud storagecapacity types getall params +func (o *PcloudStoragecapacityTypesGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud storagecapacity types getall params +func (o *PcloudStoragecapacityTypesGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudStoragecapacityTypesGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud storagecapacity types getall params +func (o *PcloudStoragecapacityTypesGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudStoragecapacityTypesGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_getall_responses.go new file mode 100644 index 00000000000..97595cd310d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity/pcloud_storagecapacity_types_getall_responses.go @@ -0,0 +1,143 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_storage_capacity + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudStoragecapacityTypesGetallReader is a Reader for the PcloudStoragecapacityTypesGetall structure. +type PcloudStoragecapacityTypesGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudStoragecapacityTypesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudStoragecapacityTypesGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPcloudStoragecapacityTypesGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudStoragecapacityTypesGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudStoragecapacityTypesGetallOK creates a PcloudStoragecapacityTypesGetallOK with default headers values +func NewPcloudStoragecapacityTypesGetallOK() *PcloudStoragecapacityTypesGetallOK { + return &PcloudStoragecapacityTypesGetallOK{} +} + +/* PcloudStoragecapacityTypesGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudStoragecapacityTypesGetallOK struct { + Payload *models.StorageTypesCapacity +} + +func (o *PcloudStoragecapacityTypesGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types][%d] pcloudStoragecapacityTypesGetallOK %+v", 200, o.Payload) +} +func (o *PcloudStoragecapacityTypesGetallOK) GetPayload() *models.StorageTypesCapacity { + return o.Payload +} + +func (o *PcloudStoragecapacityTypesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.StorageTypesCapacity) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudStoragecapacityTypesGetallUnauthorized creates a PcloudStoragecapacityTypesGetallUnauthorized with default headers values +func NewPcloudStoragecapacityTypesGetallUnauthorized() *PcloudStoragecapacityTypesGetallUnauthorized { + return &PcloudStoragecapacityTypesGetallUnauthorized{} +} + +/* PcloudStoragecapacityTypesGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudStoragecapacityTypesGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudStoragecapacityTypesGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types][%d] pcloudStoragecapacityTypesGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudStoragecapacityTypesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudStoragecapacityTypesGetallUnauthorized) 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 +} + +// NewPcloudStoragecapacityTypesGetallInternalServerError creates a PcloudStoragecapacityTypesGetallInternalServerError with default headers values +func NewPcloudStoragecapacityTypesGetallInternalServerError() *PcloudStoragecapacityTypesGetallInternalServerError { + return &PcloudStoragecapacityTypesGetallInternalServerError{} +} + +/* PcloudStoragecapacityTypesGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudStoragecapacityTypesGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudStoragecapacityTypesGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/storage-capacity/storage-types][%d] pcloudStoragecapacityTypesGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudStoragecapacityTypesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudStoragecapacityTypesGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_system_pools/p_cloud_system_pools_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_system_pools/p_cloud_system_pools_client.go new file mode 100644 index 00000000000..a94da9c21e4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_system_pools/p_cloud_system_pools_client.go @@ -0,0 +1,80 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_system_pools + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud system pools API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud system pools API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudSystempoolsGet(params *PcloudSystempoolsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSystempoolsGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudSystempoolsGet lists of available system pools within a particular data center +*/ +func (a *Client) PcloudSystempoolsGet(params *PcloudSystempoolsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudSystempoolsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudSystempoolsGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.systempools.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/system-pools", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudSystempoolsGetReader{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.(*PcloudSystempoolsGetOK) + 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 pcloud.systempools.get: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_system_pools/pcloud_systempools_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_system_pools/pcloud_systempools_get_parameters.go new file mode 100644 index 00000000000..a727b64e5b0 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_system_pools/pcloud_systempools_get_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_system_pools + +// 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" +) + +// NewPcloudSystempoolsGetParams creates a new PcloudSystempoolsGetParams 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 NewPcloudSystempoolsGetParams() *PcloudSystempoolsGetParams { + return &PcloudSystempoolsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudSystempoolsGetParamsWithTimeout creates a new PcloudSystempoolsGetParams object +// with the ability to set a timeout on a request. +func NewPcloudSystempoolsGetParamsWithTimeout(timeout time.Duration) *PcloudSystempoolsGetParams { + return &PcloudSystempoolsGetParams{ + timeout: timeout, + } +} + +// NewPcloudSystempoolsGetParamsWithContext creates a new PcloudSystempoolsGetParams object +// with the ability to set a context for a request. +func NewPcloudSystempoolsGetParamsWithContext(ctx context.Context) *PcloudSystempoolsGetParams { + return &PcloudSystempoolsGetParams{ + Context: ctx, + } +} + +// NewPcloudSystempoolsGetParamsWithHTTPClient creates a new PcloudSystempoolsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudSystempoolsGetParamsWithHTTPClient(client *http.Client) *PcloudSystempoolsGetParams { + return &PcloudSystempoolsGetParams{ + HTTPClient: client, + } +} + +/* PcloudSystempoolsGetParams contains all the parameters to send to the API endpoint + for the pcloud systempools get operation. + + Typically these are written to a http.Request. +*/ +type PcloudSystempoolsGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud systempools get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSystempoolsGetParams) WithDefaults() *PcloudSystempoolsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud systempools get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudSystempoolsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud systempools get params +func (o *PcloudSystempoolsGetParams) WithTimeout(timeout time.Duration) *PcloudSystempoolsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud systempools get params +func (o *PcloudSystempoolsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud systempools get params +func (o *PcloudSystempoolsGetParams) WithContext(ctx context.Context) *PcloudSystempoolsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud systempools get params +func (o *PcloudSystempoolsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud systempools get params +func (o *PcloudSystempoolsGetParams) WithHTTPClient(client *http.Client) *PcloudSystempoolsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud systempools get params +func (o *PcloudSystempoolsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud systempools get params +func (o *PcloudSystempoolsGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudSystempoolsGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud systempools get params +func (o *PcloudSystempoolsGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudSystempoolsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_system_pools/pcloud_systempools_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_system_pools/pcloud_systempools_get_responses.go new file mode 100644 index 00000000000..78089d7a0f4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_system_pools/pcloud_systempools_get_responses.go @@ -0,0 +1,141 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_system_pools + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudSystempoolsGetReader is a Reader for the PcloudSystempoolsGet structure. +type PcloudSystempoolsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudSystempoolsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudSystempoolsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPcloudSystempoolsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudSystempoolsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudSystempoolsGetOK creates a PcloudSystempoolsGetOK with default headers values +func NewPcloudSystempoolsGetOK() *PcloudSystempoolsGetOK { + return &PcloudSystempoolsGetOK{} +} + +/* PcloudSystempoolsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudSystempoolsGetOK struct { + Payload models.SystemPools +} + +func (o *PcloudSystempoolsGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/system-pools][%d] pcloudSystempoolsGetOK %+v", 200, o.Payload) +} +func (o *PcloudSystempoolsGetOK) GetPayload() models.SystemPools { + return o.Payload +} + +func (o *PcloudSystempoolsGetOK) 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 +} + +// NewPcloudSystempoolsGetUnauthorized creates a PcloudSystempoolsGetUnauthorized with default headers values +func NewPcloudSystempoolsGetUnauthorized() *PcloudSystempoolsGetUnauthorized { + return &PcloudSystempoolsGetUnauthorized{} +} + +/* PcloudSystempoolsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudSystempoolsGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudSystempoolsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/system-pools][%d] pcloudSystempoolsGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudSystempoolsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudSystempoolsGetUnauthorized) 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 +} + +// NewPcloudSystempoolsGetInternalServerError creates a PcloudSystempoolsGetInternalServerError with default headers values +func NewPcloudSystempoolsGetInternalServerError() *PcloudSystempoolsGetInternalServerError { + return &PcloudSystempoolsGetInternalServerError{} +} + +/* PcloudSystempoolsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudSystempoolsGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudSystempoolsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/system-pools][%d] pcloudSystempoolsGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudSystempoolsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudSystempoolsGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks/p_cloud_tasks_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks/p_cloud_tasks_client.go new file mode 100644 index 00000000000..22d71e5ec92 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks/p_cloud_tasks_client.go @@ -0,0 +1,121 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tasks + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud tasks API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud tasks API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudTasksDelete(params *PcloudTasksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTasksDeleteOK, error) + + PcloudTasksGet(params *PcloudTasksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTasksGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudTasksDelete deletes a task +*/ +func (a *Client) PcloudTasksDelete(params *PcloudTasksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTasksDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudTasksDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.tasks.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/tasks/{task_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudTasksDeleteReader{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.(*PcloudTasksDeleteOK) + 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 pcloud.tasks.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudTasksGet gets a task +*/ +func (a *Client) PcloudTasksGet(params *PcloudTasksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTasksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudTasksGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.tasks.get", + Method: "GET", + PathPattern: "/pcloud/v1/tasks/{task_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudTasksGetReader{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.(*PcloudTasksGetOK) + 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 pcloud.tasks.get: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks/pcloud_tasks_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks/pcloud_tasks_delete_parameters.go new file mode 100644 index 00000000000..641d712bc8a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks/pcloud_tasks_delete_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tasks + +// 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" +) + +// NewPcloudTasksDeleteParams creates a new PcloudTasksDeleteParams 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 NewPcloudTasksDeleteParams() *PcloudTasksDeleteParams { + return &PcloudTasksDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudTasksDeleteParamsWithTimeout creates a new PcloudTasksDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudTasksDeleteParamsWithTimeout(timeout time.Duration) *PcloudTasksDeleteParams { + return &PcloudTasksDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudTasksDeleteParamsWithContext creates a new PcloudTasksDeleteParams object +// with the ability to set a context for a request. +func NewPcloudTasksDeleteParamsWithContext(ctx context.Context) *PcloudTasksDeleteParams { + return &PcloudTasksDeleteParams{ + Context: ctx, + } +} + +// NewPcloudTasksDeleteParamsWithHTTPClient creates a new PcloudTasksDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudTasksDeleteParamsWithHTTPClient(client *http.Client) *PcloudTasksDeleteParams { + return &PcloudTasksDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudTasksDeleteParams contains all the parameters to send to the API endpoint + for the pcloud tasks delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudTasksDeleteParams struct { + + /* TaskID. + + PCloud Task ID + */ + TaskID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud tasks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTasksDeleteParams) WithDefaults() *PcloudTasksDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tasks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTasksDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud tasks delete params +func (o *PcloudTasksDeleteParams) WithTimeout(timeout time.Duration) *PcloudTasksDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud tasks delete params +func (o *PcloudTasksDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud tasks delete params +func (o *PcloudTasksDeleteParams) WithContext(ctx context.Context) *PcloudTasksDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud tasks delete params +func (o *PcloudTasksDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud tasks delete params +func (o *PcloudTasksDeleteParams) WithHTTPClient(client *http.Client) *PcloudTasksDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud tasks delete params +func (o *PcloudTasksDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithTaskID adds the taskID to the pcloud tasks delete params +func (o *PcloudTasksDeleteParams) WithTaskID(taskID string) *PcloudTasksDeleteParams { + o.SetTaskID(taskID) + return o +} + +// SetTaskID adds the taskId to the pcloud tasks delete params +func (o *PcloudTasksDeleteParams) SetTaskID(taskID string) { + o.TaskID = taskID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudTasksDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param task_id + if err := r.SetPathParam("task_id", o.TaskID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks/pcloud_tasks_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks/pcloud_tasks_delete_responses.go new file mode 100644 index 00000000000..63e82c88155 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks/pcloud_tasks_delete_responses.go @@ -0,0 +1,255 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tasks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudTasksDeleteReader is a Reader for the PcloudTasksDelete structure. +type PcloudTasksDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudTasksDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudTasksDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudTasksDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudTasksDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudTasksDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewPcloudTasksDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudTasksDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudTasksDeleteOK creates a PcloudTasksDeleteOK with default headers values +func NewPcloudTasksDeleteOK() *PcloudTasksDeleteOK { + return &PcloudTasksDeleteOK{} +} + +/* PcloudTasksDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudTasksDeleteOK struct { + Payload models.Object +} + +func (o *PcloudTasksDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/tasks/{task_id}][%d] pcloudTasksDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudTasksDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudTasksDeleteOK) 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 +} + +// NewPcloudTasksDeleteBadRequest creates a PcloudTasksDeleteBadRequest with default headers values +func NewPcloudTasksDeleteBadRequest() *PcloudTasksDeleteBadRequest { + return &PcloudTasksDeleteBadRequest{} +} + +/* PcloudTasksDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudTasksDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudTasksDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/tasks/{task_id}][%d] pcloudTasksDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudTasksDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTasksDeleteBadRequest) 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 +} + +// NewPcloudTasksDeleteUnauthorized creates a PcloudTasksDeleteUnauthorized with default headers values +func NewPcloudTasksDeleteUnauthorized() *PcloudTasksDeleteUnauthorized { + return &PcloudTasksDeleteUnauthorized{} +} + +/* PcloudTasksDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudTasksDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudTasksDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/tasks/{task_id}][%d] pcloudTasksDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudTasksDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTasksDeleteUnauthorized) 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 +} + +// NewPcloudTasksDeleteNotFound creates a PcloudTasksDeleteNotFound with default headers values +func NewPcloudTasksDeleteNotFound() *PcloudTasksDeleteNotFound { + return &PcloudTasksDeleteNotFound{} +} + +/* PcloudTasksDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudTasksDeleteNotFound struct { + Payload *models.Error +} + +func (o *PcloudTasksDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/tasks/{task_id}][%d] pcloudTasksDeleteNotFound %+v", 404, o.Payload) +} +func (o *PcloudTasksDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTasksDeleteNotFound) 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 +} + +// NewPcloudTasksDeleteGone creates a PcloudTasksDeleteGone with default headers values +func NewPcloudTasksDeleteGone() *PcloudTasksDeleteGone { + return &PcloudTasksDeleteGone{} +} + +/* PcloudTasksDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudTasksDeleteGone struct { + Payload *models.Error +} + +func (o *PcloudTasksDeleteGone) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/tasks/{task_id}][%d] pcloudTasksDeleteGone %+v", 410, o.Payload) +} +func (o *PcloudTasksDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTasksDeleteGone) 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 +} + +// NewPcloudTasksDeleteInternalServerError creates a PcloudTasksDeleteInternalServerError with default headers values +func NewPcloudTasksDeleteInternalServerError() *PcloudTasksDeleteInternalServerError { + return &PcloudTasksDeleteInternalServerError{} +} + +/* PcloudTasksDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudTasksDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudTasksDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/tasks/{task_id}][%d] pcloudTasksDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudTasksDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTasksDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks/pcloud_tasks_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks/pcloud_tasks_get_parameters.go new file mode 100644 index 00000000000..756ff392bdb --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks/pcloud_tasks_get_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tasks + +// 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" +) + +// NewPcloudTasksGetParams creates a new PcloudTasksGetParams 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 NewPcloudTasksGetParams() *PcloudTasksGetParams { + return &PcloudTasksGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudTasksGetParamsWithTimeout creates a new PcloudTasksGetParams object +// with the ability to set a timeout on a request. +func NewPcloudTasksGetParamsWithTimeout(timeout time.Duration) *PcloudTasksGetParams { + return &PcloudTasksGetParams{ + timeout: timeout, + } +} + +// NewPcloudTasksGetParamsWithContext creates a new PcloudTasksGetParams object +// with the ability to set a context for a request. +func NewPcloudTasksGetParamsWithContext(ctx context.Context) *PcloudTasksGetParams { + return &PcloudTasksGetParams{ + Context: ctx, + } +} + +// NewPcloudTasksGetParamsWithHTTPClient creates a new PcloudTasksGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudTasksGetParamsWithHTTPClient(client *http.Client) *PcloudTasksGetParams { + return &PcloudTasksGetParams{ + HTTPClient: client, + } +} + +/* PcloudTasksGetParams contains all the parameters to send to the API endpoint + for the pcloud tasks get operation. + + Typically these are written to a http.Request. +*/ +type PcloudTasksGetParams struct { + + /* TaskID. + + PCloud Task ID + */ + TaskID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud tasks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTasksGetParams) WithDefaults() *PcloudTasksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tasks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTasksGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud tasks get params +func (o *PcloudTasksGetParams) WithTimeout(timeout time.Duration) *PcloudTasksGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud tasks get params +func (o *PcloudTasksGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud tasks get params +func (o *PcloudTasksGetParams) WithContext(ctx context.Context) *PcloudTasksGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud tasks get params +func (o *PcloudTasksGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud tasks get params +func (o *PcloudTasksGetParams) WithHTTPClient(client *http.Client) *PcloudTasksGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud tasks get params +func (o *PcloudTasksGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithTaskID adds the taskID to the pcloud tasks get params +func (o *PcloudTasksGetParams) WithTaskID(taskID string) *PcloudTasksGetParams { + o.SetTaskID(taskID) + return o +} + +// SetTaskID adds the taskId to the pcloud tasks get params +func (o *PcloudTasksGetParams) SetTaskID(taskID string) { + o.TaskID = taskID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudTasksGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param task_id + if err := r.SetPathParam("task_id", o.TaskID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks/pcloud_tasks_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks/pcloud_tasks_get_responses.go new file mode 100644 index 00000000000..607e52aa97a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks/pcloud_tasks_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tasks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudTasksGetReader is a Reader for the PcloudTasksGet structure. +type PcloudTasksGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudTasksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudTasksGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudTasksGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudTasksGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudTasksGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudTasksGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudTasksGetOK creates a PcloudTasksGetOK with default headers values +func NewPcloudTasksGetOK() *PcloudTasksGetOK { + return &PcloudTasksGetOK{} +} + +/* PcloudTasksGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudTasksGetOK struct { + Payload *models.Task +} + +func (o *PcloudTasksGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tasks/{task_id}][%d] pcloudTasksGetOK %+v", 200, o.Payload) +} +func (o *PcloudTasksGetOK) GetPayload() *models.Task { + return o.Payload +} + +func (o *PcloudTasksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Task) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudTasksGetBadRequest creates a PcloudTasksGetBadRequest with default headers values +func NewPcloudTasksGetBadRequest() *PcloudTasksGetBadRequest { + return &PcloudTasksGetBadRequest{} +} + +/* PcloudTasksGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudTasksGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudTasksGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tasks/{task_id}][%d] pcloudTasksGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudTasksGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTasksGetBadRequest) 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 +} + +// NewPcloudTasksGetUnauthorized creates a PcloudTasksGetUnauthorized with default headers values +func NewPcloudTasksGetUnauthorized() *PcloudTasksGetUnauthorized { + return &PcloudTasksGetUnauthorized{} +} + +/* PcloudTasksGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudTasksGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudTasksGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tasks/{task_id}][%d] pcloudTasksGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudTasksGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTasksGetUnauthorized) 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 +} + +// NewPcloudTasksGetNotFound creates a PcloudTasksGetNotFound with default headers values +func NewPcloudTasksGetNotFound() *PcloudTasksGetNotFound { + return &PcloudTasksGetNotFound{} +} + +/* PcloudTasksGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudTasksGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudTasksGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tasks/{task_id}][%d] pcloudTasksGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudTasksGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTasksGetNotFound) 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 +} + +// NewPcloudTasksGetInternalServerError creates a PcloudTasksGetInternalServerError with default headers values +func NewPcloudTasksGetInternalServerError() *PcloudTasksGetInternalServerError { + return &PcloudTasksGetInternalServerError{} +} + +/* PcloudTasksGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudTasksGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudTasksGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tasks/{task_id}][%d] pcloudTasksGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudTasksGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTasksGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants/p_cloud_tenants_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants/p_cloud_tenants_client.go new file mode 100644 index 00000000000..48cd87d9404 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants/p_cloud_tenants_client.go @@ -0,0 +1,121 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud tenants API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud tenants API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudTenantsGet(params *PcloudTenantsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsGetOK, error) + + PcloudTenantsPut(params *PcloudTenantsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudTenantsGet gets a tenant s current state information +*/ +func (a *Client) PcloudTenantsGet(params *PcloudTenantsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudTenantsGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.tenants.get", + Method: "GET", + PathPattern: "/pcloud/v1/tenants/{tenant_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudTenantsGetReader{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.(*PcloudTenantsGetOK) + 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 pcloud.tenants.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudTenantsPut updates a tenant +*/ +func (a *Client) PcloudTenantsPut(params *PcloudTenantsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudTenantsPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.tenants.put", + Method: "PUT", + PathPattern: "/pcloud/v1/tenants/{tenant_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudTenantsPutReader{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.(*PcloudTenantsPutOK) + 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 pcloud.tenants.put: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants/pcloud_tenants_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants/pcloud_tenants_get_parameters.go new file mode 100644 index 00000000000..f6106baeb1c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants/pcloud_tenants_get_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants + +// 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" +) + +// NewPcloudTenantsGetParams creates a new PcloudTenantsGetParams 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 NewPcloudTenantsGetParams() *PcloudTenantsGetParams { + return &PcloudTenantsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudTenantsGetParamsWithTimeout creates a new PcloudTenantsGetParams object +// with the ability to set a timeout on a request. +func NewPcloudTenantsGetParamsWithTimeout(timeout time.Duration) *PcloudTenantsGetParams { + return &PcloudTenantsGetParams{ + timeout: timeout, + } +} + +// NewPcloudTenantsGetParamsWithContext creates a new PcloudTenantsGetParams object +// with the ability to set a context for a request. +func NewPcloudTenantsGetParamsWithContext(ctx context.Context) *PcloudTenantsGetParams { + return &PcloudTenantsGetParams{ + Context: ctx, + } +} + +// NewPcloudTenantsGetParamsWithHTTPClient creates a new PcloudTenantsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudTenantsGetParamsWithHTTPClient(client *http.Client) *PcloudTenantsGetParams { + return &PcloudTenantsGetParams{ + HTTPClient: client, + } +} + +/* PcloudTenantsGetParams contains all the parameters to send to the API endpoint + for the pcloud tenants get operation. + + Typically these are written to a http.Request. +*/ +type PcloudTenantsGetParams struct { + + /* TenantID. + + Tenant ID of a pcloud tenant + */ + TenantID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud tenants get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsGetParams) WithDefaults() *PcloudTenantsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tenants get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud tenants get params +func (o *PcloudTenantsGetParams) WithTimeout(timeout time.Duration) *PcloudTenantsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud tenants get params +func (o *PcloudTenantsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud tenants get params +func (o *PcloudTenantsGetParams) WithContext(ctx context.Context) *PcloudTenantsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud tenants get params +func (o *PcloudTenantsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud tenants get params +func (o *PcloudTenantsGetParams) WithHTTPClient(client *http.Client) *PcloudTenantsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud tenants get params +func (o *PcloudTenantsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithTenantID adds the tenantID to the pcloud tenants get params +func (o *PcloudTenantsGetParams) WithTenantID(tenantID string) *PcloudTenantsGetParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the pcloud tenants get params +func (o *PcloudTenantsGetParams) SetTenantID(tenantID string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudTenantsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param tenant_id + if err := r.SetPathParam("tenant_id", o.TenantID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants/pcloud_tenants_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants/pcloud_tenants_get_responses.go new file mode 100644 index 00000000000..a6ca2731433 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants/pcloud_tenants_get_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudTenantsGetReader is a Reader for the PcloudTenantsGet structure. +type PcloudTenantsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudTenantsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudTenantsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudTenantsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudTenantsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudTenantsGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudTenantsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudTenantsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudTenantsGetOK creates a PcloudTenantsGetOK with default headers values +func NewPcloudTenantsGetOK() *PcloudTenantsGetOK { + return &PcloudTenantsGetOK{} +} + +/* PcloudTenantsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudTenantsGetOK struct { + Payload *models.Tenant +} + +func (o *PcloudTenantsGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsGetOK %+v", 200, o.Payload) +} +func (o *PcloudTenantsGetOK) GetPayload() *models.Tenant { + return o.Payload +} + +func (o *PcloudTenantsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Tenant) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudTenantsGetBadRequest creates a PcloudTenantsGetBadRequest with default headers values +func NewPcloudTenantsGetBadRequest() *PcloudTenantsGetBadRequest { + return &PcloudTenantsGetBadRequest{} +} + +/* PcloudTenantsGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudTenantsGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudTenantsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudTenantsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsGetBadRequest) 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 +} + +// NewPcloudTenantsGetUnauthorized creates a PcloudTenantsGetUnauthorized with default headers values +func NewPcloudTenantsGetUnauthorized() *PcloudTenantsGetUnauthorized { + return &PcloudTenantsGetUnauthorized{} +} + +/* PcloudTenantsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudTenantsGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudTenantsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudTenantsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsGetUnauthorized) 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 +} + +// NewPcloudTenantsGetForbidden creates a PcloudTenantsGetForbidden with default headers values +func NewPcloudTenantsGetForbidden() *PcloudTenantsGetForbidden { + return &PcloudTenantsGetForbidden{} +} + +/* PcloudTenantsGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudTenantsGetForbidden struct { + Payload *models.Error +} + +func (o *PcloudTenantsGetForbidden) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsGetForbidden %+v", 403, o.Payload) +} +func (o *PcloudTenantsGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsGetForbidden) 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 +} + +// NewPcloudTenantsGetNotFound creates a PcloudTenantsGetNotFound with default headers values +func NewPcloudTenantsGetNotFound() *PcloudTenantsGetNotFound { + return &PcloudTenantsGetNotFound{} +} + +/* PcloudTenantsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudTenantsGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudTenantsGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudTenantsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsGetNotFound) 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 +} + +// NewPcloudTenantsGetInternalServerError creates a PcloudTenantsGetInternalServerError with default headers values +func NewPcloudTenantsGetInternalServerError() *PcloudTenantsGetInternalServerError { + return &PcloudTenantsGetInternalServerError{} +} + +/* PcloudTenantsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudTenantsGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudTenantsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudTenantsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants/pcloud_tenants_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants/pcloud_tenants_put_parameters.go new file mode 100644 index 00000000000..182262c5134 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants/pcloud_tenants_put_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants + +// 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" +) + +// NewPcloudTenantsPutParams creates a new PcloudTenantsPutParams 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 NewPcloudTenantsPutParams() *PcloudTenantsPutParams { + return &PcloudTenantsPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudTenantsPutParamsWithTimeout creates a new PcloudTenantsPutParams object +// with the ability to set a timeout on a request. +func NewPcloudTenantsPutParamsWithTimeout(timeout time.Duration) *PcloudTenantsPutParams { + return &PcloudTenantsPutParams{ + timeout: timeout, + } +} + +// NewPcloudTenantsPutParamsWithContext creates a new PcloudTenantsPutParams object +// with the ability to set a context for a request. +func NewPcloudTenantsPutParamsWithContext(ctx context.Context) *PcloudTenantsPutParams { + return &PcloudTenantsPutParams{ + Context: ctx, + } +} + +// NewPcloudTenantsPutParamsWithHTTPClient creates a new PcloudTenantsPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudTenantsPutParamsWithHTTPClient(client *http.Client) *PcloudTenantsPutParams { + return &PcloudTenantsPutParams{ + HTTPClient: client, + } +} + +/* PcloudTenantsPutParams contains all the parameters to send to the API endpoint + for the pcloud tenants put operation. + + Typically these are written to a http.Request. +*/ +type PcloudTenantsPutParams struct { + + /* Body. + + Parameters for updating a Tenant + */ + Body *models.TenantUpdate + + /* TenantID. + + Tenant ID of a pcloud tenant + */ + TenantID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud tenants put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsPutParams) WithDefaults() *PcloudTenantsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tenants put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud tenants put params +func (o *PcloudTenantsPutParams) WithTimeout(timeout time.Duration) *PcloudTenantsPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud tenants put params +func (o *PcloudTenantsPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud tenants put params +func (o *PcloudTenantsPutParams) WithContext(ctx context.Context) *PcloudTenantsPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud tenants put params +func (o *PcloudTenantsPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud tenants put params +func (o *PcloudTenantsPutParams) WithHTTPClient(client *http.Client) *PcloudTenantsPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud tenants put params +func (o *PcloudTenantsPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud tenants put params +func (o *PcloudTenantsPutParams) WithBody(body *models.TenantUpdate) *PcloudTenantsPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud tenants put params +func (o *PcloudTenantsPutParams) SetBody(body *models.TenantUpdate) { + o.Body = body +} + +// WithTenantID adds the tenantID to the pcloud tenants put params +func (o *PcloudTenantsPutParams) WithTenantID(tenantID string) *PcloudTenantsPutParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the pcloud tenants put params +func (o *PcloudTenantsPutParams) SetTenantID(tenantID string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudTenantsPutParams) 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 tenant_id + if err := r.SetPathParam("tenant_id", o.TenantID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants/pcloud_tenants_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants/pcloud_tenants_put_responses.go new file mode 100644 index 00000000000..75fec044d2c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants/pcloud_tenants_put_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudTenantsPutReader is a Reader for the PcloudTenantsPut structure. +type PcloudTenantsPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudTenantsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudTenantsPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudTenantsPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudTenantsPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudTenantsPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudTenantsPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudTenantsPutOK creates a PcloudTenantsPutOK with default headers values +func NewPcloudTenantsPutOK() *PcloudTenantsPutOK { + return &PcloudTenantsPutOK{} +} + +/* PcloudTenantsPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudTenantsPutOK struct { + Payload *models.Tenant +} + +func (o *PcloudTenantsPutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsPutOK %+v", 200, o.Payload) +} +func (o *PcloudTenantsPutOK) GetPayload() *models.Tenant { + return o.Payload +} + +func (o *PcloudTenantsPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Tenant) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudTenantsPutBadRequest creates a PcloudTenantsPutBadRequest with default headers values +func NewPcloudTenantsPutBadRequest() *PcloudTenantsPutBadRequest { + return &PcloudTenantsPutBadRequest{} +} + +/* PcloudTenantsPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudTenantsPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudTenantsPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudTenantsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsPutBadRequest) 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 +} + +// NewPcloudTenantsPutUnauthorized creates a PcloudTenantsPutUnauthorized with default headers values +func NewPcloudTenantsPutUnauthorized() *PcloudTenantsPutUnauthorized { + return &PcloudTenantsPutUnauthorized{} +} + +/* PcloudTenantsPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudTenantsPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudTenantsPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudTenantsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsPutUnauthorized) 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 +} + +// NewPcloudTenantsPutUnprocessableEntity creates a PcloudTenantsPutUnprocessableEntity with default headers values +func NewPcloudTenantsPutUnprocessableEntity() *PcloudTenantsPutUnprocessableEntity { + return &PcloudTenantsPutUnprocessableEntity{} +} + +/* PcloudTenantsPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudTenantsPutUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudTenantsPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsPutUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudTenantsPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsPutUnprocessableEntity) 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 +} + +// NewPcloudTenantsPutInternalServerError creates a PcloudTenantsPutInternalServerError with default headers values +func NewPcloudTenantsPutInternalServerError() *PcloudTenantsPutInternalServerError { + return &PcloudTenantsPutInternalServerError{} +} + +/* PcloudTenantsPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudTenantsPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudTenantsPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}][%d] pcloudTenantsPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudTenantsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/p_cloud_tenants_ssh_keys_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/p_cloud_tenants_ssh_keys_client.go new file mode 100644 index 00000000000..d05737fe800 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/p_cloud_tenants_ssh_keys_client.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants_ssh_keys + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud tenants ssh keys API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud tenants ssh keys API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudTenantsSshkeysDelete(params *PcloudTenantsSshkeysDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysDeleteOK, error) + + PcloudTenantsSshkeysGet(params *PcloudTenantsSshkeysGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysGetOK, error) + + PcloudTenantsSshkeysGetall(params *PcloudTenantsSshkeysGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysGetallOK, error) + + PcloudTenantsSshkeysPost(params *PcloudTenantsSshkeysPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysPostOK, *PcloudTenantsSshkeysPostCreated, error) + + PcloudTenantsSshkeysPut(params *PcloudTenantsSshkeysPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudTenantsSshkeysDelete deletes a tenant s SSH key +*/ +func (a *Client) PcloudTenantsSshkeysDelete(params *PcloudTenantsSshkeysDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudTenantsSshkeysDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.tenants.sshkeys.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudTenantsSshkeysDeleteReader{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.(*PcloudTenantsSshkeysDeleteOK) + 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 pcloud.tenants.sshkeys.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudTenantsSshkeysGet gets a tenant s SSH key by name +*/ +func (a *Client) PcloudTenantsSshkeysGet(params *PcloudTenantsSshkeysGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudTenantsSshkeysGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.tenants.sshkeys.get", + Method: "GET", + PathPattern: "/pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudTenantsSshkeysGetReader{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.(*PcloudTenantsSshkeysGetOK) + 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 pcloud.tenants.sshkeys.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudTenantsSshkeysGetall lists a tenant s SSH keys +*/ +func (a *Client) PcloudTenantsSshkeysGetall(params *PcloudTenantsSshkeysGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudTenantsSshkeysGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.tenants.sshkeys.getall", + Method: "GET", + PathPattern: "/pcloud/v1/tenants/{tenant_id}/sshkeys", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudTenantsSshkeysGetallReader{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.(*PcloudTenantsSshkeysGetallOK) + 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 pcloud.tenants.sshkeys.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudTenantsSshkeysPost adds a new SSH key to the tenant +*/ +func (a *Client) PcloudTenantsSshkeysPost(params *PcloudTenantsSshkeysPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysPostOK, *PcloudTenantsSshkeysPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudTenantsSshkeysPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.tenants.sshkeys.post", + Method: "POST", + PathPattern: "/pcloud/v1/tenants/{tenant_id}/sshkeys", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudTenantsSshkeysPostReader{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 *PcloudTenantsSshkeysPostOK: + return value, nil, nil + case *PcloudTenantsSshkeysPostCreated: + 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 p_cloud_tenants_ssh_keys: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudTenantsSshkeysPut updates an SSH key +*/ +func (a *Client) PcloudTenantsSshkeysPut(params *PcloudTenantsSshkeysPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudTenantsSshkeysPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudTenantsSshkeysPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.tenants.sshkeys.put", + Method: "PUT", + PathPattern: "/pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudTenantsSshkeysPutReader{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.(*PcloudTenantsSshkeysPutOK) + 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 pcloud.tenants.sshkeys.put: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_delete_parameters.go new file mode 100644 index 00000000000..0de6c32d747 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_delete_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants_ssh_keys + +// 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" +) + +// NewPcloudTenantsSshkeysDeleteParams creates a new PcloudTenantsSshkeysDeleteParams 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 NewPcloudTenantsSshkeysDeleteParams() *PcloudTenantsSshkeysDeleteParams { + return &PcloudTenantsSshkeysDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudTenantsSshkeysDeleteParamsWithTimeout creates a new PcloudTenantsSshkeysDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudTenantsSshkeysDeleteParamsWithTimeout(timeout time.Duration) *PcloudTenantsSshkeysDeleteParams { + return &PcloudTenantsSshkeysDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudTenantsSshkeysDeleteParamsWithContext creates a new PcloudTenantsSshkeysDeleteParams object +// with the ability to set a context for a request. +func NewPcloudTenantsSshkeysDeleteParamsWithContext(ctx context.Context) *PcloudTenantsSshkeysDeleteParams { + return &PcloudTenantsSshkeysDeleteParams{ + Context: ctx, + } +} + +// NewPcloudTenantsSshkeysDeleteParamsWithHTTPClient creates a new PcloudTenantsSshkeysDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudTenantsSshkeysDeleteParamsWithHTTPClient(client *http.Client) *PcloudTenantsSshkeysDeleteParams { + return &PcloudTenantsSshkeysDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudTenantsSshkeysDeleteParams contains all the parameters to send to the API endpoint + for the pcloud tenants sshkeys delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudTenantsSshkeysDeleteParams struct { + + /* SshkeyName. + + SSH key name for a pcloud tenant + */ + SshkeyName string + + /* TenantID. + + Tenant ID of a pcloud tenant + */ + TenantID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud tenants sshkeys delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysDeleteParams) WithDefaults() *PcloudTenantsSshkeysDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tenants sshkeys delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud tenants sshkeys delete params +func (o *PcloudTenantsSshkeysDeleteParams) WithTimeout(timeout time.Duration) *PcloudTenantsSshkeysDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud tenants sshkeys delete params +func (o *PcloudTenantsSshkeysDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud tenants sshkeys delete params +func (o *PcloudTenantsSshkeysDeleteParams) WithContext(ctx context.Context) *PcloudTenantsSshkeysDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud tenants sshkeys delete params +func (o *PcloudTenantsSshkeysDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud tenants sshkeys delete params +func (o *PcloudTenantsSshkeysDeleteParams) WithHTTPClient(client *http.Client) *PcloudTenantsSshkeysDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud tenants sshkeys delete params +func (o *PcloudTenantsSshkeysDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithSshkeyName adds the sshkeyName to the pcloud tenants sshkeys delete params +func (o *PcloudTenantsSshkeysDeleteParams) WithSshkeyName(sshkeyName string) *PcloudTenantsSshkeysDeleteParams { + o.SetSshkeyName(sshkeyName) + return o +} + +// SetSshkeyName adds the sshkeyName to the pcloud tenants sshkeys delete params +func (o *PcloudTenantsSshkeysDeleteParams) SetSshkeyName(sshkeyName string) { + o.SshkeyName = sshkeyName +} + +// WithTenantID adds the tenantID to the pcloud tenants sshkeys delete params +func (o *PcloudTenantsSshkeysDeleteParams) WithTenantID(tenantID string) *PcloudTenantsSshkeysDeleteParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the pcloud tenants sshkeys delete params +func (o *PcloudTenantsSshkeysDeleteParams) SetTenantID(tenantID string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudTenantsSshkeysDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param sshkey_name + if err := r.SetPathParam("sshkey_name", o.SshkeyName); err != nil { + return err + } + + // path param tenant_id + if err := r.SetPathParam("tenant_id", o.TenantID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_delete_responses.go new file mode 100644 index 00000000000..2c0f8aa23d5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_delete_responses.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants_ssh_keys + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudTenantsSshkeysDeleteReader is a Reader for the PcloudTenantsSshkeysDelete structure. +type PcloudTenantsSshkeysDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudTenantsSshkeysDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudTenantsSshkeysDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudTenantsSshkeysDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudTenantsSshkeysDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewPcloudTenantsSshkeysDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudTenantsSshkeysDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudTenantsSshkeysDeleteOK creates a PcloudTenantsSshkeysDeleteOK with default headers values +func NewPcloudTenantsSshkeysDeleteOK() *PcloudTenantsSshkeysDeleteOK { + return &PcloudTenantsSshkeysDeleteOK{} +} + +/* PcloudTenantsSshkeysDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudTenantsSshkeysDeleteOK struct { + Payload models.Object +} + +func (o *PcloudTenantsSshkeysDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudTenantsSshkeysDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudTenantsSshkeysDeleteOK) 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 +} + +// NewPcloudTenantsSshkeysDeleteBadRequest creates a PcloudTenantsSshkeysDeleteBadRequest with default headers values +func NewPcloudTenantsSshkeysDeleteBadRequest() *PcloudTenantsSshkeysDeleteBadRequest { + return &PcloudTenantsSshkeysDeleteBadRequest{} +} + +/* PcloudTenantsSshkeysDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudTenantsSshkeysDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudTenantsSshkeysDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysDeleteBadRequest) 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 +} + +// NewPcloudTenantsSshkeysDeleteUnauthorized creates a PcloudTenantsSshkeysDeleteUnauthorized with default headers values +func NewPcloudTenantsSshkeysDeleteUnauthorized() *PcloudTenantsSshkeysDeleteUnauthorized { + return &PcloudTenantsSshkeysDeleteUnauthorized{} +} + +/* PcloudTenantsSshkeysDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudTenantsSshkeysDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudTenantsSshkeysDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysDeleteUnauthorized) 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 +} + +// NewPcloudTenantsSshkeysDeleteGone creates a PcloudTenantsSshkeysDeleteGone with default headers values +func NewPcloudTenantsSshkeysDeleteGone() *PcloudTenantsSshkeysDeleteGone { + return &PcloudTenantsSshkeysDeleteGone{} +} + +/* PcloudTenantsSshkeysDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudTenantsSshkeysDeleteGone struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysDeleteGone) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysDeleteGone %+v", 410, o.Payload) +} +func (o *PcloudTenantsSshkeysDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysDeleteGone) 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 +} + +// NewPcloudTenantsSshkeysDeleteInternalServerError creates a PcloudTenantsSshkeysDeleteInternalServerError with default headers values +func NewPcloudTenantsSshkeysDeleteInternalServerError() *PcloudTenantsSshkeysDeleteInternalServerError { + return &PcloudTenantsSshkeysDeleteInternalServerError{} +} + +/* PcloudTenantsSshkeysDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudTenantsSshkeysDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudTenantsSshkeysDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_get_parameters.go new file mode 100644 index 00000000000..574cc6ae919 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants_ssh_keys + +// 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" +) + +// NewPcloudTenantsSshkeysGetParams creates a new PcloudTenantsSshkeysGetParams 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 NewPcloudTenantsSshkeysGetParams() *PcloudTenantsSshkeysGetParams { + return &PcloudTenantsSshkeysGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudTenantsSshkeysGetParamsWithTimeout creates a new PcloudTenantsSshkeysGetParams object +// with the ability to set a timeout on a request. +func NewPcloudTenantsSshkeysGetParamsWithTimeout(timeout time.Duration) *PcloudTenantsSshkeysGetParams { + return &PcloudTenantsSshkeysGetParams{ + timeout: timeout, + } +} + +// NewPcloudTenantsSshkeysGetParamsWithContext creates a new PcloudTenantsSshkeysGetParams object +// with the ability to set a context for a request. +func NewPcloudTenantsSshkeysGetParamsWithContext(ctx context.Context) *PcloudTenantsSshkeysGetParams { + return &PcloudTenantsSshkeysGetParams{ + Context: ctx, + } +} + +// NewPcloudTenantsSshkeysGetParamsWithHTTPClient creates a new PcloudTenantsSshkeysGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudTenantsSshkeysGetParamsWithHTTPClient(client *http.Client) *PcloudTenantsSshkeysGetParams { + return &PcloudTenantsSshkeysGetParams{ + HTTPClient: client, + } +} + +/* PcloudTenantsSshkeysGetParams contains all the parameters to send to the API endpoint + for the pcloud tenants sshkeys get operation. + + Typically these are written to a http.Request. +*/ +type PcloudTenantsSshkeysGetParams struct { + + /* SshkeyName. + + SSH key name for a pcloud tenant + */ + SshkeyName string + + /* TenantID. + + Tenant ID of a pcloud tenant + */ + TenantID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud tenants sshkeys get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysGetParams) WithDefaults() *PcloudTenantsSshkeysGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tenants sshkeys get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud tenants sshkeys get params +func (o *PcloudTenantsSshkeysGetParams) WithTimeout(timeout time.Duration) *PcloudTenantsSshkeysGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud tenants sshkeys get params +func (o *PcloudTenantsSshkeysGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud tenants sshkeys get params +func (o *PcloudTenantsSshkeysGetParams) WithContext(ctx context.Context) *PcloudTenantsSshkeysGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud tenants sshkeys get params +func (o *PcloudTenantsSshkeysGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud tenants sshkeys get params +func (o *PcloudTenantsSshkeysGetParams) WithHTTPClient(client *http.Client) *PcloudTenantsSshkeysGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud tenants sshkeys get params +func (o *PcloudTenantsSshkeysGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithSshkeyName adds the sshkeyName to the pcloud tenants sshkeys get params +func (o *PcloudTenantsSshkeysGetParams) WithSshkeyName(sshkeyName string) *PcloudTenantsSshkeysGetParams { + o.SetSshkeyName(sshkeyName) + return o +} + +// SetSshkeyName adds the sshkeyName to the pcloud tenants sshkeys get params +func (o *PcloudTenantsSshkeysGetParams) SetSshkeyName(sshkeyName string) { + o.SshkeyName = sshkeyName +} + +// WithTenantID adds the tenantID to the pcloud tenants sshkeys get params +func (o *PcloudTenantsSshkeysGetParams) WithTenantID(tenantID string) *PcloudTenantsSshkeysGetParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the pcloud tenants sshkeys get params +func (o *PcloudTenantsSshkeysGetParams) SetTenantID(tenantID string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudTenantsSshkeysGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param sshkey_name + if err := r.SetPathParam("sshkey_name", o.SshkeyName); err != nil { + return err + } + + // path param tenant_id + if err := r.SetPathParam("tenant_id", o.TenantID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_get_responses.go new file mode 100644 index 00000000000..f49bad3c0df --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants_ssh_keys + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudTenantsSshkeysGetReader is a Reader for the PcloudTenantsSshkeysGet structure. +type PcloudTenantsSshkeysGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudTenantsSshkeysGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudTenantsSshkeysGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudTenantsSshkeysGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudTenantsSshkeysGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudTenantsSshkeysGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudTenantsSshkeysGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudTenantsSshkeysGetOK creates a PcloudTenantsSshkeysGetOK with default headers values +func NewPcloudTenantsSshkeysGetOK() *PcloudTenantsSshkeysGetOK { + return &PcloudTenantsSshkeysGetOK{} +} + +/* PcloudTenantsSshkeysGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudTenantsSshkeysGetOK struct { + Payload *models.SSHKey +} + +func (o *PcloudTenantsSshkeysGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysGetOK %+v", 200, o.Payload) +} +func (o *PcloudTenantsSshkeysGetOK) GetPayload() *models.SSHKey { + return o.Payload +} + +func (o *PcloudTenantsSshkeysGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SSHKey) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudTenantsSshkeysGetBadRequest creates a PcloudTenantsSshkeysGetBadRequest with default headers values +func NewPcloudTenantsSshkeysGetBadRequest() *PcloudTenantsSshkeysGetBadRequest { + return &PcloudTenantsSshkeysGetBadRequest{} +} + +/* PcloudTenantsSshkeysGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudTenantsSshkeysGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudTenantsSshkeysGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysGetBadRequest) 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 +} + +// NewPcloudTenantsSshkeysGetUnauthorized creates a PcloudTenantsSshkeysGetUnauthorized with default headers values +func NewPcloudTenantsSshkeysGetUnauthorized() *PcloudTenantsSshkeysGetUnauthorized { + return &PcloudTenantsSshkeysGetUnauthorized{} +} + +/* PcloudTenantsSshkeysGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudTenantsSshkeysGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudTenantsSshkeysGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysGetUnauthorized) 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 +} + +// NewPcloudTenantsSshkeysGetNotFound creates a PcloudTenantsSshkeysGetNotFound with default headers values +func NewPcloudTenantsSshkeysGetNotFound() *PcloudTenantsSshkeysGetNotFound { + return &PcloudTenantsSshkeysGetNotFound{} +} + +/* PcloudTenantsSshkeysGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudTenantsSshkeysGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudTenantsSshkeysGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysGetNotFound) 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 +} + +// NewPcloudTenantsSshkeysGetInternalServerError creates a PcloudTenantsSshkeysGetInternalServerError with default headers values +func NewPcloudTenantsSshkeysGetInternalServerError() *PcloudTenantsSshkeysGetInternalServerError { + return &PcloudTenantsSshkeysGetInternalServerError{} +} + +/* PcloudTenantsSshkeysGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudTenantsSshkeysGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudTenantsSshkeysGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_getall_parameters.go new file mode 100644 index 00000000000..0e0e30b0411 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_getall_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants_ssh_keys + +// 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" +) + +// NewPcloudTenantsSshkeysGetallParams creates a new PcloudTenantsSshkeysGetallParams 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 NewPcloudTenantsSshkeysGetallParams() *PcloudTenantsSshkeysGetallParams { + return &PcloudTenantsSshkeysGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudTenantsSshkeysGetallParamsWithTimeout creates a new PcloudTenantsSshkeysGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudTenantsSshkeysGetallParamsWithTimeout(timeout time.Duration) *PcloudTenantsSshkeysGetallParams { + return &PcloudTenantsSshkeysGetallParams{ + timeout: timeout, + } +} + +// NewPcloudTenantsSshkeysGetallParamsWithContext creates a new PcloudTenantsSshkeysGetallParams object +// with the ability to set a context for a request. +func NewPcloudTenantsSshkeysGetallParamsWithContext(ctx context.Context) *PcloudTenantsSshkeysGetallParams { + return &PcloudTenantsSshkeysGetallParams{ + Context: ctx, + } +} + +// NewPcloudTenantsSshkeysGetallParamsWithHTTPClient creates a new PcloudTenantsSshkeysGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudTenantsSshkeysGetallParamsWithHTTPClient(client *http.Client) *PcloudTenantsSshkeysGetallParams { + return &PcloudTenantsSshkeysGetallParams{ + HTTPClient: client, + } +} + +/* PcloudTenantsSshkeysGetallParams contains all the parameters to send to the API endpoint + for the pcloud tenants sshkeys getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudTenantsSshkeysGetallParams struct { + + /* TenantID. + + Tenant ID of a pcloud tenant + */ + TenantID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud tenants sshkeys getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysGetallParams) WithDefaults() *PcloudTenantsSshkeysGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tenants sshkeys getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud tenants sshkeys getall params +func (o *PcloudTenantsSshkeysGetallParams) WithTimeout(timeout time.Duration) *PcloudTenantsSshkeysGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud tenants sshkeys getall params +func (o *PcloudTenantsSshkeysGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud tenants sshkeys getall params +func (o *PcloudTenantsSshkeysGetallParams) WithContext(ctx context.Context) *PcloudTenantsSshkeysGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud tenants sshkeys getall params +func (o *PcloudTenantsSshkeysGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud tenants sshkeys getall params +func (o *PcloudTenantsSshkeysGetallParams) WithHTTPClient(client *http.Client) *PcloudTenantsSshkeysGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud tenants sshkeys getall params +func (o *PcloudTenantsSshkeysGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithTenantID adds the tenantID to the pcloud tenants sshkeys getall params +func (o *PcloudTenantsSshkeysGetallParams) WithTenantID(tenantID string) *PcloudTenantsSshkeysGetallParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the pcloud tenants sshkeys getall params +func (o *PcloudTenantsSshkeysGetallParams) SetTenantID(tenantID string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudTenantsSshkeysGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param tenant_id + if err := r.SetPathParam("tenant_id", o.TenantID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_getall_responses.go new file mode 100644 index 00000000000..700ea0eb980 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_getall_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants_ssh_keys + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudTenantsSshkeysGetallReader is a Reader for the PcloudTenantsSshkeysGetall structure. +type PcloudTenantsSshkeysGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudTenantsSshkeysGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudTenantsSshkeysGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudTenantsSshkeysGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudTenantsSshkeysGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudTenantsSshkeysGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudTenantsSshkeysGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudTenantsSshkeysGetallOK creates a PcloudTenantsSshkeysGetallOK with default headers values +func NewPcloudTenantsSshkeysGetallOK() *PcloudTenantsSshkeysGetallOK { + return &PcloudTenantsSshkeysGetallOK{} +} + +/* PcloudTenantsSshkeysGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudTenantsSshkeysGetallOK struct { + Payload *models.SSHKeys +} + +func (o *PcloudTenantsSshkeysGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysGetallOK %+v", 200, o.Payload) +} +func (o *PcloudTenantsSshkeysGetallOK) GetPayload() *models.SSHKeys { + return o.Payload +} + +func (o *PcloudTenantsSshkeysGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SSHKeys) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudTenantsSshkeysGetallBadRequest creates a PcloudTenantsSshkeysGetallBadRequest with default headers values +func NewPcloudTenantsSshkeysGetallBadRequest() *PcloudTenantsSshkeysGetallBadRequest { + return &PcloudTenantsSshkeysGetallBadRequest{} +} + +/* PcloudTenantsSshkeysGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudTenantsSshkeysGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudTenantsSshkeysGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysGetallBadRequest) 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 +} + +// NewPcloudTenantsSshkeysGetallUnauthorized creates a PcloudTenantsSshkeysGetallUnauthorized with default headers values +func NewPcloudTenantsSshkeysGetallUnauthorized() *PcloudTenantsSshkeysGetallUnauthorized { + return &PcloudTenantsSshkeysGetallUnauthorized{} +} + +/* PcloudTenantsSshkeysGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudTenantsSshkeysGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudTenantsSshkeysGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysGetallUnauthorized) 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 +} + +// NewPcloudTenantsSshkeysGetallNotFound creates a PcloudTenantsSshkeysGetallNotFound with default headers values +func NewPcloudTenantsSshkeysGetallNotFound() *PcloudTenantsSshkeysGetallNotFound { + return &PcloudTenantsSshkeysGetallNotFound{} +} + +/* PcloudTenantsSshkeysGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudTenantsSshkeysGetallNotFound struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysGetallNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysGetallNotFound %+v", 404, o.Payload) +} +func (o *PcloudTenantsSshkeysGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysGetallNotFound) 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 +} + +// NewPcloudTenantsSshkeysGetallInternalServerError creates a PcloudTenantsSshkeysGetallInternalServerError with default headers values +func NewPcloudTenantsSshkeysGetallInternalServerError() *PcloudTenantsSshkeysGetallInternalServerError { + return &PcloudTenantsSshkeysGetallInternalServerError{} +} + +/* PcloudTenantsSshkeysGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudTenantsSshkeysGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudTenantsSshkeysGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_post_parameters.go new file mode 100644 index 00000000000..0f65423a5e5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants_ssh_keys + +// 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" +) + +// NewPcloudTenantsSshkeysPostParams creates a new PcloudTenantsSshkeysPostParams 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 NewPcloudTenantsSshkeysPostParams() *PcloudTenantsSshkeysPostParams { + return &PcloudTenantsSshkeysPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudTenantsSshkeysPostParamsWithTimeout creates a new PcloudTenantsSshkeysPostParams object +// with the ability to set a timeout on a request. +func NewPcloudTenantsSshkeysPostParamsWithTimeout(timeout time.Duration) *PcloudTenantsSshkeysPostParams { + return &PcloudTenantsSshkeysPostParams{ + timeout: timeout, + } +} + +// NewPcloudTenantsSshkeysPostParamsWithContext creates a new PcloudTenantsSshkeysPostParams object +// with the ability to set a context for a request. +func NewPcloudTenantsSshkeysPostParamsWithContext(ctx context.Context) *PcloudTenantsSshkeysPostParams { + return &PcloudTenantsSshkeysPostParams{ + Context: ctx, + } +} + +// NewPcloudTenantsSshkeysPostParamsWithHTTPClient creates a new PcloudTenantsSshkeysPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudTenantsSshkeysPostParamsWithHTTPClient(client *http.Client) *PcloudTenantsSshkeysPostParams { + return &PcloudTenantsSshkeysPostParams{ + HTTPClient: client, + } +} + +/* PcloudTenantsSshkeysPostParams contains all the parameters to send to the API endpoint + for the pcloud tenants sshkeys post operation. + + Typically these are written to a http.Request. +*/ +type PcloudTenantsSshkeysPostParams struct { + + /* Body. + + Parameters for the creation of a new SSH key + */ + Body *models.SSHKey + + /* TenantID. + + Tenant ID of a pcloud tenant + */ + TenantID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud tenants sshkeys post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysPostParams) WithDefaults() *PcloudTenantsSshkeysPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tenants sshkeys post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud tenants sshkeys post params +func (o *PcloudTenantsSshkeysPostParams) WithTimeout(timeout time.Duration) *PcloudTenantsSshkeysPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud tenants sshkeys post params +func (o *PcloudTenantsSshkeysPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud tenants sshkeys post params +func (o *PcloudTenantsSshkeysPostParams) WithContext(ctx context.Context) *PcloudTenantsSshkeysPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud tenants sshkeys post params +func (o *PcloudTenantsSshkeysPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud tenants sshkeys post params +func (o *PcloudTenantsSshkeysPostParams) WithHTTPClient(client *http.Client) *PcloudTenantsSshkeysPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud tenants sshkeys post params +func (o *PcloudTenantsSshkeysPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud tenants sshkeys post params +func (o *PcloudTenantsSshkeysPostParams) WithBody(body *models.SSHKey) *PcloudTenantsSshkeysPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud tenants sshkeys post params +func (o *PcloudTenantsSshkeysPostParams) SetBody(body *models.SSHKey) { + o.Body = body +} + +// WithTenantID adds the tenantID to the pcloud tenants sshkeys post params +func (o *PcloudTenantsSshkeysPostParams) WithTenantID(tenantID string) *PcloudTenantsSshkeysPostParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the pcloud tenants sshkeys post params +func (o *PcloudTenantsSshkeysPostParams) SetTenantID(tenantID string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudTenantsSshkeysPostParams) 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 tenant_id + if err := r.SetPathParam("tenant_id", o.TenantID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_post_responses.go new file mode 100644 index 00000000000..2717b7ea58b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_post_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants_ssh_keys + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudTenantsSshkeysPostReader is a Reader for the PcloudTenantsSshkeysPost structure. +type PcloudTenantsSshkeysPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudTenantsSshkeysPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudTenantsSshkeysPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 201: + result := NewPcloudTenantsSshkeysPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudTenantsSshkeysPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudTenantsSshkeysPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudTenantsSshkeysPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudTenantsSshkeysPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudTenantsSshkeysPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudTenantsSshkeysPostOK creates a PcloudTenantsSshkeysPostOK with default headers values +func NewPcloudTenantsSshkeysPostOK() *PcloudTenantsSshkeysPostOK { + return &PcloudTenantsSshkeysPostOK{} +} + +/* PcloudTenantsSshkeysPostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudTenantsSshkeysPostOK struct { + Payload *models.SSHKey +} + +func (o *PcloudTenantsSshkeysPostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysPostOK %+v", 200, o.Payload) +} +func (o *PcloudTenantsSshkeysPostOK) GetPayload() *models.SSHKey { + return o.Payload +} + +func (o *PcloudTenantsSshkeysPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SSHKey) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudTenantsSshkeysPostCreated creates a PcloudTenantsSshkeysPostCreated with default headers values +func NewPcloudTenantsSshkeysPostCreated() *PcloudTenantsSshkeysPostCreated { + return &PcloudTenantsSshkeysPostCreated{} +} + +/* PcloudTenantsSshkeysPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type PcloudTenantsSshkeysPostCreated struct { + Payload *models.SSHKey +} + +func (o *PcloudTenantsSshkeysPostCreated) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysPostCreated %+v", 201, o.Payload) +} +func (o *PcloudTenantsSshkeysPostCreated) GetPayload() *models.SSHKey { + return o.Payload +} + +func (o *PcloudTenantsSshkeysPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SSHKey) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudTenantsSshkeysPostBadRequest creates a PcloudTenantsSshkeysPostBadRequest with default headers values +func NewPcloudTenantsSshkeysPostBadRequest() *PcloudTenantsSshkeysPostBadRequest { + return &PcloudTenantsSshkeysPostBadRequest{} +} + +/* PcloudTenantsSshkeysPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudTenantsSshkeysPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudTenantsSshkeysPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysPostBadRequest) 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 +} + +// NewPcloudTenantsSshkeysPostUnauthorized creates a PcloudTenantsSshkeysPostUnauthorized with default headers values +func NewPcloudTenantsSshkeysPostUnauthorized() *PcloudTenantsSshkeysPostUnauthorized { + return &PcloudTenantsSshkeysPostUnauthorized{} +} + +/* PcloudTenantsSshkeysPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudTenantsSshkeysPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudTenantsSshkeysPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysPostUnauthorized) 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 +} + +// NewPcloudTenantsSshkeysPostConflict creates a PcloudTenantsSshkeysPostConflict with default headers values +func NewPcloudTenantsSshkeysPostConflict() *PcloudTenantsSshkeysPostConflict { + return &PcloudTenantsSshkeysPostConflict{} +} + +/* PcloudTenantsSshkeysPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudTenantsSshkeysPostConflict struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysPostConflict %+v", 409, o.Payload) +} +func (o *PcloudTenantsSshkeysPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysPostConflict) 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 +} + +// NewPcloudTenantsSshkeysPostUnprocessableEntity creates a PcloudTenantsSshkeysPostUnprocessableEntity with default headers values +func NewPcloudTenantsSshkeysPostUnprocessableEntity() *PcloudTenantsSshkeysPostUnprocessableEntity { + return &PcloudTenantsSshkeysPostUnprocessableEntity{} +} + +/* PcloudTenantsSshkeysPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudTenantsSshkeysPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudTenantsSshkeysPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysPostUnprocessableEntity) 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 +} + +// NewPcloudTenantsSshkeysPostInternalServerError creates a PcloudTenantsSshkeysPostInternalServerError with default headers values +func NewPcloudTenantsSshkeysPostInternalServerError() *PcloudTenantsSshkeysPostInternalServerError { + return &PcloudTenantsSshkeysPostInternalServerError{} +} + +/* PcloudTenantsSshkeysPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudTenantsSshkeysPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/tenants/{tenant_id}/sshkeys][%d] pcloudTenantsSshkeysPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudTenantsSshkeysPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_put_parameters.go new file mode 100644 index 00000000000..af532745052 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_put_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants_ssh_keys + +// 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" +) + +// NewPcloudTenantsSshkeysPutParams creates a new PcloudTenantsSshkeysPutParams 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 NewPcloudTenantsSshkeysPutParams() *PcloudTenantsSshkeysPutParams { + return &PcloudTenantsSshkeysPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudTenantsSshkeysPutParamsWithTimeout creates a new PcloudTenantsSshkeysPutParams object +// with the ability to set a timeout on a request. +func NewPcloudTenantsSshkeysPutParamsWithTimeout(timeout time.Duration) *PcloudTenantsSshkeysPutParams { + return &PcloudTenantsSshkeysPutParams{ + timeout: timeout, + } +} + +// NewPcloudTenantsSshkeysPutParamsWithContext creates a new PcloudTenantsSshkeysPutParams object +// with the ability to set a context for a request. +func NewPcloudTenantsSshkeysPutParamsWithContext(ctx context.Context) *PcloudTenantsSshkeysPutParams { + return &PcloudTenantsSshkeysPutParams{ + Context: ctx, + } +} + +// NewPcloudTenantsSshkeysPutParamsWithHTTPClient creates a new PcloudTenantsSshkeysPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudTenantsSshkeysPutParamsWithHTTPClient(client *http.Client) *PcloudTenantsSshkeysPutParams { + return &PcloudTenantsSshkeysPutParams{ + HTTPClient: client, + } +} + +/* PcloudTenantsSshkeysPutParams contains all the parameters to send to the API endpoint + for the pcloud tenants sshkeys put operation. + + Typically these are written to a http.Request. +*/ +type PcloudTenantsSshkeysPutParams struct { + + /* Body. + + Parameters for updating a Tenant's SSH Key + */ + Body *models.SSHKey + + /* SshkeyName. + + SSH key name for a pcloud tenant + */ + SshkeyName string + + /* TenantID. + + Tenant ID of a pcloud tenant + */ + TenantID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud tenants sshkeys put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysPutParams) WithDefaults() *PcloudTenantsSshkeysPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud tenants sshkeys put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudTenantsSshkeysPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud tenants sshkeys put params +func (o *PcloudTenantsSshkeysPutParams) WithTimeout(timeout time.Duration) *PcloudTenantsSshkeysPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud tenants sshkeys put params +func (o *PcloudTenantsSshkeysPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud tenants sshkeys put params +func (o *PcloudTenantsSshkeysPutParams) WithContext(ctx context.Context) *PcloudTenantsSshkeysPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud tenants sshkeys put params +func (o *PcloudTenantsSshkeysPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud tenants sshkeys put params +func (o *PcloudTenantsSshkeysPutParams) WithHTTPClient(client *http.Client) *PcloudTenantsSshkeysPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud tenants sshkeys put params +func (o *PcloudTenantsSshkeysPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud tenants sshkeys put params +func (o *PcloudTenantsSshkeysPutParams) WithBody(body *models.SSHKey) *PcloudTenantsSshkeysPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud tenants sshkeys put params +func (o *PcloudTenantsSshkeysPutParams) SetBody(body *models.SSHKey) { + o.Body = body +} + +// WithSshkeyName adds the sshkeyName to the pcloud tenants sshkeys put params +func (o *PcloudTenantsSshkeysPutParams) WithSshkeyName(sshkeyName string) *PcloudTenantsSshkeysPutParams { + o.SetSshkeyName(sshkeyName) + return o +} + +// SetSshkeyName adds the sshkeyName to the pcloud tenants sshkeys put params +func (o *PcloudTenantsSshkeysPutParams) SetSshkeyName(sshkeyName string) { + o.SshkeyName = sshkeyName +} + +// WithTenantID adds the tenantID to the pcloud tenants sshkeys put params +func (o *PcloudTenantsSshkeysPutParams) WithTenantID(tenantID string) *PcloudTenantsSshkeysPutParams { + o.SetTenantID(tenantID) + return o +} + +// SetTenantID adds the tenantId to the pcloud tenants sshkeys put params +func (o *PcloudTenantsSshkeysPutParams) SetTenantID(tenantID string) { + o.TenantID = tenantID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudTenantsSshkeysPutParams) 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 sshkey_name + if err := r.SetPathParam("sshkey_name", o.SshkeyName); err != nil { + return err + } + + // path param tenant_id + if err := r.SetPathParam("tenant_id", o.TenantID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_put_responses.go new file mode 100644 index 00000000000..5d091866f57 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys/pcloud_tenants_sshkeys_put_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_tenants_ssh_keys + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudTenantsSshkeysPutReader is a Reader for the PcloudTenantsSshkeysPut structure. +type PcloudTenantsSshkeysPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudTenantsSshkeysPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudTenantsSshkeysPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudTenantsSshkeysPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudTenantsSshkeysPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudTenantsSshkeysPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudTenantsSshkeysPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudTenantsSshkeysPutOK creates a PcloudTenantsSshkeysPutOK with default headers values +func NewPcloudTenantsSshkeysPutOK() *PcloudTenantsSshkeysPutOK { + return &PcloudTenantsSshkeysPutOK{} +} + +/* PcloudTenantsSshkeysPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudTenantsSshkeysPutOK struct { + Payload *models.SSHKey +} + +func (o *PcloudTenantsSshkeysPutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysPutOK %+v", 200, o.Payload) +} +func (o *PcloudTenantsSshkeysPutOK) GetPayload() *models.SSHKey { + return o.Payload +} + +func (o *PcloudTenantsSshkeysPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SSHKey) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudTenantsSshkeysPutBadRequest creates a PcloudTenantsSshkeysPutBadRequest with default headers values +func NewPcloudTenantsSshkeysPutBadRequest() *PcloudTenantsSshkeysPutBadRequest { + return &PcloudTenantsSshkeysPutBadRequest{} +} + +/* PcloudTenantsSshkeysPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudTenantsSshkeysPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudTenantsSshkeysPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysPutBadRequest) 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 +} + +// NewPcloudTenantsSshkeysPutUnauthorized creates a PcloudTenantsSshkeysPutUnauthorized with default headers values +func NewPcloudTenantsSshkeysPutUnauthorized() *PcloudTenantsSshkeysPutUnauthorized { + return &PcloudTenantsSshkeysPutUnauthorized{} +} + +/* PcloudTenantsSshkeysPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudTenantsSshkeysPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudTenantsSshkeysPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysPutUnauthorized) 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 +} + +// NewPcloudTenantsSshkeysPutUnprocessableEntity creates a PcloudTenantsSshkeysPutUnprocessableEntity with default headers values +func NewPcloudTenantsSshkeysPutUnprocessableEntity() *PcloudTenantsSshkeysPutUnprocessableEntity { + return &PcloudTenantsSshkeysPutUnprocessableEntity{} +} + +/* PcloudTenantsSshkeysPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudTenantsSshkeysPutUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysPutUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudTenantsSshkeysPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysPutUnprocessableEntity) 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 +} + +// NewPcloudTenantsSshkeysPutInternalServerError creates a PcloudTenantsSshkeysPutInternalServerError with default headers values +func NewPcloudTenantsSshkeysPutInternalServerError() *PcloudTenantsSshkeysPutInternalServerError { + return &PcloudTenantsSshkeysPutInternalServerError{} +} + +/* PcloudTenantsSshkeysPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudTenantsSshkeysPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudTenantsSshkeysPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/tenants/{tenant_id}/sshkeys/{sshkey_name}][%d] pcloudTenantsSshkeysPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudTenantsSshkeysPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudTenantsSshkeysPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/p_cloudvpn_connections_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/p_cloudvpn_connections_client.go new file mode 100644 index 00000000000..95a58fbebb0 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/p_cloudvpn_connections_client.go @@ -0,0 +1,512 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud v p n connections API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud v p n connections API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudVpnconnectionsDelete(params *PcloudVpnconnectionsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsDeleteAccepted, error) + + PcloudVpnconnectionsGet(params *PcloudVpnconnectionsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsGetOK, error) + + PcloudVpnconnectionsGetall(params *PcloudVpnconnectionsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsGetallOK, error) + + PcloudVpnconnectionsNetworksDelete(params *PcloudVpnconnectionsNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsNetworksDeleteAccepted, error) + + PcloudVpnconnectionsNetworksGet(params *PcloudVpnconnectionsNetworksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsNetworksGetOK, error) + + PcloudVpnconnectionsNetworksPut(params *PcloudVpnconnectionsNetworksPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsNetworksPutAccepted, error) + + PcloudVpnconnectionsPeersubnetsDelete(params *PcloudVpnconnectionsPeersubnetsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPeersubnetsDeleteOK, error) + + PcloudVpnconnectionsPeersubnetsGet(params *PcloudVpnconnectionsPeersubnetsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPeersubnetsGetOK, error) + + PcloudVpnconnectionsPeersubnetsPut(params *PcloudVpnconnectionsPeersubnetsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPeersubnetsPutOK, error) + + PcloudVpnconnectionsPost(params *PcloudVpnconnectionsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPostAccepted, error) + + PcloudVpnconnectionsPut(params *PcloudVpnconnectionsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudVpnconnectionsDelete deletes v p n connection + + Delete VPN Connection (by its identifier) +*/ +func (a *Client) PcloudVpnconnectionsDelete(params *PcloudVpnconnectionsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsDeleteReader{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.(*PcloudVpnconnectionsDeleteAccepted) + 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 pcloud.vpnconnections.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsGet gets v p n connection + + Get a VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsGet(params *PcloudVpnconnectionsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsGetReader{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.(*PcloudVpnconnectionsGetOK) + 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 pcloud.vpnconnections.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsGetall gets all v p n connections + + Get all VPN Connections +*/ +func (a *Client) PcloudVpnconnectionsGetall(params *PcloudVpnconnectionsGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsGetallReader{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.(*PcloudVpnconnectionsGetallOK) + 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 pcloud.vpnconnections.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsNetworksDelete detaches network + + Detach network from a specific VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsNetworksDelete(params *PcloudVpnconnectionsNetworksDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsNetworksDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsNetworksDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.networks.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsNetworksDeleteReader{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.(*PcloudVpnconnectionsNetworksDeleteAccepted) + 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 pcloud.vpnconnections.networks.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsNetworksGet gets attached networks + + Get a list of network IDs attached to a VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsNetworksGet(params *PcloudVpnconnectionsNetworksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsNetworksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsNetworksGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.networks.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsNetworksGetReader{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.(*PcloudVpnconnectionsNetworksGetOK) + 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 pcloud.vpnconnections.networks.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsNetworksPut attaches network + + Attach a network to a VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsNetworksPut(params *PcloudVpnconnectionsNetworksPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsNetworksPutAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsNetworksPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.networks.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsNetworksPutReader{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.(*PcloudVpnconnectionsNetworksPutAccepted) + 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 pcloud.vpnconnections.networks.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsPeersubnetsDelete detaches peer subnet + + Detach peer subnet from a VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsPeersubnetsDelete(params *PcloudVpnconnectionsPeersubnetsDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPeersubnetsDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsPeersubnetsDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.peersubnets.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsPeersubnetsDeleteReader{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.(*PcloudVpnconnectionsPeersubnetsDeleteOK) + 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 pcloud.vpnconnections.peersubnets.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsPeersubnetsGet gets peer subnets + + Get a list of peer subnets attached to a specific VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsPeersubnetsGet(params *PcloudVpnconnectionsPeersubnetsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPeersubnetsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsPeersubnetsGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.peersubnets.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsPeersubnetsGetReader{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.(*PcloudVpnconnectionsPeersubnetsGetOK) + 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 pcloud.vpnconnections.peersubnets.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsPeersubnetsPut attaches peer subnet + + Attach peer subnet to a VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsPeersubnetsPut(params *PcloudVpnconnectionsPeersubnetsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPeersubnetsPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsPeersubnetsPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.peersubnets.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsPeersubnetsPutReader{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.(*PcloudVpnconnectionsPeersubnetsPutOK) + 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 pcloud.vpnconnections.peersubnets.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsPost creates v p n connection + + Create a new VPN Connection +*/ +func (a *Client) PcloudVpnconnectionsPost(params *PcloudVpnconnectionsPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsPostReader{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.(*PcloudVpnconnectionsPostAccepted) + 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 pcloud.vpnconnections.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVpnconnectionsPut updates v p n connection + + update a VPN Connection (by its identifier) +*/ +func (a *Client) PcloudVpnconnectionsPut(params *PcloudVpnconnectionsPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVpnconnectionsPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVpnconnectionsPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.vpnconnections.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVpnconnectionsPutReader{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.(*PcloudVpnconnectionsPutOK) + 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 pcloud.vpnconnections.put: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_delete_parameters.go new file mode 100644 index 00000000000..6bb03a9b94b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_delete_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// 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" +) + +// NewPcloudVpnconnectionsDeleteParams creates a new PcloudVpnconnectionsDeleteParams 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 NewPcloudVpnconnectionsDeleteParams() *PcloudVpnconnectionsDeleteParams { + return &PcloudVpnconnectionsDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVpnconnectionsDeleteParamsWithTimeout creates a new PcloudVpnconnectionsDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudVpnconnectionsDeleteParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsDeleteParams { + return &PcloudVpnconnectionsDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudVpnconnectionsDeleteParamsWithContext creates a new PcloudVpnconnectionsDeleteParams object +// with the ability to set a context for a request. +func NewPcloudVpnconnectionsDeleteParamsWithContext(ctx context.Context) *PcloudVpnconnectionsDeleteParams { + return &PcloudVpnconnectionsDeleteParams{ + Context: ctx, + } +} + +// NewPcloudVpnconnectionsDeleteParamsWithHTTPClient creates a new PcloudVpnconnectionsDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVpnconnectionsDeleteParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsDeleteParams { + return &PcloudVpnconnectionsDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudVpnconnectionsDeleteParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudVpnconnectionsDeleteParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VpnConnectionID. + + ID of a VPN connection + */ + VpnConnectionID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud vpnconnections delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsDeleteParams) WithDefaults() *PcloudVpnconnectionsDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud vpnconnections delete params +func (o *PcloudVpnconnectionsDeleteParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud vpnconnections delete params +func (o *PcloudVpnconnectionsDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud vpnconnections delete params +func (o *PcloudVpnconnectionsDeleteParams) WithContext(ctx context.Context) *PcloudVpnconnectionsDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud vpnconnections delete params +func (o *PcloudVpnconnectionsDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud vpnconnections delete params +func (o *PcloudVpnconnectionsDeleteParams) WithHTTPClient(client *http.Client) *PcloudVpnconnectionsDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud vpnconnections delete params +func (o *PcloudVpnconnectionsDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud vpnconnections delete params +func (o *PcloudVpnconnectionsDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudVpnconnectionsDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud vpnconnections delete params +func (o *PcloudVpnconnectionsDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVpnConnectionID adds the vpnConnectionID to the pcloud vpnconnections delete params +func (o *PcloudVpnconnectionsDeleteParams) WithVpnConnectionID(vpnConnectionID string) *PcloudVpnconnectionsDeleteParams { + o.SetVpnConnectionID(vpnConnectionID) + return o +} + +// SetVpnConnectionID adds the vpnConnectionId to the pcloud vpnconnections delete params +func (o *PcloudVpnconnectionsDeleteParams) SetVpnConnectionID(vpnConnectionID string) { + o.VpnConnectionID = vpnConnectionID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVpnconnectionsDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param vpn_connection_id + if err := r.SetPathParam("vpn_connection_id", o.VpnConnectionID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_delete_responses.go new file mode 100644 index 00000000000..cd546b15228 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_delete_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudVpnconnectionsDeleteReader is a Reader for the PcloudVpnconnectionsDelete structure. +type PcloudVpnconnectionsDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVpnconnectionsDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudVpnconnectionsDeleteAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVpnconnectionsDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVpnconnectionsDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudVpnconnectionsDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudVpnconnectionsDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVpnconnectionsDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudVpnconnectionsDeleteAccepted creates a PcloudVpnconnectionsDeleteAccepted with default headers values +func NewPcloudVpnconnectionsDeleteAccepted() *PcloudVpnconnectionsDeleteAccepted { + return &PcloudVpnconnectionsDeleteAccepted{} +} + +/* PcloudVpnconnectionsDeleteAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudVpnconnectionsDeleteAccepted struct { + Payload *models.JobReference +} + +func (o *PcloudVpnconnectionsDeleteAccepted) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsDeleteAccepted %+v", 202, o.Payload) +} +func (o *PcloudVpnconnectionsDeleteAccepted) GetPayload() *models.JobReference { + return o.Payload +} + +func (o *PcloudVpnconnectionsDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.JobReference) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudVpnconnectionsDeleteBadRequest creates a PcloudVpnconnectionsDeleteBadRequest with default headers values +func NewPcloudVpnconnectionsDeleteBadRequest() *PcloudVpnconnectionsDeleteBadRequest { + return &PcloudVpnconnectionsDeleteBadRequest{} +} + +/* PcloudVpnconnectionsDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVpnconnectionsDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudVpnconnectionsDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsDeleteBadRequest) 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 +} + +// NewPcloudVpnconnectionsDeleteUnauthorized creates a PcloudVpnconnectionsDeleteUnauthorized with default headers values +func NewPcloudVpnconnectionsDeleteUnauthorized() *PcloudVpnconnectionsDeleteUnauthorized { + return &PcloudVpnconnectionsDeleteUnauthorized{} +} + +/* PcloudVpnconnectionsDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVpnconnectionsDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudVpnconnectionsDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsDeleteUnauthorized) 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 +} + +// NewPcloudVpnconnectionsDeleteForbidden creates a PcloudVpnconnectionsDeleteForbidden with default headers values +func NewPcloudVpnconnectionsDeleteForbidden() *PcloudVpnconnectionsDeleteForbidden { + return &PcloudVpnconnectionsDeleteForbidden{} +} + +/* PcloudVpnconnectionsDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudVpnconnectionsDeleteForbidden struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsDeleteForbidden %+v", 403, o.Payload) +} +func (o *PcloudVpnconnectionsDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsDeleteForbidden) 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 +} + +// NewPcloudVpnconnectionsDeleteNotFound creates a PcloudVpnconnectionsDeleteNotFound with default headers values +func NewPcloudVpnconnectionsDeleteNotFound() *PcloudVpnconnectionsDeleteNotFound { + return &PcloudVpnconnectionsDeleteNotFound{} +} + +/* PcloudVpnconnectionsDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudVpnconnectionsDeleteNotFound struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsDeleteNotFound %+v", 404, o.Payload) +} +func (o *PcloudVpnconnectionsDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsDeleteNotFound) 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 +} + +// NewPcloudVpnconnectionsDeleteInternalServerError creates a PcloudVpnconnectionsDeleteInternalServerError with default headers values +func NewPcloudVpnconnectionsDeleteInternalServerError() *PcloudVpnconnectionsDeleteInternalServerError { + return &PcloudVpnconnectionsDeleteInternalServerError{} +} + +/* PcloudVpnconnectionsDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVpnconnectionsDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudVpnconnectionsDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_get_parameters.go new file mode 100644 index 00000000000..9e34b4962b0 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// 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" +) + +// NewPcloudVpnconnectionsGetParams creates a new PcloudVpnconnectionsGetParams 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 NewPcloudVpnconnectionsGetParams() *PcloudVpnconnectionsGetParams { + return &PcloudVpnconnectionsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVpnconnectionsGetParamsWithTimeout creates a new PcloudVpnconnectionsGetParams object +// with the ability to set a timeout on a request. +func NewPcloudVpnconnectionsGetParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsGetParams { + return &PcloudVpnconnectionsGetParams{ + timeout: timeout, + } +} + +// NewPcloudVpnconnectionsGetParamsWithContext creates a new PcloudVpnconnectionsGetParams object +// with the ability to set a context for a request. +func NewPcloudVpnconnectionsGetParamsWithContext(ctx context.Context) *PcloudVpnconnectionsGetParams { + return &PcloudVpnconnectionsGetParams{ + Context: ctx, + } +} + +// NewPcloudVpnconnectionsGetParamsWithHTTPClient creates a new PcloudVpnconnectionsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVpnconnectionsGetParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsGetParams { + return &PcloudVpnconnectionsGetParams{ + HTTPClient: client, + } +} + +/* PcloudVpnconnectionsGetParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections get operation. + + Typically these are written to a http.Request. +*/ +type PcloudVpnconnectionsGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VpnConnectionID. + + ID of a VPN connection + */ + VpnConnectionID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud vpnconnections get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsGetParams) WithDefaults() *PcloudVpnconnectionsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud vpnconnections get params +func (o *PcloudVpnconnectionsGetParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud vpnconnections get params +func (o *PcloudVpnconnectionsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud vpnconnections get params +func (o *PcloudVpnconnectionsGetParams) WithContext(ctx context.Context) *PcloudVpnconnectionsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud vpnconnections get params +func (o *PcloudVpnconnectionsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud vpnconnections get params +func (o *PcloudVpnconnectionsGetParams) WithHTTPClient(client *http.Client) *PcloudVpnconnectionsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud vpnconnections get params +func (o *PcloudVpnconnectionsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud vpnconnections get params +func (o *PcloudVpnconnectionsGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudVpnconnectionsGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud vpnconnections get params +func (o *PcloudVpnconnectionsGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVpnConnectionID adds the vpnConnectionID to the pcloud vpnconnections get params +func (o *PcloudVpnconnectionsGetParams) WithVpnConnectionID(vpnConnectionID string) *PcloudVpnconnectionsGetParams { + o.SetVpnConnectionID(vpnConnectionID) + return o +} + +// SetVpnConnectionID adds the vpnConnectionId to the pcloud vpnconnections get params +func (o *PcloudVpnconnectionsGetParams) SetVpnConnectionID(vpnConnectionID string) { + o.VpnConnectionID = vpnConnectionID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVpnconnectionsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param vpn_connection_id + if err := r.SetPathParam("vpn_connection_id", o.VpnConnectionID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_get_responses.go new file mode 100644 index 00000000000..79413add9d7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_get_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudVpnconnectionsGetReader is a Reader for the PcloudVpnconnectionsGet structure. +type PcloudVpnconnectionsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVpnconnectionsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudVpnconnectionsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVpnconnectionsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVpnconnectionsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudVpnconnectionsGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudVpnconnectionsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudVpnconnectionsGetUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVpnconnectionsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudVpnconnectionsGetOK creates a PcloudVpnconnectionsGetOK with default headers values +func NewPcloudVpnconnectionsGetOK() *PcloudVpnconnectionsGetOK { + return &PcloudVpnconnectionsGetOK{} +} + +/* PcloudVpnconnectionsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudVpnconnectionsGetOK struct { + Payload *models.VPNConnection +} + +func (o *PcloudVpnconnectionsGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsGetOK %+v", 200, o.Payload) +} +func (o *PcloudVpnconnectionsGetOK) GetPayload() *models.VPNConnection { + return o.Payload +} + +func (o *PcloudVpnconnectionsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VPNConnection) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudVpnconnectionsGetBadRequest creates a PcloudVpnconnectionsGetBadRequest with default headers values +func NewPcloudVpnconnectionsGetBadRequest() *PcloudVpnconnectionsGetBadRequest { + return &PcloudVpnconnectionsGetBadRequest{} +} + +/* PcloudVpnconnectionsGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVpnconnectionsGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudVpnconnectionsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsGetBadRequest) 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 +} + +// NewPcloudVpnconnectionsGetUnauthorized creates a PcloudVpnconnectionsGetUnauthorized with default headers values +func NewPcloudVpnconnectionsGetUnauthorized() *PcloudVpnconnectionsGetUnauthorized { + return &PcloudVpnconnectionsGetUnauthorized{} +} + +/* PcloudVpnconnectionsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVpnconnectionsGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudVpnconnectionsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsGetUnauthorized) 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 +} + +// NewPcloudVpnconnectionsGetForbidden creates a PcloudVpnconnectionsGetForbidden with default headers values +func NewPcloudVpnconnectionsGetForbidden() *PcloudVpnconnectionsGetForbidden { + return &PcloudVpnconnectionsGetForbidden{} +} + +/* PcloudVpnconnectionsGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudVpnconnectionsGetForbidden struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsGetForbidden) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsGetForbidden %+v", 403, o.Payload) +} +func (o *PcloudVpnconnectionsGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsGetForbidden) 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 +} + +// NewPcloudVpnconnectionsGetNotFound creates a PcloudVpnconnectionsGetNotFound with default headers values +func NewPcloudVpnconnectionsGetNotFound() *PcloudVpnconnectionsGetNotFound { + return &PcloudVpnconnectionsGetNotFound{} +} + +/* PcloudVpnconnectionsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudVpnconnectionsGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudVpnconnectionsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsGetNotFound) 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 +} + +// NewPcloudVpnconnectionsGetUnprocessableEntity creates a PcloudVpnconnectionsGetUnprocessableEntity with default headers values +func NewPcloudVpnconnectionsGetUnprocessableEntity() *PcloudVpnconnectionsGetUnprocessableEntity { + return &PcloudVpnconnectionsGetUnprocessableEntity{} +} + +/* PcloudVpnconnectionsGetUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudVpnconnectionsGetUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsGetUnprocessableEntity) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsGetUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudVpnconnectionsGetUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsGetUnprocessableEntity) 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 +} + +// NewPcloudVpnconnectionsGetInternalServerError creates a PcloudVpnconnectionsGetInternalServerError with default headers values +func NewPcloudVpnconnectionsGetInternalServerError() *PcloudVpnconnectionsGetInternalServerError { + return &PcloudVpnconnectionsGetInternalServerError{} +} + +/* PcloudVpnconnectionsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVpnconnectionsGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudVpnconnectionsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_getall_parameters.go new file mode 100644 index 00000000000..08d55e3aecd --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_getall_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// 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" +) + +// NewPcloudVpnconnectionsGetallParams creates a new PcloudVpnconnectionsGetallParams 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 NewPcloudVpnconnectionsGetallParams() *PcloudVpnconnectionsGetallParams { + return &PcloudVpnconnectionsGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVpnconnectionsGetallParamsWithTimeout creates a new PcloudVpnconnectionsGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudVpnconnectionsGetallParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsGetallParams { + return &PcloudVpnconnectionsGetallParams{ + timeout: timeout, + } +} + +// NewPcloudVpnconnectionsGetallParamsWithContext creates a new PcloudVpnconnectionsGetallParams object +// with the ability to set a context for a request. +func NewPcloudVpnconnectionsGetallParamsWithContext(ctx context.Context) *PcloudVpnconnectionsGetallParams { + return &PcloudVpnconnectionsGetallParams{ + Context: ctx, + } +} + +// NewPcloudVpnconnectionsGetallParamsWithHTTPClient creates a new PcloudVpnconnectionsGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVpnconnectionsGetallParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsGetallParams { + return &PcloudVpnconnectionsGetallParams{ + HTTPClient: client, + } +} + +/* PcloudVpnconnectionsGetallParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudVpnconnectionsGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud vpnconnections getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsGetallParams) WithDefaults() *PcloudVpnconnectionsGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud vpnconnections getall params +func (o *PcloudVpnconnectionsGetallParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud vpnconnections getall params +func (o *PcloudVpnconnectionsGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud vpnconnections getall params +func (o *PcloudVpnconnectionsGetallParams) WithContext(ctx context.Context) *PcloudVpnconnectionsGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud vpnconnections getall params +func (o *PcloudVpnconnectionsGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud vpnconnections getall params +func (o *PcloudVpnconnectionsGetallParams) WithHTTPClient(client *http.Client) *PcloudVpnconnectionsGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud vpnconnections getall params +func (o *PcloudVpnconnectionsGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud vpnconnections getall params +func (o *PcloudVpnconnectionsGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudVpnconnectionsGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud vpnconnections getall params +func (o *PcloudVpnconnectionsGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVpnconnectionsGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_getall_responses.go new file mode 100644 index 00000000000..487398c79ce --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_getall_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudVpnconnectionsGetallReader is a Reader for the PcloudVpnconnectionsGetall structure. +type PcloudVpnconnectionsGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVpnconnectionsGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudVpnconnectionsGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVpnconnectionsGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVpnconnectionsGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudVpnconnectionsGetallForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudVpnconnectionsGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVpnconnectionsGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudVpnconnectionsGetallOK creates a PcloudVpnconnectionsGetallOK with default headers values +func NewPcloudVpnconnectionsGetallOK() *PcloudVpnconnectionsGetallOK { + return &PcloudVpnconnectionsGetallOK{} +} + +/* PcloudVpnconnectionsGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudVpnconnectionsGetallOK struct { + Payload *models.VPNConnections +} + +func (o *PcloudVpnconnectionsGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsGetallOK %+v", 200, o.Payload) +} +func (o *PcloudVpnconnectionsGetallOK) GetPayload() *models.VPNConnections { + return o.Payload +} + +func (o *PcloudVpnconnectionsGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VPNConnections) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudVpnconnectionsGetallBadRequest creates a PcloudVpnconnectionsGetallBadRequest with default headers values +func NewPcloudVpnconnectionsGetallBadRequest() *PcloudVpnconnectionsGetallBadRequest { + return &PcloudVpnconnectionsGetallBadRequest{} +} + +/* PcloudVpnconnectionsGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVpnconnectionsGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudVpnconnectionsGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsGetallBadRequest) 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 +} + +// NewPcloudVpnconnectionsGetallUnauthorized creates a PcloudVpnconnectionsGetallUnauthorized with default headers values +func NewPcloudVpnconnectionsGetallUnauthorized() *PcloudVpnconnectionsGetallUnauthorized { + return &PcloudVpnconnectionsGetallUnauthorized{} +} + +/* PcloudVpnconnectionsGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVpnconnectionsGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudVpnconnectionsGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsGetallUnauthorized) 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 +} + +// NewPcloudVpnconnectionsGetallForbidden creates a PcloudVpnconnectionsGetallForbidden with default headers values +func NewPcloudVpnconnectionsGetallForbidden() *PcloudVpnconnectionsGetallForbidden { + return &PcloudVpnconnectionsGetallForbidden{} +} + +/* PcloudVpnconnectionsGetallForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudVpnconnectionsGetallForbidden struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsGetallForbidden) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsGetallForbidden %+v", 403, o.Payload) +} +func (o *PcloudVpnconnectionsGetallForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsGetallForbidden) 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 +} + +// NewPcloudVpnconnectionsGetallNotFound creates a PcloudVpnconnectionsGetallNotFound with default headers values +func NewPcloudVpnconnectionsGetallNotFound() *PcloudVpnconnectionsGetallNotFound { + return &PcloudVpnconnectionsGetallNotFound{} +} + +/* PcloudVpnconnectionsGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudVpnconnectionsGetallNotFound struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsGetallNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsGetallNotFound %+v", 404, o.Payload) +} +func (o *PcloudVpnconnectionsGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsGetallNotFound) 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 +} + +// NewPcloudVpnconnectionsGetallInternalServerError creates a PcloudVpnconnectionsGetallInternalServerError with default headers values +func NewPcloudVpnconnectionsGetallInternalServerError() *PcloudVpnconnectionsGetallInternalServerError { + return &PcloudVpnconnectionsGetallInternalServerError{} +} + +/* PcloudVpnconnectionsGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVpnconnectionsGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudVpnconnectionsGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_delete_parameters.go new file mode 100644 index 00000000000..a7b4b14a236 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_delete_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// 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" +) + +// NewPcloudVpnconnectionsNetworksDeleteParams creates a new PcloudVpnconnectionsNetworksDeleteParams 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 NewPcloudVpnconnectionsNetworksDeleteParams() *PcloudVpnconnectionsNetworksDeleteParams { + return &PcloudVpnconnectionsNetworksDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVpnconnectionsNetworksDeleteParamsWithTimeout creates a new PcloudVpnconnectionsNetworksDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudVpnconnectionsNetworksDeleteParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsNetworksDeleteParams { + return &PcloudVpnconnectionsNetworksDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudVpnconnectionsNetworksDeleteParamsWithContext creates a new PcloudVpnconnectionsNetworksDeleteParams object +// with the ability to set a context for a request. +func NewPcloudVpnconnectionsNetworksDeleteParamsWithContext(ctx context.Context) *PcloudVpnconnectionsNetworksDeleteParams { + return &PcloudVpnconnectionsNetworksDeleteParams{ + Context: ctx, + } +} + +// NewPcloudVpnconnectionsNetworksDeleteParamsWithHTTPClient creates a new PcloudVpnconnectionsNetworksDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVpnconnectionsNetworksDeleteParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsNetworksDeleteParams { + return &PcloudVpnconnectionsNetworksDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudVpnconnectionsNetworksDeleteParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections networks delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudVpnconnectionsNetworksDeleteParams struct { + + /* Body. + + network to detach + */ + Body *models.NetworkID + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VpnConnectionID. + + ID of a VPN connection + */ + VpnConnectionID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud vpnconnections networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsNetworksDeleteParams) WithDefaults() *PcloudVpnconnectionsNetworksDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections networks delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsNetworksDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud vpnconnections networks delete params +func (o *PcloudVpnconnectionsNetworksDeleteParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsNetworksDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud vpnconnections networks delete params +func (o *PcloudVpnconnectionsNetworksDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud vpnconnections networks delete params +func (o *PcloudVpnconnectionsNetworksDeleteParams) WithContext(ctx context.Context) *PcloudVpnconnectionsNetworksDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud vpnconnections networks delete params +func (o *PcloudVpnconnectionsNetworksDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud vpnconnections networks delete params +func (o *PcloudVpnconnectionsNetworksDeleteParams) WithHTTPClient(client *http.Client) *PcloudVpnconnectionsNetworksDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud vpnconnections networks delete params +func (o *PcloudVpnconnectionsNetworksDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud vpnconnections networks delete params +func (o *PcloudVpnconnectionsNetworksDeleteParams) WithBody(body *models.NetworkID) *PcloudVpnconnectionsNetworksDeleteParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud vpnconnections networks delete params +func (o *PcloudVpnconnectionsNetworksDeleteParams) SetBody(body *models.NetworkID) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud vpnconnections networks delete params +func (o *PcloudVpnconnectionsNetworksDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudVpnconnectionsNetworksDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud vpnconnections networks delete params +func (o *PcloudVpnconnectionsNetworksDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVpnConnectionID adds the vpnConnectionID to the pcloud vpnconnections networks delete params +func (o *PcloudVpnconnectionsNetworksDeleteParams) WithVpnConnectionID(vpnConnectionID string) *PcloudVpnconnectionsNetworksDeleteParams { + o.SetVpnConnectionID(vpnConnectionID) + return o +} + +// SetVpnConnectionID adds the vpnConnectionId to the pcloud vpnconnections networks delete params +func (o *PcloudVpnconnectionsNetworksDeleteParams) SetVpnConnectionID(vpnConnectionID string) { + o.VpnConnectionID = vpnConnectionID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVpnconnectionsNetworksDeleteParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param vpn_connection_id + if err := r.SetPathParam("vpn_connection_id", o.VpnConnectionID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_delete_responses.go new file mode 100644 index 00000000000..4d2685a4b9d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_delete_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudVpnconnectionsNetworksDeleteReader is a Reader for the PcloudVpnconnectionsNetworksDelete structure. +type PcloudVpnconnectionsNetworksDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVpnconnectionsNetworksDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudVpnconnectionsNetworksDeleteAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVpnconnectionsNetworksDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVpnconnectionsNetworksDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudVpnconnectionsNetworksDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudVpnconnectionsNetworksDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudVpnconnectionsNetworksDeleteUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVpnconnectionsNetworksDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudVpnconnectionsNetworksDeleteAccepted creates a PcloudVpnconnectionsNetworksDeleteAccepted with default headers values +func NewPcloudVpnconnectionsNetworksDeleteAccepted() *PcloudVpnconnectionsNetworksDeleteAccepted { + return &PcloudVpnconnectionsNetworksDeleteAccepted{} +} + +/* PcloudVpnconnectionsNetworksDeleteAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudVpnconnectionsNetworksDeleteAccepted struct { + Payload *models.JobReference +} + +func (o *PcloudVpnconnectionsNetworksDeleteAccepted) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksDeleteAccepted %+v", 202, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksDeleteAccepted) GetPayload() *models.JobReference { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.JobReference) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudVpnconnectionsNetworksDeleteBadRequest creates a PcloudVpnconnectionsNetworksDeleteBadRequest with default headers values +func NewPcloudVpnconnectionsNetworksDeleteBadRequest() *PcloudVpnconnectionsNetworksDeleteBadRequest { + return &PcloudVpnconnectionsNetworksDeleteBadRequest{} +} + +/* PcloudVpnconnectionsNetworksDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVpnconnectionsNetworksDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksDeleteBadRequest) 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 +} + +// NewPcloudVpnconnectionsNetworksDeleteUnauthorized creates a PcloudVpnconnectionsNetworksDeleteUnauthorized with default headers values +func NewPcloudVpnconnectionsNetworksDeleteUnauthorized() *PcloudVpnconnectionsNetworksDeleteUnauthorized { + return &PcloudVpnconnectionsNetworksDeleteUnauthorized{} +} + +/* PcloudVpnconnectionsNetworksDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVpnconnectionsNetworksDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksDeleteUnauthorized) 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 +} + +// NewPcloudVpnconnectionsNetworksDeleteForbidden creates a PcloudVpnconnectionsNetworksDeleteForbidden with default headers values +func NewPcloudVpnconnectionsNetworksDeleteForbidden() *PcloudVpnconnectionsNetworksDeleteForbidden { + return &PcloudVpnconnectionsNetworksDeleteForbidden{} +} + +/* PcloudVpnconnectionsNetworksDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudVpnconnectionsNetworksDeleteForbidden struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksDeleteForbidden %+v", 403, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksDeleteForbidden) 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 +} + +// NewPcloudVpnconnectionsNetworksDeleteNotFound creates a PcloudVpnconnectionsNetworksDeleteNotFound with default headers values +func NewPcloudVpnconnectionsNetworksDeleteNotFound() *PcloudVpnconnectionsNetworksDeleteNotFound { + return &PcloudVpnconnectionsNetworksDeleteNotFound{} +} + +/* PcloudVpnconnectionsNetworksDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudVpnconnectionsNetworksDeleteNotFound struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksDeleteNotFound %+v", 404, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksDeleteNotFound) 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 +} + +// NewPcloudVpnconnectionsNetworksDeleteUnprocessableEntity creates a PcloudVpnconnectionsNetworksDeleteUnprocessableEntity with default headers values +func NewPcloudVpnconnectionsNetworksDeleteUnprocessableEntity() *PcloudVpnconnectionsNetworksDeleteUnprocessableEntity { + return &PcloudVpnconnectionsNetworksDeleteUnprocessableEntity{} +} + +/* PcloudVpnconnectionsNetworksDeleteUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudVpnconnectionsNetworksDeleteUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksDeleteUnprocessableEntity) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksDeleteUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksDeleteUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksDeleteUnprocessableEntity) 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 +} + +// NewPcloudVpnconnectionsNetworksDeleteInternalServerError creates a PcloudVpnconnectionsNetworksDeleteInternalServerError with default headers values +func NewPcloudVpnconnectionsNetworksDeleteInternalServerError() *PcloudVpnconnectionsNetworksDeleteInternalServerError { + return &PcloudVpnconnectionsNetworksDeleteInternalServerError{} +} + +/* PcloudVpnconnectionsNetworksDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVpnconnectionsNetworksDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_get_parameters.go new file mode 100644 index 00000000000..a09738cfa28 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// 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" +) + +// NewPcloudVpnconnectionsNetworksGetParams creates a new PcloudVpnconnectionsNetworksGetParams 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 NewPcloudVpnconnectionsNetworksGetParams() *PcloudVpnconnectionsNetworksGetParams { + return &PcloudVpnconnectionsNetworksGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVpnconnectionsNetworksGetParamsWithTimeout creates a new PcloudVpnconnectionsNetworksGetParams object +// with the ability to set a timeout on a request. +func NewPcloudVpnconnectionsNetworksGetParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsNetworksGetParams { + return &PcloudVpnconnectionsNetworksGetParams{ + timeout: timeout, + } +} + +// NewPcloudVpnconnectionsNetworksGetParamsWithContext creates a new PcloudVpnconnectionsNetworksGetParams object +// with the ability to set a context for a request. +func NewPcloudVpnconnectionsNetworksGetParamsWithContext(ctx context.Context) *PcloudVpnconnectionsNetworksGetParams { + return &PcloudVpnconnectionsNetworksGetParams{ + Context: ctx, + } +} + +// NewPcloudVpnconnectionsNetworksGetParamsWithHTTPClient creates a new PcloudVpnconnectionsNetworksGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVpnconnectionsNetworksGetParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsNetworksGetParams { + return &PcloudVpnconnectionsNetworksGetParams{ + HTTPClient: client, + } +} + +/* PcloudVpnconnectionsNetworksGetParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections networks get operation. + + Typically these are written to a http.Request. +*/ +type PcloudVpnconnectionsNetworksGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VpnConnectionID. + + ID of a VPN connection + */ + VpnConnectionID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud vpnconnections networks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsNetworksGetParams) WithDefaults() *PcloudVpnconnectionsNetworksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections networks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsNetworksGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud vpnconnections networks get params +func (o *PcloudVpnconnectionsNetworksGetParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsNetworksGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud vpnconnections networks get params +func (o *PcloudVpnconnectionsNetworksGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud vpnconnections networks get params +func (o *PcloudVpnconnectionsNetworksGetParams) WithContext(ctx context.Context) *PcloudVpnconnectionsNetworksGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud vpnconnections networks get params +func (o *PcloudVpnconnectionsNetworksGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud vpnconnections networks get params +func (o *PcloudVpnconnectionsNetworksGetParams) WithHTTPClient(client *http.Client) *PcloudVpnconnectionsNetworksGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud vpnconnections networks get params +func (o *PcloudVpnconnectionsNetworksGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud vpnconnections networks get params +func (o *PcloudVpnconnectionsNetworksGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudVpnconnectionsNetworksGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud vpnconnections networks get params +func (o *PcloudVpnconnectionsNetworksGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVpnConnectionID adds the vpnConnectionID to the pcloud vpnconnections networks get params +func (o *PcloudVpnconnectionsNetworksGetParams) WithVpnConnectionID(vpnConnectionID string) *PcloudVpnconnectionsNetworksGetParams { + o.SetVpnConnectionID(vpnConnectionID) + return o +} + +// SetVpnConnectionID adds the vpnConnectionId to the pcloud vpnconnections networks get params +func (o *PcloudVpnconnectionsNetworksGetParams) SetVpnConnectionID(vpnConnectionID string) { + o.VpnConnectionID = vpnConnectionID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVpnconnectionsNetworksGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param vpn_connection_id + if err := r.SetPathParam("vpn_connection_id", o.VpnConnectionID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_get_responses.go new file mode 100644 index 00000000000..de86c27f685 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_get_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudVpnconnectionsNetworksGetReader is a Reader for the PcloudVpnconnectionsNetworksGet structure. +type PcloudVpnconnectionsNetworksGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVpnconnectionsNetworksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudVpnconnectionsNetworksGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVpnconnectionsNetworksGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVpnconnectionsNetworksGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudVpnconnectionsNetworksGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudVpnconnectionsNetworksGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVpnconnectionsNetworksGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudVpnconnectionsNetworksGetOK creates a PcloudVpnconnectionsNetworksGetOK with default headers values +func NewPcloudVpnconnectionsNetworksGetOK() *PcloudVpnconnectionsNetworksGetOK { + return &PcloudVpnconnectionsNetworksGetOK{} +} + +/* PcloudVpnconnectionsNetworksGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudVpnconnectionsNetworksGetOK struct { + Payload *models.NetworkIDs +} + +func (o *PcloudVpnconnectionsNetworksGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksGetOK %+v", 200, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksGetOK) GetPayload() *models.NetworkIDs { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.NetworkIDs) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudVpnconnectionsNetworksGetBadRequest creates a PcloudVpnconnectionsNetworksGetBadRequest with default headers values +func NewPcloudVpnconnectionsNetworksGetBadRequest() *PcloudVpnconnectionsNetworksGetBadRequest { + return &PcloudVpnconnectionsNetworksGetBadRequest{} +} + +/* PcloudVpnconnectionsNetworksGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVpnconnectionsNetworksGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksGetBadRequest) 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 +} + +// NewPcloudVpnconnectionsNetworksGetUnauthorized creates a PcloudVpnconnectionsNetworksGetUnauthorized with default headers values +func NewPcloudVpnconnectionsNetworksGetUnauthorized() *PcloudVpnconnectionsNetworksGetUnauthorized { + return &PcloudVpnconnectionsNetworksGetUnauthorized{} +} + +/* PcloudVpnconnectionsNetworksGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVpnconnectionsNetworksGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksGetUnauthorized) 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 +} + +// NewPcloudVpnconnectionsNetworksGetForbidden creates a PcloudVpnconnectionsNetworksGetForbidden with default headers values +func NewPcloudVpnconnectionsNetworksGetForbidden() *PcloudVpnconnectionsNetworksGetForbidden { + return &PcloudVpnconnectionsNetworksGetForbidden{} +} + +/* PcloudVpnconnectionsNetworksGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudVpnconnectionsNetworksGetForbidden struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksGetForbidden) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksGetForbidden %+v", 403, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksGetForbidden) 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 +} + +// NewPcloudVpnconnectionsNetworksGetNotFound creates a PcloudVpnconnectionsNetworksGetNotFound with default headers values +func NewPcloudVpnconnectionsNetworksGetNotFound() *PcloudVpnconnectionsNetworksGetNotFound { + return &PcloudVpnconnectionsNetworksGetNotFound{} +} + +/* PcloudVpnconnectionsNetworksGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudVpnconnectionsNetworksGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksGetNotFound) 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 +} + +// NewPcloudVpnconnectionsNetworksGetInternalServerError creates a PcloudVpnconnectionsNetworksGetInternalServerError with default headers values +func NewPcloudVpnconnectionsNetworksGetInternalServerError() *PcloudVpnconnectionsNetworksGetInternalServerError { + return &PcloudVpnconnectionsNetworksGetInternalServerError{} +} + +/* PcloudVpnconnectionsNetworksGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVpnconnectionsNetworksGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_put_parameters.go new file mode 100644 index 00000000000..1cd48aa1573 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_put_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// 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" +) + +// NewPcloudVpnconnectionsNetworksPutParams creates a new PcloudVpnconnectionsNetworksPutParams 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 NewPcloudVpnconnectionsNetworksPutParams() *PcloudVpnconnectionsNetworksPutParams { + return &PcloudVpnconnectionsNetworksPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVpnconnectionsNetworksPutParamsWithTimeout creates a new PcloudVpnconnectionsNetworksPutParams object +// with the ability to set a timeout on a request. +func NewPcloudVpnconnectionsNetworksPutParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsNetworksPutParams { + return &PcloudVpnconnectionsNetworksPutParams{ + timeout: timeout, + } +} + +// NewPcloudVpnconnectionsNetworksPutParamsWithContext creates a new PcloudVpnconnectionsNetworksPutParams object +// with the ability to set a context for a request. +func NewPcloudVpnconnectionsNetworksPutParamsWithContext(ctx context.Context) *PcloudVpnconnectionsNetworksPutParams { + return &PcloudVpnconnectionsNetworksPutParams{ + Context: ctx, + } +} + +// NewPcloudVpnconnectionsNetworksPutParamsWithHTTPClient creates a new PcloudVpnconnectionsNetworksPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVpnconnectionsNetworksPutParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsNetworksPutParams { + return &PcloudVpnconnectionsNetworksPutParams{ + HTTPClient: client, + } +} + +/* PcloudVpnconnectionsNetworksPutParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections networks put operation. + + Typically these are written to a http.Request. +*/ +type PcloudVpnconnectionsNetworksPutParams struct { + + /* Body. + + network to attach + */ + Body *models.NetworkID + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VpnConnectionID. + + ID of a VPN connection + */ + VpnConnectionID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud vpnconnections networks put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsNetworksPutParams) WithDefaults() *PcloudVpnconnectionsNetworksPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections networks put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsNetworksPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud vpnconnections networks put params +func (o *PcloudVpnconnectionsNetworksPutParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsNetworksPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud vpnconnections networks put params +func (o *PcloudVpnconnectionsNetworksPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud vpnconnections networks put params +func (o *PcloudVpnconnectionsNetworksPutParams) WithContext(ctx context.Context) *PcloudVpnconnectionsNetworksPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud vpnconnections networks put params +func (o *PcloudVpnconnectionsNetworksPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud vpnconnections networks put params +func (o *PcloudVpnconnectionsNetworksPutParams) WithHTTPClient(client *http.Client) *PcloudVpnconnectionsNetworksPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud vpnconnections networks put params +func (o *PcloudVpnconnectionsNetworksPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud vpnconnections networks put params +func (o *PcloudVpnconnectionsNetworksPutParams) WithBody(body *models.NetworkID) *PcloudVpnconnectionsNetworksPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud vpnconnections networks put params +func (o *PcloudVpnconnectionsNetworksPutParams) SetBody(body *models.NetworkID) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud vpnconnections networks put params +func (o *PcloudVpnconnectionsNetworksPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudVpnconnectionsNetworksPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud vpnconnections networks put params +func (o *PcloudVpnconnectionsNetworksPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVpnConnectionID adds the vpnConnectionID to the pcloud vpnconnections networks put params +func (o *PcloudVpnconnectionsNetworksPutParams) WithVpnConnectionID(vpnConnectionID string) *PcloudVpnconnectionsNetworksPutParams { + o.SetVpnConnectionID(vpnConnectionID) + return o +} + +// SetVpnConnectionID adds the vpnConnectionId to the pcloud vpnconnections networks put params +func (o *PcloudVpnconnectionsNetworksPutParams) SetVpnConnectionID(vpnConnectionID string) { + o.VpnConnectionID = vpnConnectionID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVpnconnectionsNetworksPutParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param vpn_connection_id + if err := r.SetPathParam("vpn_connection_id", o.VpnConnectionID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_put_responses.go new file mode 100644 index 00000000000..4bcc8502d9b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_networks_put_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudVpnconnectionsNetworksPutReader is a Reader for the PcloudVpnconnectionsNetworksPut structure. +type PcloudVpnconnectionsNetworksPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVpnconnectionsNetworksPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudVpnconnectionsNetworksPutAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVpnconnectionsNetworksPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVpnconnectionsNetworksPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudVpnconnectionsNetworksPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudVpnconnectionsNetworksPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudVpnconnectionsNetworksPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVpnconnectionsNetworksPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudVpnconnectionsNetworksPutAccepted creates a PcloudVpnconnectionsNetworksPutAccepted with default headers values +func NewPcloudVpnconnectionsNetworksPutAccepted() *PcloudVpnconnectionsNetworksPutAccepted { + return &PcloudVpnconnectionsNetworksPutAccepted{} +} + +/* PcloudVpnconnectionsNetworksPutAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudVpnconnectionsNetworksPutAccepted struct { + Payload *models.JobReference +} + +func (o *PcloudVpnconnectionsNetworksPutAccepted) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksPutAccepted %+v", 202, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksPutAccepted) GetPayload() *models.JobReference { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksPutAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.JobReference) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudVpnconnectionsNetworksPutBadRequest creates a PcloudVpnconnectionsNetworksPutBadRequest with default headers values +func NewPcloudVpnconnectionsNetworksPutBadRequest() *PcloudVpnconnectionsNetworksPutBadRequest { + return &PcloudVpnconnectionsNetworksPutBadRequest{} +} + +/* PcloudVpnconnectionsNetworksPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVpnconnectionsNetworksPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksPutBadRequest) 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 +} + +// NewPcloudVpnconnectionsNetworksPutUnauthorized creates a PcloudVpnconnectionsNetworksPutUnauthorized with default headers values +func NewPcloudVpnconnectionsNetworksPutUnauthorized() *PcloudVpnconnectionsNetworksPutUnauthorized { + return &PcloudVpnconnectionsNetworksPutUnauthorized{} +} + +/* PcloudVpnconnectionsNetworksPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVpnconnectionsNetworksPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksPutUnauthorized) 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 +} + +// NewPcloudVpnconnectionsNetworksPutForbidden creates a PcloudVpnconnectionsNetworksPutForbidden with default headers values +func NewPcloudVpnconnectionsNetworksPutForbidden() *PcloudVpnconnectionsNetworksPutForbidden { + return &PcloudVpnconnectionsNetworksPutForbidden{} +} + +/* PcloudVpnconnectionsNetworksPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudVpnconnectionsNetworksPutForbidden struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksPutForbidden) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksPutForbidden %+v", 403, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksPutForbidden) 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 +} + +// NewPcloudVpnconnectionsNetworksPutNotFound creates a PcloudVpnconnectionsNetworksPutNotFound with default headers values +func NewPcloudVpnconnectionsNetworksPutNotFound() *PcloudVpnconnectionsNetworksPutNotFound { + return &PcloudVpnconnectionsNetworksPutNotFound{} +} + +/* PcloudVpnconnectionsNetworksPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudVpnconnectionsNetworksPutNotFound struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksPutNotFound) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksPutNotFound %+v", 404, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksPutNotFound) 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 +} + +// NewPcloudVpnconnectionsNetworksPutUnprocessableEntity creates a PcloudVpnconnectionsNetworksPutUnprocessableEntity with default headers values +func NewPcloudVpnconnectionsNetworksPutUnprocessableEntity() *PcloudVpnconnectionsNetworksPutUnprocessableEntity { + return &PcloudVpnconnectionsNetworksPutUnprocessableEntity{} +} + +/* PcloudVpnconnectionsNetworksPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudVpnconnectionsNetworksPutUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksPutUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksPutUnprocessableEntity) 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 +} + +// NewPcloudVpnconnectionsNetworksPutInternalServerError creates a PcloudVpnconnectionsNetworksPutInternalServerError with default headers values +func NewPcloudVpnconnectionsNetworksPutInternalServerError() *PcloudVpnconnectionsNetworksPutInternalServerError { + return &PcloudVpnconnectionsNetworksPutInternalServerError{} +} + +/* PcloudVpnconnectionsNetworksPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVpnconnectionsNetworksPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsNetworksPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/networks][%d] pcloudVpnconnectionsNetworksPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudVpnconnectionsNetworksPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsNetworksPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_delete_parameters.go new file mode 100644 index 00000000000..5834aeab041 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_delete_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// 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" +) + +// NewPcloudVpnconnectionsPeersubnetsDeleteParams creates a new PcloudVpnconnectionsPeersubnetsDeleteParams 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 NewPcloudVpnconnectionsPeersubnetsDeleteParams() *PcloudVpnconnectionsPeersubnetsDeleteParams { + return &PcloudVpnconnectionsPeersubnetsDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVpnconnectionsPeersubnetsDeleteParamsWithTimeout creates a new PcloudVpnconnectionsPeersubnetsDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudVpnconnectionsPeersubnetsDeleteParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsPeersubnetsDeleteParams { + return &PcloudVpnconnectionsPeersubnetsDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudVpnconnectionsPeersubnetsDeleteParamsWithContext creates a new PcloudVpnconnectionsPeersubnetsDeleteParams object +// with the ability to set a context for a request. +func NewPcloudVpnconnectionsPeersubnetsDeleteParamsWithContext(ctx context.Context) *PcloudVpnconnectionsPeersubnetsDeleteParams { + return &PcloudVpnconnectionsPeersubnetsDeleteParams{ + Context: ctx, + } +} + +// NewPcloudVpnconnectionsPeersubnetsDeleteParamsWithHTTPClient creates a new PcloudVpnconnectionsPeersubnetsDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVpnconnectionsPeersubnetsDeleteParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsPeersubnetsDeleteParams { + return &PcloudVpnconnectionsPeersubnetsDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudVpnconnectionsPeersubnetsDeleteParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections peersubnets delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudVpnconnectionsPeersubnetsDeleteParams struct { + + /* Body. + + Peer subnet to detach + */ + Body *models.PeerSubnetUpdate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VpnConnectionID. + + ID of a VPN connection + */ + VpnConnectionID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud vpnconnections peersubnets delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) WithDefaults() *PcloudVpnconnectionsPeersubnetsDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections peersubnets delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud vpnconnections peersubnets delete params +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsPeersubnetsDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud vpnconnections peersubnets delete params +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud vpnconnections peersubnets delete params +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) WithContext(ctx context.Context) *PcloudVpnconnectionsPeersubnetsDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud vpnconnections peersubnets delete params +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud vpnconnections peersubnets delete params +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) WithHTTPClient(client *http.Client) *PcloudVpnconnectionsPeersubnetsDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud vpnconnections peersubnets delete params +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud vpnconnections peersubnets delete params +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) WithBody(body *models.PeerSubnetUpdate) *PcloudVpnconnectionsPeersubnetsDeleteParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud vpnconnections peersubnets delete params +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) SetBody(body *models.PeerSubnetUpdate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud vpnconnections peersubnets delete params +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudVpnconnectionsPeersubnetsDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud vpnconnections peersubnets delete params +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVpnConnectionID adds the vpnConnectionID to the pcloud vpnconnections peersubnets delete params +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) WithVpnConnectionID(vpnConnectionID string) *PcloudVpnconnectionsPeersubnetsDeleteParams { + o.SetVpnConnectionID(vpnConnectionID) + return o +} + +// SetVpnConnectionID adds the vpnConnectionId to the pcloud vpnconnections peersubnets delete params +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) SetVpnConnectionID(vpnConnectionID string) { + o.VpnConnectionID = vpnConnectionID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVpnconnectionsPeersubnetsDeleteParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param vpn_connection_id + if err := r.SetPathParam("vpn_connection_id", o.VpnConnectionID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_delete_responses.go new file mode 100644 index 00000000000..5b6d05ba598 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_delete_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudVpnconnectionsPeersubnetsDeleteReader is a Reader for the PcloudVpnconnectionsPeersubnetsDelete structure. +type PcloudVpnconnectionsPeersubnetsDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVpnconnectionsPeersubnetsDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudVpnconnectionsPeersubnetsDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVpnconnectionsPeersubnetsDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVpnconnectionsPeersubnetsDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudVpnconnectionsPeersubnetsDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVpnconnectionsPeersubnetsDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudVpnconnectionsPeersubnetsDeleteOK creates a PcloudVpnconnectionsPeersubnetsDeleteOK with default headers values +func NewPcloudVpnconnectionsPeersubnetsDeleteOK() *PcloudVpnconnectionsPeersubnetsDeleteOK { + return &PcloudVpnconnectionsPeersubnetsDeleteOK{} +} + +/* PcloudVpnconnectionsPeersubnetsDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudVpnconnectionsPeersubnetsDeleteOK struct { + Payload *models.PeerSubnets +} + +func (o *PcloudVpnconnectionsPeersubnetsDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsDeleteOK) GetPayload() *models.PeerSubnets { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PeerSubnets) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudVpnconnectionsPeersubnetsDeleteBadRequest creates a PcloudVpnconnectionsPeersubnetsDeleteBadRequest with default headers values +func NewPcloudVpnconnectionsPeersubnetsDeleteBadRequest() *PcloudVpnconnectionsPeersubnetsDeleteBadRequest { + return &PcloudVpnconnectionsPeersubnetsDeleteBadRequest{} +} + +/* PcloudVpnconnectionsPeersubnetsDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVpnconnectionsPeersubnetsDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPeersubnetsDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsDeleteBadRequest) 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 +} + +// NewPcloudVpnconnectionsPeersubnetsDeleteUnauthorized creates a PcloudVpnconnectionsPeersubnetsDeleteUnauthorized with default headers values +func NewPcloudVpnconnectionsPeersubnetsDeleteUnauthorized() *PcloudVpnconnectionsPeersubnetsDeleteUnauthorized { + return &PcloudVpnconnectionsPeersubnetsDeleteUnauthorized{} +} + +/* PcloudVpnconnectionsPeersubnetsDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVpnconnectionsPeersubnetsDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPeersubnetsDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsDeleteUnauthorized) 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 +} + +// NewPcloudVpnconnectionsPeersubnetsDeleteForbidden creates a PcloudVpnconnectionsPeersubnetsDeleteForbidden with default headers values +func NewPcloudVpnconnectionsPeersubnetsDeleteForbidden() *PcloudVpnconnectionsPeersubnetsDeleteForbidden { + return &PcloudVpnconnectionsPeersubnetsDeleteForbidden{} +} + +/* PcloudVpnconnectionsPeersubnetsDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudVpnconnectionsPeersubnetsDeleteForbidden struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPeersubnetsDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsDeleteForbidden %+v", 403, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsDeleteForbidden) 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 +} + +// NewPcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity creates a PcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity with default headers values +func NewPcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity() *PcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity { + return &PcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity{} +} + +/* PcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsDeleteUnprocessableEntity) 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 +} + +// NewPcloudVpnconnectionsPeersubnetsDeleteInternalServerError creates a PcloudVpnconnectionsPeersubnetsDeleteInternalServerError with default headers values +func NewPcloudVpnconnectionsPeersubnetsDeleteInternalServerError() *PcloudVpnconnectionsPeersubnetsDeleteInternalServerError { + return &PcloudVpnconnectionsPeersubnetsDeleteInternalServerError{} +} + +/* PcloudVpnconnectionsPeersubnetsDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVpnconnectionsPeersubnetsDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPeersubnetsDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_get_parameters.go new file mode 100644 index 00000000000..d17411fda91 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// 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" +) + +// NewPcloudVpnconnectionsPeersubnetsGetParams creates a new PcloudVpnconnectionsPeersubnetsGetParams 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 NewPcloudVpnconnectionsPeersubnetsGetParams() *PcloudVpnconnectionsPeersubnetsGetParams { + return &PcloudVpnconnectionsPeersubnetsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVpnconnectionsPeersubnetsGetParamsWithTimeout creates a new PcloudVpnconnectionsPeersubnetsGetParams object +// with the ability to set a timeout on a request. +func NewPcloudVpnconnectionsPeersubnetsGetParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsPeersubnetsGetParams { + return &PcloudVpnconnectionsPeersubnetsGetParams{ + timeout: timeout, + } +} + +// NewPcloudVpnconnectionsPeersubnetsGetParamsWithContext creates a new PcloudVpnconnectionsPeersubnetsGetParams object +// with the ability to set a context for a request. +func NewPcloudVpnconnectionsPeersubnetsGetParamsWithContext(ctx context.Context) *PcloudVpnconnectionsPeersubnetsGetParams { + return &PcloudVpnconnectionsPeersubnetsGetParams{ + Context: ctx, + } +} + +// NewPcloudVpnconnectionsPeersubnetsGetParamsWithHTTPClient creates a new PcloudVpnconnectionsPeersubnetsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVpnconnectionsPeersubnetsGetParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsPeersubnetsGetParams { + return &PcloudVpnconnectionsPeersubnetsGetParams{ + HTTPClient: client, + } +} + +/* PcloudVpnconnectionsPeersubnetsGetParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections peersubnets get operation. + + Typically these are written to a http.Request. +*/ +type PcloudVpnconnectionsPeersubnetsGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VpnConnectionID. + + ID of a VPN connection + */ + VpnConnectionID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud vpnconnections peersubnets get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPeersubnetsGetParams) WithDefaults() *PcloudVpnconnectionsPeersubnetsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections peersubnets get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPeersubnetsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud vpnconnections peersubnets get params +func (o *PcloudVpnconnectionsPeersubnetsGetParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsPeersubnetsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud vpnconnections peersubnets get params +func (o *PcloudVpnconnectionsPeersubnetsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud vpnconnections peersubnets get params +func (o *PcloudVpnconnectionsPeersubnetsGetParams) WithContext(ctx context.Context) *PcloudVpnconnectionsPeersubnetsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud vpnconnections peersubnets get params +func (o *PcloudVpnconnectionsPeersubnetsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud vpnconnections peersubnets get params +func (o *PcloudVpnconnectionsPeersubnetsGetParams) WithHTTPClient(client *http.Client) *PcloudVpnconnectionsPeersubnetsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud vpnconnections peersubnets get params +func (o *PcloudVpnconnectionsPeersubnetsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud vpnconnections peersubnets get params +func (o *PcloudVpnconnectionsPeersubnetsGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudVpnconnectionsPeersubnetsGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud vpnconnections peersubnets get params +func (o *PcloudVpnconnectionsPeersubnetsGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVpnConnectionID adds the vpnConnectionID to the pcloud vpnconnections peersubnets get params +func (o *PcloudVpnconnectionsPeersubnetsGetParams) WithVpnConnectionID(vpnConnectionID string) *PcloudVpnconnectionsPeersubnetsGetParams { + o.SetVpnConnectionID(vpnConnectionID) + return o +} + +// SetVpnConnectionID adds the vpnConnectionId to the pcloud vpnconnections peersubnets get params +func (o *PcloudVpnconnectionsPeersubnetsGetParams) SetVpnConnectionID(vpnConnectionID string) { + o.VpnConnectionID = vpnConnectionID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVpnconnectionsPeersubnetsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param vpn_connection_id + if err := r.SetPathParam("vpn_connection_id", o.VpnConnectionID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_get_responses.go new file mode 100644 index 00000000000..6f9e64ef18f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_get_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudVpnconnectionsPeersubnetsGetReader is a Reader for the PcloudVpnconnectionsPeersubnetsGet structure. +type PcloudVpnconnectionsPeersubnetsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVpnconnectionsPeersubnetsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudVpnconnectionsPeersubnetsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVpnconnectionsPeersubnetsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVpnconnectionsPeersubnetsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudVpnconnectionsPeersubnetsGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudVpnconnectionsPeersubnetsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVpnconnectionsPeersubnetsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudVpnconnectionsPeersubnetsGetOK creates a PcloudVpnconnectionsPeersubnetsGetOK with default headers values +func NewPcloudVpnconnectionsPeersubnetsGetOK() *PcloudVpnconnectionsPeersubnetsGetOK { + return &PcloudVpnconnectionsPeersubnetsGetOK{} +} + +/* PcloudVpnconnectionsPeersubnetsGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudVpnconnectionsPeersubnetsGetOK struct { + Payload *models.PeerSubnets +} + +func (o *PcloudVpnconnectionsPeersubnetsGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsGetOK %+v", 200, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsGetOK) GetPayload() *models.PeerSubnets { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PeerSubnets) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudVpnconnectionsPeersubnetsGetBadRequest creates a PcloudVpnconnectionsPeersubnetsGetBadRequest with default headers values +func NewPcloudVpnconnectionsPeersubnetsGetBadRequest() *PcloudVpnconnectionsPeersubnetsGetBadRequest { + return &PcloudVpnconnectionsPeersubnetsGetBadRequest{} +} + +/* PcloudVpnconnectionsPeersubnetsGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVpnconnectionsPeersubnetsGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPeersubnetsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsGetBadRequest) 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 +} + +// NewPcloudVpnconnectionsPeersubnetsGetUnauthorized creates a PcloudVpnconnectionsPeersubnetsGetUnauthorized with default headers values +func NewPcloudVpnconnectionsPeersubnetsGetUnauthorized() *PcloudVpnconnectionsPeersubnetsGetUnauthorized { + return &PcloudVpnconnectionsPeersubnetsGetUnauthorized{} +} + +/* PcloudVpnconnectionsPeersubnetsGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVpnconnectionsPeersubnetsGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPeersubnetsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsGetUnauthorized) 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 +} + +// NewPcloudVpnconnectionsPeersubnetsGetForbidden creates a PcloudVpnconnectionsPeersubnetsGetForbidden with default headers values +func NewPcloudVpnconnectionsPeersubnetsGetForbidden() *PcloudVpnconnectionsPeersubnetsGetForbidden { + return &PcloudVpnconnectionsPeersubnetsGetForbidden{} +} + +/* PcloudVpnconnectionsPeersubnetsGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudVpnconnectionsPeersubnetsGetForbidden struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPeersubnetsGetForbidden) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsGetForbidden %+v", 403, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsGetForbidden) 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 +} + +// NewPcloudVpnconnectionsPeersubnetsGetNotFound creates a PcloudVpnconnectionsPeersubnetsGetNotFound with default headers values +func NewPcloudVpnconnectionsPeersubnetsGetNotFound() *PcloudVpnconnectionsPeersubnetsGetNotFound { + return &PcloudVpnconnectionsPeersubnetsGetNotFound{} +} + +/* PcloudVpnconnectionsPeersubnetsGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudVpnconnectionsPeersubnetsGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPeersubnetsGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsGetNotFound) 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 +} + +// NewPcloudVpnconnectionsPeersubnetsGetInternalServerError creates a PcloudVpnconnectionsPeersubnetsGetInternalServerError with default headers values +func NewPcloudVpnconnectionsPeersubnetsGetInternalServerError() *PcloudVpnconnectionsPeersubnetsGetInternalServerError { + return &PcloudVpnconnectionsPeersubnetsGetInternalServerError{} +} + +/* PcloudVpnconnectionsPeersubnetsGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVpnconnectionsPeersubnetsGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPeersubnetsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_put_parameters.go new file mode 100644 index 00000000000..0f74fcc1555 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_put_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// 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" +) + +// NewPcloudVpnconnectionsPeersubnetsPutParams creates a new PcloudVpnconnectionsPeersubnetsPutParams 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 NewPcloudVpnconnectionsPeersubnetsPutParams() *PcloudVpnconnectionsPeersubnetsPutParams { + return &PcloudVpnconnectionsPeersubnetsPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVpnconnectionsPeersubnetsPutParamsWithTimeout creates a new PcloudVpnconnectionsPeersubnetsPutParams object +// with the ability to set a timeout on a request. +func NewPcloudVpnconnectionsPeersubnetsPutParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsPeersubnetsPutParams { + return &PcloudVpnconnectionsPeersubnetsPutParams{ + timeout: timeout, + } +} + +// NewPcloudVpnconnectionsPeersubnetsPutParamsWithContext creates a new PcloudVpnconnectionsPeersubnetsPutParams object +// with the ability to set a context for a request. +func NewPcloudVpnconnectionsPeersubnetsPutParamsWithContext(ctx context.Context) *PcloudVpnconnectionsPeersubnetsPutParams { + return &PcloudVpnconnectionsPeersubnetsPutParams{ + Context: ctx, + } +} + +// NewPcloudVpnconnectionsPeersubnetsPutParamsWithHTTPClient creates a new PcloudVpnconnectionsPeersubnetsPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVpnconnectionsPeersubnetsPutParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsPeersubnetsPutParams { + return &PcloudVpnconnectionsPeersubnetsPutParams{ + HTTPClient: client, + } +} + +/* PcloudVpnconnectionsPeersubnetsPutParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections peersubnets put operation. + + Typically these are written to a http.Request. +*/ +type PcloudVpnconnectionsPeersubnetsPutParams struct { + + /* Body. + + peer subnet to attach + */ + Body *models.PeerSubnetUpdate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VpnConnectionID. + + ID of a VPN connection + */ + VpnConnectionID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud vpnconnections peersubnets put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPeersubnetsPutParams) WithDefaults() *PcloudVpnconnectionsPeersubnetsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections peersubnets put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPeersubnetsPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud vpnconnections peersubnets put params +func (o *PcloudVpnconnectionsPeersubnetsPutParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsPeersubnetsPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud vpnconnections peersubnets put params +func (o *PcloudVpnconnectionsPeersubnetsPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud vpnconnections peersubnets put params +func (o *PcloudVpnconnectionsPeersubnetsPutParams) WithContext(ctx context.Context) *PcloudVpnconnectionsPeersubnetsPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud vpnconnections peersubnets put params +func (o *PcloudVpnconnectionsPeersubnetsPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud vpnconnections peersubnets put params +func (o *PcloudVpnconnectionsPeersubnetsPutParams) WithHTTPClient(client *http.Client) *PcloudVpnconnectionsPeersubnetsPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud vpnconnections peersubnets put params +func (o *PcloudVpnconnectionsPeersubnetsPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud vpnconnections peersubnets put params +func (o *PcloudVpnconnectionsPeersubnetsPutParams) WithBody(body *models.PeerSubnetUpdate) *PcloudVpnconnectionsPeersubnetsPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud vpnconnections peersubnets put params +func (o *PcloudVpnconnectionsPeersubnetsPutParams) SetBody(body *models.PeerSubnetUpdate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud vpnconnections peersubnets put params +func (o *PcloudVpnconnectionsPeersubnetsPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudVpnconnectionsPeersubnetsPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud vpnconnections peersubnets put params +func (o *PcloudVpnconnectionsPeersubnetsPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVpnConnectionID adds the vpnConnectionID to the pcloud vpnconnections peersubnets put params +func (o *PcloudVpnconnectionsPeersubnetsPutParams) WithVpnConnectionID(vpnConnectionID string) *PcloudVpnconnectionsPeersubnetsPutParams { + o.SetVpnConnectionID(vpnConnectionID) + return o +} + +// SetVpnConnectionID adds the vpnConnectionId to the pcloud vpnconnections peersubnets put params +func (o *PcloudVpnconnectionsPeersubnetsPutParams) SetVpnConnectionID(vpnConnectionID string) { + o.VpnConnectionID = vpnConnectionID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVpnconnectionsPeersubnetsPutParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param vpn_connection_id + if err := r.SetPathParam("vpn_connection_id", o.VpnConnectionID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_put_responses.go new file mode 100644 index 00000000000..a9967c9a47c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_peersubnets_put_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudVpnconnectionsPeersubnetsPutReader is a Reader for the PcloudVpnconnectionsPeersubnetsPut structure. +type PcloudVpnconnectionsPeersubnetsPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVpnconnectionsPeersubnetsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudVpnconnectionsPeersubnetsPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVpnconnectionsPeersubnetsPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVpnconnectionsPeersubnetsPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudVpnconnectionsPeersubnetsPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudVpnconnectionsPeersubnetsPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVpnconnectionsPeersubnetsPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudVpnconnectionsPeersubnetsPutOK creates a PcloudVpnconnectionsPeersubnetsPutOK with default headers values +func NewPcloudVpnconnectionsPeersubnetsPutOK() *PcloudVpnconnectionsPeersubnetsPutOK { + return &PcloudVpnconnectionsPeersubnetsPutOK{} +} + +/* PcloudVpnconnectionsPeersubnetsPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudVpnconnectionsPeersubnetsPutOK struct { + Payload *models.PeerSubnets +} + +func (o *PcloudVpnconnectionsPeersubnetsPutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsPutOK %+v", 200, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsPutOK) GetPayload() *models.PeerSubnets { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.PeerSubnets) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudVpnconnectionsPeersubnetsPutBadRequest creates a PcloudVpnconnectionsPeersubnetsPutBadRequest with default headers values +func NewPcloudVpnconnectionsPeersubnetsPutBadRequest() *PcloudVpnconnectionsPeersubnetsPutBadRequest { + return &PcloudVpnconnectionsPeersubnetsPutBadRequest{} +} + +/* PcloudVpnconnectionsPeersubnetsPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVpnconnectionsPeersubnetsPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPeersubnetsPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsPutBadRequest) 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 +} + +// NewPcloudVpnconnectionsPeersubnetsPutUnauthorized creates a PcloudVpnconnectionsPeersubnetsPutUnauthorized with default headers values +func NewPcloudVpnconnectionsPeersubnetsPutUnauthorized() *PcloudVpnconnectionsPeersubnetsPutUnauthorized { + return &PcloudVpnconnectionsPeersubnetsPutUnauthorized{} +} + +/* PcloudVpnconnectionsPeersubnetsPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVpnconnectionsPeersubnetsPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPeersubnetsPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsPutUnauthorized) 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 +} + +// NewPcloudVpnconnectionsPeersubnetsPutForbidden creates a PcloudVpnconnectionsPeersubnetsPutForbidden with default headers values +func NewPcloudVpnconnectionsPeersubnetsPutForbidden() *PcloudVpnconnectionsPeersubnetsPutForbidden { + return &PcloudVpnconnectionsPeersubnetsPutForbidden{} +} + +/* PcloudVpnconnectionsPeersubnetsPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudVpnconnectionsPeersubnetsPutForbidden struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPeersubnetsPutForbidden) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsPutForbidden %+v", 403, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsPutForbidden) 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 +} + +// NewPcloudVpnconnectionsPeersubnetsPutUnprocessableEntity creates a PcloudVpnconnectionsPeersubnetsPutUnprocessableEntity with default headers values +func NewPcloudVpnconnectionsPeersubnetsPutUnprocessableEntity() *PcloudVpnconnectionsPeersubnetsPutUnprocessableEntity { + return &PcloudVpnconnectionsPeersubnetsPutUnprocessableEntity{} +} + +/* PcloudVpnconnectionsPeersubnetsPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudVpnconnectionsPeersubnetsPutUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPeersubnetsPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsPutUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsPutUnprocessableEntity) 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 +} + +// NewPcloudVpnconnectionsPeersubnetsPutInternalServerError creates a PcloudVpnconnectionsPeersubnetsPutInternalServerError with default headers values +func NewPcloudVpnconnectionsPeersubnetsPutInternalServerError() *PcloudVpnconnectionsPeersubnetsPutInternalServerError { + return &PcloudVpnconnectionsPeersubnetsPutInternalServerError{} +} + +/* PcloudVpnconnectionsPeersubnetsPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVpnconnectionsPeersubnetsPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPeersubnetsPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}/peer-subnets][%d] pcloudVpnconnectionsPeersubnetsPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudVpnconnectionsPeersubnetsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPeersubnetsPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_post_parameters.go new file mode 100644 index 00000000000..0c10162117b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// 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" +) + +// NewPcloudVpnconnectionsPostParams creates a new PcloudVpnconnectionsPostParams 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 NewPcloudVpnconnectionsPostParams() *PcloudVpnconnectionsPostParams { + return &PcloudVpnconnectionsPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVpnconnectionsPostParamsWithTimeout creates a new PcloudVpnconnectionsPostParams object +// with the ability to set a timeout on a request. +func NewPcloudVpnconnectionsPostParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsPostParams { + return &PcloudVpnconnectionsPostParams{ + timeout: timeout, + } +} + +// NewPcloudVpnconnectionsPostParamsWithContext creates a new PcloudVpnconnectionsPostParams object +// with the ability to set a context for a request. +func NewPcloudVpnconnectionsPostParamsWithContext(ctx context.Context) *PcloudVpnconnectionsPostParams { + return &PcloudVpnconnectionsPostParams{ + Context: ctx, + } +} + +// NewPcloudVpnconnectionsPostParamsWithHTTPClient creates a new PcloudVpnconnectionsPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVpnconnectionsPostParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsPostParams { + return &PcloudVpnconnectionsPostParams{ + HTTPClient: client, + } +} + +/* PcloudVpnconnectionsPostParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections post operation. + + Typically these are written to a http.Request. +*/ +type PcloudVpnconnectionsPostParams struct { + + /* Body. + + VPN Connection object used for creation + */ + Body *models.VPNConnectionCreate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud vpnconnections post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPostParams) WithDefaults() *PcloudVpnconnectionsPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud vpnconnections post params +func (o *PcloudVpnconnectionsPostParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud vpnconnections post params +func (o *PcloudVpnconnectionsPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud vpnconnections post params +func (o *PcloudVpnconnectionsPostParams) WithContext(ctx context.Context) *PcloudVpnconnectionsPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud vpnconnections post params +func (o *PcloudVpnconnectionsPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud vpnconnections post params +func (o *PcloudVpnconnectionsPostParams) WithHTTPClient(client *http.Client) *PcloudVpnconnectionsPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud vpnconnections post params +func (o *PcloudVpnconnectionsPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud vpnconnections post params +func (o *PcloudVpnconnectionsPostParams) WithBody(body *models.VPNConnectionCreate) *PcloudVpnconnectionsPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud vpnconnections post params +func (o *PcloudVpnconnectionsPostParams) SetBody(body *models.VPNConnectionCreate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud vpnconnections post params +func (o *PcloudVpnconnectionsPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudVpnconnectionsPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud vpnconnections post params +func (o *PcloudVpnconnectionsPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVpnconnectionsPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_post_responses.go new file mode 100644 index 00000000000..c4f1f0a6181 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_post_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudVpnconnectionsPostReader is a Reader for the PcloudVpnconnectionsPost structure. +type PcloudVpnconnectionsPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVpnconnectionsPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudVpnconnectionsPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVpnconnectionsPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVpnconnectionsPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudVpnconnectionsPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudVpnconnectionsPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudVpnconnectionsPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVpnconnectionsPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudVpnconnectionsPostAccepted creates a PcloudVpnconnectionsPostAccepted with default headers values +func NewPcloudVpnconnectionsPostAccepted() *PcloudVpnconnectionsPostAccepted { + return &PcloudVpnconnectionsPostAccepted{} +} + +/* PcloudVpnconnectionsPostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudVpnconnectionsPostAccepted struct { + Payload *models.VPNConnectionCreateResponse +} + +func (o *PcloudVpnconnectionsPostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsPostAccepted %+v", 202, o.Payload) +} +func (o *PcloudVpnconnectionsPostAccepted) GetPayload() *models.VPNConnectionCreateResponse { + return o.Payload +} + +func (o *PcloudVpnconnectionsPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VPNConnectionCreateResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudVpnconnectionsPostBadRequest creates a PcloudVpnconnectionsPostBadRequest with default headers values +func NewPcloudVpnconnectionsPostBadRequest() *PcloudVpnconnectionsPostBadRequest { + return &PcloudVpnconnectionsPostBadRequest{} +} + +/* PcloudVpnconnectionsPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVpnconnectionsPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudVpnconnectionsPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPostBadRequest) 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 +} + +// NewPcloudVpnconnectionsPostUnauthorized creates a PcloudVpnconnectionsPostUnauthorized with default headers values +func NewPcloudVpnconnectionsPostUnauthorized() *PcloudVpnconnectionsPostUnauthorized { + return &PcloudVpnconnectionsPostUnauthorized{} +} + +/* PcloudVpnconnectionsPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVpnconnectionsPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudVpnconnectionsPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPostUnauthorized) 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 +} + +// NewPcloudVpnconnectionsPostForbidden creates a PcloudVpnconnectionsPostForbidden with default headers values +func NewPcloudVpnconnectionsPostForbidden() *PcloudVpnconnectionsPostForbidden { + return &PcloudVpnconnectionsPostForbidden{} +} + +/* PcloudVpnconnectionsPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudVpnconnectionsPostForbidden struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPostForbidden) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsPostForbidden %+v", 403, o.Payload) +} +func (o *PcloudVpnconnectionsPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPostForbidden) 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 +} + +// NewPcloudVpnconnectionsPostConflict creates a PcloudVpnconnectionsPostConflict with default headers values +func NewPcloudVpnconnectionsPostConflict() *PcloudVpnconnectionsPostConflict { + return &PcloudVpnconnectionsPostConflict{} +} + +/* PcloudVpnconnectionsPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudVpnconnectionsPostConflict struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsPostConflict %+v", 409, o.Payload) +} +func (o *PcloudVpnconnectionsPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPostConflict) 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 +} + +// NewPcloudVpnconnectionsPostUnprocessableEntity creates a PcloudVpnconnectionsPostUnprocessableEntity with default headers values +func NewPcloudVpnconnectionsPostUnprocessableEntity() *PcloudVpnconnectionsPostUnprocessableEntity { + return &PcloudVpnconnectionsPostUnprocessableEntity{} +} + +/* PcloudVpnconnectionsPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudVpnconnectionsPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudVpnconnectionsPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPostUnprocessableEntity) 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 +} + +// NewPcloudVpnconnectionsPostInternalServerError creates a PcloudVpnconnectionsPostInternalServerError with default headers values +func NewPcloudVpnconnectionsPostInternalServerError() *PcloudVpnconnectionsPostInternalServerError { + return &PcloudVpnconnectionsPostInternalServerError{} +} + +/* PcloudVpnconnectionsPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVpnconnectionsPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections][%d] pcloudVpnconnectionsPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudVpnconnectionsPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_put_parameters.go new file mode 100644 index 00000000000..5775cb00858 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_put_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// 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" +) + +// NewPcloudVpnconnectionsPutParams creates a new PcloudVpnconnectionsPutParams 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 NewPcloudVpnconnectionsPutParams() *PcloudVpnconnectionsPutParams { + return &PcloudVpnconnectionsPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVpnconnectionsPutParamsWithTimeout creates a new PcloudVpnconnectionsPutParams object +// with the ability to set a timeout on a request. +func NewPcloudVpnconnectionsPutParamsWithTimeout(timeout time.Duration) *PcloudVpnconnectionsPutParams { + return &PcloudVpnconnectionsPutParams{ + timeout: timeout, + } +} + +// NewPcloudVpnconnectionsPutParamsWithContext creates a new PcloudVpnconnectionsPutParams object +// with the ability to set a context for a request. +func NewPcloudVpnconnectionsPutParamsWithContext(ctx context.Context) *PcloudVpnconnectionsPutParams { + return &PcloudVpnconnectionsPutParams{ + Context: ctx, + } +} + +// NewPcloudVpnconnectionsPutParamsWithHTTPClient creates a new PcloudVpnconnectionsPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVpnconnectionsPutParamsWithHTTPClient(client *http.Client) *PcloudVpnconnectionsPutParams { + return &PcloudVpnconnectionsPutParams{ + HTTPClient: client, + } +} + +/* PcloudVpnconnectionsPutParams contains all the parameters to send to the API endpoint + for the pcloud vpnconnections put operation. + + Typically these are written to a http.Request. +*/ +type PcloudVpnconnectionsPutParams struct { + + /* Body. + + VPN Connection object used for update + */ + Body *models.VPNConnectionUpdate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VpnConnectionID. + + ID of a VPN connection + */ + VpnConnectionID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud vpnconnections put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPutParams) WithDefaults() *PcloudVpnconnectionsPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud vpnconnections put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVpnconnectionsPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud vpnconnections put params +func (o *PcloudVpnconnectionsPutParams) WithTimeout(timeout time.Duration) *PcloudVpnconnectionsPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud vpnconnections put params +func (o *PcloudVpnconnectionsPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud vpnconnections put params +func (o *PcloudVpnconnectionsPutParams) WithContext(ctx context.Context) *PcloudVpnconnectionsPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud vpnconnections put params +func (o *PcloudVpnconnectionsPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud vpnconnections put params +func (o *PcloudVpnconnectionsPutParams) WithHTTPClient(client *http.Client) *PcloudVpnconnectionsPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud vpnconnections put params +func (o *PcloudVpnconnectionsPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud vpnconnections put params +func (o *PcloudVpnconnectionsPutParams) WithBody(body *models.VPNConnectionUpdate) *PcloudVpnconnectionsPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud vpnconnections put params +func (o *PcloudVpnconnectionsPutParams) SetBody(body *models.VPNConnectionUpdate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud vpnconnections put params +func (o *PcloudVpnconnectionsPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudVpnconnectionsPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud vpnconnections put params +func (o *PcloudVpnconnectionsPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVpnConnectionID adds the vpnConnectionID to the pcloud vpnconnections put params +func (o *PcloudVpnconnectionsPutParams) WithVpnConnectionID(vpnConnectionID string) *PcloudVpnconnectionsPutParams { + o.SetVpnConnectionID(vpnConnectionID) + return o +} + +// SetVpnConnectionID adds the vpnConnectionId to the pcloud vpnconnections put params +func (o *PcloudVpnconnectionsPutParams) SetVpnConnectionID(vpnConnectionID string) { + o.VpnConnectionID = vpnConnectionID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVpnconnectionsPutParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param vpn_connection_id + if err := r.SetPathParam("vpn_connection_id", o.VpnConnectionID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_put_responses.go new file mode 100644 index 00000000000..2e2026de05c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections/pcloud_vpnconnections_put_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_connections + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudVpnconnectionsPutReader is a Reader for the PcloudVpnconnectionsPut structure. +type PcloudVpnconnectionsPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVpnconnectionsPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudVpnconnectionsPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVpnconnectionsPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVpnconnectionsPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudVpnconnectionsPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudVpnconnectionsPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudVpnconnectionsPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVpnconnectionsPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudVpnconnectionsPutOK creates a PcloudVpnconnectionsPutOK with default headers values +func NewPcloudVpnconnectionsPutOK() *PcloudVpnconnectionsPutOK { + return &PcloudVpnconnectionsPutOK{} +} + +/* PcloudVpnconnectionsPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudVpnconnectionsPutOK struct { + Payload *models.VPNConnection +} + +func (o *PcloudVpnconnectionsPutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsPutOK %+v", 200, o.Payload) +} +func (o *PcloudVpnconnectionsPutOK) GetPayload() *models.VPNConnection { + return o.Payload +} + +func (o *PcloudVpnconnectionsPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VPNConnection) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudVpnconnectionsPutBadRequest creates a PcloudVpnconnectionsPutBadRequest with default headers values +func NewPcloudVpnconnectionsPutBadRequest() *PcloudVpnconnectionsPutBadRequest { + return &PcloudVpnconnectionsPutBadRequest{} +} + +/* PcloudVpnconnectionsPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVpnconnectionsPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudVpnconnectionsPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPutBadRequest) 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 +} + +// NewPcloudVpnconnectionsPutUnauthorized creates a PcloudVpnconnectionsPutUnauthorized with default headers values +func NewPcloudVpnconnectionsPutUnauthorized() *PcloudVpnconnectionsPutUnauthorized { + return &PcloudVpnconnectionsPutUnauthorized{} +} + +/* PcloudVpnconnectionsPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVpnconnectionsPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudVpnconnectionsPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPutUnauthorized) 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 +} + +// NewPcloudVpnconnectionsPutForbidden creates a PcloudVpnconnectionsPutForbidden with default headers values +func NewPcloudVpnconnectionsPutForbidden() *PcloudVpnconnectionsPutForbidden { + return &PcloudVpnconnectionsPutForbidden{} +} + +/* PcloudVpnconnectionsPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudVpnconnectionsPutForbidden struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPutForbidden) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsPutForbidden %+v", 403, o.Payload) +} +func (o *PcloudVpnconnectionsPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPutForbidden) 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 +} + +// NewPcloudVpnconnectionsPutNotFound creates a PcloudVpnconnectionsPutNotFound with default headers values +func NewPcloudVpnconnectionsPutNotFound() *PcloudVpnconnectionsPutNotFound { + return &PcloudVpnconnectionsPutNotFound{} +} + +/* PcloudVpnconnectionsPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudVpnconnectionsPutNotFound struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPutNotFound) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsPutNotFound %+v", 404, o.Payload) +} +func (o *PcloudVpnconnectionsPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPutNotFound) 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 +} + +// NewPcloudVpnconnectionsPutUnprocessableEntity creates a PcloudVpnconnectionsPutUnprocessableEntity with default headers values +func NewPcloudVpnconnectionsPutUnprocessableEntity() *PcloudVpnconnectionsPutUnprocessableEntity { + return &PcloudVpnconnectionsPutUnprocessableEntity{} +} + +/* PcloudVpnconnectionsPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudVpnconnectionsPutUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsPutUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudVpnconnectionsPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPutUnprocessableEntity) 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 +} + +// NewPcloudVpnconnectionsPutInternalServerError creates a PcloudVpnconnectionsPutInternalServerError with default headers values +func NewPcloudVpnconnectionsPutInternalServerError() *PcloudVpnconnectionsPutInternalServerError { + return &PcloudVpnconnectionsPutInternalServerError{} +} + +/* PcloudVpnconnectionsPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVpnconnectionsPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudVpnconnectionsPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/vpn-connections/{vpn_connection_id}][%d] pcloudVpnconnectionsPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudVpnconnectionsPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVpnconnectionsPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/p_cloudvpn_policies_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/p_cloudvpn_policies_client.go new file mode 100644 index 00000000000..677be4f2fbb --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/p_cloudvpn_policies_client.go @@ -0,0 +1,469 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud v p n policies API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud v p n policies API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudIkepoliciesDelete(params *PcloudIkepoliciesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesDeleteOK, error) + + PcloudIkepoliciesGet(params *PcloudIkepoliciesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesGetOK, error) + + PcloudIkepoliciesGetall(params *PcloudIkepoliciesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesGetallOK, error) + + PcloudIkepoliciesPost(params *PcloudIkepoliciesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesPostOK, error) + + PcloudIkepoliciesPut(params *PcloudIkepoliciesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesPutOK, error) + + PcloudIpsecpoliciesDelete(params *PcloudIpsecpoliciesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesDeleteOK, error) + + PcloudIpsecpoliciesGet(params *PcloudIpsecpoliciesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesGetOK, error) + + PcloudIpsecpoliciesGetall(params *PcloudIpsecpoliciesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesGetallOK, error) + + PcloudIpsecpoliciesPost(params *PcloudIpsecpoliciesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesPostOK, error) + + PcloudIpsecpoliciesPut(params *PcloudIpsecpoliciesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesPutOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudIkepoliciesDelete deletes i k e policy + + Delete an IKE Policy (by its unique identifier) +*/ +func (a *Client) PcloudIkepoliciesDelete(params *PcloudIkepoliciesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIkepoliciesDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ikepolicies.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIkepoliciesDeleteReader{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.(*PcloudIkepoliciesDeleteOK) + 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 pcloud.ikepolicies.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIkepoliciesGet gets the specified i k e policy + + Get an IKE Policy (by its unique identifier) +*/ +func (a *Client) PcloudIkepoliciesGet(params *PcloudIkepoliciesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIkepoliciesGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ikepolicies.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIkepoliciesGetReader{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.(*PcloudIkepoliciesGetOK) + 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 pcloud.ikepolicies.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIkepoliciesGetall gets all i k e policies + + List all IKE Policies with all attributes +*/ +func (a *Client) PcloudIkepoliciesGetall(params *PcloudIkepoliciesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIkepoliciesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ikepolicies.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIkepoliciesGetallReader{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.(*PcloudIkepoliciesGetallOK) + 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 pcloud.ikepolicies.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIkepoliciesPost adds i k e policy + + Add a new IKE Policy +*/ +func (a *Client) PcloudIkepoliciesPost(params *PcloudIkepoliciesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIkepoliciesPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ikepolicies.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIkepoliciesPostReader{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.(*PcloudIkepoliciesPostOK) + 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 pcloud.ikepolicies.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIkepoliciesPut updates i k e policy + + update an IKE Policy (by its unique identifier) +*/ +func (a *Client) PcloudIkepoliciesPut(params *PcloudIkepoliciesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIkepoliciesPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIkepoliciesPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ikepolicies.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIkepoliciesPutReader{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.(*PcloudIkepoliciesPutOK) + 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 pcloud.ikepolicies.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIpsecpoliciesDelete deletes IP sec policy + + Delete an IPSec Policy (by its unique identifier) +*/ +func (a *Client) PcloudIpsecpoliciesDelete(params *PcloudIpsecpoliciesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIpsecpoliciesDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ipsecpolicies.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIpsecpoliciesDeleteReader{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.(*PcloudIpsecpoliciesDeleteOK) + 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 pcloud.ipsecpolicies.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIpsecpoliciesGet gets the specified IP sec policy + + Get an IPSec Policy (by its unique identifier) +*/ +func (a *Client) PcloudIpsecpoliciesGet(params *PcloudIpsecpoliciesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIpsecpoliciesGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ipsecpolicies.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIpsecpoliciesGetReader{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.(*PcloudIpsecpoliciesGetOK) + 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 pcloud.ipsecpolicies.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIpsecpoliciesGetall gets all IP sec policies + + Get all IPSec Policies with all their attributes +*/ +func (a *Client) PcloudIpsecpoliciesGetall(params *PcloudIpsecpoliciesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIpsecpoliciesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ipsecpolicies.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIpsecpoliciesGetallReader{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.(*PcloudIpsecpoliciesGetallOK) + 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 pcloud.ipsecpolicies.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIpsecpoliciesPost adds IP sec policy + + Add a new IPSec Policy +*/ +func (a *Client) PcloudIpsecpoliciesPost(params *PcloudIpsecpoliciesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIpsecpoliciesPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ipsecpolicies.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIpsecpoliciesPostReader{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.(*PcloudIpsecpoliciesPostOK) + 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 pcloud.ipsecpolicies.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudIpsecpoliciesPut updates IP sec policy + + update an IPSec Policy +*/ +func (a *Client) PcloudIpsecpoliciesPut(params *PcloudIpsecpoliciesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudIpsecpoliciesPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudIpsecpoliciesPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.ipsecpolicies.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudIpsecpoliciesPutReader{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.(*PcloudIpsecpoliciesPutOK) + 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 pcloud.ipsecpolicies.put: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_delete_parameters.go new file mode 100644 index 00000000000..7463101da64 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_delete_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// 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" +) + +// NewPcloudIkepoliciesDeleteParams creates a new PcloudIkepoliciesDeleteParams 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 NewPcloudIkepoliciesDeleteParams() *PcloudIkepoliciesDeleteParams { + return &PcloudIkepoliciesDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudIkepoliciesDeleteParamsWithTimeout creates a new PcloudIkepoliciesDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudIkepoliciesDeleteParamsWithTimeout(timeout time.Duration) *PcloudIkepoliciesDeleteParams { + return &PcloudIkepoliciesDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudIkepoliciesDeleteParamsWithContext creates a new PcloudIkepoliciesDeleteParams object +// with the ability to set a context for a request. +func NewPcloudIkepoliciesDeleteParamsWithContext(ctx context.Context) *PcloudIkepoliciesDeleteParams { + return &PcloudIkepoliciesDeleteParams{ + Context: ctx, + } +} + +// NewPcloudIkepoliciesDeleteParamsWithHTTPClient creates a new PcloudIkepoliciesDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudIkepoliciesDeleteParamsWithHTTPClient(client *http.Client) *PcloudIkepoliciesDeleteParams { + return &PcloudIkepoliciesDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudIkepoliciesDeleteParams contains all the parameters to send to the API endpoint + for the pcloud ikepolicies delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudIkepoliciesDeleteParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* IkePolicyID. + + ID of a IKE Policy + */ + IkePolicyID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud ikepolicies delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesDeleteParams) WithDefaults() *PcloudIkepoliciesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ikepolicies delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud ikepolicies delete params +func (o *PcloudIkepoliciesDeleteParams) WithTimeout(timeout time.Duration) *PcloudIkepoliciesDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud ikepolicies delete params +func (o *PcloudIkepoliciesDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud ikepolicies delete params +func (o *PcloudIkepoliciesDeleteParams) WithContext(ctx context.Context) *PcloudIkepoliciesDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud ikepolicies delete params +func (o *PcloudIkepoliciesDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud ikepolicies delete params +func (o *PcloudIkepoliciesDeleteParams) WithHTTPClient(client *http.Client) *PcloudIkepoliciesDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud ikepolicies delete params +func (o *PcloudIkepoliciesDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud ikepolicies delete params +func (o *PcloudIkepoliciesDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudIkepoliciesDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud ikepolicies delete params +func (o *PcloudIkepoliciesDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithIkePolicyID adds the ikePolicyID to the pcloud ikepolicies delete params +func (o *PcloudIkepoliciesDeleteParams) WithIkePolicyID(ikePolicyID string) *PcloudIkepoliciesDeleteParams { + o.SetIkePolicyID(ikePolicyID) + return o +} + +// SetIkePolicyID adds the ikePolicyId to the pcloud ikepolicies delete params +func (o *PcloudIkepoliciesDeleteParams) SetIkePolicyID(ikePolicyID string) { + o.IkePolicyID = ikePolicyID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudIkepoliciesDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param ike_policy_id + if err := r.SetPathParam("ike_policy_id", o.IkePolicyID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_delete_responses.go new file mode 100644 index 00000000000..6e717941063 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_delete_responses.go @@ -0,0 +1,255 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudIkepoliciesDeleteReader is a Reader for the PcloudIkepoliciesDelete structure. +type PcloudIkepoliciesDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudIkepoliciesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudIkepoliciesDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudIkepoliciesDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudIkepoliciesDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudIkepoliciesDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudIkepoliciesDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudIkepoliciesDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudIkepoliciesDeleteOK creates a PcloudIkepoliciesDeleteOK with default headers values +func NewPcloudIkepoliciesDeleteOK() *PcloudIkepoliciesDeleteOK { + return &PcloudIkepoliciesDeleteOK{} +} + +/* PcloudIkepoliciesDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudIkepoliciesDeleteOK struct { + Payload models.Object +} + +func (o *PcloudIkepoliciesDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudIkepoliciesDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudIkepoliciesDeleteOK) 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 +} + +// NewPcloudIkepoliciesDeleteBadRequest creates a PcloudIkepoliciesDeleteBadRequest with default headers values +func NewPcloudIkepoliciesDeleteBadRequest() *PcloudIkepoliciesDeleteBadRequest { + return &PcloudIkepoliciesDeleteBadRequest{} +} + +/* PcloudIkepoliciesDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudIkepoliciesDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudIkepoliciesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesDeleteBadRequest) 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 +} + +// NewPcloudIkepoliciesDeleteUnauthorized creates a PcloudIkepoliciesDeleteUnauthorized with default headers values +func NewPcloudIkepoliciesDeleteUnauthorized() *PcloudIkepoliciesDeleteUnauthorized { + return &PcloudIkepoliciesDeleteUnauthorized{} +} + +/* PcloudIkepoliciesDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudIkepoliciesDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudIkepoliciesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesDeleteUnauthorized) 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 +} + +// NewPcloudIkepoliciesDeleteForbidden creates a PcloudIkepoliciesDeleteForbidden with default headers values +func NewPcloudIkepoliciesDeleteForbidden() *PcloudIkepoliciesDeleteForbidden { + return &PcloudIkepoliciesDeleteForbidden{} +} + +/* PcloudIkepoliciesDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudIkepoliciesDeleteForbidden struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesDeleteForbidden %+v", 403, o.Payload) +} +func (o *PcloudIkepoliciesDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesDeleteForbidden) 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 +} + +// NewPcloudIkepoliciesDeleteNotFound creates a PcloudIkepoliciesDeleteNotFound with default headers values +func NewPcloudIkepoliciesDeleteNotFound() *PcloudIkepoliciesDeleteNotFound { + return &PcloudIkepoliciesDeleteNotFound{} +} + +/* PcloudIkepoliciesDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudIkepoliciesDeleteNotFound struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesDeleteNotFound %+v", 404, o.Payload) +} +func (o *PcloudIkepoliciesDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesDeleteNotFound) 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 +} + +// NewPcloudIkepoliciesDeleteInternalServerError creates a PcloudIkepoliciesDeleteInternalServerError with default headers values +func NewPcloudIkepoliciesDeleteInternalServerError() *PcloudIkepoliciesDeleteInternalServerError { + return &PcloudIkepoliciesDeleteInternalServerError{} +} + +/* PcloudIkepoliciesDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudIkepoliciesDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudIkepoliciesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_get_parameters.go new file mode 100644 index 00000000000..9a0318cff3d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// 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" +) + +// NewPcloudIkepoliciesGetParams creates a new PcloudIkepoliciesGetParams 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 NewPcloudIkepoliciesGetParams() *PcloudIkepoliciesGetParams { + return &PcloudIkepoliciesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudIkepoliciesGetParamsWithTimeout creates a new PcloudIkepoliciesGetParams object +// with the ability to set a timeout on a request. +func NewPcloudIkepoliciesGetParamsWithTimeout(timeout time.Duration) *PcloudIkepoliciesGetParams { + return &PcloudIkepoliciesGetParams{ + timeout: timeout, + } +} + +// NewPcloudIkepoliciesGetParamsWithContext creates a new PcloudIkepoliciesGetParams object +// with the ability to set a context for a request. +func NewPcloudIkepoliciesGetParamsWithContext(ctx context.Context) *PcloudIkepoliciesGetParams { + return &PcloudIkepoliciesGetParams{ + Context: ctx, + } +} + +// NewPcloudIkepoliciesGetParamsWithHTTPClient creates a new PcloudIkepoliciesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudIkepoliciesGetParamsWithHTTPClient(client *http.Client) *PcloudIkepoliciesGetParams { + return &PcloudIkepoliciesGetParams{ + HTTPClient: client, + } +} + +/* PcloudIkepoliciesGetParams contains all the parameters to send to the API endpoint + for the pcloud ikepolicies get operation. + + Typically these are written to a http.Request. +*/ +type PcloudIkepoliciesGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* IkePolicyID. + + ID of a IKE Policy + */ + IkePolicyID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud ikepolicies get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesGetParams) WithDefaults() *PcloudIkepoliciesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ikepolicies get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud ikepolicies get params +func (o *PcloudIkepoliciesGetParams) WithTimeout(timeout time.Duration) *PcloudIkepoliciesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud ikepolicies get params +func (o *PcloudIkepoliciesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud ikepolicies get params +func (o *PcloudIkepoliciesGetParams) WithContext(ctx context.Context) *PcloudIkepoliciesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud ikepolicies get params +func (o *PcloudIkepoliciesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud ikepolicies get params +func (o *PcloudIkepoliciesGetParams) WithHTTPClient(client *http.Client) *PcloudIkepoliciesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud ikepolicies get params +func (o *PcloudIkepoliciesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud ikepolicies get params +func (o *PcloudIkepoliciesGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudIkepoliciesGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud ikepolicies get params +func (o *PcloudIkepoliciesGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithIkePolicyID adds the ikePolicyID to the pcloud ikepolicies get params +func (o *PcloudIkepoliciesGetParams) WithIkePolicyID(ikePolicyID string) *PcloudIkepoliciesGetParams { + o.SetIkePolicyID(ikePolicyID) + return o +} + +// SetIkePolicyID adds the ikePolicyId to the pcloud ikepolicies get params +func (o *PcloudIkepoliciesGetParams) SetIkePolicyID(ikePolicyID string) { + o.IkePolicyID = ikePolicyID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudIkepoliciesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param ike_policy_id + if err := r.SetPathParam("ike_policy_id", o.IkePolicyID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_get_responses.go new file mode 100644 index 00000000000..d6d3b799c0f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_get_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudIkepoliciesGetReader is a Reader for the PcloudIkepoliciesGet structure. +type PcloudIkepoliciesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudIkepoliciesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudIkepoliciesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudIkepoliciesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudIkepoliciesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudIkepoliciesGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudIkepoliciesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudIkepoliciesGetUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudIkepoliciesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudIkepoliciesGetOK creates a PcloudIkepoliciesGetOK with default headers values +func NewPcloudIkepoliciesGetOK() *PcloudIkepoliciesGetOK { + return &PcloudIkepoliciesGetOK{} +} + +/* PcloudIkepoliciesGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudIkepoliciesGetOK struct { + Payload *models.IKEPolicy +} + +func (o *PcloudIkepoliciesGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesGetOK %+v", 200, o.Payload) +} +func (o *PcloudIkepoliciesGetOK) GetPayload() *models.IKEPolicy { + return o.Payload +} + +func (o *PcloudIkepoliciesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.IKEPolicy) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudIkepoliciesGetBadRequest creates a PcloudIkepoliciesGetBadRequest with default headers values +func NewPcloudIkepoliciesGetBadRequest() *PcloudIkepoliciesGetBadRequest { + return &PcloudIkepoliciesGetBadRequest{} +} + +/* PcloudIkepoliciesGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudIkepoliciesGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudIkepoliciesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesGetBadRequest) 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 +} + +// NewPcloudIkepoliciesGetUnauthorized creates a PcloudIkepoliciesGetUnauthorized with default headers values +func NewPcloudIkepoliciesGetUnauthorized() *PcloudIkepoliciesGetUnauthorized { + return &PcloudIkepoliciesGetUnauthorized{} +} + +/* PcloudIkepoliciesGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudIkepoliciesGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudIkepoliciesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesGetUnauthorized) 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 +} + +// NewPcloudIkepoliciesGetForbidden creates a PcloudIkepoliciesGetForbidden with default headers values +func NewPcloudIkepoliciesGetForbidden() *PcloudIkepoliciesGetForbidden { + return &PcloudIkepoliciesGetForbidden{} +} + +/* PcloudIkepoliciesGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudIkepoliciesGetForbidden struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesGetForbidden) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesGetForbidden %+v", 403, o.Payload) +} +func (o *PcloudIkepoliciesGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesGetForbidden) 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 +} + +// NewPcloudIkepoliciesGetNotFound creates a PcloudIkepoliciesGetNotFound with default headers values +func NewPcloudIkepoliciesGetNotFound() *PcloudIkepoliciesGetNotFound { + return &PcloudIkepoliciesGetNotFound{} +} + +/* PcloudIkepoliciesGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudIkepoliciesGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudIkepoliciesGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesGetNotFound) 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 +} + +// NewPcloudIkepoliciesGetUnprocessableEntity creates a PcloudIkepoliciesGetUnprocessableEntity with default headers values +func NewPcloudIkepoliciesGetUnprocessableEntity() *PcloudIkepoliciesGetUnprocessableEntity { + return &PcloudIkepoliciesGetUnprocessableEntity{} +} + +/* PcloudIkepoliciesGetUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudIkepoliciesGetUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesGetUnprocessableEntity) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesGetUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudIkepoliciesGetUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesGetUnprocessableEntity) 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 +} + +// NewPcloudIkepoliciesGetInternalServerError creates a PcloudIkepoliciesGetInternalServerError with default headers values +func NewPcloudIkepoliciesGetInternalServerError() *PcloudIkepoliciesGetInternalServerError { + return &PcloudIkepoliciesGetInternalServerError{} +} + +/* PcloudIkepoliciesGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudIkepoliciesGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudIkepoliciesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_getall_parameters.go new file mode 100644 index 00000000000..c83d29a40df --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_getall_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// 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" +) + +// NewPcloudIkepoliciesGetallParams creates a new PcloudIkepoliciesGetallParams 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 NewPcloudIkepoliciesGetallParams() *PcloudIkepoliciesGetallParams { + return &PcloudIkepoliciesGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudIkepoliciesGetallParamsWithTimeout creates a new PcloudIkepoliciesGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudIkepoliciesGetallParamsWithTimeout(timeout time.Duration) *PcloudIkepoliciesGetallParams { + return &PcloudIkepoliciesGetallParams{ + timeout: timeout, + } +} + +// NewPcloudIkepoliciesGetallParamsWithContext creates a new PcloudIkepoliciesGetallParams object +// with the ability to set a context for a request. +func NewPcloudIkepoliciesGetallParamsWithContext(ctx context.Context) *PcloudIkepoliciesGetallParams { + return &PcloudIkepoliciesGetallParams{ + Context: ctx, + } +} + +// NewPcloudIkepoliciesGetallParamsWithHTTPClient creates a new PcloudIkepoliciesGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudIkepoliciesGetallParamsWithHTTPClient(client *http.Client) *PcloudIkepoliciesGetallParams { + return &PcloudIkepoliciesGetallParams{ + HTTPClient: client, + } +} + +/* PcloudIkepoliciesGetallParams contains all the parameters to send to the API endpoint + for the pcloud ikepolicies getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudIkepoliciesGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud ikepolicies getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesGetallParams) WithDefaults() *PcloudIkepoliciesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ikepolicies getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud ikepolicies getall params +func (o *PcloudIkepoliciesGetallParams) WithTimeout(timeout time.Duration) *PcloudIkepoliciesGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud ikepolicies getall params +func (o *PcloudIkepoliciesGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud ikepolicies getall params +func (o *PcloudIkepoliciesGetallParams) WithContext(ctx context.Context) *PcloudIkepoliciesGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud ikepolicies getall params +func (o *PcloudIkepoliciesGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud ikepolicies getall params +func (o *PcloudIkepoliciesGetallParams) WithHTTPClient(client *http.Client) *PcloudIkepoliciesGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud ikepolicies getall params +func (o *PcloudIkepoliciesGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud ikepolicies getall params +func (o *PcloudIkepoliciesGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudIkepoliciesGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud ikepolicies getall params +func (o *PcloudIkepoliciesGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudIkepoliciesGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_getall_responses.go new file mode 100644 index 00000000000..8286d8f0ba2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_getall_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudIkepoliciesGetallReader is a Reader for the PcloudIkepoliciesGetall structure. +type PcloudIkepoliciesGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudIkepoliciesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudIkepoliciesGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudIkepoliciesGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudIkepoliciesGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudIkepoliciesGetallForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudIkepoliciesGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudIkepoliciesGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudIkepoliciesGetallOK creates a PcloudIkepoliciesGetallOK with default headers values +func NewPcloudIkepoliciesGetallOK() *PcloudIkepoliciesGetallOK { + return &PcloudIkepoliciesGetallOK{} +} + +/* PcloudIkepoliciesGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudIkepoliciesGetallOK struct { + Payload *models.IKEPolicies +} + +func (o *PcloudIkepoliciesGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesGetallOK %+v", 200, o.Payload) +} +func (o *PcloudIkepoliciesGetallOK) GetPayload() *models.IKEPolicies { + return o.Payload +} + +func (o *PcloudIkepoliciesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.IKEPolicies) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudIkepoliciesGetallBadRequest creates a PcloudIkepoliciesGetallBadRequest with default headers values +func NewPcloudIkepoliciesGetallBadRequest() *PcloudIkepoliciesGetallBadRequest { + return &PcloudIkepoliciesGetallBadRequest{} +} + +/* PcloudIkepoliciesGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudIkepoliciesGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudIkepoliciesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesGetallBadRequest) 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 +} + +// NewPcloudIkepoliciesGetallUnauthorized creates a PcloudIkepoliciesGetallUnauthorized with default headers values +func NewPcloudIkepoliciesGetallUnauthorized() *PcloudIkepoliciesGetallUnauthorized { + return &PcloudIkepoliciesGetallUnauthorized{} +} + +/* PcloudIkepoliciesGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudIkepoliciesGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudIkepoliciesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesGetallUnauthorized) 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 +} + +// NewPcloudIkepoliciesGetallForbidden creates a PcloudIkepoliciesGetallForbidden with default headers values +func NewPcloudIkepoliciesGetallForbidden() *PcloudIkepoliciesGetallForbidden { + return &PcloudIkepoliciesGetallForbidden{} +} + +/* PcloudIkepoliciesGetallForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudIkepoliciesGetallForbidden struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesGetallForbidden) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesGetallForbidden %+v", 403, o.Payload) +} +func (o *PcloudIkepoliciesGetallForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesGetallForbidden) 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 +} + +// NewPcloudIkepoliciesGetallNotFound creates a PcloudIkepoliciesGetallNotFound with default headers values +func NewPcloudIkepoliciesGetallNotFound() *PcloudIkepoliciesGetallNotFound { + return &PcloudIkepoliciesGetallNotFound{} +} + +/* PcloudIkepoliciesGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudIkepoliciesGetallNotFound struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesGetallNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesGetallNotFound %+v", 404, o.Payload) +} +func (o *PcloudIkepoliciesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesGetallNotFound) 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 +} + +// NewPcloudIkepoliciesGetallInternalServerError creates a PcloudIkepoliciesGetallInternalServerError with default headers values +func NewPcloudIkepoliciesGetallInternalServerError() *PcloudIkepoliciesGetallInternalServerError { + return &PcloudIkepoliciesGetallInternalServerError{} +} + +/* PcloudIkepoliciesGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudIkepoliciesGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudIkepoliciesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_post_parameters.go new file mode 100644 index 00000000000..57d82f091a6 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// 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" +) + +// NewPcloudIkepoliciesPostParams creates a new PcloudIkepoliciesPostParams 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 NewPcloudIkepoliciesPostParams() *PcloudIkepoliciesPostParams { + return &PcloudIkepoliciesPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudIkepoliciesPostParamsWithTimeout creates a new PcloudIkepoliciesPostParams object +// with the ability to set a timeout on a request. +func NewPcloudIkepoliciesPostParamsWithTimeout(timeout time.Duration) *PcloudIkepoliciesPostParams { + return &PcloudIkepoliciesPostParams{ + timeout: timeout, + } +} + +// NewPcloudIkepoliciesPostParamsWithContext creates a new PcloudIkepoliciesPostParams object +// with the ability to set a context for a request. +func NewPcloudIkepoliciesPostParamsWithContext(ctx context.Context) *PcloudIkepoliciesPostParams { + return &PcloudIkepoliciesPostParams{ + Context: ctx, + } +} + +// NewPcloudIkepoliciesPostParamsWithHTTPClient creates a new PcloudIkepoliciesPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudIkepoliciesPostParamsWithHTTPClient(client *http.Client) *PcloudIkepoliciesPostParams { + return &PcloudIkepoliciesPostParams{ + HTTPClient: client, + } +} + +/* PcloudIkepoliciesPostParams contains all the parameters to send to the API endpoint + for the pcloud ikepolicies post operation. + + Typically these are written to a http.Request. +*/ +type PcloudIkepoliciesPostParams struct { + + /* Body. + + Parameters for the creation of a new IKE Policy + */ + Body *models.IKEPolicyCreate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud ikepolicies post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesPostParams) WithDefaults() *PcloudIkepoliciesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ikepolicies post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud ikepolicies post params +func (o *PcloudIkepoliciesPostParams) WithTimeout(timeout time.Duration) *PcloudIkepoliciesPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud ikepolicies post params +func (o *PcloudIkepoliciesPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud ikepolicies post params +func (o *PcloudIkepoliciesPostParams) WithContext(ctx context.Context) *PcloudIkepoliciesPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud ikepolicies post params +func (o *PcloudIkepoliciesPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud ikepolicies post params +func (o *PcloudIkepoliciesPostParams) WithHTTPClient(client *http.Client) *PcloudIkepoliciesPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud ikepolicies post params +func (o *PcloudIkepoliciesPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud ikepolicies post params +func (o *PcloudIkepoliciesPostParams) WithBody(body *models.IKEPolicyCreate) *PcloudIkepoliciesPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud ikepolicies post params +func (o *PcloudIkepoliciesPostParams) SetBody(body *models.IKEPolicyCreate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud ikepolicies post params +func (o *PcloudIkepoliciesPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudIkepoliciesPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud ikepolicies post params +func (o *PcloudIkepoliciesPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudIkepoliciesPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_post_responses.go new file mode 100644 index 00000000000..3b3d81964d7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_post_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudIkepoliciesPostReader is a Reader for the PcloudIkepoliciesPost structure. +type PcloudIkepoliciesPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudIkepoliciesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudIkepoliciesPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudIkepoliciesPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudIkepoliciesPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudIkepoliciesPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudIkepoliciesPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudIkepoliciesPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudIkepoliciesPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudIkepoliciesPostOK creates a PcloudIkepoliciesPostOK with default headers values +func NewPcloudIkepoliciesPostOK() *PcloudIkepoliciesPostOK { + return &PcloudIkepoliciesPostOK{} +} + +/* PcloudIkepoliciesPostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudIkepoliciesPostOK struct { + Payload *models.IKEPolicy +} + +func (o *PcloudIkepoliciesPostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesPostOK %+v", 200, o.Payload) +} +func (o *PcloudIkepoliciesPostOK) GetPayload() *models.IKEPolicy { + return o.Payload +} + +func (o *PcloudIkepoliciesPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.IKEPolicy) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudIkepoliciesPostBadRequest creates a PcloudIkepoliciesPostBadRequest with default headers values +func NewPcloudIkepoliciesPostBadRequest() *PcloudIkepoliciesPostBadRequest { + return &PcloudIkepoliciesPostBadRequest{} +} + +/* PcloudIkepoliciesPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudIkepoliciesPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudIkepoliciesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesPostBadRequest) 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 +} + +// NewPcloudIkepoliciesPostUnauthorized creates a PcloudIkepoliciesPostUnauthorized with default headers values +func NewPcloudIkepoliciesPostUnauthorized() *PcloudIkepoliciesPostUnauthorized { + return &PcloudIkepoliciesPostUnauthorized{} +} + +/* PcloudIkepoliciesPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudIkepoliciesPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudIkepoliciesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesPostUnauthorized) 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 +} + +// NewPcloudIkepoliciesPostForbidden creates a PcloudIkepoliciesPostForbidden with default headers values +func NewPcloudIkepoliciesPostForbidden() *PcloudIkepoliciesPostForbidden { + return &PcloudIkepoliciesPostForbidden{} +} + +/* PcloudIkepoliciesPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudIkepoliciesPostForbidden struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesPostForbidden) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesPostForbidden %+v", 403, o.Payload) +} +func (o *PcloudIkepoliciesPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesPostForbidden) 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 +} + +// NewPcloudIkepoliciesPostConflict creates a PcloudIkepoliciesPostConflict with default headers values +func NewPcloudIkepoliciesPostConflict() *PcloudIkepoliciesPostConflict { + return &PcloudIkepoliciesPostConflict{} +} + +/* PcloudIkepoliciesPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudIkepoliciesPostConflict struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesPostConflict %+v", 409, o.Payload) +} +func (o *PcloudIkepoliciesPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesPostConflict) 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 +} + +// NewPcloudIkepoliciesPostUnprocessableEntity creates a PcloudIkepoliciesPostUnprocessableEntity with default headers values +func NewPcloudIkepoliciesPostUnprocessableEntity() *PcloudIkepoliciesPostUnprocessableEntity { + return &PcloudIkepoliciesPostUnprocessableEntity{} +} + +/* PcloudIkepoliciesPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudIkepoliciesPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudIkepoliciesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesPostUnprocessableEntity) 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 +} + +// NewPcloudIkepoliciesPostInternalServerError creates a PcloudIkepoliciesPostInternalServerError with default headers values +func NewPcloudIkepoliciesPostInternalServerError() *PcloudIkepoliciesPostInternalServerError { + return &PcloudIkepoliciesPostInternalServerError{} +} + +/* PcloudIkepoliciesPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudIkepoliciesPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies][%d] pcloudIkepoliciesPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudIkepoliciesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_put_parameters.go new file mode 100644 index 00000000000..c845b8aee92 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_put_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// 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" +) + +// NewPcloudIkepoliciesPutParams creates a new PcloudIkepoliciesPutParams 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 NewPcloudIkepoliciesPutParams() *PcloudIkepoliciesPutParams { + return &PcloudIkepoliciesPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudIkepoliciesPutParamsWithTimeout creates a new PcloudIkepoliciesPutParams object +// with the ability to set a timeout on a request. +func NewPcloudIkepoliciesPutParamsWithTimeout(timeout time.Duration) *PcloudIkepoliciesPutParams { + return &PcloudIkepoliciesPutParams{ + timeout: timeout, + } +} + +// NewPcloudIkepoliciesPutParamsWithContext creates a new PcloudIkepoliciesPutParams object +// with the ability to set a context for a request. +func NewPcloudIkepoliciesPutParamsWithContext(ctx context.Context) *PcloudIkepoliciesPutParams { + return &PcloudIkepoliciesPutParams{ + Context: ctx, + } +} + +// NewPcloudIkepoliciesPutParamsWithHTTPClient creates a new PcloudIkepoliciesPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudIkepoliciesPutParamsWithHTTPClient(client *http.Client) *PcloudIkepoliciesPutParams { + return &PcloudIkepoliciesPutParams{ + HTTPClient: client, + } +} + +/* PcloudIkepoliciesPutParams contains all the parameters to send to the API endpoint + for the pcloud ikepolicies put operation. + + Typically these are written to a http.Request. +*/ +type PcloudIkepoliciesPutParams struct { + + /* Body. + + Parameters for updating IKE Policy + */ + Body *models.IKEPolicyUpdate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* IkePolicyID. + + ID of a IKE Policy + */ + IkePolicyID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud ikepolicies put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesPutParams) WithDefaults() *PcloudIkepoliciesPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ikepolicies put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIkepoliciesPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud ikepolicies put params +func (o *PcloudIkepoliciesPutParams) WithTimeout(timeout time.Duration) *PcloudIkepoliciesPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud ikepolicies put params +func (o *PcloudIkepoliciesPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud ikepolicies put params +func (o *PcloudIkepoliciesPutParams) WithContext(ctx context.Context) *PcloudIkepoliciesPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud ikepolicies put params +func (o *PcloudIkepoliciesPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud ikepolicies put params +func (o *PcloudIkepoliciesPutParams) WithHTTPClient(client *http.Client) *PcloudIkepoliciesPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud ikepolicies put params +func (o *PcloudIkepoliciesPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud ikepolicies put params +func (o *PcloudIkepoliciesPutParams) WithBody(body *models.IKEPolicyUpdate) *PcloudIkepoliciesPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud ikepolicies put params +func (o *PcloudIkepoliciesPutParams) SetBody(body *models.IKEPolicyUpdate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud ikepolicies put params +func (o *PcloudIkepoliciesPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudIkepoliciesPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud ikepolicies put params +func (o *PcloudIkepoliciesPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithIkePolicyID adds the ikePolicyID to the pcloud ikepolicies put params +func (o *PcloudIkepoliciesPutParams) WithIkePolicyID(ikePolicyID string) *PcloudIkepoliciesPutParams { + o.SetIkePolicyID(ikePolicyID) + return o +} + +// SetIkePolicyID adds the ikePolicyId to the pcloud ikepolicies put params +func (o *PcloudIkepoliciesPutParams) SetIkePolicyID(ikePolicyID string) { + o.IkePolicyID = ikePolicyID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudIkepoliciesPutParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param ike_policy_id + if err := r.SetPathParam("ike_policy_id", o.IkePolicyID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_put_responses.go new file mode 100644 index 00000000000..b9350c86f88 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ikepolicies_put_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudIkepoliciesPutReader is a Reader for the PcloudIkepoliciesPut structure. +type PcloudIkepoliciesPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudIkepoliciesPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudIkepoliciesPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudIkepoliciesPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudIkepoliciesPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudIkepoliciesPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudIkepoliciesPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudIkepoliciesPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudIkepoliciesPutOK creates a PcloudIkepoliciesPutOK with default headers values +func NewPcloudIkepoliciesPutOK() *PcloudIkepoliciesPutOK { + return &PcloudIkepoliciesPutOK{} +} + +/* PcloudIkepoliciesPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudIkepoliciesPutOK struct { + Payload *models.IKEPolicy +} + +func (o *PcloudIkepoliciesPutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesPutOK %+v", 200, o.Payload) +} +func (o *PcloudIkepoliciesPutOK) GetPayload() *models.IKEPolicy { + return o.Payload +} + +func (o *PcloudIkepoliciesPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.IKEPolicy) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudIkepoliciesPutBadRequest creates a PcloudIkepoliciesPutBadRequest with default headers values +func NewPcloudIkepoliciesPutBadRequest() *PcloudIkepoliciesPutBadRequest { + return &PcloudIkepoliciesPutBadRequest{} +} + +/* PcloudIkepoliciesPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudIkepoliciesPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudIkepoliciesPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesPutBadRequest) 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 +} + +// NewPcloudIkepoliciesPutUnauthorized creates a PcloudIkepoliciesPutUnauthorized with default headers values +func NewPcloudIkepoliciesPutUnauthorized() *PcloudIkepoliciesPutUnauthorized { + return &PcloudIkepoliciesPutUnauthorized{} +} + +/* PcloudIkepoliciesPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudIkepoliciesPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudIkepoliciesPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesPutUnauthorized) 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 +} + +// NewPcloudIkepoliciesPutForbidden creates a PcloudIkepoliciesPutForbidden with default headers values +func NewPcloudIkepoliciesPutForbidden() *PcloudIkepoliciesPutForbidden { + return &PcloudIkepoliciesPutForbidden{} +} + +/* PcloudIkepoliciesPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudIkepoliciesPutForbidden struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesPutForbidden) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesPutForbidden %+v", 403, o.Payload) +} +func (o *PcloudIkepoliciesPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesPutForbidden) 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 +} + +// NewPcloudIkepoliciesPutUnprocessableEntity creates a PcloudIkepoliciesPutUnprocessableEntity with default headers values +func NewPcloudIkepoliciesPutUnprocessableEntity() *PcloudIkepoliciesPutUnprocessableEntity { + return &PcloudIkepoliciesPutUnprocessableEntity{} +} + +/* PcloudIkepoliciesPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudIkepoliciesPutUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesPutUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudIkepoliciesPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesPutUnprocessableEntity) 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 +} + +// NewPcloudIkepoliciesPutInternalServerError creates a PcloudIkepoliciesPutInternalServerError with default headers values +func NewPcloudIkepoliciesPutInternalServerError() *PcloudIkepoliciesPutInternalServerError { + return &PcloudIkepoliciesPutInternalServerError{} +} + +/* PcloudIkepoliciesPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudIkepoliciesPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudIkepoliciesPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ike-policies/{ike_policy_id}][%d] pcloudIkepoliciesPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudIkepoliciesPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIkepoliciesPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_delete_parameters.go new file mode 100644 index 00000000000..fdd67659cc2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_delete_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// 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" +) + +// NewPcloudIpsecpoliciesDeleteParams creates a new PcloudIpsecpoliciesDeleteParams 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 NewPcloudIpsecpoliciesDeleteParams() *PcloudIpsecpoliciesDeleteParams { + return &PcloudIpsecpoliciesDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudIpsecpoliciesDeleteParamsWithTimeout creates a new PcloudIpsecpoliciesDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudIpsecpoliciesDeleteParamsWithTimeout(timeout time.Duration) *PcloudIpsecpoliciesDeleteParams { + return &PcloudIpsecpoliciesDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudIpsecpoliciesDeleteParamsWithContext creates a new PcloudIpsecpoliciesDeleteParams object +// with the ability to set a context for a request. +func NewPcloudIpsecpoliciesDeleteParamsWithContext(ctx context.Context) *PcloudIpsecpoliciesDeleteParams { + return &PcloudIpsecpoliciesDeleteParams{ + Context: ctx, + } +} + +// NewPcloudIpsecpoliciesDeleteParamsWithHTTPClient creates a new PcloudIpsecpoliciesDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudIpsecpoliciesDeleteParamsWithHTTPClient(client *http.Client) *PcloudIpsecpoliciesDeleteParams { + return &PcloudIpsecpoliciesDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudIpsecpoliciesDeleteParams contains all the parameters to send to the API endpoint + for the pcloud ipsecpolicies delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudIpsecpoliciesDeleteParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* IpsecPolicyID. + + ID of a IPSec Policy + */ + IpsecPolicyID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud ipsecpolicies delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesDeleteParams) WithDefaults() *PcloudIpsecpoliciesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ipsecpolicies delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud ipsecpolicies delete params +func (o *PcloudIpsecpoliciesDeleteParams) WithTimeout(timeout time.Duration) *PcloudIpsecpoliciesDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud ipsecpolicies delete params +func (o *PcloudIpsecpoliciesDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud ipsecpolicies delete params +func (o *PcloudIpsecpoliciesDeleteParams) WithContext(ctx context.Context) *PcloudIpsecpoliciesDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud ipsecpolicies delete params +func (o *PcloudIpsecpoliciesDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud ipsecpolicies delete params +func (o *PcloudIpsecpoliciesDeleteParams) WithHTTPClient(client *http.Client) *PcloudIpsecpoliciesDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud ipsecpolicies delete params +func (o *PcloudIpsecpoliciesDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud ipsecpolicies delete params +func (o *PcloudIpsecpoliciesDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudIpsecpoliciesDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud ipsecpolicies delete params +func (o *PcloudIpsecpoliciesDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithIpsecPolicyID adds the ipsecPolicyID to the pcloud ipsecpolicies delete params +func (o *PcloudIpsecpoliciesDeleteParams) WithIpsecPolicyID(ipsecPolicyID string) *PcloudIpsecpoliciesDeleteParams { + o.SetIpsecPolicyID(ipsecPolicyID) + return o +} + +// SetIpsecPolicyID adds the ipsecPolicyId to the pcloud ipsecpolicies delete params +func (o *PcloudIpsecpoliciesDeleteParams) SetIpsecPolicyID(ipsecPolicyID string) { + o.IpsecPolicyID = ipsecPolicyID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudIpsecpoliciesDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param ipsec_policy_id + if err := r.SetPathParam("ipsec_policy_id", o.IpsecPolicyID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_delete_responses.go new file mode 100644 index 00000000000..0d01bf97cd6 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_delete_responses.go @@ -0,0 +1,255 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudIpsecpoliciesDeleteReader is a Reader for the PcloudIpsecpoliciesDelete structure. +type PcloudIpsecpoliciesDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudIpsecpoliciesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudIpsecpoliciesDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudIpsecpoliciesDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudIpsecpoliciesDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudIpsecpoliciesDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudIpsecpoliciesDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudIpsecpoliciesDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudIpsecpoliciesDeleteOK creates a PcloudIpsecpoliciesDeleteOK with default headers values +func NewPcloudIpsecpoliciesDeleteOK() *PcloudIpsecpoliciesDeleteOK { + return &PcloudIpsecpoliciesDeleteOK{} +} + +/* PcloudIpsecpoliciesDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudIpsecpoliciesDeleteOK struct { + Payload models.Object +} + +func (o *PcloudIpsecpoliciesDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudIpsecpoliciesDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudIpsecpoliciesDeleteOK) 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 +} + +// NewPcloudIpsecpoliciesDeleteBadRequest creates a PcloudIpsecpoliciesDeleteBadRequest with default headers values +func NewPcloudIpsecpoliciesDeleteBadRequest() *PcloudIpsecpoliciesDeleteBadRequest { + return &PcloudIpsecpoliciesDeleteBadRequest{} +} + +/* PcloudIpsecpoliciesDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudIpsecpoliciesDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudIpsecpoliciesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesDeleteBadRequest) 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 +} + +// NewPcloudIpsecpoliciesDeleteUnauthorized creates a PcloudIpsecpoliciesDeleteUnauthorized with default headers values +func NewPcloudIpsecpoliciesDeleteUnauthorized() *PcloudIpsecpoliciesDeleteUnauthorized { + return &PcloudIpsecpoliciesDeleteUnauthorized{} +} + +/* PcloudIpsecpoliciesDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudIpsecpoliciesDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudIpsecpoliciesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesDeleteUnauthorized) 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 +} + +// NewPcloudIpsecpoliciesDeleteForbidden creates a PcloudIpsecpoliciesDeleteForbidden with default headers values +func NewPcloudIpsecpoliciesDeleteForbidden() *PcloudIpsecpoliciesDeleteForbidden { + return &PcloudIpsecpoliciesDeleteForbidden{} +} + +/* PcloudIpsecpoliciesDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudIpsecpoliciesDeleteForbidden struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesDeleteForbidden %+v", 403, o.Payload) +} +func (o *PcloudIpsecpoliciesDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesDeleteForbidden) 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 +} + +// NewPcloudIpsecpoliciesDeleteNotFound creates a PcloudIpsecpoliciesDeleteNotFound with default headers values +func NewPcloudIpsecpoliciesDeleteNotFound() *PcloudIpsecpoliciesDeleteNotFound { + return &PcloudIpsecpoliciesDeleteNotFound{} +} + +/* PcloudIpsecpoliciesDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudIpsecpoliciesDeleteNotFound struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesDeleteNotFound %+v", 404, o.Payload) +} +func (o *PcloudIpsecpoliciesDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesDeleteNotFound) 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 +} + +// NewPcloudIpsecpoliciesDeleteInternalServerError creates a PcloudIpsecpoliciesDeleteInternalServerError with default headers values +func NewPcloudIpsecpoliciesDeleteInternalServerError() *PcloudIpsecpoliciesDeleteInternalServerError { + return &PcloudIpsecpoliciesDeleteInternalServerError{} +} + +/* PcloudIpsecpoliciesDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudIpsecpoliciesDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudIpsecpoliciesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_get_parameters.go new file mode 100644 index 00000000000..8f24e703cb7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// 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" +) + +// NewPcloudIpsecpoliciesGetParams creates a new PcloudIpsecpoliciesGetParams 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 NewPcloudIpsecpoliciesGetParams() *PcloudIpsecpoliciesGetParams { + return &PcloudIpsecpoliciesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudIpsecpoliciesGetParamsWithTimeout creates a new PcloudIpsecpoliciesGetParams object +// with the ability to set a timeout on a request. +func NewPcloudIpsecpoliciesGetParamsWithTimeout(timeout time.Duration) *PcloudIpsecpoliciesGetParams { + return &PcloudIpsecpoliciesGetParams{ + timeout: timeout, + } +} + +// NewPcloudIpsecpoliciesGetParamsWithContext creates a new PcloudIpsecpoliciesGetParams object +// with the ability to set a context for a request. +func NewPcloudIpsecpoliciesGetParamsWithContext(ctx context.Context) *PcloudIpsecpoliciesGetParams { + return &PcloudIpsecpoliciesGetParams{ + Context: ctx, + } +} + +// NewPcloudIpsecpoliciesGetParamsWithHTTPClient creates a new PcloudIpsecpoliciesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudIpsecpoliciesGetParamsWithHTTPClient(client *http.Client) *PcloudIpsecpoliciesGetParams { + return &PcloudIpsecpoliciesGetParams{ + HTTPClient: client, + } +} + +/* PcloudIpsecpoliciesGetParams contains all the parameters to send to the API endpoint + for the pcloud ipsecpolicies get operation. + + Typically these are written to a http.Request. +*/ +type PcloudIpsecpoliciesGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* IpsecPolicyID. + + ID of a IPSec Policy + */ + IpsecPolicyID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud ipsecpolicies get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesGetParams) WithDefaults() *PcloudIpsecpoliciesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ipsecpolicies get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud ipsecpolicies get params +func (o *PcloudIpsecpoliciesGetParams) WithTimeout(timeout time.Duration) *PcloudIpsecpoliciesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud ipsecpolicies get params +func (o *PcloudIpsecpoliciesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud ipsecpolicies get params +func (o *PcloudIpsecpoliciesGetParams) WithContext(ctx context.Context) *PcloudIpsecpoliciesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud ipsecpolicies get params +func (o *PcloudIpsecpoliciesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud ipsecpolicies get params +func (o *PcloudIpsecpoliciesGetParams) WithHTTPClient(client *http.Client) *PcloudIpsecpoliciesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud ipsecpolicies get params +func (o *PcloudIpsecpoliciesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud ipsecpolicies get params +func (o *PcloudIpsecpoliciesGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudIpsecpoliciesGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud ipsecpolicies get params +func (o *PcloudIpsecpoliciesGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithIpsecPolicyID adds the ipsecPolicyID to the pcloud ipsecpolicies get params +func (o *PcloudIpsecpoliciesGetParams) WithIpsecPolicyID(ipsecPolicyID string) *PcloudIpsecpoliciesGetParams { + o.SetIpsecPolicyID(ipsecPolicyID) + return o +} + +// SetIpsecPolicyID adds the ipsecPolicyId to the pcloud ipsecpolicies get params +func (o *PcloudIpsecpoliciesGetParams) SetIpsecPolicyID(ipsecPolicyID string) { + o.IpsecPolicyID = ipsecPolicyID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudIpsecpoliciesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param ipsec_policy_id + if err := r.SetPathParam("ipsec_policy_id", o.IpsecPolicyID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_get_responses.go new file mode 100644 index 00000000000..ddaa9a9b8e9 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_get_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudIpsecpoliciesGetReader is a Reader for the PcloudIpsecpoliciesGet structure. +type PcloudIpsecpoliciesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudIpsecpoliciesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudIpsecpoliciesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudIpsecpoliciesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudIpsecpoliciesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudIpsecpoliciesGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudIpsecpoliciesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudIpsecpoliciesGetUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudIpsecpoliciesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudIpsecpoliciesGetOK creates a PcloudIpsecpoliciesGetOK with default headers values +func NewPcloudIpsecpoliciesGetOK() *PcloudIpsecpoliciesGetOK { + return &PcloudIpsecpoliciesGetOK{} +} + +/* PcloudIpsecpoliciesGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudIpsecpoliciesGetOK struct { + Payload *models.IPSecPolicy +} + +func (o *PcloudIpsecpoliciesGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesGetOK %+v", 200, o.Payload) +} +func (o *PcloudIpsecpoliciesGetOK) GetPayload() *models.IPSecPolicy { + return o.Payload +} + +func (o *PcloudIpsecpoliciesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.IPSecPolicy) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudIpsecpoliciesGetBadRequest creates a PcloudIpsecpoliciesGetBadRequest with default headers values +func NewPcloudIpsecpoliciesGetBadRequest() *PcloudIpsecpoliciesGetBadRequest { + return &PcloudIpsecpoliciesGetBadRequest{} +} + +/* PcloudIpsecpoliciesGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudIpsecpoliciesGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudIpsecpoliciesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesGetBadRequest) 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 +} + +// NewPcloudIpsecpoliciesGetUnauthorized creates a PcloudIpsecpoliciesGetUnauthorized with default headers values +func NewPcloudIpsecpoliciesGetUnauthorized() *PcloudIpsecpoliciesGetUnauthorized { + return &PcloudIpsecpoliciesGetUnauthorized{} +} + +/* PcloudIpsecpoliciesGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudIpsecpoliciesGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudIpsecpoliciesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesGetUnauthorized) 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 +} + +// NewPcloudIpsecpoliciesGetForbidden creates a PcloudIpsecpoliciesGetForbidden with default headers values +func NewPcloudIpsecpoliciesGetForbidden() *PcloudIpsecpoliciesGetForbidden { + return &PcloudIpsecpoliciesGetForbidden{} +} + +/* PcloudIpsecpoliciesGetForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudIpsecpoliciesGetForbidden struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesGetForbidden) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesGetForbidden %+v", 403, o.Payload) +} +func (o *PcloudIpsecpoliciesGetForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesGetForbidden) 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 +} + +// NewPcloudIpsecpoliciesGetNotFound creates a PcloudIpsecpoliciesGetNotFound with default headers values +func NewPcloudIpsecpoliciesGetNotFound() *PcloudIpsecpoliciesGetNotFound { + return &PcloudIpsecpoliciesGetNotFound{} +} + +/* PcloudIpsecpoliciesGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudIpsecpoliciesGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudIpsecpoliciesGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesGetNotFound) 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 +} + +// NewPcloudIpsecpoliciesGetUnprocessableEntity creates a PcloudIpsecpoliciesGetUnprocessableEntity with default headers values +func NewPcloudIpsecpoliciesGetUnprocessableEntity() *PcloudIpsecpoliciesGetUnprocessableEntity { + return &PcloudIpsecpoliciesGetUnprocessableEntity{} +} + +/* PcloudIpsecpoliciesGetUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudIpsecpoliciesGetUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesGetUnprocessableEntity) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesGetUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudIpsecpoliciesGetUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesGetUnprocessableEntity) 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 +} + +// NewPcloudIpsecpoliciesGetInternalServerError creates a PcloudIpsecpoliciesGetInternalServerError with default headers values +func NewPcloudIpsecpoliciesGetInternalServerError() *PcloudIpsecpoliciesGetInternalServerError { + return &PcloudIpsecpoliciesGetInternalServerError{} +} + +/* PcloudIpsecpoliciesGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudIpsecpoliciesGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudIpsecpoliciesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_getall_parameters.go new file mode 100644 index 00000000000..6d9a00d3a36 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_getall_parameters.go @@ -0,0 +1,149 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// 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" +) + +// NewPcloudIpsecpoliciesGetallParams creates a new PcloudIpsecpoliciesGetallParams 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 NewPcloudIpsecpoliciesGetallParams() *PcloudIpsecpoliciesGetallParams { + return &PcloudIpsecpoliciesGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudIpsecpoliciesGetallParamsWithTimeout creates a new PcloudIpsecpoliciesGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudIpsecpoliciesGetallParamsWithTimeout(timeout time.Duration) *PcloudIpsecpoliciesGetallParams { + return &PcloudIpsecpoliciesGetallParams{ + timeout: timeout, + } +} + +// NewPcloudIpsecpoliciesGetallParamsWithContext creates a new PcloudIpsecpoliciesGetallParams object +// with the ability to set a context for a request. +func NewPcloudIpsecpoliciesGetallParamsWithContext(ctx context.Context) *PcloudIpsecpoliciesGetallParams { + return &PcloudIpsecpoliciesGetallParams{ + Context: ctx, + } +} + +// NewPcloudIpsecpoliciesGetallParamsWithHTTPClient creates a new PcloudIpsecpoliciesGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudIpsecpoliciesGetallParamsWithHTTPClient(client *http.Client) *PcloudIpsecpoliciesGetallParams { + return &PcloudIpsecpoliciesGetallParams{ + HTTPClient: client, + } +} + +/* PcloudIpsecpoliciesGetallParams contains all the parameters to send to the API endpoint + for the pcloud ipsecpolicies getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudIpsecpoliciesGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud ipsecpolicies getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesGetallParams) WithDefaults() *PcloudIpsecpoliciesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ipsecpolicies getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud ipsecpolicies getall params +func (o *PcloudIpsecpoliciesGetallParams) WithTimeout(timeout time.Duration) *PcloudIpsecpoliciesGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud ipsecpolicies getall params +func (o *PcloudIpsecpoliciesGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud ipsecpolicies getall params +func (o *PcloudIpsecpoliciesGetallParams) WithContext(ctx context.Context) *PcloudIpsecpoliciesGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud ipsecpolicies getall params +func (o *PcloudIpsecpoliciesGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud ipsecpolicies getall params +func (o *PcloudIpsecpoliciesGetallParams) WithHTTPClient(client *http.Client) *PcloudIpsecpoliciesGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud ipsecpolicies getall params +func (o *PcloudIpsecpoliciesGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud ipsecpolicies getall params +func (o *PcloudIpsecpoliciesGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudIpsecpoliciesGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud ipsecpolicies getall params +func (o *PcloudIpsecpoliciesGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudIpsecpoliciesGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_getall_responses.go new file mode 100644 index 00000000000..92925b59b4b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_getall_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudIpsecpoliciesGetallReader is a Reader for the PcloudIpsecpoliciesGetall structure. +type PcloudIpsecpoliciesGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudIpsecpoliciesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudIpsecpoliciesGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudIpsecpoliciesGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudIpsecpoliciesGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudIpsecpoliciesGetallForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudIpsecpoliciesGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudIpsecpoliciesGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudIpsecpoliciesGetallOK creates a PcloudIpsecpoliciesGetallOK with default headers values +func NewPcloudIpsecpoliciesGetallOK() *PcloudIpsecpoliciesGetallOK { + return &PcloudIpsecpoliciesGetallOK{} +} + +/* PcloudIpsecpoliciesGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudIpsecpoliciesGetallOK struct { + Payload *models.IPSecPolicies +} + +func (o *PcloudIpsecpoliciesGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesGetallOK %+v", 200, o.Payload) +} +func (o *PcloudIpsecpoliciesGetallOK) GetPayload() *models.IPSecPolicies { + return o.Payload +} + +func (o *PcloudIpsecpoliciesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.IPSecPolicies) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudIpsecpoliciesGetallBadRequest creates a PcloudIpsecpoliciesGetallBadRequest with default headers values +func NewPcloudIpsecpoliciesGetallBadRequest() *PcloudIpsecpoliciesGetallBadRequest { + return &PcloudIpsecpoliciesGetallBadRequest{} +} + +/* PcloudIpsecpoliciesGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudIpsecpoliciesGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudIpsecpoliciesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesGetallBadRequest) 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 +} + +// NewPcloudIpsecpoliciesGetallUnauthorized creates a PcloudIpsecpoliciesGetallUnauthorized with default headers values +func NewPcloudIpsecpoliciesGetallUnauthorized() *PcloudIpsecpoliciesGetallUnauthorized { + return &PcloudIpsecpoliciesGetallUnauthorized{} +} + +/* PcloudIpsecpoliciesGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudIpsecpoliciesGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudIpsecpoliciesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesGetallUnauthorized) 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 +} + +// NewPcloudIpsecpoliciesGetallForbidden creates a PcloudIpsecpoliciesGetallForbidden with default headers values +func NewPcloudIpsecpoliciesGetallForbidden() *PcloudIpsecpoliciesGetallForbidden { + return &PcloudIpsecpoliciesGetallForbidden{} +} + +/* PcloudIpsecpoliciesGetallForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudIpsecpoliciesGetallForbidden struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesGetallForbidden) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesGetallForbidden %+v", 403, o.Payload) +} +func (o *PcloudIpsecpoliciesGetallForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesGetallForbidden) 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 +} + +// NewPcloudIpsecpoliciesGetallNotFound creates a PcloudIpsecpoliciesGetallNotFound with default headers values +func NewPcloudIpsecpoliciesGetallNotFound() *PcloudIpsecpoliciesGetallNotFound { + return &PcloudIpsecpoliciesGetallNotFound{} +} + +/* PcloudIpsecpoliciesGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudIpsecpoliciesGetallNotFound struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesGetallNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesGetallNotFound %+v", 404, o.Payload) +} +func (o *PcloudIpsecpoliciesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesGetallNotFound) 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 +} + +// NewPcloudIpsecpoliciesGetallInternalServerError creates a PcloudIpsecpoliciesGetallInternalServerError with default headers values +func NewPcloudIpsecpoliciesGetallInternalServerError() *PcloudIpsecpoliciesGetallInternalServerError { + return &PcloudIpsecpoliciesGetallInternalServerError{} +} + +/* PcloudIpsecpoliciesGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudIpsecpoliciesGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudIpsecpoliciesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_post_parameters.go new file mode 100644 index 00000000000..a09d4300f1a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// 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" +) + +// NewPcloudIpsecpoliciesPostParams creates a new PcloudIpsecpoliciesPostParams 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 NewPcloudIpsecpoliciesPostParams() *PcloudIpsecpoliciesPostParams { + return &PcloudIpsecpoliciesPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudIpsecpoliciesPostParamsWithTimeout creates a new PcloudIpsecpoliciesPostParams object +// with the ability to set a timeout on a request. +func NewPcloudIpsecpoliciesPostParamsWithTimeout(timeout time.Duration) *PcloudIpsecpoliciesPostParams { + return &PcloudIpsecpoliciesPostParams{ + timeout: timeout, + } +} + +// NewPcloudIpsecpoliciesPostParamsWithContext creates a new PcloudIpsecpoliciesPostParams object +// with the ability to set a context for a request. +func NewPcloudIpsecpoliciesPostParamsWithContext(ctx context.Context) *PcloudIpsecpoliciesPostParams { + return &PcloudIpsecpoliciesPostParams{ + Context: ctx, + } +} + +// NewPcloudIpsecpoliciesPostParamsWithHTTPClient creates a new PcloudIpsecpoliciesPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudIpsecpoliciesPostParamsWithHTTPClient(client *http.Client) *PcloudIpsecpoliciesPostParams { + return &PcloudIpsecpoliciesPostParams{ + HTTPClient: client, + } +} + +/* PcloudIpsecpoliciesPostParams contains all the parameters to send to the API endpoint + for the pcloud ipsecpolicies post operation. + + Typically these are written to a http.Request. +*/ +type PcloudIpsecpoliciesPostParams struct { + + /* Body. + + Parameters for the creation of a new IPSec Policy + */ + Body *models.IPSecPolicyCreate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud ipsecpolicies post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesPostParams) WithDefaults() *PcloudIpsecpoliciesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ipsecpolicies post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud ipsecpolicies post params +func (o *PcloudIpsecpoliciesPostParams) WithTimeout(timeout time.Duration) *PcloudIpsecpoliciesPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud ipsecpolicies post params +func (o *PcloudIpsecpoliciesPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud ipsecpolicies post params +func (o *PcloudIpsecpoliciesPostParams) WithContext(ctx context.Context) *PcloudIpsecpoliciesPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud ipsecpolicies post params +func (o *PcloudIpsecpoliciesPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud ipsecpolicies post params +func (o *PcloudIpsecpoliciesPostParams) WithHTTPClient(client *http.Client) *PcloudIpsecpoliciesPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud ipsecpolicies post params +func (o *PcloudIpsecpoliciesPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud ipsecpolicies post params +func (o *PcloudIpsecpoliciesPostParams) WithBody(body *models.IPSecPolicyCreate) *PcloudIpsecpoliciesPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud ipsecpolicies post params +func (o *PcloudIpsecpoliciesPostParams) SetBody(body *models.IPSecPolicyCreate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud ipsecpolicies post params +func (o *PcloudIpsecpoliciesPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudIpsecpoliciesPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud ipsecpolicies post params +func (o *PcloudIpsecpoliciesPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudIpsecpoliciesPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_post_responses.go new file mode 100644 index 00000000000..20620cea35d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_post_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudIpsecpoliciesPostReader is a Reader for the PcloudIpsecpoliciesPost structure. +type PcloudIpsecpoliciesPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudIpsecpoliciesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudIpsecpoliciesPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudIpsecpoliciesPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudIpsecpoliciesPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudIpsecpoliciesPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudIpsecpoliciesPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudIpsecpoliciesPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudIpsecpoliciesPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudIpsecpoliciesPostOK creates a PcloudIpsecpoliciesPostOK with default headers values +func NewPcloudIpsecpoliciesPostOK() *PcloudIpsecpoliciesPostOK { + return &PcloudIpsecpoliciesPostOK{} +} + +/* PcloudIpsecpoliciesPostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudIpsecpoliciesPostOK struct { + Payload *models.IPSecPolicy +} + +func (o *PcloudIpsecpoliciesPostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesPostOK %+v", 200, o.Payload) +} +func (o *PcloudIpsecpoliciesPostOK) GetPayload() *models.IPSecPolicy { + return o.Payload +} + +func (o *PcloudIpsecpoliciesPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.IPSecPolicy) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudIpsecpoliciesPostBadRequest creates a PcloudIpsecpoliciesPostBadRequest with default headers values +func NewPcloudIpsecpoliciesPostBadRequest() *PcloudIpsecpoliciesPostBadRequest { + return &PcloudIpsecpoliciesPostBadRequest{} +} + +/* PcloudIpsecpoliciesPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudIpsecpoliciesPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudIpsecpoliciesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesPostBadRequest) 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 +} + +// NewPcloudIpsecpoliciesPostUnauthorized creates a PcloudIpsecpoliciesPostUnauthorized with default headers values +func NewPcloudIpsecpoliciesPostUnauthorized() *PcloudIpsecpoliciesPostUnauthorized { + return &PcloudIpsecpoliciesPostUnauthorized{} +} + +/* PcloudIpsecpoliciesPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudIpsecpoliciesPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudIpsecpoliciesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesPostUnauthorized) 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 +} + +// NewPcloudIpsecpoliciesPostForbidden creates a PcloudIpsecpoliciesPostForbidden with default headers values +func NewPcloudIpsecpoliciesPostForbidden() *PcloudIpsecpoliciesPostForbidden { + return &PcloudIpsecpoliciesPostForbidden{} +} + +/* PcloudIpsecpoliciesPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudIpsecpoliciesPostForbidden struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesPostForbidden) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesPostForbidden %+v", 403, o.Payload) +} +func (o *PcloudIpsecpoliciesPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesPostForbidden) 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 +} + +// NewPcloudIpsecpoliciesPostConflict creates a PcloudIpsecpoliciesPostConflict with default headers values +func NewPcloudIpsecpoliciesPostConflict() *PcloudIpsecpoliciesPostConflict { + return &PcloudIpsecpoliciesPostConflict{} +} + +/* PcloudIpsecpoliciesPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudIpsecpoliciesPostConflict struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesPostConflict %+v", 409, o.Payload) +} +func (o *PcloudIpsecpoliciesPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesPostConflict) 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 +} + +// NewPcloudIpsecpoliciesPostUnprocessableEntity creates a PcloudIpsecpoliciesPostUnprocessableEntity with default headers values +func NewPcloudIpsecpoliciesPostUnprocessableEntity() *PcloudIpsecpoliciesPostUnprocessableEntity { + return &PcloudIpsecpoliciesPostUnprocessableEntity{} +} + +/* PcloudIpsecpoliciesPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudIpsecpoliciesPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudIpsecpoliciesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesPostUnprocessableEntity) 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 +} + +// NewPcloudIpsecpoliciesPostInternalServerError creates a PcloudIpsecpoliciesPostInternalServerError with default headers values +func NewPcloudIpsecpoliciesPostInternalServerError() *PcloudIpsecpoliciesPostInternalServerError { + return &PcloudIpsecpoliciesPostInternalServerError{} +} + +/* PcloudIpsecpoliciesPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudIpsecpoliciesPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies][%d] pcloudIpsecpoliciesPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudIpsecpoliciesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_put_parameters.go new file mode 100644 index 00000000000..4849277eaab --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_put_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// 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" +) + +// NewPcloudIpsecpoliciesPutParams creates a new PcloudIpsecpoliciesPutParams 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 NewPcloudIpsecpoliciesPutParams() *PcloudIpsecpoliciesPutParams { + return &PcloudIpsecpoliciesPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudIpsecpoliciesPutParamsWithTimeout creates a new PcloudIpsecpoliciesPutParams object +// with the ability to set a timeout on a request. +func NewPcloudIpsecpoliciesPutParamsWithTimeout(timeout time.Duration) *PcloudIpsecpoliciesPutParams { + return &PcloudIpsecpoliciesPutParams{ + timeout: timeout, + } +} + +// NewPcloudIpsecpoliciesPutParamsWithContext creates a new PcloudIpsecpoliciesPutParams object +// with the ability to set a context for a request. +func NewPcloudIpsecpoliciesPutParamsWithContext(ctx context.Context) *PcloudIpsecpoliciesPutParams { + return &PcloudIpsecpoliciesPutParams{ + Context: ctx, + } +} + +// NewPcloudIpsecpoliciesPutParamsWithHTTPClient creates a new PcloudIpsecpoliciesPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudIpsecpoliciesPutParamsWithHTTPClient(client *http.Client) *PcloudIpsecpoliciesPutParams { + return &PcloudIpsecpoliciesPutParams{ + HTTPClient: client, + } +} + +/* PcloudIpsecpoliciesPutParams contains all the parameters to send to the API endpoint + for the pcloud ipsecpolicies put operation. + + Typically these are written to a http.Request. +*/ +type PcloudIpsecpoliciesPutParams struct { + + /* Body. + + Parameters for the update of an IPSec Policy + */ + Body *models.IPSecPolicyUpdate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* IpsecPolicyID. + + ID of a IPSec Policy + */ + IpsecPolicyID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud ipsecpolicies put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesPutParams) WithDefaults() *PcloudIpsecpoliciesPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud ipsecpolicies put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudIpsecpoliciesPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud ipsecpolicies put params +func (o *PcloudIpsecpoliciesPutParams) WithTimeout(timeout time.Duration) *PcloudIpsecpoliciesPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud ipsecpolicies put params +func (o *PcloudIpsecpoliciesPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud ipsecpolicies put params +func (o *PcloudIpsecpoliciesPutParams) WithContext(ctx context.Context) *PcloudIpsecpoliciesPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud ipsecpolicies put params +func (o *PcloudIpsecpoliciesPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud ipsecpolicies put params +func (o *PcloudIpsecpoliciesPutParams) WithHTTPClient(client *http.Client) *PcloudIpsecpoliciesPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud ipsecpolicies put params +func (o *PcloudIpsecpoliciesPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud ipsecpolicies put params +func (o *PcloudIpsecpoliciesPutParams) WithBody(body *models.IPSecPolicyUpdate) *PcloudIpsecpoliciesPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud ipsecpolicies put params +func (o *PcloudIpsecpoliciesPutParams) SetBody(body *models.IPSecPolicyUpdate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud ipsecpolicies put params +func (o *PcloudIpsecpoliciesPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudIpsecpoliciesPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud ipsecpolicies put params +func (o *PcloudIpsecpoliciesPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithIpsecPolicyID adds the ipsecPolicyID to the pcloud ipsecpolicies put params +func (o *PcloudIpsecpoliciesPutParams) WithIpsecPolicyID(ipsecPolicyID string) *PcloudIpsecpoliciesPutParams { + o.SetIpsecPolicyID(ipsecPolicyID) + return o +} + +// SetIpsecPolicyID adds the ipsecPolicyId to the pcloud ipsecpolicies put params +func (o *PcloudIpsecpoliciesPutParams) SetIpsecPolicyID(ipsecPolicyID string) { + o.IpsecPolicyID = ipsecPolicyID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudIpsecpoliciesPutParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param ipsec_policy_id + if err := r.SetPathParam("ipsec_policy_id", o.IpsecPolicyID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_put_responses.go new file mode 100644 index 00000000000..feb151312c7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies/pcloud_ipsecpolicies_put_responses.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_v_p_n_policies + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudIpsecpoliciesPutReader is a Reader for the PcloudIpsecpoliciesPut structure. +type PcloudIpsecpoliciesPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudIpsecpoliciesPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudIpsecpoliciesPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudIpsecpoliciesPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudIpsecpoliciesPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudIpsecpoliciesPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudIpsecpoliciesPutConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudIpsecpoliciesPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudIpsecpoliciesPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudIpsecpoliciesPutOK creates a PcloudIpsecpoliciesPutOK with default headers values +func NewPcloudIpsecpoliciesPutOK() *PcloudIpsecpoliciesPutOK { + return &PcloudIpsecpoliciesPutOK{} +} + +/* PcloudIpsecpoliciesPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudIpsecpoliciesPutOK struct { + Payload *models.IPSecPolicy +} + +func (o *PcloudIpsecpoliciesPutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesPutOK %+v", 200, o.Payload) +} +func (o *PcloudIpsecpoliciesPutOK) GetPayload() *models.IPSecPolicy { + return o.Payload +} + +func (o *PcloudIpsecpoliciesPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.IPSecPolicy) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudIpsecpoliciesPutBadRequest creates a PcloudIpsecpoliciesPutBadRequest with default headers values +func NewPcloudIpsecpoliciesPutBadRequest() *PcloudIpsecpoliciesPutBadRequest { + return &PcloudIpsecpoliciesPutBadRequest{} +} + +/* PcloudIpsecpoliciesPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudIpsecpoliciesPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudIpsecpoliciesPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesPutBadRequest) 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 +} + +// NewPcloudIpsecpoliciesPutUnauthorized creates a PcloudIpsecpoliciesPutUnauthorized with default headers values +func NewPcloudIpsecpoliciesPutUnauthorized() *PcloudIpsecpoliciesPutUnauthorized { + return &PcloudIpsecpoliciesPutUnauthorized{} +} + +/* PcloudIpsecpoliciesPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudIpsecpoliciesPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudIpsecpoliciesPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesPutUnauthorized) 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 +} + +// NewPcloudIpsecpoliciesPutForbidden creates a PcloudIpsecpoliciesPutForbidden with default headers values +func NewPcloudIpsecpoliciesPutForbidden() *PcloudIpsecpoliciesPutForbidden { + return &PcloudIpsecpoliciesPutForbidden{} +} + +/* PcloudIpsecpoliciesPutForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudIpsecpoliciesPutForbidden struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesPutForbidden) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesPutForbidden %+v", 403, o.Payload) +} +func (o *PcloudIpsecpoliciesPutForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesPutForbidden) 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 +} + +// NewPcloudIpsecpoliciesPutConflict creates a PcloudIpsecpoliciesPutConflict with default headers values +func NewPcloudIpsecpoliciesPutConflict() *PcloudIpsecpoliciesPutConflict { + return &PcloudIpsecpoliciesPutConflict{} +} + +/* PcloudIpsecpoliciesPutConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudIpsecpoliciesPutConflict struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesPutConflict) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesPutConflict %+v", 409, o.Payload) +} +func (o *PcloudIpsecpoliciesPutConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesPutConflict) 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 +} + +// NewPcloudIpsecpoliciesPutUnprocessableEntity creates a PcloudIpsecpoliciesPutUnprocessableEntity with default headers values +func NewPcloudIpsecpoliciesPutUnprocessableEntity() *PcloudIpsecpoliciesPutUnprocessableEntity { + return &PcloudIpsecpoliciesPutUnprocessableEntity{} +} + +/* PcloudIpsecpoliciesPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudIpsecpoliciesPutUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesPutUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudIpsecpoliciesPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesPutUnprocessableEntity) 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 +} + +// NewPcloudIpsecpoliciesPutInternalServerError creates a PcloudIpsecpoliciesPutInternalServerError with default headers values +func NewPcloudIpsecpoliciesPutInternalServerError() *PcloudIpsecpoliciesPutInternalServerError { + return &PcloudIpsecpoliciesPutInternalServerError{} +} + +/* PcloudIpsecpoliciesPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudIpsecpoliciesPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudIpsecpoliciesPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/vpn/ipsec-policies/{ipsec_policy_id}][%d] pcloudIpsecpoliciesPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudIpsecpoliciesPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudIpsecpoliciesPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/p_cloud_volumes_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/p_cloud_volumes_client.go new file mode 100644 index 00000000000..d0afc8f4369 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/p_cloud_volumes_client.go @@ -0,0 +1,1023 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new p cloud volumes API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for p cloud volumes API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PcloudCloudinstancesVolumesActionPost(params *PcloudCloudinstancesVolumesActionPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesActionPostAccepted, error) + + PcloudCloudinstancesVolumesDelete(params *PcloudCloudinstancesVolumesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesDeleteOK, error) + + PcloudCloudinstancesVolumesGet(params *PcloudCloudinstancesVolumesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesGetOK, error) + + PcloudCloudinstancesVolumesGetall(params *PcloudCloudinstancesVolumesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesGetallOK, error) + + PcloudCloudinstancesVolumesPost(params *PcloudCloudinstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesPostAccepted, error) + + PcloudCloudinstancesVolumesPut(params *PcloudCloudinstancesVolumesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesPutOK, error) + + PcloudPvminstancesVolumesDelete(params *PcloudPvminstancesVolumesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesDeleteAccepted, error) + + PcloudPvminstancesVolumesGet(params *PcloudPvminstancesVolumesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesGetOK, error) + + PcloudPvminstancesVolumesGetall(params *PcloudPvminstancesVolumesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesGetallOK, error) + + PcloudPvminstancesVolumesPost(params *PcloudPvminstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesPostOK, error) + + PcloudPvminstancesVolumesPut(params *PcloudPvminstancesVolumesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesPutOK, error) + + PcloudPvminstancesVolumesSetbootPut(params *PcloudPvminstancesVolumesSetbootPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesSetbootPutOK, error) + + PcloudV2PvminstancesVolumesPost(params *PcloudV2PvminstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2PvminstancesVolumesPostAccepted, error) + + PcloudV2VolumesClonePost(params *PcloudV2VolumesClonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesClonePostAccepted, error) + + PcloudV2VolumesClonetasksGet(params *PcloudV2VolumesClonetasksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesClonetasksGetOK, error) + + PcloudV2VolumesPost(params *PcloudV2VolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesPostCreated, error) + + PcloudV2VolumescloneCancelPost(params *PcloudV2VolumescloneCancelPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneCancelPostAccepted, error) + + PcloudV2VolumescloneDelete(params *PcloudV2VolumescloneDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneDeleteOK, error) + + PcloudV2VolumescloneExecutePost(params *PcloudV2VolumescloneExecutePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneExecutePostAccepted, error) + + PcloudV2VolumescloneGet(params *PcloudV2VolumescloneGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneGetOK, error) + + PcloudV2VolumescloneGetall(params *PcloudV2VolumescloneGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneGetallOK, error) + + PcloudV2VolumesclonePost(params *PcloudV2VolumesclonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesclonePostAccepted, error) + + PcloudV2VolumescloneStartPost(params *PcloudV2VolumescloneStartPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneStartPostOK, error) + + PcloudVolumesClonePost(params *PcloudVolumesClonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVolumesClonePostOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PcloudCloudinstancesVolumesActionPost performs an action on a volume +*/ +func (a *Client) PcloudCloudinstancesVolumesActionPost(params *PcloudCloudinstancesVolumesActionPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesActionPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesVolumesActionPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.volumes.action.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}/action", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesVolumesActionPostReader{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.(*PcloudCloudinstancesVolumesActionPostAccepted) + 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 pcloud.cloudinstances.volumes.action.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesVolumesDelete deletes a cloud instance volume +*/ +func (a *Client) PcloudCloudinstancesVolumesDelete(params *PcloudCloudinstancesVolumesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesVolumesDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.volumes.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesVolumesDeleteReader{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.(*PcloudCloudinstancesVolumesDeleteOK) + 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 pcloud.cloudinstances.volumes.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesVolumesGet detaileds info of a volume +*/ +func (a *Client) PcloudCloudinstancesVolumesGet(params *PcloudCloudinstancesVolumesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesVolumesGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.volumes.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesVolumesGetReader{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.(*PcloudCloudinstancesVolumesGetOK) + 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 pcloud.cloudinstances.volumes.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesVolumesGetall lists all volumes for this cloud instance +*/ +func (a *Client) PcloudCloudinstancesVolumesGetall(params *PcloudCloudinstancesVolumesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesVolumesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.volumes.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/volumes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesVolumesGetallReader{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.(*PcloudCloudinstancesVolumesGetallOK) + 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 pcloud.cloudinstances.volumes.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesVolumesPost creates a new data volume +*/ +func (a *Client) PcloudCloudinstancesVolumesPost(params *PcloudCloudinstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesVolumesPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.volumes.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/volumes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesVolumesPostReader{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.(*PcloudCloudinstancesVolumesPostAccepted) + 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 pcloud.cloudinstances.volumes.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudCloudinstancesVolumesPut updates a cloud instance volume +*/ +func (a *Client) PcloudCloudinstancesVolumesPut(params *PcloudCloudinstancesVolumesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudCloudinstancesVolumesPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudCloudinstancesVolumesPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.cloudinstances.volumes.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudCloudinstancesVolumesPutReader{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.(*PcloudCloudinstancesVolumesPutOK) + 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 pcloud.cloudinstances.volumes.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesVolumesDelete detaches a volume from a p VM instance +*/ +func (a *Client) PcloudPvminstancesVolumesDelete(params *PcloudPvminstancesVolumesDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesVolumesDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.volumes.delete", + Method: "DELETE", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesVolumesDeleteReader{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.(*PcloudPvminstancesVolumesDeleteAccepted) + 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 pcloud.pvminstances.volumes.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesVolumesGet detaileds info of a volume attached to a p VM instance +*/ +func (a *Client) PcloudPvminstancesVolumesGet(params *PcloudPvminstancesVolumesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesVolumesGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.volumes.get", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesVolumesGetReader{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.(*PcloudPvminstancesVolumesGetOK) + 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 pcloud.pvminstances.volumes.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesVolumesGetall lists all volumes attached to a p VM instance +*/ +func (a *Client) PcloudPvminstancesVolumesGetall(params *PcloudPvminstancesVolumesGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesVolumesGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.volumes.getall", + Method: "GET", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesVolumesGetallReader{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.(*PcloudPvminstancesVolumesGetallOK) + 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 pcloud.pvminstances.volumes.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesVolumesPost attaches a volume to a p VM instance +*/ +func (a *Client) PcloudPvminstancesVolumesPost(params *PcloudPvminstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesVolumesPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.volumes.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesVolumesPostReader{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.(*PcloudPvminstancesVolumesPostOK) + 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 pcloud.pvminstances.volumes.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesVolumesPut updates a volume attached to a p VM instance +*/ +func (a *Client) PcloudPvminstancesVolumesPut(params *PcloudPvminstancesVolumesPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesVolumesPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.volumes.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesVolumesPutReader{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.(*PcloudPvminstancesVolumesPutOK) + 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 pcloud.pvminstances.volumes.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudPvminstancesVolumesSetbootPut sets the p VM instance volume as the boot volume +*/ +func (a *Client) PcloudPvminstancesVolumesSetbootPut(params *PcloudPvminstancesVolumesSetbootPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesSetbootPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudPvminstancesVolumesSetbootPutParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.pvminstances.volumes.setboot.put", + Method: "PUT", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}/setboot", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudPvminstancesVolumesSetbootPutReader{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.(*PcloudPvminstancesVolumesSetbootPutOK) + 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 pcloud.pvminstances.volumes.setboot.put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2PvminstancesVolumesPost attaches all volumes to a p VM instance +*/ +func (a *Client) PcloudV2PvminstancesVolumesPost(params *PcloudV2PvminstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2PvminstancesVolumesPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2PvminstancesVolumesPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.pvminstances.volumes.post", + Method: "POST", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2PvminstancesVolumesPostReader{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.(*PcloudV2PvminstancesVolumesPostAccepted) + 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 pcloud.v2.pvminstances.volumes.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2VolumesClonePost creates a volume clone for specified volumes +*/ +func (a *Client) PcloudV2VolumesClonePost(params *PcloudV2VolumesClonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesClonePostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2VolumesClonePostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.volumes.clone.post", + Method: "POST", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2VolumesClonePostReader{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.(*PcloudV2VolumesClonePostAccepted) + 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 pcloud.v2.volumes.clone.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2VolumesClonetasksGet gets the status of a volumes clone request for the specified clone task ID +*/ +func (a *Client) PcloudV2VolumesClonetasksGet(params *PcloudV2VolumesClonetasksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesClonetasksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2VolumesClonetasksGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.volumes.clonetasks.get", + Method: "GET", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone-tasks/{clone_task_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2VolumesClonetasksGetReader{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.(*PcloudV2VolumesClonetasksGetOK) + 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 pcloud.v2.volumes.clonetasks.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2VolumesPost creates multiple data volumes from a single definition +*/ +func (a *Client) PcloudV2VolumesPost(params *PcloudV2VolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesPostCreated, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2VolumesPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.volumes.post", + Method: "POST", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2VolumesPostReader{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.(*PcloudV2VolumesPostCreated) + 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 pcloud.v2.volumes.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2VolumescloneCancelPost cancels a volumes clone request initiates the cleanup action cleanup action performs the cleanup of the preparatory clones and snapshot volumes +*/ +func (a *Client) PcloudV2VolumescloneCancelPost(params *PcloudV2VolumescloneCancelPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneCancelPostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2VolumescloneCancelPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.volumesclone.cancel.post", + Method: "POST", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/cancel", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2VolumescloneCancelPostReader{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.(*PcloudV2VolumescloneCancelPostAccepted) + 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 pcloud.v2.volumesclone.cancel.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2VolumescloneDelete deletes a volumes clone request +*/ +func (a *Client) PcloudV2VolumescloneDelete(params *PcloudV2VolumescloneDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2VolumescloneDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.volumesclone.delete", + Method: "DELETE", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2VolumescloneDeleteReader{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.(*PcloudV2VolumescloneDeleteOK) + 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 pcloud.v2.volumesclone.delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2VolumescloneExecutePost initiates the execute action for a volumes clone request execute action creates the cloned volumes using the volume snapshots +*/ +func (a *Client) PcloudV2VolumescloneExecutePost(params *PcloudV2VolumescloneExecutePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneExecutePostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2VolumescloneExecutePostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.volumesclone.execute.post", + Method: "POST", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/execute", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2VolumescloneExecutePostReader{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.(*PcloudV2VolumescloneExecutePostAccepted) + 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 pcloud.v2.volumesclone.execute.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2VolumescloneGet gets the details for a volumes clone request +*/ +func (a *Client) PcloudV2VolumescloneGet(params *PcloudV2VolumescloneGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2VolumescloneGetParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.volumesclone.get", + Method: "GET", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2VolumescloneGetReader{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.(*PcloudV2VolumescloneGetOK) + 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 pcloud.v2.volumesclone.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2VolumescloneGetall gets the list of volumes clone request for a cloud instance +*/ +func (a *Client) PcloudV2VolumescloneGetall(params *PcloudV2VolumescloneGetallParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneGetallOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2VolumescloneGetallParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.volumesclone.getall", + Method: "GET", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2VolumescloneGetallReader{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.(*PcloudV2VolumescloneGetallOK) + 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 pcloud.v2.volumesclone.getall: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2VolumesclonePost creates a new volumes clone request and initiates the prepare action requires a minimum of two volumes requires a minimum of one volume to be in the in use state requires a unique volumes clone name prepare action does the preparatory work for creating the snapshot volumes +*/ +func (a *Client) PcloudV2VolumesclonePost(params *PcloudV2VolumesclonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumesclonePostAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2VolumesclonePostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.volumesclone.post", + Method: "POST", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2VolumesclonePostReader{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.(*PcloudV2VolumesclonePostAccepted) + 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 pcloud.v2.volumesclone.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudV2VolumescloneStartPost initiates the start action for a volumes clone request start action starts the consistency group to initiate the flash copy +*/ +func (a *Client) PcloudV2VolumescloneStartPost(params *PcloudV2VolumescloneStartPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudV2VolumescloneStartPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudV2VolumescloneStartPostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.v2.volumesclone.start.post", + Method: "POST", + PathPattern: "/pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/start", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudV2VolumescloneStartPostReader{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.(*PcloudV2VolumescloneStartPostOK) + 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 pcloud.v2.volumesclone.start.post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PcloudVolumesClonePost creates a volume clone for specified volumes +*/ +func (a *Client) PcloudVolumesClonePost(params *PcloudVolumesClonePostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudVolumesClonePostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPcloudVolumesClonePostParams() + } + op := &runtime.ClientOperation{ + ID: "pcloud.volumes.clone.post", + Method: "POST", + PathPattern: "/pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/clone", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &PcloudVolumesClonePostReader{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.(*PcloudVolumesClonePostOK) + 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 pcloud.volumes.clone.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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_action_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_action_post_parameters.go new file mode 100644 index 00000000000..a66e7a29b36 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_action_post_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudCloudinstancesVolumesActionPostParams creates a new PcloudCloudinstancesVolumesActionPostParams 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 NewPcloudCloudinstancesVolumesActionPostParams() *PcloudCloudinstancesVolumesActionPostParams { + return &PcloudCloudinstancesVolumesActionPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesVolumesActionPostParamsWithTimeout creates a new PcloudCloudinstancesVolumesActionPostParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesVolumesActionPostParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesActionPostParams { + return &PcloudCloudinstancesVolumesActionPostParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesVolumesActionPostParamsWithContext creates a new PcloudCloudinstancesVolumesActionPostParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesVolumesActionPostParamsWithContext(ctx context.Context) *PcloudCloudinstancesVolumesActionPostParams { + return &PcloudCloudinstancesVolumesActionPostParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesVolumesActionPostParamsWithHTTPClient creates a new PcloudCloudinstancesVolumesActionPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesVolumesActionPostParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesActionPostParams { + return &PcloudCloudinstancesVolumesActionPostParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesVolumesActionPostParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances volumes action post operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesVolumesActionPostParams struct { + + /* Body. + + Parameters for the desired action + */ + Body *models.VolumeAction + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VolumeID. + + Volume ID + */ + VolumeID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances volumes action post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesActionPostParams) WithDefaults() *PcloudCloudinstancesVolumesActionPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances volumes action post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesActionPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances volumes action post params +func (o *PcloudCloudinstancesVolumesActionPostParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesActionPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances volumes action post params +func (o *PcloudCloudinstancesVolumesActionPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances volumes action post params +func (o *PcloudCloudinstancesVolumesActionPostParams) WithContext(ctx context.Context) *PcloudCloudinstancesVolumesActionPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances volumes action post params +func (o *PcloudCloudinstancesVolumesActionPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances volumes action post params +func (o *PcloudCloudinstancesVolumesActionPostParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesActionPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances volumes action post params +func (o *PcloudCloudinstancesVolumesActionPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud cloudinstances volumes action post params +func (o *PcloudCloudinstancesVolumesActionPostParams) WithBody(body *models.VolumeAction) *PcloudCloudinstancesVolumesActionPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud cloudinstances volumes action post params +func (o *PcloudCloudinstancesVolumesActionPostParams) SetBody(body *models.VolumeAction) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances volumes action post params +func (o *PcloudCloudinstancesVolumesActionPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesVolumesActionPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances volumes action post params +func (o *PcloudCloudinstancesVolumesActionPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVolumeID adds the volumeID to the pcloud cloudinstances volumes action post params +func (o *PcloudCloudinstancesVolumesActionPostParams) WithVolumeID(volumeID string) *PcloudCloudinstancesVolumesActionPostParams { + o.SetVolumeID(volumeID) + return o +} + +// SetVolumeID adds the volumeId to the pcloud cloudinstances volumes action post params +func (o *PcloudCloudinstancesVolumesActionPostParams) SetVolumeID(volumeID string) { + o.VolumeID = volumeID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesVolumesActionPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param volume_id + if err := r.SetPathParam("volume_id", o.VolumeID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_action_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_action_post_responses.go new file mode 100644 index 00000000000..24d75e2cd2f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_action_post_responses.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesVolumesActionPostReader is a Reader for the PcloudCloudinstancesVolumesActionPost structure. +type PcloudCloudinstancesVolumesActionPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesVolumesActionPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudCloudinstancesVolumesActionPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesVolumesActionPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesVolumesActionPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesVolumesActionPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesVolumesActionPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesVolumesActionPostAccepted creates a PcloudCloudinstancesVolumesActionPostAccepted with default headers values +func NewPcloudCloudinstancesVolumesActionPostAccepted() *PcloudCloudinstancesVolumesActionPostAccepted { + return &PcloudCloudinstancesVolumesActionPostAccepted{} +} + +/* PcloudCloudinstancesVolumesActionPostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudCloudinstancesVolumesActionPostAccepted struct { + Payload models.Object +} + +func (o *PcloudCloudinstancesVolumesActionPostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}/action][%d] pcloudCloudinstancesVolumesActionPostAccepted %+v", 202, o.Payload) +} +func (o *PcloudCloudinstancesVolumesActionPostAccepted) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesActionPostAccepted) 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 +} + +// NewPcloudCloudinstancesVolumesActionPostBadRequest creates a PcloudCloudinstancesVolumesActionPostBadRequest with default headers values +func NewPcloudCloudinstancesVolumesActionPostBadRequest() *PcloudCloudinstancesVolumesActionPostBadRequest { + return &PcloudCloudinstancesVolumesActionPostBadRequest{} +} + +/* PcloudCloudinstancesVolumesActionPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesVolumesActionPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesActionPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}/action][%d] pcloudCloudinstancesVolumesActionPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesVolumesActionPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesActionPostBadRequest) 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 +} + +// NewPcloudCloudinstancesVolumesActionPostUnauthorized creates a PcloudCloudinstancesVolumesActionPostUnauthorized with default headers values +func NewPcloudCloudinstancesVolumesActionPostUnauthorized() *PcloudCloudinstancesVolumesActionPostUnauthorized { + return &PcloudCloudinstancesVolumesActionPostUnauthorized{} +} + +/* PcloudCloudinstancesVolumesActionPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesVolumesActionPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesActionPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}/action][%d] pcloudCloudinstancesVolumesActionPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesVolumesActionPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesActionPostUnauthorized) 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 +} + +// NewPcloudCloudinstancesVolumesActionPostNotFound creates a PcloudCloudinstancesVolumesActionPostNotFound with default headers values +func NewPcloudCloudinstancesVolumesActionPostNotFound() *PcloudCloudinstancesVolumesActionPostNotFound { + return &PcloudCloudinstancesVolumesActionPostNotFound{} +} + +/* PcloudCloudinstancesVolumesActionPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesVolumesActionPostNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesActionPostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}/action][%d] pcloudCloudinstancesVolumesActionPostNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudinstancesVolumesActionPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesActionPostNotFound) 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 +} + +// NewPcloudCloudinstancesVolumesActionPostInternalServerError creates a PcloudCloudinstancesVolumesActionPostInternalServerError with default headers values +func NewPcloudCloudinstancesVolumesActionPostInternalServerError() *PcloudCloudinstancesVolumesActionPostInternalServerError { + return &PcloudCloudinstancesVolumesActionPostInternalServerError{} +} + +/* PcloudCloudinstancesVolumesActionPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesVolumesActionPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesActionPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}/action][%d] pcloudCloudinstancesVolumesActionPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesVolumesActionPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesActionPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_delete_parameters.go new file mode 100644 index 00000000000..d6066439cc9 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_delete_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudCloudinstancesVolumesDeleteParams creates a new PcloudCloudinstancesVolumesDeleteParams 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 NewPcloudCloudinstancesVolumesDeleteParams() *PcloudCloudinstancesVolumesDeleteParams { + return &PcloudCloudinstancesVolumesDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesVolumesDeleteParamsWithTimeout creates a new PcloudCloudinstancesVolumesDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesVolumesDeleteParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesDeleteParams { + return &PcloudCloudinstancesVolumesDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesVolumesDeleteParamsWithContext creates a new PcloudCloudinstancesVolumesDeleteParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesVolumesDeleteParamsWithContext(ctx context.Context) *PcloudCloudinstancesVolumesDeleteParams { + return &PcloudCloudinstancesVolumesDeleteParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesVolumesDeleteParamsWithHTTPClient creates a new PcloudCloudinstancesVolumesDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesVolumesDeleteParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesDeleteParams { + return &PcloudCloudinstancesVolumesDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesVolumesDeleteParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances volumes delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesVolumesDeleteParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VolumeID. + + Volume ID + */ + VolumeID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances volumes delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesDeleteParams) WithDefaults() *PcloudCloudinstancesVolumesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances volumes delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances volumes delete params +func (o *PcloudCloudinstancesVolumesDeleteParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances volumes delete params +func (o *PcloudCloudinstancesVolumesDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances volumes delete params +func (o *PcloudCloudinstancesVolumesDeleteParams) WithContext(ctx context.Context) *PcloudCloudinstancesVolumesDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances volumes delete params +func (o *PcloudCloudinstancesVolumesDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances volumes delete params +func (o *PcloudCloudinstancesVolumesDeleteParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances volumes delete params +func (o *PcloudCloudinstancesVolumesDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances volumes delete params +func (o *PcloudCloudinstancesVolumesDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesVolumesDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances volumes delete params +func (o *PcloudCloudinstancesVolumesDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVolumeID adds the volumeID to the pcloud cloudinstances volumes delete params +func (o *PcloudCloudinstancesVolumesDeleteParams) WithVolumeID(volumeID string) *PcloudCloudinstancesVolumesDeleteParams { + o.SetVolumeID(volumeID) + return o +} + +// SetVolumeID adds the volumeId to the pcloud cloudinstances volumes delete params +func (o *PcloudCloudinstancesVolumesDeleteParams) SetVolumeID(volumeID string) { + o.VolumeID = volumeID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesVolumesDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param volume_id + if err := r.SetPathParam("volume_id", o.VolumeID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_delete_responses.go new file mode 100644 index 00000000000..eb7f8fbf965 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_delete_responses.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesVolumesDeleteReader is a Reader for the PcloudCloudinstancesVolumesDelete structure. +type PcloudCloudinstancesVolumesDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesVolumesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesVolumesDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesVolumesDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesVolumesDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewPcloudCloudinstancesVolumesDeleteGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesVolumesDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesVolumesDeleteOK creates a PcloudCloudinstancesVolumesDeleteOK with default headers values +func NewPcloudCloudinstancesVolumesDeleteOK() *PcloudCloudinstancesVolumesDeleteOK { + return &PcloudCloudinstancesVolumesDeleteOK{} +} + +/* PcloudCloudinstancesVolumesDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesVolumesDeleteOK struct { + Payload models.Object +} + +func (o *PcloudCloudinstancesVolumesDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesVolumesDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesDeleteOK) 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 +} + +// NewPcloudCloudinstancesVolumesDeleteBadRequest creates a PcloudCloudinstancesVolumesDeleteBadRequest with default headers values +func NewPcloudCloudinstancesVolumesDeleteBadRequest() *PcloudCloudinstancesVolumesDeleteBadRequest { + return &PcloudCloudinstancesVolumesDeleteBadRequest{} +} + +/* PcloudCloudinstancesVolumesDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesVolumesDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesVolumesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesDeleteBadRequest) 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 +} + +// NewPcloudCloudinstancesVolumesDeleteUnauthorized creates a PcloudCloudinstancesVolumesDeleteUnauthorized with default headers values +func NewPcloudCloudinstancesVolumesDeleteUnauthorized() *PcloudCloudinstancesVolumesDeleteUnauthorized { + return &PcloudCloudinstancesVolumesDeleteUnauthorized{} +} + +/* PcloudCloudinstancesVolumesDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesVolumesDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesVolumesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesDeleteUnauthorized) 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 +} + +// NewPcloudCloudinstancesVolumesDeleteGone creates a PcloudCloudinstancesVolumesDeleteGone with default headers values +func NewPcloudCloudinstancesVolumesDeleteGone() *PcloudCloudinstancesVolumesDeleteGone { + return &PcloudCloudinstancesVolumesDeleteGone{} +} + +/* PcloudCloudinstancesVolumesDeleteGone describes a response with status code 410, with default header values. + +Gone +*/ +type PcloudCloudinstancesVolumesDeleteGone struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesDeleteGone) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesDeleteGone %+v", 410, o.Payload) +} +func (o *PcloudCloudinstancesVolumesDeleteGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesDeleteGone) 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 +} + +// NewPcloudCloudinstancesVolumesDeleteInternalServerError creates a PcloudCloudinstancesVolumesDeleteInternalServerError with default headers values +func NewPcloudCloudinstancesVolumesDeleteInternalServerError() *PcloudCloudinstancesVolumesDeleteInternalServerError { + return &PcloudCloudinstancesVolumesDeleteInternalServerError{} +} + +/* PcloudCloudinstancesVolumesDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesVolumesDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesVolumesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_get_parameters.go new file mode 100644 index 00000000000..df8f8e699b3 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudCloudinstancesVolumesGetParams creates a new PcloudCloudinstancesVolumesGetParams 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 NewPcloudCloudinstancesVolumesGetParams() *PcloudCloudinstancesVolumesGetParams { + return &PcloudCloudinstancesVolumesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesVolumesGetParamsWithTimeout creates a new PcloudCloudinstancesVolumesGetParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesVolumesGetParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesGetParams { + return &PcloudCloudinstancesVolumesGetParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesVolumesGetParamsWithContext creates a new PcloudCloudinstancesVolumesGetParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesVolumesGetParamsWithContext(ctx context.Context) *PcloudCloudinstancesVolumesGetParams { + return &PcloudCloudinstancesVolumesGetParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesVolumesGetParamsWithHTTPClient creates a new PcloudCloudinstancesVolumesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesVolumesGetParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesGetParams { + return &PcloudCloudinstancesVolumesGetParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesVolumesGetParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances volumes get operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesVolumesGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VolumeID. + + Volume ID + */ + VolumeID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances volumes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesGetParams) WithDefaults() *PcloudCloudinstancesVolumesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances volumes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances volumes get params +func (o *PcloudCloudinstancesVolumesGetParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances volumes get params +func (o *PcloudCloudinstancesVolumesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances volumes get params +func (o *PcloudCloudinstancesVolumesGetParams) WithContext(ctx context.Context) *PcloudCloudinstancesVolumesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances volumes get params +func (o *PcloudCloudinstancesVolumesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances volumes get params +func (o *PcloudCloudinstancesVolumesGetParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances volumes get params +func (o *PcloudCloudinstancesVolumesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances volumes get params +func (o *PcloudCloudinstancesVolumesGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesVolumesGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances volumes get params +func (o *PcloudCloudinstancesVolumesGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVolumeID adds the volumeID to the pcloud cloudinstances volumes get params +func (o *PcloudCloudinstancesVolumesGetParams) WithVolumeID(volumeID string) *PcloudCloudinstancesVolumesGetParams { + o.SetVolumeID(volumeID) + return o +} + +// SetVolumeID adds the volumeId to the pcloud cloudinstances volumes get params +func (o *PcloudCloudinstancesVolumesGetParams) SetVolumeID(volumeID string) { + o.VolumeID = volumeID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesVolumesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param volume_id + if err := r.SetPathParam("volume_id", o.VolumeID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_get_responses.go new file mode 100644 index 00000000000..896d21be08c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesVolumesGetReader is a Reader for the PcloudCloudinstancesVolumesGet structure. +type PcloudCloudinstancesVolumesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesVolumesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesVolumesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesVolumesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesVolumesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesVolumesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesVolumesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesVolumesGetOK creates a PcloudCloudinstancesVolumesGetOK with default headers values +func NewPcloudCloudinstancesVolumesGetOK() *PcloudCloudinstancesVolumesGetOK { + return &PcloudCloudinstancesVolumesGetOK{} +} + +/* PcloudCloudinstancesVolumesGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesVolumesGetOK struct { + Payload *models.Volume +} + +func (o *PcloudCloudinstancesVolumesGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesGetOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesVolumesGetOK) GetPayload() *models.Volume { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Volume) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesVolumesGetBadRequest creates a PcloudCloudinstancesVolumesGetBadRequest with default headers values +func NewPcloudCloudinstancesVolumesGetBadRequest() *PcloudCloudinstancesVolumesGetBadRequest { + return &PcloudCloudinstancesVolumesGetBadRequest{} +} + +/* PcloudCloudinstancesVolumesGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesVolumesGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesVolumesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesGetBadRequest) 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 +} + +// NewPcloudCloudinstancesVolumesGetUnauthorized creates a PcloudCloudinstancesVolumesGetUnauthorized with default headers values +func NewPcloudCloudinstancesVolumesGetUnauthorized() *PcloudCloudinstancesVolumesGetUnauthorized { + return &PcloudCloudinstancesVolumesGetUnauthorized{} +} + +/* PcloudCloudinstancesVolumesGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesVolumesGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesVolumesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesGetUnauthorized) 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 +} + +// NewPcloudCloudinstancesVolumesGetNotFound creates a PcloudCloudinstancesVolumesGetNotFound with default headers values +func NewPcloudCloudinstancesVolumesGetNotFound() *PcloudCloudinstancesVolumesGetNotFound { + return &PcloudCloudinstancesVolumesGetNotFound{} +} + +/* PcloudCloudinstancesVolumesGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesVolumesGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudinstancesVolumesGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesGetNotFound) 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 +} + +// NewPcloudCloudinstancesVolumesGetInternalServerError creates a PcloudCloudinstancesVolumesGetInternalServerError with default headers values +func NewPcloudCloudinstancesVolumesGetInternalServerError() *PcloudCloudinstancesVolumesGetInternalServerError { + return &PcloudCloudinstancesVolumesGetInternalServerError{} +} + +/* PcloudCloudinstancesVolumesGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesVolumesGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesVolumesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_getall_parameters.go new file mode 100644 index 00000000000..55d12effb28 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_getall_parameters.go @@ -0,0 +1,218 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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/go-openapi/swag" +) + +// NewPcloudCloudinstancesVolumesGetallParams creates a new PcloudCloudinstancesVolumesGetallParams 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 NewPcloudCloudinstancesVolumesGetallParams() *PcloudCloudinstancesVolumesGetallParams { + return &PcloudCloudinstancesVolumesGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesVolumesGetallParamsWithTimeout creates a new PcloudCloudinstancesVolumesGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesVolumesGetallParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesGetallParams { + return &PcloudCloudinstancesVolumesGetallParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesVolumesGetallParamsWithContext creates a new PcloudCloudinstancesVolumesGetallParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesVolumesGetallParamsWithContext(ctx context.Context) *PcloudCloudinstancesVolumesGetallParams { + return &PcloudCloudinstancesVolumesGetallParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesVolumesGetallParamsWithHTTPClient creates a new PcloudCloudinstancesVolumesGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesVolumesGetallParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesGetallParams { + return &PcloudCloudinstancesVolumesGetallParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesVolumesGetallParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances volumes getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesVolumesGetallParams struct { + + /* Affinity. + + A pvmInstance (id or name), limits a volumes list response to only volumes that have affinity to the pvmInstance + */ + Affinity *string + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* ReplicationEnabled. + + true or false, limits a volumes list to replication or non replication enabled volumes + */ + ReplicationEnabled *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances volumes getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesGetallParams) WithDefaults() *PcloudCloudinstancesVolumesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances volumes getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances volumes getall params +func (o *PcloudCloudinstancesVolumesGetallParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances volumes getall params +func (o *PcloudCloudinstancesVolumesGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances volumes getall params +func (o *PcloudCloudinstancesVolumesGetallParams) WithContext(ctx context.Context) *PcloudCloudinstancesVolumesGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances volumes getall params +func (o *PcloudCloudinstancesVolumesGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances volumes getall params +func (o *PcloudCloudinstancesVolumesGetallParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances volumes getall params +func (o *PcloudCloudinstancesVolumesGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAffinity adds the affinity to the pcloud cloudinstances volumes getall params +func (o *PcloudCloudinstancesVolumesGetallParams) WithAffinity(affinity *string) *PcloudCloudinstancesVolumesGetallParams { + o.SetAffinity(affinity) + return o +} + +// SetAffinity adds the affinity to the pcloud cloudinstances volumes getall params +func (o *PcloudCloudinstancesVolumesGetallParams) SetAffinity(affinity *string) { + o.Affinity = affinity +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances volumes getall params +func (o *PcloudCloudinstancesVolumesGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesVolumesGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances volumes getall params +func (o *PcloudCloudinstancesVolumesGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithReplicationEnabled adds the replicationEnabled to the pcloud cloudinstances volumes getall params +func (o *PcloudCloudinstancesVolumesGetallParams) WithReplicationEnabled(replicationEnabled *bool) *PcloudCloudinstancesVolumesGetallParams { + o.SetReplicationEnabled(replicationEnabled) + return o +} + +// SetReplicationEnabled adds the replicationEnabled to the pcloud cloudinstances volumes getall params +func (o *PcloudCloudinstancesVolumesGetallParams) SetReplicationEnabled(replicationEnabled *bool) { + o.ReplicationEnabled = replicationEnabled +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesVolumesGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Affinity != nil { + + // query param affinity + var qrAffinity string + + if o.Affinity != nil { + qrAffinity = *o.Affinity + } + qAffinity := qrAffinity + if qAffinity != "" { + + if err := r.SetQueryParam("affinity", qAffinity); err != nil { + return err + } + } + } + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if o.ReplicationEnabled != nil { + + // query param replicationEnabled + var qrReplicationEnabled bool + + if o.ReplicationEnabled != nil { + qrReplicationEnabled = *o.ReplicationEnabled + } + qReplicationEnabled := swag.FormatBool(qrReplicationEnabled) + if qReplicationEnabled != "" { + + if err := r.SetQueryParam("replicationEnabled", qReplicationEnabled); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_getall_responses.go new file mode 100644 index 00000000000..88e6badbeff --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_getall_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesVolumesGetallReader is a Reader for the PcloudCloudinstancesVolumesGetall structure. +type PcloudCloudinstancesVolumesGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesVolumesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesVolumesGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesVolumesGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesVolumesGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudCloudinstancesVolumesGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesVolumesGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesVolumesGetallOK creates a PcloudCloudinstancesVolumesGetallOK with default headers values +func NewPcloudCloudinstancesVolumesGetallOK() *PcloudCloudinstancesVolumesGetallOK { + return &PcloudCloudinstancesVolumesGetallOK{} +} + +/* PcloudCloudinstancesVolumesGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesVolumesGetallOK struct { + Payload *models.Volumes +} + +func (o *PcloudCloudinstancesVolumesGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesGetallOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesVolumesGetallOK) GetPayload() *models.Volumes { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Volumes) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesVolumesGetallBadRequest creates a PcloudCloudinstancesVolumesGetallBadRequest with default headers values +func NewPcloudCloudinstancesVolumesGetallBadRequest() *PcloudCloudinstancesVolumesGetallBadRequest { + return &PcloudCloudinstancesVolumesGetallBadRequest{} +} + +/* PcloudCloudinstancesVolumesGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesVolumesGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesVolumesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesGetallBadRequest) 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 +} + +// NewPcloudCloudinstancesVolumesGetallUnauthorized creates a PcloudCloudinstancesVolumesGetallUnauthorized with default headers values +func NewPcloudCloudinstancesVolumesGetallUnauthorized() *PcloudCloudinstancesVolumesGetallUnauthorized { + return &PcloudCloudinstancesVolumesGetallUnauthorized{} +} + +/* PcloudCloudinstancesVolumesGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesVolumesGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesVolumesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesGetallUnauthorized) 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 +} + +// NewPcloudCloudinstancesVolumesGetallNotFound creates a PcloudCloudinstancesVolumesGetallNotFound with default headers values +func NewPcloudCloudinstancesVolumesGetallNotFound() *PcloudCloudinstancesVolumesGetallNotFound { + return &PcloudCloudinstancesVolumesGetallNotFound{} +} + +/* PcloudCloudinstancesVolumesGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudCloudinstancesVolumesGetallNotFound struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesGetallNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesGetallNotFound %+v", 404, o.Payload) +} +func (o *PcloudCloudinstancesVolumesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesGetallNotFound) 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 +} + +// NewPcloudCloudinstancesVolumesGetallInternalServerError creates a PcloudCloudinstancesVolumesGetallInternalServerError with default headers values +func NewPcloudCloudinstancesVolumesGetallInternalServerError() *PcloudCloudinstancesVolumesGetallInternalServerError { + return &PcloudCloudinstancesVolumesGetallInternalServerError{} +} + +/* PcloudCloudinstancesVolumesGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesVolumesGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesVolumesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_post_parameters.go new file mode 100644 index 00000000000..456bf17a9b9 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudCloudinstancesVolumesPostParams creates a new PcloudCloudinstancesVolumesPostParams 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 NewPcloudCloudinstancesVolumesPostParams() *PcloudCloudinstancesVolumesPostParams { + return &PcloudCloudinstancesVolumesPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesVolumesPostParamsWithTimeout creates a new PcloudCloudinstancesVolumesPostParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesVolumesPostParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesPostParams { + return &PcloudCloudinstancesVolumesPostParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesVolumesPostParamsWithContext creates a new PcloudCloudinstancesVolumesPostParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesVolumesPostParamsWithContext(ctx context.Context) *PcloudCloudinstancesVolumesPostParams { + return &PcloudCloudinstancesVolumesPostParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesVolumesPostParamsWithHTTPClient creates a new PcloudCloudinstancesVolumesPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesVolumesPostParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesPostParams { + return &PcloudCloudinstancesVolumesPostParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesVolumesPostParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances volumes post operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesVolumesPostParams struct { + + /* Body. + + Parameters for the creation of a new data volume + */ + Body *models.CreateDataVolume + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesPostParams) WithDefaults() *PcloudCloudinstancesVolumesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances volumes post params +func (o *PcloudCloudinstancesVolumesPostParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances volumes post params +func (o *PcloudCloudinstancesVolumesPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances volumes post params +func (o *PcloudCloudinstancesVolumesPostParams) WithContext(ctx context.Context) *PcloudCloudinstancesVolumesPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances volumes post params +func (o *PcloudCloudinstancesVolumesPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances volumes post params +func (o *PcloudCloudinstancesVolumesPostParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances volumes post params +func (o *PcloudCloudinstancesVolumesPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud cloudinstances volumes post params +func (o *PcloudCloudinstancesVolumesPostParams) WithBody(body *models.CreateDataVolume) *PcloudCloudinstancesVolumesPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud cloudinstances volumes post params +func (o *PcloudCloudinstancesVolumesPostParams) SetBody(body *models.CreateDataVolume) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances volumes post params +func (o *PcloudCloudinstancesVolumesPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesVolumesPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances volumes post params +func (o *PcloudCloudinstancesVolumesPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesVolumesPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_post_responses.go new file mode 100644 index 00000000000..258e913a868 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_post_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesVolumesPostReader is a Reader for the PcloudCloudinstancesVolumesPost structure. +type PcloudCloudinstancesVolumesPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesVolumesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudCloudinstancesVolumesPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesVolumesPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesVolumesPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudCloudinstancesVolumesPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudCloudinstancesVolumesPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesVolumesPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesVolumesPostAccepted creates a PcloudCloudinstancesVolumesPostAccepted with default headers values +func NewPcloudCloudinstancesVolumesPostAccepted() *PcloudCloudinstancesVolumesPostAccepted { + return &PcloudCloudinstancesVolumesPostAccepted{} +} + +/* PcloudCloudinstancesVolumesPostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudCloudinstancesVolumesPostAccepted struct { + Payload *models.Volume +} + +func (o *PcloudCloudinstancesVolumesPostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesPostAccepted %+v", 202, o.Payload) +} +func (o *PcloudCloudinstancesVolumesPostAccepted) GetPayload() *models.Volume { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Volume) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesVolumesPostBadRequest creates a PcloudCloudinstancesVolumesPostBadRequest with default headers values +func NewPcloudCloudinstancesVolumesPostBadRequest() *PcloudCloudinstancesVolumesPostBadRequest { + return &PcloudCloudinstancesVolumesPostBadRequest{} +} + +/* PcloudCloudinstancesVolumesPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesVolumesPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesVolumesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesPostBadRequest) 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 +} + +// NewPcloudCloudinstancesVolumesPostUnauthorized creates a PcloudCloudinstancesVolumesPostUnauthorized with default headers values +func NewPcloudCloudinstancesVolumesPostUnauthorized() *PcloudCloudinstancesVolumesPostUnauthorized { + return &PcloudCloudinstancesVolumesPostUnauthorized{} +} + +/* PcloudCloudinstancesVolumesPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesVolumesPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesVolumesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesPostUnauthorized) 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 +} + +// NewPcloudCloudinstancesVolumesPostConflict creates a PcloudCloudinstancesVolumesPostConflict with default headers values +func NewPcloudCloudinstancesVolumesPostConflict() *PcloudCloudinstancesVolumesPostConflict { + return &PcloudCloudinstancesVolumesPostConflict{} +} + +/* PcloudCloudinstancesVolumesPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudCloudinstancesVolumesPostConflict struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesPostConflict %+v", 409, o.Payload) +} +func (o *PcloudCloudinstancesVolumesPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesPostConflict) 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 +} + +// NewPcloudCloudinstancesVolumesPostUnprocessableEntity creates a PcloudCloudinstancesVolumesPostUnprocessableEntity with default headers values +func NewPcloudCloudinstancesVolumesPostUnprocessableEntity() *PcloudCloudinstancesVolumesPostUnprocessableEntity { + return &PcloudCloudinstancesVolumesPostUnprocessableEntity{} +} + +/* PcloudCloudinstancesVolumesPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudCloudinstancesVolumesPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudCloudinstancesVolumesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesPostUnprocessableEntity) 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 +} + +// NewPcloudCloudinstancesVolumesPostInternalServerError creates a PcloudCloudinstancesVolumesPostInternalServerError with default headers values +func NewPcloudCloudinstancesVolumesPostInternalServerError() *PcloudCloudinstancesVolumesPostInternalServerError { + return &PcloudCloudinstancesVolumesPostInternalServerError{} +} + +/* PcloudCloudinstancesVolumesPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesVolumesPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudCloudinstancesVolumesPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesVolumesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_put_parameters.go new file mode 100644 index 00000000000..3c0e47c964e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_put_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudCloudinstancesVolumesPutParams creates a new PcloudCloudinstancesVolumesPutParams 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 NewPcloudCloudinstancesVolumesPutParams() *PcloudCloudinstancesVolumesPutParams { + return &PcloudCloudinstancesVolumesPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudCloudinstancesVolumesPutParamsWithTimeout creates a new PcloudCloudinstancesVolumesPutParams object +// with the ability to set a timeout on a request. +func NewPcloudCloudinstancesVolumesPutParamsWithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesPutParams { + return &PcloudCloudinstancesVolumesPutParams{ + timeout: timeout, + } +} + +// NewPcloudCloudinstancesVolumesPutParamsWithContext creates a new PcloudCloudinstancesVolumesPutParams object +// with the ability to set a context for a request. +func NewPcloudCloudinstancesVolumesPutParamsWithContext(ctx context.Context) *PcloudCloudinstancesVolumesPutParams { + return &PcloudCloudinstancesVolumesPutParams{ + Context: ctx, + } +} + +// NewPcloudCloudinstancesVolumesPutParamsWithHTTPClient creates a new PcloudCloudinstancesVolumesPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudCloudinstancesVolumesPutParamsWithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesPutParams { + return &PcloudCloudinstancesVolumesPutParams{ + HTTPClient: client, + } +} + +/* PcloudCloudinstancesVolumesPutParams contains all the parameters to send to the API endpoint + for the pcloud cloudinstances volumes put operation. + + Typically these are written to a http.Request. +*/ +type PcloudCloudinstancesVolumesPutParams struct { + + /* Body. + + Parameters to update a cloud instance volume + */ + Body *models.UpdateVolume + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VolumeID. + + Volume ID + */ + VolumeID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud cloudinstances volumes put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesPutParams) WithDefaults() *PcloudCloudinstancesVolumesPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud cloudinstances volumes put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudCloudinstancesVolumesPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud cloudinstances volumes put params +func (o *PcloudCloudinstancesVolumesPutParams) WithTimeout(timeout time.Duration) *PcloudCloudinstancesVolumesPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud cloudinstances volumes put params +func (o *PcloudCloudinstancesVolumesPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud cloudinstances volumes put params +func (o *PcloudCloudinstancesVolumesPutParams) WithContext(ctx context.Context) *PcloudCloudinstancesVolumesPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud cloudinstances volumes put params +func (o *PcloudCloudinstancesVolumesPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud cloudinstances volumes put params +func (o *PcloudCloudinstancesVolumesPutParams) WithHTTPClient(client *http.Client) *PcloudCloudinstancesVolumesPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud cloudinstances volumes put params +func (o *PcloudCloudinstancesVolumesPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud cloudinstances volumes put params +func (o *PcloudCloudinstancesVolumesPutParams) WithBody(body *models.UpdateVolume) *PcloudCloudinstancesVolumesPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud cloudinstances volumes put params +func (o *PcloudCloudinstancesVolumesPutParams) SetBody(body *models.UpdateVolume) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud cloudinstances volumes put params +func (o *PcloudCloudinstancesVolumesPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudCloudinstancesVolumesPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud cloudinstances volumes put params +func (o *PcloudCloudinstancesVolumesPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVolumeID adds the volumeID to the pcloud cloudinstances volumes put params +func (o *PcloudCloudinstancesVolumesPutParams) WithVolumeID(volumeID string) *PcloudCloudinstancesVolumesPutParams { + o.SetVolumeID(volumeID) + return o +} + +// SetVolumeID adds the volumeId to the pcloud cloudinstances volumes put params +func (o *PcloudCloudinstancesVolumesPutParams) SetVolumeID(volumeID string) { + o.VolumeID = volumeID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudCloudinstancesVolumesPutParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param volume_id + if err := r.SetPathParam("volume_id", o.VolumeID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_put_responses.go new file mode 100644 index 00000000000..37837d85419 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_cloudinstances_volumes_put_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudCloudinstancesVolumesPutReader is a Reader for the PcloudCloudinstancesVolumesPut structure. +type PcloudCloudinstancesVolumesPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudCloudinstancesVolumesPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudCloudinstancesVolumesPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudCloudinstancesVolumesPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudCloudinstancesVolumesPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudCloudinstancesVolumesPutConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudCloudinstancesVolumesPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudCloudinstancesVolumesPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudCloudinstancesVolumesPutOK creates a PcloudCloudinstancesVolumesPutOK with default headers values +func NewPcloudCloudinstancesVolumesPutOK() *PcloudCloudinstancesVolumesPutOK { + return &PcloudCloudinstancesVolumesPutOK{} +} + +/* PcloudCloudinstancesVolumesPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudCloudinstancesVolumesPutOK struct { + Payload *models.Volume +} + +func (o *PcloudCloudinstancesVolumesPutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesPutOK %+v", 200, o.Payload) +} +func (o *PcloudCloudinstancesVolumesPutOK) GetPayload() *models.Volume { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Volume) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudCloudinstancesVolumesPutBadRequest creates a PcloudCloudinstancesVolumesPutBadRequest with default headers values +func NewPcloudCloudinstancesVolumesPutBadRequest() *PcloudCloudinstancesVolumesPutBadRequest { + return &PcloudCloudinstancesVolumesPutBadRequest{} +} + +/* PcloudCloudinstancesVolumesPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudCloudinstancesVolumesPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudCloudinstancesVolumesPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesPutBadRequest) 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 +} + +// NewPcloudCloudinstancesVolumesPutUnauthorized creates a PcloudCloudinstancesVolumesPutUnauthorized with default headers values +func NewPcloudCloudinstancesVolumesPutUnauthorized() *PcloudCloudinstancesVolumesPutUnauthorized { + return &PcloudCloudinstancesVolumesPutUnauthorized{} +} + +/* PcloudCloudinstancesVolumesPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudCloudinstancesVolumesPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudCloudinstancesVolumesPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesPutUnauthorized) 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 +} + +// NewPcloudCloudinstancesVolumesPutConflict creates a PcloudCloudinstancesVolumesPutConflict with default headers values +func NewPcloudCloudinstancesVolumesPutConflict() *PcloudCloudinstancesVolumesPutConflict { + return &PcloudCloudinstancesVolumesPutConflict{} +} + +/* PcloudCloudinstancesVolumesPutConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudCloudinstancesVolumesPutConflict struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesPutConflict) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesPutConflict %+v", 409, o.Payload) +} +func (o *PcloudCloudinstancesVolumesPutConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesPutConflict) 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 +} + +// NewPcloudCloudinstancesVolumesPutUnprocessableEntity creates a PcloudCloudinstancesVolumesPutUnprocessableEntity with default headers values +func NewPcloudCloudinstancesVolumesPutUnprocessableEntity() *PcloudCloudinstancesVolumesPutUnprocessableEntity { + return &PcloudCloudinstancesVolumesPutUnprocessableEntity{} +} + +/* PcloudCloudinstancesVolumesPutUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudCloudinstancesVolumesPutUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesPutUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudCloudinstancesVolumesPutUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesPutUnprocessableEntity) 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 +} + +// NewPcloudCloudinstancesVolumesPutInternalServerError creates a PcloudCloudinstancesVolumesPutInternalServerError with default headers values +func NewPcloudCloudinstancesVolumesPutInternalServerError() *PcloudCloudinstancesVolumesPutInternalServerError { + return &PcloudCloudinstancesVolumesPutInternalServerError{} +} + +/* PcloudCloudinstancesVolumesPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudCloudinstancesVolumesPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudCloudinstancesVolumesPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/{volume_id}][%d] pcloudCloudinstancesVolumesPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudCloudinstancesVolumesPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudCloudinstancesVolumesPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_delete_parameters.go new file mode 100644 index 00000000000..0facc81b622 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_delete_parameters.go @@ -0,0 +1,193 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudPvminstancesVolumesDeleteParams creates a new PcloudPvminstancesVolumesDeleteParams 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 NewPcloudPvminstancesVolumesDeleteParams() *PcloudPvminstancesVolumesDeleteParams { + return &PcloudPvminstancesVolumesDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesVolumesDeleteParamsWithTimeout creates a new PcloudPvminstancesVolumesDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesVolumesDeleteParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesDeleteParams { + return &PcloudPvminstancesVolumesDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesVolumesDeleteParamsWithContext creates a new PcloudPvminstancesVolumesDeleteParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesVolumesDeleteParamsWithContext(ctx context.Context) *PcloudPvminstancesVolumesDeleteParams { + return &PcloudPvminstancesVolumesDeleteParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesVolumesDeleteParamsWithHTTPClient creates a new PcloudPvminstancesVolumesDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesVolumesDeleteParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesDeleteParams { + return &PcloudPvminstancesVolumesDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesVolumesDeleteParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances volumes delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesVolumesDeleteParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + /* VolumeID. + + Volume ID + */ + VolumeID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances volumes delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesDeleteParams) WithDefaults() *PcloudPvminstancesVolumesDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances volumes delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances volumes delete params +func (o *PcloudPvminstancesVolumesDeleteParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances volumes delete params +func (o *PcloudPvminstancesVolumesDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances volumes delete params +func (o *PcloudPvminstancesVolumesDeleteParams) WithContext(ctx context.Context) *PcloudPvminstancesVolumesDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances volumes delete params +func (o *PcloudPvminstancesVolumesDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances volumes delete params +func (o *PcloudPvminstancesVolumesDeleteParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances volumes delete params +func (o *PcloudPvminstancesVolumesDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances volumes delete params +func (o *PcloudPvminstancesVolumesDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesVolumesDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances volumes delete params +func (o *PcloudPvminstancesVolumesDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances volumes delete params +func (o *PcloudPvminstancesVolumesDeleteParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesVolumesDeleteParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances volumes delete params +func (o *PcloudPvminstancesVolumesDeleteParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WithVolumeID adds the volumeID to the pcloud pvminstances volumes delete params +func (o *PcloudPvminstancesVolumesDeleteParams) WithVolumeID(volumeID string) *PcloudPvminstancesVolumesDeleteParams { + o.SetVolumeID(volumeID) + return o +} + +// SetVolumeID adds the volumeId to the pcloud pvminstances volumes delete params +func (o *PcloudPvminstancesVolumesDeleteParams) SetVolumeID(volumeID string) { + o.VolumeID = volumeID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesVolumesDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + // path param volume_id + if err := r.SetPathParam("volume_id", o.VolumeID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_delete_responses.go new file mode 100644 index 00000000000..7965aa2c97b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_delete_responses.go @@ -0,0 +1,293 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesVolumesDeleteReader is a Reader for the PcloudPvminstancesVolumesDelete structure. +type PcloudPvminstancesVolumesDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesVolumesDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudPvminstancesVolumesDeleteAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesVolumesDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesVolumesDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudPvminstancesVolumesDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesVolumesDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudPvminstancesVolumesDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesVolumesDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesVolumesDeleteAccepted creates a PcloudPvminstancesVolumesDeleteAccepted with default headers values +func NewPcloudPvminstancesVolumesDeleteAccepted() *PcloudPvminstancesVolumesDeleteAccepted { + return &PcloudPvminstancesVolumesDeleteAccepted{} +} + +/* PcloudPvminstancesVolumesDeleteAccepted describes a response with status code 202, with default header values. + +OK +*/ +type PcloudPvminstancesVolumesDeleteAccepted struct { + Payload models.Object +} + +func (o *PcloudPvminstancesVolumesDeleteAccepted) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesDeleteAccepted %+v", 202, o.Payload) +} +func (o *PcloudPvminstancesVolumesDeleteAccepted) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesDeleteAccepted) 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 +} + +// NewPcloudPvminstancesVolumesDeleteBadRequest creates a PcloudPvminstancesVolumesDeleteBadRequest with default headers values +func NewPcloudPvminstancesVolumesDeleteBadRequest() *PcloudPvminstancesVolumesDeleteBadRequest { + return &PcloudPvminstancesVolumesDeleteBadRequest{} +} + +/* PcloudPvminstancesVolumesDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesVolumesDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesVolumesDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesDeleteBadRequest) 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 +} + +// NewPcloudPvminstancesVolumesDeleteUnauthorized creates a PcloudPvminstancesVolumesDeleteUnauthorized with default headers values +func NewPcloudPvminstancesVolumesDeleteUnauthorized() *PcloudPvminstancesVolumesDeleteUnauthorized { + return &PcloudPvminstancesVolumesDeleteUnauthorized{} +} + +/* PcloudPvminstancesVolumesDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesVolumesDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesVolumesDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesDeleteUnauthorized) 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 +} + +// NewPcloudPvminstancesVolumesDeleteForbidden creates a PcloudPvminstancesVolumesDeleteForbidden with default headers values +func NewPcloudPvminstancesVolumesDeleteForbidden() *PcloudPvminstancesVolumesDeleteForbidden { + return &PcloudPvminstancesVolumesDeleteForbidden{} +} + +/* PcloudPvminstancesVolumesDeleteForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudPvminstancesVolumesDeleteForbidden struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesDeleteForbidden %+v", 403, o.Payload) +} +func (o *PcloudPvminstancesVolumesDeleteForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesDeleteForbidden) 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 +} + +// NewPcloudPvminstancesVolumesDeleteNotFound creates a PcloudPvminstancesVolumesDeleteNotFound with default headers values +func NewPcloudPvminstancesVolumesDeleteNotFound() *PcloudPvminstancesVolumesDeleteNotFound { + return &PcloudPvminstancesVolumesDeleteNotFound{} +} + +/* PcloudPvminstancesVolumesDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesVolumesDeleteNotFound struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesDeleteNotFound %+v", 404, o.Payload) +} +func (o *PcloudPvminstancesVolumesDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesDeleteNotFound) 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 +} + +// NewPcloudPvminstancesVolumesDeleteConflict creates a PcloudPvminstancesVolumesDeleteConflict with default headers values +func NewPcloudPvminstancesVolumesDeleteConflict() *PcloudPvminstancesVolumesDeleteConflict { + return &PcloudPvminstancesVolumesDeleteConflict{} +} + +/* PcloudPvminstancesVolumesDeleteConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudPvminstancesVolumesDeleteConflict struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesDeleteConflict) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesDeleteConflict %+v", 409, o.Payload) +} +func (o *PcloudPvminstancesVolumesDeleteConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesDeleteConflict) 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 +} + +// NewPcloudPvminstancesVolumesDeleteInternalServerError creates a PcloudPvminstancesVolumesDeleteInternalServerError with default headers values +func NewPcloudPvminstancesVolumesDeleteInternalServerError() *PcloudPvminstancesVolumesDeleteInternalServerError { + return &PcloudPvminstancesVolumesDeleteInternalServerError{} +} + +/* PcloudPvminstancesVolumesDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesVolumesDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesVolumesDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_get_parameters.go new file mode 100644 index 00000000000..0307f189f6e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_get_parameters.go @@ -0,0 +1,193 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudPvminstancesVolumesGetParams creates a new PcloudPvminstancesVolumesGetParams 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 NewPcloudPvminstancesVolumesGetParams() *PcloudPvminstancesVolumesGetParams { + return &PcloudPvminstancesVolumesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesVolumesGetParamsWithTimeout creates a new PcloudPvminstancesVolumesGetParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesVolumesGetParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesGetParams { + return &PcloudPvminstancesVolumesGetParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesVolumesGetParamsWithContext creates a new PcloudPvminstancesVolumesGetParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesVolumesGetParamsWithContext(ctx context.Context) *PcloudPvminstancesVolumesGetParams { + return &PcloudPvminstancesVolumesGetParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesVolumesGetParamsWithHTTPClient creates a new PcloudPvminstancesVolumesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesVolumesGetParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesGetParams { + return &PcloudPvminstancesVolumesGetParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesVolumesGetParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances volumes get operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesVolumesGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + /* VolumeID. + + Volume ID + */ + VolumeID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances volumes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesGetParams) WithDefaults() *PcloudPvminstancesVolumesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances volumes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances volumes get params +func (o *PcloudPvminstancesVolumesGetParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances volumes get params +func (o *PcloudPvminstancesVolumesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances volumes get params +func (o *PcloudPvminstancesVolumesGetParams) WithContext(ctx context.Context) *PcloudPvminstancesVolumesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances volumes get params +func (o *PcloudPvminstancesVolumesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances volumes get params +func (o *PcloudPvminstancesVolumesGetParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances volumes get params +func (o *PcloudPvminstancesVolumesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances volumes get params +func (o *PcloudPvminstancesVolumesGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesVolumesGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances volumes get params +func (o *PcloudPvminstancesVolumesGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances volumes get params +func (o *PcloudPvminstancesVolumesGetParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesVolumesGetParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances volumes get params +func (o *PcloudPvminstancesVolumesGetParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WithVolumeID adds the volumeID to the pcloud pvminstances volumes get params +func (o *PcloudPvminstancesVolumesGetParams) WithVolumeID(volumeID string) *PcloudPvminstancesVolumesGetParams { + o.SetVolumeID(volumeID) + return o +} + +// SetVolumeID adds the volumeId to the pcloud pvminstances volumes get params +func (o *PcloudPvminstancesVolumesGetParams) SetVolumeID(volumeID string) { + o.VolumeID = volumeID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesVolumesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + // path param volume_id + if err := r.SetPathParam("volume_id", o.VolumeID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_get_responses.go new file mode 100644 index 00000000000..fa119079ee4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesVolumesGetReader is a Reader for the PcloudPvminstancesVolumesGet structure. +type PcloudPvminstancesVolumesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesVolumesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesVolumesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesVolumesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesVolumesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesVolumesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesVolumesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesVolumesGetOK creates a PcloudPvminstancesVolumesGetOK with default headers values +func NewPcloudPvminstancesVolumesGetOK() *PcloudPvminstancesVolumesGetOK { + return &PcloudPvminstancesVolumesGetOK{} +} + +/* PcloudPvminstancesVolumesGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesVolumesGetOK struct { + Payload *models.Volume +} + +func (o *PcloudPvminstancesVolumesGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesGetOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesVolumesGetOK) GetPayload() *models.Volume { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Volume) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesVolumesGetBadRequest creates a PcloudPvminstancesVolumesGetBadRequest with default headers values +func NewPcloudPvminstancesVolumesGetBadRequest() *PcloudPvminstancesVolumesGetBadRequest { + return &PcloudPvminstancesVolumesGetBadRequest{} +} + +/* PcloudPvminstancesVolumesGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesVolumesGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesVolumesGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesGetBadRequest) 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 +} + +// NewPcloudPvminstancesVolumesGetUnauthorized creates a PcloudPvminstancesVolumesGetUnauthorized with default headers values +func NewPcloudPvminstancesVolumesGetUnauthorized() *PcloudPvminstancesVolumesGetUnauthorized { + return &PcloudPvminstancesVolumesGetUnauthorized{} +} + +/* PcloudPvminstancesVolumesGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesVolumesGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesVolumesGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesGetUnauthorized) 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 +} + +// NewPcloudPvminstancesVolumesGetNotFound creates a PcloudPvminstancesVolumesGetNotFound with default headers values +func NewPcloudPvminstancesVolumesGetNotFound() *PcloudPvminstancesVolumesGetNotFound { + return &PcloudPvminstancesVolumesGetNotFound{} +} + +/* PcloudPvminstancesVolumesGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesVolumesGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudPvminstancesVolumesGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesGetNotFound) 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 +} + +// NewPcloudPvminstancesVolumesGetInternalServerError creates a PcloudPvminstancesVolumesGetInternalServerError with default headers values +func NewPcloudPvminstancesVolumesGetInternalServerError() *PcloudPvminstancesVolumesGetInternalServerError { + return &PcloudPvminstancesVolumesGetInternalServerError{} +} + +/* PcloudPvminstancesVolumesGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesVolumesGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesVolumesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_getall_parameters.go new file mode 100644 index 00000000000..ad7ca531864 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_getall_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudPvminstancesVolumesGetallParams creates a new PcloudPvminstancesVolumesGetallParams 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 NewPcloudPvminstancesVolumesGetallParams() *PcloudPvminstancesVolumesGetallParams { + return &PcloudPvminstancesVolumesGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesVolumesGetallParamsWithTimeout creates a new PcloudPvminstancesVolumesGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesVolumesGetallParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesGetallParams { + return &PcloudPvminstancesVolumesGetallParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesVolumesGetallParamsWithContext creates a new PcloudPvminstancesVolumesGetallParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesVolumesGetallParamsWithContext(ctx context.Context) *PcloudPvminstancesVolumesGetallParams { + return &PcloudPvminstancesVolumesGetallParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesVolumesGetallParamsWithHTTPClient creates a new PcloudPvminstancesVolumesGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesVolumesGetallParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesGetallParams { + return &PcloudPvminstancesVolumesGetallParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesVolumesGetallParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances volumes getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesVolumesGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances volumes getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesGetallParams) WithDefaults() *PcloudPvminstancesVolumesGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances volumes getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances volumes getall params +func (o *PcloudPvminstancesVolumesGetallParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances volumes getall params +func (o *PcloudPvminstancesVolumesGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances volumes getall params +func (o *PcloudPvminstancesVolumesGetallParams) WithContext(ctx context.Context) *PcloudPvminstancesVolumesGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances volumes getall params +func (o *PcloudPvminstancesVolumesGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances volumes getall params +func (o *PcloudPvminstancesVolumesGetallParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances volumes getall params +func (o *PcloudPvminstancesVolumesGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances volumes getall params +func (o *PcloudPvminstancesVolumesGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesVolumesGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances volumes getall params +func (o *PcloudPvminstancesVolumesGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances volumes getall params +func (o *PcloudPvminstancesVolumesGetallParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesVolumesGetallParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances volumes getall params +func (o *PcloudPvminstancesVolumesGetallParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesVolumesGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_getall_responses.go new file mode 100644 index 00000000000..7e98352931b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_getall_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesVolumesGetallReader is a Reader for the PcloudPvminstancesVolumesGetall structure. +type PcloudPvminstancesVolumesGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesVolumesGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesVolumesGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesVolumesGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesVolumesGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesVolumesGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesVolumesGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesVolumesGetallOK creates a PcloudPvminstancesVolumesGetallOK with default headers values +func NewPcloudPvminstancesVolumesGetallOK() *PcloudPvminstancesVolumesGetallOK { + return &PcloudPvminstancesVolumesGetallOK{} +} + +/* PcloudPvminstancesVolumesGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesVolumesGetallOK struct { + Payload *models.Volumes +} + +func (o *PcloudPvminstancesVolumesGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudPvminstancesVolumesGetallOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesVolumesGetallOK) GetPayload() *models.Volumes { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Volumes) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudPvminstancesVolumesGetallBadRequest creates a PcloudPvminstancesVolumesGetallBadRequest with default headers values +func NewPcloudPvminstancesVolumesGetallBadRequest() *PcloudPvminstancesVolumesGetallBadRequest { + return &PcloudPvminstancesVolumesGetallBadRequest{} +} + +/* PcloudPvminstancesVolumesGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesVolumesGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudPvminstancesVolumesGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesVolumesGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesGetallBadRequest) 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 +} + +// NewPcloudPvminstancesVolumesGetallUnauthorized creates a PcloudPvminstancesVolumesGetallUnauthorized with default headers values +func NewPcloudPvminstancesVolumesGetallUnauthorized() *PcloudPvminstancesVolumesGetallUnauthorized { + return &PcloudPvminstancesVolumesGetallUnauthorized{} +} + +/* PcloudPvminstancesVolumesGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesVolumesGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudPvminstancesVolumesGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesVolumesGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesGetallUnauthorized) 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 +} + +// NewPcloudPvminstancesVolumesGetallNotFound creates a PcloudPvminstancesVolumesGetallNotFound with default headers values +func NewPcloudPvminstancesVolumesGetallNotFound() *PcloudPvminstancesVolumesGetallNotFound { + return &PcloudPvminstancesVolumesGetallNotFound{} +} + +/* PcloudPvminstancesVolumesGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesVolumesGetallNotFound struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesGetallNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudPvminstancesVolumesGetallNotFound %+v", 404, o.Payload) +} +func (o *PcloudPvminstancesVolumesGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesGetallNotFound) 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 +} + +// NewPcloudPvminstancesVolumesGetallInternalServerError creates a PcloudPvminstancesVolumesGetallInternalServerError with default headers values +func NewPcloudPvminstancesVolumesGetallInternalServerError() *PcloudPvminstancesVolumesGetallInternalServerError { + return &PcloudPvminstancesVolumesGetallInternalServerError{} +} + +/* PcloudPvminstancesVolumesGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesVolumesGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudPvminstancesVolumesGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesVolumesGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_post_parameters.go new file mode 100644 index 00000000000..e6144e828a1 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_post_parameters.go @@ -0,0 +1,193 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudPvminstancesVolumesPostParams creates a new PcloudPvminstancesVolumesPostParams 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 NewPcloudPvminstancesVolumesPostParams() *PcloudPvminstancesVolumesPostParams { + return &PcloudPvminstancesVolumesPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesVolumesPostParamsWithTimeout creates a new PcloudPvminstancesVolumesPostParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesVolumesPostParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesPostParams { + return &PcloudPvminstancesVolumesPostParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesVolumesPostParamsWithContext creates a new PcloudPvminstancesVolumesPostParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesVolumesPostParamsWithContext(ctx context.Context) *PcloudPvminstancesVolumesPostParams { + return &PcloudPvminstancesVolumesPostParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesVolumesPostParamsWithHTTPClient creates a new PcloudPvminstancesVolumesPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesVolumesPostParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesPostParams { + return &PcloudPvminstancesVolumesPostParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesVolumesPostParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances volumes post operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesVolumesPostParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + /* VolumeID. + + Volume ID + */ + VolumeID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesPostParams) WithDefaults() *PcloudPvminstancesVolumesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances volumes post params +func (o *PcloudPvminstancesVolumesPostParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances volumes post params +func (o *PcloudPvminstancesVolumesPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances volumes post params +func (o *PcloudPvminstancesVolumesPostParams) WithContext(ctx context.Context) *PcloudPvminstancesVolumesPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances volumes post params +func (o *PcloudPvminstancesVolumesPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances volumes post params +func (o *PcloudPvminstancesVolumesPostParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances volumes post params +func (o *PcloudPvminstancesVolumesPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances volumes post params +func (o *PcloudPvminstancesVolumesPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesVolumesPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances volumes post params +func (o *PcloudPvminstancesVolumesPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances volumes post params +func (o *PcloudPvminstancesVolumesPostParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesVolumesPostParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances volumes post params +func (o *PcloudPvminstancesVolumesPostParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WithVolumeID adds the volumeID to the pcloud pvminstances volumes post params +func (o *PcloudPvminstancesVolumesPostParams) WithVolumeID(volumeID string) *PcloudPvminstancesVolumesPostParams { + o.SetVolumeID(volumeID) + return o +} + +// SetVolumeID adds the volumeId to the pcloud pvminstances volumes post params +func (o *PcloudPvminstancesVolumesPostParams) SetVolumeID(volumeID string) { + o.VolumeID = volumeID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesVolumesPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + // path param volume_id + if err := r.SetPathParam("volume_id", o.VolumeID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_post_responses.go new file mode 100644 index 00000000000..85de2ff75ca --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_post_responses.go @@ -0,0 +1,293 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesVolumesPostReader is a Reader for the PcloudPvminstancesVolumesPost structure. +type PcloudPvminstancesVolumesPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesVolumesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesVolumesPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesVolumesPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesVolumesPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudPvminstancesVolumesPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesVolumesPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudPvminstancesVolumesPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesVolumesPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesVolumesPostOK creates a PcloudPvminstancesVolumesPostOK with default headers values +func NewPcloudPvminstancesVolumesPostOK() *PcloudPvminstancesVolumesPostOK { + return &PcloudPvminstancesVolumesPostOK{} +} + +/* PcloudPvminstancesVolumesPostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesVolumesPostOK struct { + Payload models.Object +} + +func (o *PcloudPvminstancesVolumesPostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPostOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesVolumesPostOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesPostOK) 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 +} + +// NewPcloudPvminstancesVolumesPostBadRequest creates a PcloudPvminstancesVolumesPostBadRequest with default headers values +func NewPcloudPvminstancesVolumesPostBadRequest() *PcloudPvminstancesVolumesPostBadRequest { + return &PcloudPvminstancesVolumesPostBadRequest{} +} + +/* PcloudPvminstancesVolumesPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesVolumesPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesVolumesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesPostBadRequest) 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 +} + +// NewPcloudPvminstancesVolumesPostUnauthorized creates a PcloudPvminstancesVolumesPostUnauthorized with default headers values +func NewPcloudPvminstancesVolumesPostUnauthorized() *PcloudPvminstancesVolumesPostUnauthorized { + return &PcloudPvminstancesVolumesPostUnauthorized{} +} + +/* PcloudPvminstancesVolumesPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesVolumesPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesVolumesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesPostUnauthorized) 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 +} + +// NewPcloudPvminstancesVolumesPostForbidden creates a PcloudPvminstancesVolumesPostForbidden with default headers values +func NewPcloudPvminstancesVolumesPostForbidden() *PcloudPvminstancesVolumesPostForbidden { + return &PcloudPvminstancesVolumesPostForbidden{} +} + +/* PcloudPvminstancesVolumesPostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudPvminstancesVolumesPostForbidden struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesPostForbidden) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPostForbidden %+v", 403, o.Payload) +} +func (o *PcloudPvminstancesVolumesPostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesPostForbidden) 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 +} + +// NewPcloudPvminstancesVolumesPostNotFound creates a PcloudPvminstancesVolumesPostNotFound with default headers values +func NewPcloudPvminstancesVolumesPostNotFound() *PcloudPvminstancesVolumesPostNotFound { + return &PcloudPvminstancesVolumesPostNotFound{} +} + +/* PcloudPvminstancesVolumesPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesVolumesPostNotFound struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesPostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPostNotFound %+v", 404, o.Payload) +} +func (o *PcloudPvminstancesVolumesPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesPostNotFound) 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 +} + +// NewPcloudPvminstancesVolumesPostConflict creates a PcloudPvminstancesVolumesPostConflict with default headers values +func NewPcloudPvminstancesVolumesPostConflict() *PcloudPvminstancesVolumesPostConflict { + return &PcloudPvminstancesVolumesPostConflict{} +} + +/* PcloudPvminstancesVolumesPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudPvminstancesVolumesPostConflict struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPostConflict %+v", 409, o.Payload) +} +func (o *PcloudPvminstancesVolumesPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesPostConflict) 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 +} + +// NewPcloudPvminstancesVolumesPostInternalServerError creates a PcloudPvminstancesVolumesPostInternalServerError with default headers values +func NewPcloudPvminstancesVolumesPostInternalServerError() *PcloudPvminstancesVolumesPostInternalServerError { + return &PcloudPvminstancesVolumesPostInternalServerError{} +} + +/* PcloudPvminstancesVolumesPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesVolumesPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesVolumesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_put_parameters.go new file mode 100644 index 00000000000..01ba400c0b8 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_put_parameters.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudPvminstancesVolumesPutParams creates a new PcloudPvminstancesVolumesPutParams 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 NewPcloudPvminstancesVolumesPutParams() *PcloudPvminstancesVolumesPutParams { + return &PcloudPvminstancesVolumesPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesVolumesPutParamsWithTimeout creates a new PcloudPvminstancesVolumesPutParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesVolumesPutParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesPutParams { + return &PcloudPvminstancesVolumesPutParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesVolumesPutParamsWithContext creates a new PcloudPvminstancesVolumesPutParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesVolumesPutParamsWithContext(ctx context.Context) *PcloudPvminstancesVolumesPutParams { + return &PcloudPvminstancesVolumesPutParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesVolumesPutParamsWithHTTPClient creates a new PcloudPvminstancesVolumesPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesVolumesPutParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesPutParams { + return &PcloudPvminstancesVolumesPutParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesVolumesPutParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances volumes put operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesVolumesPutParams struct { + + /* Body. + + Parameters to update a volume attached to a PVMInstance + */ + Body *models.PVMInstanceVolumeUpdate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + /* VolumeID. + + Volume ID + */ + VolumeID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances volumes put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesPutParams) WithDefaults() *PcloudPvminstancesVolumesPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances volumes put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances volumes put params +func (o *PcloudPvminstancesVolumesPutParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances volumes put params +func (o *PcloudPvminstancesVolumesPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances volumes put params +func (o *PcloudPvminstancesVolumesPutParams) WithContext(ctx context.Context) *PcloudPvminstancesVolumesPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances volumes put params +func (o *PcloudPvminstancesVolumesPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances volumes put params +func (o *PcloudPvminstancesVolumesPutParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances volumes put params +func (o *PcloudPvminstancesVolumesPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud pvminstances volumes put params +func (o *PcloudPvminstancesVolumesPutParams) WithBody(body *models.PVMInstanceVolumeUpdate) *PcloudPvminstancesVolumesPutParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud pvminstances volumes put params +func (o *PcloudPvminstancesVolumesPutParams) SetBody(body *models.PVMInstanceVolumeUpdate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances volumes put params +func (o *PcloudPvminstancesVolumesPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesVolumesPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances volumes put params +func (o *PcloudPvminstancesVolumesPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances volumes put params +func (o *PcloudPvminstancesVolumesPutParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesVolumesPutParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances volumes put params +func (o *PcloudPvminstancesVolumesPutParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WithVolumeID adds the volumeID to the pcloud pvminstances volumes put params +func (o *PcloudPvminstancesVolumesPutParams) WithVolumeID(volumeID string) *PcloudPvminstancesVolumesPutParams { + o.SetVolumeID(volumeID) + return o +} + +// SetVolumeID adds the volumeId to the pcloud pvminstances volumes put params +func (o *PcloudPvminstancesVolumesPutParams) SetVolumeID(volumeID string) { + o.VolumeID = volumeID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesVolumesPutParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + // path param volume_id + if err := r.SetPathParam("volume_id", o.VolumeID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_put_responses.go new file mode 100644 index 00000000000..a9da1b15a16 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_put_responses.go @@ -0,0 +1,141 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesVolumesPutReader is a Reader for the PcloudPvminstancesVolumesPut structure. +type PcloudPvminstancesVolumesPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesVolumesPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesVolumesPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesVolumesPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesVolumesPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesVolumesPutOK creates a PcloudPvminstancesVolumesPutOK with default headers values +func NewPcloudPvminstancesVolumesPutOK() *PcloudPvminstancesVolumesPutOK { + return &PcloudPvminstancesVolumesPutOK{} +} + +/* PcloudPvminstancesVolumesPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesVolumesPutOK struct { + Payload models.Object +} + +func (o *PcloudPvminstancesVolumesPutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPutOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesVolumesPutOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesPutOK) 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 +} + +// NewPcloudPvminstancesVolumesPutBadRequest creates a PcloudPvminstancesVolumesPutBadRequest with default headers values +func NewPcloudPvminstancesVolumesPutBadRequest() *PcloudPvminstancesVolumesPutBadRequest { + return &PcloudPvminstancesVolumesPutBadRequest{} +} + +/* PcloudPvminstancesVolumesPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesVolumesPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesVolumesPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesPutBadRequest) 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 +} + +// NewPcloudPvminstancesVolumesPutInternalServerError creates a PcloudPvminstancesVolumesPutInternalServerError with default headers values +func NewPcloudPvminstancesVolumesPutInternalServerError() *PcloudPvminstancesVolumesPutInternalServerError { + return &PcloudPvminstancesVolumesPutInternalServerError{} +} + +/* PcloudPvminstancesVolumesPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesVolumesPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}][%d] pcloudPvminstancesVolumesPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesVolumesPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_setboot_put_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_setboot_put_parameters.go new file mode 100644 index 00000000000..77fab0cb54e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_setboot_put_parameters.go @@ -0,0 +1,193 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudPvminstancesVolumesSetbootPutParams creates a new PcloudPvminstancesVolumesSetbootPutParams 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 NewPcloudPvminstancesVolumesSetbootPutParams() *PcloudPvminstancesVolumesSetbootPutParams { + return &PcloudPvminstancesVolumesSetbootPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudPvminstancesVolumesSetbootPutParamsWithTimeout creates a new PcloudPvminstancesVolumesSetbootPutParams object +// with the ability to set a timeout on a request. +func NewPcloudPvminstancesVolumesSetbootPutParamsWithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesSetbootPutParams { + return &PcloudPvminstancesVolumesSetbootPutParams{ + timeout: timeout, + } +} + +// NewPcloudPvminstancesVolumesSetbootPutParamsWithContext creates a new PcloudPvminstancesVolumesSetbootPutParams object +// with the ability to set a context for a request. +func NewPcloudPvminstancesVolumesSetbootPutParamsWithContext(ctx context.Context) *PcloudPvminstancesVolumesSetbootPutParams { + return &PcloudPvminstancesVolumesSetbootPutParams{ + Context: ctx, + } +} + +// NewPcloudPvminstancesVolumesSetbootPutParamsWithHTTPClient creates a new PcloudPvminstancesVolumesSetbootPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudPvminstancesVolumesSetbootPutParamsWithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesSetbootPutParams { + return &PcloudPvminstancesVolumesSetbootPutParams{ + HTTPClient: client, + } +} + +/* PcloudPvminstancesVolumesSetbootPutParams contains all the parameters to send to the API endpoint + for the pcloud pvminstances volumes setboot put operation. + + Typically these are written to a http.Request. +*/ +type PcloudPvminstancesVolumesSetbootPutParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + /* VolumeID. + + Volume ID + */ + VolumeID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud pvminstances volumes setboot put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesSetbootPutParams) WithDefaults() *PcloudPvminstancesVolumesSetbootPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud pvminstances volumes setboot put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudPvminstancesVolumesSetbootPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud pvminstances volumes setboot put params +func (o *PcloudPvminstancesVolumesSetbootPutParams) WithTimeout(timeout time.Duration) *PcloudPvminstancesVolumesSetbootPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud pvminstances volumes setboot put params +func (o *PcloudPvminstancesVolumesSetbootPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud pvminstances volumes setboot put params +func (o *PcloudPvminstancesVolumesSetbootPutParams) WithContext(ctx context.Context) *PcloudPvminstancesVolumesSetbootPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud pvminstances volumes setboot put params +func (o *PcloudPvminstancesVolumesSetbootPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud pvminstances volumes setboot put params +func (o *PcloudPvminstancesVolumesSetbootPutParams) WithHTTPClient(client *http.Client) *PcloudPvminstancesVolumesSetbootPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud pvminstances volumes setboot put params +func (o *PcloudPvminstancesVolumesSetbootPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud pvminstances volumes setboot put params +func (o *PcloudPvminstancesVolumesSetbootPutParams) WithCloudInstanceID(cloudInstanceID string) *PcloudPvminstancesVolumesSetbootPutParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud pvminstances volumes setboot put params +func (o *PcloudPvminstancesVolumesSetbootPutParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud pvminstances volumes setboot put params +func (o *PcloudPvminstancesVolumesSetbootPutParams) WithPvmInstanceID(pvmInstanceID string) *PcloudPvminstancesVolumesSetbootPutParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud pvminstances volumes setboot put params +func (o *PcloudPvminstancesVolumesSetbootPutParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WithVolumeID adds the volumeID to the pcloud pvminstances volumes setboot put params +func (o *PcloudPvminstancesVolumesSetbootPutParams) WithVolumeID(volumeID string) *PcloudPvminstancesVolumesSetbootPutParams { + o.SetVolumeID(volumeID) + return o +} + +// SetVolumeID adds the volumeId to the pcloud pvminstances volumes setboot put params +func (o *PcloudPvminstancesVolumesSetbootPutParams) SetVolumeID(volumeID string) { + o.VolumeID = volumeID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudPvminstancesVolumesSetbootPutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + // path param volume_id + if err := r.SetPathParam("volume_id", o.VolumeID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_setboot_put_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_setboot_put_responses.go new file mode 100644 index 00000000000..0842e8f1cb5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_pvminstances_volumes_setboot_put_responses.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudPvminstancesVolumesSetbootPutReader is a Reader for the PcloudPvminstancesVolumesSetbootPut structure. +type PcloudPvminstancesVolumesSetbootPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudPvminstancesVolumesSetbootPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudPvminstancesVolumesSetbootPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudPvminstancesVolumesSetbootPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudPvminstancesVolumesSetbootPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudPvminstancesVolumesSetbootPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudPvminstancesVolumesSetbootPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudPvminstancesVolumesSetbootPutOK creates a PcloudPvminstancesVolumesSetbootPutOK with default headers values +func NewPcloudPvminstancesVolumesSetbootPutOK() *PcloudPvminstancesVolumesSetbootPutOK { + return &PcloudPvminstancesVolumesSetbootPutOK{} +} + +/* PcloudPvminstancesVolumesSetbootPutOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudPvminstancesVolumesSetbootPutOK struct { + Payload models.Object +} + +func (o *PcloudPvminstancesVolumesSetbootPutOK) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}/setboot][%d] pcloudPvminstancesVolumesSetbootPutOK %+v", 200, o.Payload) +} +func (o *PcloudPvminstancesVolumesSetbootPutOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesSetbootPutOK) 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 +} + +// NewPcloudPvminstancesVolumesSetbootPutBadRequest creates a PcloudPvminstancesVolumesSetbootPutBadRequest with default headers values +func NewPcloudPvminstancesVolumesSetbootPutBadRequest() *PcloudPvminstancesVolumesSetbootPutBadRequest { + return &PcloudPvminstancesVolumesSetbootPutBadRequest{} +} + +/* PcloudPvminstancesVolumesSetbootPutBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudPvminstancesVolumesSetbootPutBadRequest struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesSetbootPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}/setboot][%d] pcloudPvminstancesVolumesSetbootPutBadRequest %+v", 400, o.Payload) +} +func (o *PcloudPvminstancesVolumesSetbootPutBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesSetbootPutBadRequest) 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 +} + +// NewPcloudPvminstancesVolumesSetbootPutUnauthorized creates a PcloudPvminstancesVolumesSetbootPutUnauthorized with default headers values +func NewPcloudPvminstancesVolumesSetbootPutUnauthorized() *PcloudPvminstancesVolumesSetbootPutUnauthorized { + return &PcloudPvminstancesVolumesSetbootPutUnauthorized{} +} + +/* PcloudPvminstancesVolumesSetbootPutUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudPvminstancesVolumesSetbootPutUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesSetbootPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}/setboot][%d] pcloudPvminstancesVolumesSetbootPutUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudPvminstancesVolumesSetbootPutUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesSetbootPutUnauthorized) 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 +} + +// NewPcloudPvminstancesVolumesSetbootPutNotFound creates a PcloudPvminstancesVolumesSetbootPutNotFound with default headers values +func NewPcloudPvminstancesVolumesSetbootPutNotFound() *PcloudPvminstancesVolumesSetbootPutNotFound { + return &PcloudPvminstancesVolumesSetbootPutNotFound{} +} + +/* PcloudPvminstancesVolumesSetbootPutNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudPvminstancesVolumesSetbootPutNotFound struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesSetbootPutNotFound) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}/setboot][%d] pcloudPvminstancesVolumesSetbootPutNotFound %+v", 404, o.Payload) +} +func (o *PcloudPvminstancesVolumesSetbootPutNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesSetbootPutNotFound) 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 +} + +// NewPcloudPvminstancesVolumesSetbootPutInternalServerError creates a PcloudPvminstancesVolumesSetbootPutInternalServerError with default headers values +func NewPcloudPvminstancesVolumesSetbootPutInternalServerError() *PcloudPvminstancesVolumesSetbootPutInternalServerError { + return &PcloudPvminstancesVolumesSetbootPutInternalServerError{} +} + +/* PcloudPvminstancesVolumesSetbootPutInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudPvminstancesVolumesSetbootPutInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudPvminstancesVolumesSetbootPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}/setboot][%d] pcloudPvminstancesVolumesSetbootPutInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudPvminstancesVolumesSetbootPutInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudPvminstancesVolumesSetbootPutInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_pvminstances_volumes_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_pvminstances_volumes_post_parameters.go new file mode 100644 index 00000000000..ba0f31924ce --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_pvminstances_volumes_post_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudV2PvminstancesVolumesPostParams creates a new PcloudV2PvminstancesVolumesPostParams 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 NewPcloudV2PvminstancesVolumesPostParams() *PcloudV2PvminstancesVolumesPostParams { + return &PcloudV2PvminstancesVolumesPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2PvminstancesVolumesPostParamsWithTimeout creates a new PcloudV2PvminstancesVolumesPostParams object +// with the ability to set a timeout on a request. +func NewPcloudV2PvminstancesVolumesPostParamsWithTimeout(timeout time.Duration) *PcloudV2PvminstancesVolumesPostParams { + return &PcloudV2PvminstancesVolumesPostParams{ + timeout: timeout, + } +} + +// NewPcloudV2PvminstancesVolumesPostParamsWithContext creates a new PcloudV2PvminstancesVolumesPostParams object +// with the ability to set a context for a request. +func NewPcloudV2PvminstancesVolumesPostParamsWithContext(ctx context.Context) *PcloudV2PvminstancesVolumesPostParams { + return &PcloudV2PvminstancesVolumesPostParams{ + Context: ctx, + } +} + +// NewPcloudV2PvminstancesVolumesPostParamsWithHTTPClient creates a new PcloudV2PvminstancesVolumesPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2PvminstancesVolumesPostParamsWithHTTPClient(client *http.Client) *PcloudV2PvminstancesVolumesPostParams { + return &PcloudV2PvminstancesVolumesPostParams{ + HTTPClient: client, + } +} + +/* PcloudV2PvminstancesVolumesPostParams contains all the parameters to send to the API endpoint + for the pcloud v2 pvminstances volumes post operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2PvminstancesVolumesPostParams struct { + + /* Body. + + Parameter to attach volumes to a PVMInstance + */ + Body *models.VolumesAttach + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* PvmInstanceID. + + PCloud PVM Instance ID + */ + PvmInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 pvminstances volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2PvminstancesVolumesPostParams) WithDefaults() *PcloudV2PvminstancesVolumesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 pvminstances volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2PvminstancesVolumesPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 pvminstances volumes post params +func (o *PcloudV2PvminstancesVolumesPostParams) WithTimeout(timeout time.Duration) *PcloudV2PvminstancesVolumesPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 pvminstances volumes post params +func (o *PcloudV2PvminstancesVolumesPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 pvminstances volumes post params +func (o *PcloudV2PvminstancesVolumesPostParams) WithContext(ctx context.Context) *PcloudV2PvminstancesVolumesPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 pvminstances volumes post params +func (o *PcloudV2PvminstancesVolumesPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 pvminstances volumes post params +func (o *PcloudV2PvminstancesVolumesPostParams) WithHTTPClient(client *http.Client) *PcloudV2PvminstancesVolumesPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 pvminstances volumes post params +func (o *PcloudV2PvminstancesVolumesPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud v2 pvminstances volumes post params +func (o *PcloudV2PvminstancesVolumesPostParams) WithBody(body *models.VolumesAttach) *PcloudV2PvminstancesVolumesPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud v2 pvminstances volumes post params +func (o *PcloudV2PvminstancesVolumesPostParams) SetBody(body *models.VolumesAttach) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 pvminstances volumes post params +func (o *PcloudV2PvminstancesVolumesPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2PvminstancesVolumesPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 pvminstances volumes post params +func (o *PcloudV2PvminstancesVolumesPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithPvmInstanceID adds the pvmInstanceID to the pcloud v2 pvminstances volumes post params +func (o *PcloudV2PvminstancesVolumesPostParams) WithPvmInstanceID(pvmInstanceID string) *PcloudV2PvminstancesVolumesPostParams { + o.SetPvmInstanceID(pvmInstanceID) + return o +} + +// SetPvmInstanceID adds the pvmInstanceId to the pcloud v2 pvminstances volumes post params +func (o *PcloudV2PvminstancesVolumesPostParams) SetPvmInstanceID(pvmInstanceID string) { + o.PvmInstanceID = pvmInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2PvminstancesVolumesPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param pvm_instance_id + if err := r.SetPathParam("pvm_instance_id", o.PvmInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_pvminstances_volumes_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_pvminstances_volumes_post_responses.go new file mode 100644 index 00000000000..e7c8a6c588d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_pvminstances_volumes_post_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV2PvminstancesVolumesPostReader is a Reader for the PcloudV2PvminstancesVolumesPost structure. +type PcloudV2PvminstancesVolumesPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2PvminstancesVolumesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudV2PvminstancesVolumesPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudV2PvminstancesVolumesPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudV2PvminstancesVolumesPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2PvminstancesVolumesPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2PvminstancesVolumesPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV2PvminstancesVolumesPostAccepted creates a PcloudV2PvminstancesVolumesPostAccepted with default headers values +func NewPcloudV2PvminstancesVolumesPostAccepted() *PcloudV2PvminstancesVolumesPostAccepted { + return &PcloudV2PvminstancesVolumesPostAccepted{} +} + +/* PcloudV2PvminstancesVolumesPostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudV2PvminstancesVolumesPostAccepted struct { + Payload *models.VolumesAttachmentResponse +} + +func (o *PcloudV2PvminstancesVolumesPostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudV2PvminstancesVolumesPostAccepted %+v", 202, o.Payload) +} +func (o *PcloudV2PvminstancesVolumesPostAccepted) GetPayload() *models.VolumesAttachmentResponse { + return o.Payload +} + +func (o *PcloudV2PvminstancesVolumesPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VolumesAttachmentResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2PvminstancesVolumesPostBadRequest creates a PcloudV2PvminstancesVolumesPostBadRequest with default headers values +func NewPcloudV2PvminstancesVolumesPostBadRequest() *PcloudV2PvminstancesVolumesPostBadRequest { + return &PcloudV2PvminstancesVolumesPostBadRequest{} +} + +/* PcloudV2PvminstancesVolumesPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudV2PvminstancesVolumesPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudV2PvminstancesVolumesPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudV2PvminstancesVolumesPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudV2PvminstancesVolumesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2PvminstancesVolumesPostBadRequest) 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 +} + +// NewPcloudV2PvminstancesVolumesPostUnauthorized creates a PcloudV2PvminstancesVolumesPostUnauthorized with default headers values +func NewPcloudV2PvminstancesVolumesPostUnauthorized() *PcloudV2PvminstancesVolumesPostUnauthorized { + return &PcloudV2PvminstancesVolumesPostUnauthorized{} +} + +/* PcloudV2PvminstancesVolumesPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2PvminstancesVolumesPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV2PvminstancesVolumesPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudV2PvminstancesVolumesPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV2PvminstancesVolumesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2PvminstancesVolumesPostUnauthorized) 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 +} + +// NewPcloudV2PvminstancesVolumesPostNotFound creates a PcloudV2PvminstancesVolumesPostNotFound with default headers values +func NewPcloudV2PvminstancesVolumesPostNotFound() *PcloudV2PvminstancesVolumesPostNotFound { + return &PcloudV2PvminstancesVolumesPostNotFound{} +} + +/* PcloudV2PvminstancesVolumesPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudV2PvminstancesVolumesPostNotFound struct { + Payload *models.Error +} + +func (o *PcloudV2PvminstancesVolumesPostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudV2PvminstancesVolumesPostNotFound %+v", 404, o.Payload) +} +func (o *PcloudV2PvminstancesVolumesPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2PvminstancesVolumesPostNotFound) 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 +} + +// NewPcloudV2PvminstancesVolumesPostInternalServerError creates a PcloudV2PvminstancesVolumesPostInternalServerError with default headers values +func NewPcloudV2PvminstancesVolumesPostInternalServerError() *PcloudV2PvminstancesVolumesPostInternalServerError { + return &PcloudV2PvminstancesVolumesPostInternalServerError{} +} + +/* PcloudV2PvminstancesVolumesPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2PvminstancesVolumesPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV2PvminstancesVolumesPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes][%d] pcloudV2PvminstancesVolumesPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV2PvminstancesVolumesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2PvminstancesVolumesPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_clone_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_clone_post_parameters.go new file mode 100644 index 00000000000..99a119e98ae --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_clone_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudV2VolumesClonePostParams creates a new PcloudV2VolumesClonePostParams 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 NewPcloudV2VolumesClonePostParams() *PcloudV2VolumesClonePostParams { + return &PcloudV2VolumesClonePostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2VolumesClonePostParamsWithTimeout creates a new PcloudV2VolumesClonePostParams object +// with the ability to set a timeout on a request. +func NewPcloudV2VolumesClonePostParamsWithTimeout(timeout time.Duration) *PcloudV2VolumesClonePostParams { + return &PcloudV2VolumesClonePostParams{ + timeout: timeout, + } +} + +// NewPcloudV2VolumesClonePostParamsWithContext creates a new PcloudV2VolumesClonePostParams object +// with the ability to set a context for a request. +func NewPcloudV2VolumesClonePostParamsWithContext(ctx context.Context) *PcloudV2VolumesClonePostParams { + return &PcloudV2VolumesClonePostParams{ + Context: ctx, + } +} + +// NewPcloudV2VolumesClonePostParamsWithHTTPClient creates a new PcloudV2VolumesClonePostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2VolumesClonePostParamsWithHTTPClient(client *http.Client) *PcloudV2VolumesClonePostParams { + return &PcloudV2VolumesClonePostParams{ + HTTPClient: client, + } +} + +/* PcloudV2VolumesClonePostParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumes clone post operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2VolumesClonePostParams struct { + + /* Body. + + Parameters for the cloning of volumes + */ + Body *models.VolumesCloneAsyncRequest + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 volumes clone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesClonePostParams) WithDefaults() *PcloudV2VolumesClonePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumes clone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesClonePostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 volumes clone post params +func (o *PcloudV2VolumesClonePostParams) WithTimeout(timeout time.Duration) *PcloudV2VolumesClonePostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 volumes clone post params +func (o *PcloudV2VolumesClonePostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 volumes clone post params +func (o *PcloudV2VolumesClonePostParams) WithContext(ctx context.Context) *PcloudV2VolumesClonePostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 volumes clone post params +func (o *PcloudV2VolumesClonePostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 volumes clone post params +func (o *PcloudV2VolumesClonePostParams) WithHTTPClient(client *http.Client) *PcloudV2VolumesClonePostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 volumes clone post params +func (o *PcloudV2VolumesClonePostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud v2 volumes clone post params +func (o *PcloudV2VolumesClonePostParams) WithBody(body *models.VolumesCloneAsyncRequest) *PcloudV2VolumesClonePostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud v2 volumes clone post params +func (o *PcloudV2VolumesClonePostParams) SetBody(body *models.VolumesCloneAsyncRequest) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 volumes clone post params +func (o *PcloudV2VolumesClonePostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2VolumesClonePostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 volumes clone post params +func (o *PcloudV2VolumesClonePostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2VolumesClonePostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_clone_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_clone_post_responses.go new file mode 100644 index 00000000000..17b686b297e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_clone_post_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV2VolumesClonePostReader is a Reader for the PcloudV2VolumesClonePost structure. +type PcloudV2VolumesClonePostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2VolumesClonePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudV2VolumesClonePostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudV2VolumesClonePostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudV2VolumesClonePostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2VolumesClonePostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2VolumesClonePostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV2VolumesClonePostAccepted creates a PcloudV2VolumesClonePostAccepted with default headers values +func NewPcloudV2VolumesClonePostAccepted() *PcloudV2VolumesClonePostAccepted { + return &PcloudV2VolumesClonePostAccepted{} +} + +/* PcloudV2VolumesClonePostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudV2VolumesClonePostAccepted struct { + Payload *models.CloneTaskReference +} + +func (o *PcloudV2VolumesClonePostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudV2VolumesClonePostAccepted %+v", 202, o.Payload) +} +func (o *PcloudV2VolumesClonePostAccepted) GetPayload() *models.CloneTaskReference { + return o.Payload +} + +func (o *PcloudV2VolumesClonePostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CloneTaskReference) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2VolumesClonePostBadRequest creates a PcloudV2VolumesClonePostBadRequest with default headers values +func NewPcloudV2VolumesClonePostBadRequest() *PcloudV2VolumesClonePostBadRequest { + return &PcloudV2VolumesClonePostBadRequest{} +} + +/* PcloudV2VolumesClonePostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudV2VolumesClonePostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesClonePostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudV2VolumesClonePostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudV2VolumesClonePostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesClonePostBadRequest) 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 +} + +// NewPcloudV2VolumesClonePostUnauthorized creates a PcloudV2VolumesClonePostUnauthorized with default headers values +func NewPcloudV2VolumesClonePostUnauthorized() *PcloudV2VolumesClonePostUnauthorized { + return &PcloudV2VolumesClonePostUnauthorized{} +} + +/* PcloudV2VolumesClonePostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2VolumesClonePostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesClonePostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudV2VolumesClonePostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV2VolumesClonePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesClonePostUnauthorized) 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 +} + +// NewPcloudV2VolumesClonePostNotFound creates a PcloudV2VolumesClonePostNotFound with default headers values +func NewPcloudV2VolumesClonePostNotFound() *PcloudV2VolumesClonePostNotFound { + return &PcloudV2VolumesClonePostNotFound{} +} + +/* PcloudV2VolumesClonePostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudV2VolumesClonePostNotFound struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesClonePostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudV2VolumesClonePostNotFound %+v", 404, o.Payload) +} +func (o *PcloudV2VolumesClonePostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesClonePostNotFound) 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 +} + +// NewPcloudV2VolumesClonePostInternalServerError creates a PcloudV2VolumesClonePostInternalServerError with default headers values +func NewPcloudV2VolumesClonePostInternalServerError() *PcloudV2VolumesClonePostInternalServerError { + return &PcloudV2VolumesClonePostInternalServerError{} +} + +/* PcloudV2VolumesClonePostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2VolumesClonePostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesClonePostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudV2VolumesClonePostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV2VolumesClonePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesClonePostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_clonetasks_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_clonetasks_get_parameters.go new file mode 100644 index 00000000000..b75497e1e31 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_clonetasks_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudV2VolumesClonetasksGetParams creates a new PcloudV2VolumesClonetasksGetParams 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 NewPcloudV2VolumesClonetasksGetParams() *PcloudV2VolumesClonetasksGetParams { + return &PcloudV2VolumesClonetasksGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2VolumesClonetasksGetParamsWithTimeout creates a new PcloudV2VolumesClonetasksGetParams object +// with the ability to set a timeout on a request. +func NewPcloudV2VolumesClonetasksGetParamsWithTimeout(timeout time.Duration) *PcloudV2VolumesClonetasksGetParams { + return &PcloudV2VolumesClonetasksGetParams{ + timeout: timeout, + } +} + +// NewPcloudV2VolumesClonetasksGetParamsWithContext creates a new PcloudV2VolumesClonetasksGetParams object +// with the ability to set a context for a request. +func NewPcloudV2VolumesClonetasksGetParamsWithContext(ctx context.Context) *PcloudV2VolumesClonetasksGetParams { + return &PcloudV2VolumesClonetasksGetParams{ + Context: ctx, + } +} + +// NewPcloudV2VolumesClonetasksGetParamsWithHTTPClient creates a new PcloudV2VolumesClonetasksGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2VolumesClonetasksGetParamsWithHTTPClient(client *http.Client) *PcloudV2VolumesClonetasksGetParams { + return &PcloudV2VolumesClonetasksGetParams{ + HTTPClient: client, + } +} + +/* PcloudV2VolumesClonetasksGetParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumes clonetasks get operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2VolumesClonetasksGetParams struct { + + /* CloneTaskID. + + Volumes Clone Task ID + */ + CloneTaskID string + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 volumes clonetasks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesClonetasksGetParams) WithDefaults() *PcloudV2VolumesClonetasksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumes clonetasks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesClonetasksGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 volumes clonetasks get params +func (o *PcloudV2VolumesClonetasksGetParams) WithTimeout(timeout time.Duration) *PcloudV2VolumesClonetasksGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 volumes clonetasks get params +func (o *PcloudV2VolumesClonetasksGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 volumes clonetasks get params +func (o *PcloudV2VolumesClonetasksGetParams) WithContext(ctx context.Context) *PcloudV2VolumesClonetasksGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 volumes clonetasks get params +func (o *PcloudV2VolumesClonetasksGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 volumes clonetasks get params +func (o *PcloudV2VolumesClonetasksGetParams) WithHTTPClient(client *http.Client) *PcloudV2VolumesClonetasksGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 volumes clonetasks get params +func (o *PcloudV2VolumesClonetasksGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloneTaskID adds the cloneTaskID to the pcloud v2 volumes clonetasks get params +func (o *PcloudV2VolumesClonetasksGetParams) WithCloneTaskID(cloneTaskID string) *PcloudV2VolumesClonetasksGetParams { + o.SetCloneTaskID(cloneTaskID) + return o +} + +// SetCloneTaskID adds the cloneTaskId to the pcloud v2 volumes clonetasks get params +func (o *PcloudV2VolumesClonetasksGetParams) SetCloneTaskID(cloneTaskID string) { + o.CloneTaskID = cloneTaskID +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 volumes clonetasks get params +func (o *PcloudV2VolumesClonetasksGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2VolumesClonetasksGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 volumes clonetasks get params +func (o *PcloudV2VolumesClonetasksGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2VolumesClonetasksGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param clone_task_id + if err := r.SetPathParam("clone_task_id", o.CloneTaskID); err != nil { + return err + } + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_clonetasks_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_clonetasks_get_responses.go new file mode 100644 index 00000000000..a59491866c9 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_clonetasks_get_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV2VolumesClonetasksGetReader is a Reader for the PcloudV2VolumesClonetasksGet structure. +type PcloudV2VolumesClonetasksGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2VolumesClonetasksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudV2VolumesClonetasksGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudV2VolumesClonetasksGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudV2VolumesClonetasksGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2VolumesClonetasksGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudV2VolumesClonetasksGetConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2VolumesClonetasksGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV2VolumesClonetasksGetOK creates a PcloudV2VolumesClonetasksGetOK with default headers values +func NewPcloudV2VolumesClonetasksGetOK() *PcloudV2VolumesClonetasksGetOK { + return &PcloudV2VolumesClonetasksGetOK{} +} + +/* PcloudV2VolumesClonetasksGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudV2VolumesClonetasksGetOK struct { + Payload *models.CloneTaskStatus +} + +func (o *PcloudV2VolumesClonetasksGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone-tasks/{clone_task_id}][%d] pcloudV2VolumesClonetasksGetOK %+v", 200, o.Payload) +} +func (o *PcloudV2VolumesClonetasksGetOK) GetPayload() *models.CloneTaskStatus { + return o.Payload +} + +func (o *PcloudV2VolumesClonetasksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.CloneTaskStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2VolumesClonetasksGetBadRequest creates a PcloudV2VolumesClonetasksGetBadRequest with default headers values +func NewPcloudV2VolumesClonetasksGetBadRequest() *PcloudV2VolumesClonetasksGetBadRequest { + return &PcloudV2VolumesClonetasksGetBadRequest{} +} + +/* PcloudV2VolumesClonetasksGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudV2VolumesClonetasksGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesClonetasksGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone-tasks/{clone_task_id}][%d] pcloudV2VolumesClonetasksGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudV2VolumesClonetasksGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesClonetasksGetBadRequest) 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 +} + +// NewPcloudV2VolumesClonetasksGetUnauthorized creates a PcloudV2VolumesClonetasksGetUnauthorized with default headers values +func NewPcloudV2VolumesClonetasksGetUnauthorized() *PcloudV2VolumesClonetasksGetUnauthorized { + return &PcloudV2VolumesClonetasksGetUnauthorized{} +} + +/* PcloudV2VolumesClonetasksGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2VolumesClonetasksGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesClonetasksGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone-tasks/{clone_task_id}][%d] pcloudV2VolumesClonetasksGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV2VolumesClonetasksGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesClonetasksGetUnauthorized) 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 +} + +// NewPcloudV2VolumesClonetasksGetNotFound creates a PcloudV2VolumesClonetasksGetNotFound with default headers values +func NewPcloudV2VolumesClonetasksGetNotFound() *PcloudV2VolumesClonetasksGetNotFound { + return &PcloudV2VolumesClonetasksGetNotFound{} +} + +/* PcloudV2VolumesClonetasksGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudV2VolumesClonetasksGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesClonetasksGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone-tasks/{clone_task_id}][%d] pcloudV2VolumesClonetasksGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudV2VolumesClonetasksGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesClonetasksGetNotFound) 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 +} + +// NewPcloudV2VolumesClonetasksGetConflict creates a PcloudV2VolumesClonetasksGetConflict with default headers values +func NewPcloudV2VolumesClonetasksGetConflict() *PcloudV2VolumesClonetasksGetConflict { + return &PcloudV2VolumesClonetasksGetConflict{} +} + +/* PcloudV2VolumesClonetasksGetConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudV2VolumesClonetasksGetConflict struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesClonetasksGetConflict) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone-tasks/{clone_task_id}][%d] pcloudV2VolumesClonetasksGetConflict %+v", 409, o.Payload) +} +func (o *PcloudV2VolumesClonetasksGetConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesClonetasksGetConflict) 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 +} + +// NewPcloudV2VolumesClonetasksGetInternalServerError creates a PcloudV2VolumesClonetasksGetInternalServerError with default headers values +func NewPcloudV2VolumesClonetasksGetInternalServerError() *PcloudV2VolumesClonetasksGetInternalServerError { + return &PcloudV2VolumesClonetasksGetInternalServerError{} +} + +/* PcloudV2VolumesClonetasksGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2VolumesClonetasksGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesClonetasksGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes/clone-tasks/{clone_task_id}][%d] pcloudV2VolumesClonetasksGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV2VolumesClonetasksGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesClonetasksGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_post_parameters.go new file mode 100644 index 00000000000..6ec3d1080df --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudV2VolumesPostParams creates a new PcloudV2VolumesPostParams 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 NewPcloudV2VolumesPostParams() *PcloudV2VolumesPostParams { + return &PcloudV2VolumesPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2VolumesPostParamsWithTimeout creates a new PcloudV2VolumesPostParams object +// with the ability to set a timeout on a request. +func NewPcloudV2VolumesPostParamsWithTimeout(timeout time.Duration) *PcloudV2VolumesPostParams { + return &PcloudV2VolumesPostParams{ + timeout: timeout, + } +} + +// NewPcloudV2VolumesPostParamsWithContext creates a new PcloudV2VolumesPostParams object +// with the ability to set a context for a request. +func NewPcloudV2VolumesPostParamsWithContext(ctx context.Context) *PcloudV2VolumesPostParams { + return &PcloudV2VolumesPostParams{ + Context: ctx, + } +} + +// NewPcloudV2VolumesPostParamsWithHTTPClient creates a new PcloudV2VolumesPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2VolumesPostParamsWithHTTPClient(client *http.Client) *PcloudV2VolumesPostParams { + return &PcloudV2VolumesPostParams{ + HTTPClient: client, + } +} + +/* PcloudV2VolumesPostParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumes post operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2VolumesPostParams struct { + + /* Body. + + Parameters for creating multiple volumes + */ + Body *models.MultiVolumesCreate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesPostParams) WithDefaults() *PcloudV2VolumesPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumes post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 volumes post params +func (o *PcloudV2VolumesPostParams) WithTimeout(timeout time.Duration) *PcloudV2VolumesPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 volumes post params +func (o *PcloudV2VolumesPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 volumes post params +func (o *PcloudV2VolumesPostParams) WithContext(ctx context.Context) *PcloudV2VolumesPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 volumes post params +func (o *PcloudV2VolumesPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 volumes post params +func (o *PcloudV2VolumesPostParams) WithHTTPClient(client *http.Client) *PcloudV2VolumesPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 volumes post params +func (o *PcloudV2VolumesPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud v2 volumes post params +func (o *PcloudV2VolumesPostParams) WithBody(body *models.MultiVolumesCreate) *PcloudV2VolumesPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud v2 volumes post params +func (o *PcloudV2VolumesPostParams) SetBody(body *models.MultiVolumesCreate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 volumes post params +func (o *PcloudV2VolumesPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2VolumesPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 volumes post params +func (o *PcloudV2VolumesPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2VolumesPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_post_responses.go new file mode 100644 index 00000000000..7101f333724 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumes_post_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV2VolumesPostReader is a Reader for the PcloudV2VolumesPost structure. +type PcloudV2VolumesPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2VolumesPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 201: + result := NewPcloudV2VolumesPostCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudV2VolumesPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudV2VolumesPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudV2VolumesPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPcloudV2VolumesPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2VolumesPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV2VolumesPostCreated creates a PcloudV2VolumesPostCreated with default headers values +func NewPcloudV2VolumesPostCreated() *PcloudV2VolumesPostCreated { + return &PcloudV2VolumesPostCreated{} +} + +/* PcloudV2VolumesPostCreated describes a response with status code 201, with default header values. + +Created +*/ +type PcloudV2VolumesPostCreated struct { + Payload *models.Volumes +} + +func (o *PcloudV2VolumesPostCreated) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesPostCreated %+v", 201, o.Payload) +} +func (o *PcloudV2VolumesPostCreated) GetPayload() *models.Volumes { + return o.Payload +} + +func (o *PcloudV2VolumesPostCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Volumes) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2VolumesPostBadRequest creates a PcloudV2VolumesPostBadRequest with default headers values +func NewPcloudV2VolumesPostBadRequest() *PcloudV2VolumesPostBadRequest { + return &PcloudV2VolumesPostBadRequest{} +} + +/* PcloudV2VolumesPostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudV2VolumesPostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesPostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesPostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudV2VolumesPostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesPostBadRequest) 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 +} + +// NewPcloudV2VolumesPostUnauthorized creates a PcloudV2VolumesPostUnauthorized with default headers values +func NewPcloudV2VolumesPostUnauthorized() *PcloudV2VolumesPostUnauthorized { + return &PcloudV2VolumesPostUnauthorized{} +} + +/* PcloudV2VolumesPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2VolumesPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV2VolumesPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesPostUnauthorized) 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 +} + +// NewPcloudV2VolumesPostConflict creates a PcloudV2VolumesPostConflict with default headers values +func NewPcloudV2VolumesPostConflict() *PcloudV2VolumesPostConflict { + return &PcloudV2VolumesPostConflict{} +} + +/* PcloudV2VolumesPostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudV2VolumesPostConflict struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesPostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesPostConflict %+v", 409, o.Payload) +} +func (o *PcloudV2VolumesPostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesPostConflict) 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 +} + +// NewPcloudV2VolumesPostUnprocessableEntity creates a PcloudV2VolumesPostUnprocessableEntity with default headers values +func NewPcloudV2VolumesPostUnprocessableEntity() *PcloudV2VolumesPostUnprocessableEntity { + return &PcloudV2VolumesPostUnprocessableEntity{} +} + +/* PcloudV2VolumesPostUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type PcloudV2VolumesPostUnprocessableEntity struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesPostUnprocessableEntity %+v", 422, o.Payload) +} +func (o *PcloudV2VolumesPostUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesPostUnprocessableEntity) 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 +} + +// NewPcloudV2VolumesPostInternalServerError creates a PcloudV2VolumesPostInternalServerError with default headers values +func NewPcloudV2VolumesPostInternalServerError() *PcloudV2VolumesPostInternalServerError { + return &PcloudV2VolumesPostInternalServerError{} +} + +/* PcloudV2VolumesPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2VolumesPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes][%d] pcloudV2VolumesPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV2VolumesPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_cancel_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_cancel_post_parameters.go new file mode 100644 index 00000000000..a71bc1d7eec --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_cancel_post_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudV2VolumescloneCancelPostParams creates a new PcloudV2VolumescloneCancelPostParams 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 NewPcloudV2VolumescloneCancelPostParams() *PcloudV2VolumescloneCancelPostParams { + return &PcloudV2VolumescloneCancelPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2VolumescloneCancelPostParamsWithTimeout creates a new PcloudV2VolumescloneCancelPostParams object +// with the ability to set a timeout on a request. +func NewPcloudV2VolumescloneCancelPostParamsWithTimeout(timeout time.Duration) *PcloudV2VolumescloneCancelPostParams { + return &PcloudV2VolumescloneCancelPostParams{ + timeout: timeout, + } +} + +// NewPcloudV2VolumescloneCancelPostParamsWithContext creates a new PcloudV2VolumescloneCancelPostParams object +// with the ability to set a context for a request. +func NewPcloudV2VolumescloneCancelPostParamsWithContext(ctx context.Context) *PcloudV2VolumescloneCancelPostParams { + return &PcloudV2VolumescloneCancelPostParams{ + Context: ctx, + } +} + +// NewPcloudV2VolumescloneCancelPostParamsWithHTTPClient creates a new PcloudV2VolumescloneCancelPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2VolumescloneCancelPostParamsWithHTTPClient(client *http.Client) *PcloudV2VolumescloneCancelPostParams { + return &PcloudV2VolumescloneCancelPostParams{ + HTTPClient: client, + } +} + +/* PcloudV2VolumescloneCancelPostParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumesclone cancel post operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2VolumescloneCancelPostParams struct { + + /* Body. + + Parameters for cancelling a volumes-clone request + */ + Body *models.VolumesCloneCancel + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VolumesCloneID. + + Volumes Clone ID + */ + VolumesCloneID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 volumesclone cancel post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneCancelPostParams) WithDefaults() *PcloudV2VolumescloneCancelPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumesclone cancel post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneCancelPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 volumesclone cancel post params +func (o *PcloudV2VolumescloneCancelPostParams) WithTimeout(timeout time.Duration) *PcloudV2VolumescloneCancelPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 volumesclone cancel post params +func (o *PcloudV2VolumescloneCancelPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 volumesclone cancel post params +func (o *PcloudV2VolumescloneCancelPostParams) WithContext(ctx context.Context) *PcloudV2VolumescloneCancelPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 volumesclone cancel post params +func (o *PcloudV2VolumescloneCancelPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 volumesclone cancel post params +func (o *PcloudV2VolumescloneCancelPostParams) WithHTTPClient(client *http.Client) *PcloudV2VolumescloneCancelPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 volumesclone cancel post params +func (o *PcloudV2VolumescloneCancelPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud v2 volumesclone cancel post params +func (o *PcloudV2VolumescloneCancelPostParams) WithBody(body *models.VolumesCloneCancel) *PcloudV2VolumescloneCancelPostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud v2 volumesclone cancel post params +func (o *PcloudV2VolumescloneCancelPostParams) SetBody(body *models.VolumesCloneCancel) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 volumesclone cancel post params +func (o *PcloudV2VolumescloneCancelPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2VolumescloneCancelPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 volumesclone cancel post params +func (o *PcloudV2VolumescloneCancelPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVolumesCloneID adds the volumesCloneID to the pcloud v2 volumesclone cancel post params +func (o *PcloudV2VolumescloneCancelPostParams) WithVolumesCloneID(volumesCloneID string) *PcloudV2VolumescloneCancelPostParams { + o.SetVolumesCloneID(volumesCloneID) + return o +} + +// SetVolumesCloneID adds the volumesCloneId to the pcloud v2 volumesclone cancel post params +func (o *PcloudV2VolumescloneCancelPostParams) SetVolumesCloneID(volumesCloneID string) { + o.VolumesCloneID = volumesCloneID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2VolumescloneCancelPostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param volumes_clone_id + if err := r.SetPathParam("volumes_clone_id", o.VolumesCloneID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_cancel_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_cancel_post_responses.go new file mode 100644 index 00000000000..3d06fe1baec --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_cancel_post_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV2VolumescloneCancelPostReader is a Reader for the PcloudV2VolumescloneCancelPost structure. +type PcloudV2VolumescloneCancelPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2VolumescloneCancelPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudV2VolumescloneCancelPostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPcloudV2VolumescloneCancelPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2VolumescloneCancelPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2VolumescloneCancelPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV2VolumescloneCancelPostAccepted creates a PcloudV2VolumescloneCancelPostAccepted with default headers values +func NewPcloudV2VolumescloneCancelPostAccepted() *PcloudV2VolumescloneCancelPostAccepted { + return &PcloudV2VolumescloneCancelPostAccepted{} +} + +/* PcloudV2VolumescloneCancelPostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudV2VolumescloneCancelPostAccepted struct { + Payload *models.VolumesClone +} + +func (o *PcloudV2VolumescloneCancelPostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/cancel][%d] pcloudV2VolumescloneCancelPostAccepted %+v", 202, o.Payload) +} +func (o *PcloudV2VolumescloneCancelPostAccepted) GetPayload() *models.VolumesClone { + return o.Payload +} + +func (o *PcloudV2VolumescloneCancelPostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VolumesClone) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2VolumescloneCancelPostUnauthorized creates a PcloudV2VolumescloneCancelPostUnauthorized with default headers values +func NewPcloudV2VolumescloneCancelPostUnauthorized() *PcloudV2VolumescloneCancelPostUnauthorized { + return &PcloudV2VolumescloneCancelPostUnauthorized{} +} + +/* PcloudV2VolumescloneCancelPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2VolumescloneCancelPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneCancelPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/cancel][%d] pcloudV2VolumescloneCancelPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV2VolumescloneCancelPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneCancelPostUnauthorized) 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 +} + +// NewPcloudV2VolumescloneCancelPostNotFound creates a PcloudV2VolumescloneCancelPostNotFound with default headers values +func NewPcloudV2VolumescloneCancelPostNotFound() *PcloudV2VolumescloneCancelPostNotFound { + return &PcloudV2VolumescloneCancelPostNotFound{} +} + +/* PcloudV2VolumescloneCancelPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudV2VolumescloneCancelPostNotFound struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneCancelPostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/cancel][%d] pcloudV2VolumescloneCancelPostNotFound %+v", 404, o.Payload) +} +func (o *PcloudV2VolumescloneCancelPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneCancelPostNotFound) 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 +} + +// NewPcloudV2VolumescloneCancelPostInternalServerError creates a PcloudV2VolumescloneCancelPostInternalServerError with default headers values +func NewPcloudV2VolumescloneCancelPostInternalServerError() *PcloudV2VolumescloneCancelPostInternalServerError { + return &PcloudV2VolumescloneCancelPostInternalServerError{} +} + +/* PcloudV2VolumescloneCancelPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2VolumescloneCancelPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneCancelPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/cancel][%d] pcloudV2VolumescloneCancelPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV2VolumescloneCancelPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneCancelPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_delete_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_delete_parameters.go new file mode 100644 index 00000000000..bee811980f6 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_delete_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudV2VolumescloneDeleteParams creates a new PcloudV2VolumescloneDeleteParams 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 NewPcloudV2VolumescloneDeleteParams() *PcloudV2VolumescloneDeleteParams { + return &PcloudV2VolumescloneDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2VolumescloneDeleteParamsWithTimeout creates a new PcloudV2VolumescloneDeleteParams object +// with the ability to set a timeout on a request. +func NewPcloudV2VolumescloneDeleteParamsWithTimeout(timeout time.Duration) *PcloudV2VolumescloneDeleteParams { + return &PcloudV2VolumescloneDeleteParams{ + timeout: timeout, + } +} + +// NewPcloudV2VolumescloneDeleteParamsWithContext creates a new PcloudV2VolumescloneDeleteParams object +// with the ability to set a context for a request. +func NewPcloudV2VolumescloneDeleteParamsWithContext(ctx context.Context) *PcloudV2VolumescloneDeleteParams { + return &PcloudV2VolumescloneDeleteParams{ + Context: ctx, + } +} + +// NewPcloudV2VolumescloneDeleteParamsWithHTTPClient creates a new PcloudV2VolumescloneDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2VolumescloneDeleteParamsWithHTTPClient(client *http.Client) *PcloudV2VolumescloneDeleteParams { + return &PcloudV2VolumescloneDeleteParams{ + HTTPClient: client, + } +} + +/* PcloudV2VolumescloneDeleteParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumesclone delete operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2VolumescloneDeleteParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VolumesCloneID. + + Volumes Clone ID + */ + VolumesCloneID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 volumesclone delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneDeleteParams) WithDefaults() *PcloudV2VolumescloneDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumesclone delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 volumesclone delete params +func (o *PcloudV2VolumescloneDeleteParams) WithTimeout(timeout time.Duration) *PcloudV2VolumescloneDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 volumesclone delete params +func (o *PcloudV2VolumescloneDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 volumesclone delete params +func (o *PcloudV2VolumescloneDeleteParams) WithContext(ctx context.Context) *PcloudV2VolumescloneDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 volumesclone delete params +func (o *PcloudV2VolumescloneDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 volumesclone delete params +func (o *PcloudV2VolumescloneDeleteParams) WithHTTPClient(client *http.Client) *PcloudV2VolumescloneDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 volumesclone delete params +func (o *PcloudV2VolumescloneDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 volumesclone delete params +func (o *PcloudV2VolumescloneDeleteParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2VolumescloneDeleteParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 volumesclone delete params +func (o *PcloudV2VolumescloneDeleteParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVolumesCloneID adds the volumesCloneID to the pcloud v2 volumesclone delete params +func (o *PcloudV2VolumescloneDeleteParams) WithVolumesCloneID(volumesCloneID string) *PcloudV2VolumescloneDeleteParams { + o.SetVolumesCloneID(volumesCloneID) + return o +} + +// SetVolumesCloneID adds the volumesCloneId to the pcloud v2 volumesclone delete params +func (o *PcloudV2VolumescloneDeleteParams) SetVolumesCloneID(volumesCloneID string) { + o.VolumesCloneID = volumesCloneID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2VolumescloneDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param volumes_clone_id + if err := r.SetPathParam("volumes_clone_id", o.VolumesCloneID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_delete_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_delete_responses.go new file mode 100644 index 00000000000..2dc153ace69 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_delete_responses.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV2VolumescloneDeleteReader is a Reader for the PcloudV2VolumescloneDelete structure. +type PcloudV2VolumescloneDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2VolumescloneDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudV2VolumescloneDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudV2VolumescloneDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudV2VolumescloneDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2VolumescloneDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2VolumescloneDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV2VolumescloneDeleteOK creates a PcloudV2VolumescloneDeleteOK with default headers values +func NewPcloudV2VolumescloneDeleteOK() *PcloudV2VolumescloneDeleteOK { + return &PcloudV2VolumescloneDeleteOK{} +} + +/* PcloudV2VolumescloneDeleteOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudV2VolumescloneDeleteOK struct { + Payload models.Object +} + +func (o *PcloudV2VolumescloneDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneDeleteOK %+v", 200, o.Payload) +} +func (o *PcloudV2VolumescloneDeleteOK) GetPayload() models.Object { + return o.Payload +} + +func (o *PcloudV2VolumescloneDeleteOK) 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 +} + +// NewPcloudV2VolumescloneDeleteBadRequest creates a PcloudV2VolumescloneDeleteBadRequest with default headers values +func NewPcloudV2VolumescloneDeleteBadRequest() *PcloudV2VolumescloneDeleteBadRequest { + return &PcloudV2VolumescloneDeleteBadRequest{} +} + +/* PcloudV2VolumescloneDeleteBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudV2VolumescloneDeleteBadRequest struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneDeleteBadRequest %+v", 400, o.Payload) +} +func (o *PcloudV2VolumescloneDeleteBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneDeleteBadRequest) 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 +} + +// NewPcloudV2VolumescloneDeleteUnauthorized creates a PcloudV2VolumescloneDeleteUnauthorized with default headers values +func NewPcloudV2VolumescloneDeleteUnauthorized() *PcloudV2VolumescloneDeleteUnauthorized { + return &PcloudV2VolumescloneDeleteUnauthorized{} +} + +/* PcloudV2VolumescloneDeleteUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2VolumescloneDeleteUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneDeleteUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV2VolumescloneDeleteUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneDeleteUnauthorized) 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 +} + +// NewPcloudV2VolumescloneDeleteNotFound creates a PcloudV2VolumescloneDeleteNotFound with default headers values +func NewPcloudV2VolumescloneDeleteNotFound() *PcloudV2VolumescloneDeleteNotFound { + return &PcloudV2VolumescloneDeleteNotFound{} +} + +/* PcloudV2VolumescloneDeleteNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudV2VolumescloneDeleteNotFound struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneDeleteNotFound %+v", 404, o.Payload) +} +func (o *PcloudV2VolumescloneDeleteNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneDeleteNotFound) 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 +} + +// NewPcloudV2VolumescloneDeleteInternalServerError creates a PcloudV2VolumescloneDeleteInternalServerError with default headers values +func NewPcloudV2VolumescloneDeleteInternalServerError() *PcloudV2VolumescloneDeleteInternalServerError { + return &PcloudV2VolumescloneDeleteInternalServerError{} +} + +/* PcloudV2VolumescloneDeleteInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2VolumescloneDeleteInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneDeleteInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV2VolumescloneDeleteInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneDeleteInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_execute_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_execute_post_parameters.go new file mode 100644 index 00000000000..f3d74219a2f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_execute_post_parameters.go @@ -0,0 +1,195 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudV2VolumescloneExecutePostParams creates a new PcloudV2VolumescloneExecutePostParams 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 NewPcloudV2VolumescloneExecutePostParams() *PcloudV2VolumescloneExecutePostParams { + return &PcloudV2VolumescloneExecutePostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2VolumescloneExecutePostParamsWithTimeout creates a new PcloudV2VolumescloneExecutePostParams object +// with the ability to set a timeout on a request. +func NewPcloudV2VolumescloneExecutePostParamsWithTimeout(timeout time.Duration) *PcloudV2VolumescloneExecutePostParams { + return &PcloudV2VolumescloneExecutePostParams{ + timeout: timeout, + } +} + +// NewPcloudV2VolumescloneExecutePostParamsWithContext creates a new PcloudV2VolumescloneExecutePostParams object +// with the ability to set a context for a request. +func NewPcloudV2VolumescloneExecutePostParamsWithContext(ctx context.Context) *PcloudV2VolumescloneExecutePostParams { + return &PcloudV2VolumescloneExecutePostParams{ + Context: ctx, + } +} + +// NewPcloudV2VolumescloneExecutePostParamsWithHTTPClient creates a new PcloudV2VolumescloneExecutePostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2VolumescloneExecutePostParamsWithHTTPClient(client *http.Client) *PcloudV2VolumescloneExecutePostParams { + return &PcloudV2VolumescloneExecutePostParams{ + HTTPClient: client, + } +} + +/* PcloudV2VolumescloneExecutePostParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumesclone execute post operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2VolumescloneExecutePostParams struct { + + /* Body. + + Parameters for the cloning of volumes + */ + Body *models.VolumesCloneExecute + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VolumesCloneID. + + Volumes Clone ID + */ + VolumesCloneID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 volumesclone execute post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneExecutePostParams) WithDefaults() *PcloudV2VolumescloneExecutePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumesclone execute post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneExecutePostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 volumesclone execute post params +func (o *PcloudV2VolumescloneExecutePostParams) WithTimeout(timeout time.Duration) *PcloudV2VolumescloneExecutePostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 volumesclone execute post params +func (o *PcloudV2VolumescloneExecutePostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 volumesclone execute post params +func (o *PcloudV2VolumescloneExecutePostParams) WithContext(ctx context.Context) *PcloudV2VolumescloneExecutePostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 volumesclone execute post params +func (o *PcloudV2VolumescloneExecutePostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 volumesclone execute post params +func (o *PcloudV2VolumescloneExecutePostParams) WithHTTPClient(client *http.Client) *PcloudV2VolumescloneExecutePostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 volumesclone execute post params +func (o *PcloudV2VolumescloneExecutePostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud v2 volumesclone execute post params +func (o *PcloudV2VolumescloneExecutePostParams) WithBody(body *models.VolumesCloneExecute) *PcloudV2VolumescloneExecutePostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud v2 volumesclone execute post params +func (o *PcloudV2VolumescloneExecutePostParams) SetBody(body *models.VolumesCloneExecute) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 volumesclone execute post params +func (o *PcloudV2VolumescloneExecutePostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2VolumescloneExecutePostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 volumesclone execute post params +func (o *PcloudV2VolumescloneExecutePostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVolumesCloneID adds the volumesCloneID to the pcloud v2 volumesclone execute post params +func (o *PcloudV2VolumescloneExecutePostParams) WithVolumesCloneID(volumesCloneID string) *PcloudV2VolumescloneExecutePostParams { + o.SetVolumesCloneID(volumesCloneID) + return o +} + +// SetVolumesCloneID adds the volumesCloneId to the pcloud v2 volumesclone execute post params +func (o *PcloudV2VolumescloneExecutePostParams) SetVolumesCloneID(volumesCloneID string) { + o.VolumesCloneID = volumesCloneID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2VolumescloneExecutePostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param volumes_clone_id + if err := r.SetPathParam("volumes_clone_id", o.VolumesCloneID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_execute_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_execute_post_responses.go new file mode 100644 index 00000000000..4523d858fde --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_execute_post_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV2VolumescloneExecutePostReader is a Reader for the PcloudV2VolumescloneExecutePost structure. +type PcloudV2VolumescloneExecutePostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2VolumescloneExecutePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudV2VolumescloneExecutePostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudV2VolumescloneExecutePostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudV2VolumescloneExecutePostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2VolumescloneExecutePostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2VolumescloneExecutePostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV2VolumescloneExecutePostAccepted creates a PcloudV2VolumescloneExecutePostAccepted with default headers values +func NewPcloudV2VolumescloneExecutePostAccepted() *PcloudV2VolumescloneExecutePostAccepted { + return &PcloudV2VolumescloneExecutePostAccepted{} +} + +/* PcloudV2VolumescloneExecutePostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudV2VolumescloneExecutePostAccepted struct { + Payload *models.VolumesClone +} + +func (o *PcloudV2VolumescloneExecutePostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/execute][%d] pcloudV2VolumescloneExecutePostAccepted %+v", 202, o.Payload) +} +func (o *PcloudV2VolumescloneExecutePostAccepted) GetPayload() *models.VolumesClone { + return o.Payload +} + +func (o *PcloudV2VolumescloneExecutePostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VolumesClone) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2VolumescloneExecutePostBadRequest creates a PcloudV2VolumescloneExecutePostBadRequest with default headers values +func NewPcloudV2VolumescloneExecutePostBadRequest() *PcloudV2VolumescloneExecutePostBadRequest { + return &PcloudV2VolumescloneExecutePostBadRequest{} +} + +/* PcloudV2VolumescloneExecutePostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudV2VolumescloneExecutePostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneExecutePostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/execute][%d] pcloudV2VolumescloneExecutePostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudV2VolumescloneExecutePostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneExecutePostBadRequest) 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 +} + +// NewPcloudV2VolumescloneExecutePostUnauthorized creates a PcloudV2VolumescloneExecutePostUnauthorized with default headers values +func NewPcloudV2VolumescloneExecutePostUnauthorized() *PcloudV2VolumescloneExecutePostUnauthorized { + return &PcloudV2VolumescloneExecutePostUnauthorized{} +} + +/* PcloudV2VolumescloneExecutePostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2VolumescloneExecutePostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneExecutePostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/execute][%d] pcloudV2VolumescloneExecutePostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV2VolumescloneExecutePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneExecutePostUnauthorized) 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 +} + +// NewPcloudV2VolumescloneExecutePostNotFound creates a PcloudV2VolumescloneExecutePostNotFound with default headers values +func NewPcloudV2VolumescloneExecutePostNotFound() *PcloudV2VolumescloneExecutePostNotFound { + return &PcloudV2VolumescloneExecutePostNotFound{} +} + +/* PcloudV2VolumescloneExecutePostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudV2VolumescloneExecutePostNotFound struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneExecutePostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/execute][%d] pcloudV2VolumescloneExecutePostNotFound %+v", 404, o.Payload) +} +func (o *PcloudV2VolumescloneExecutePostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneExecutePostNotFound) 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 +} + +// NewPcloudV2VolumescloneExecutePostInternalServerError creates a PcloudV2VolumescloneExecutePostInternalServerError with default headers values +func NewPcloudV2VolumescloneExecutePostInternalServerError() *PcloudV2VolumescloneExecutePostInternalServerError { + return &PcloudV2VolumescloneExecutePostInternalServerError{} +} + +/* PcloudV2VolumescloneExecutePostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2VolumescloneExecutePostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneExecutePostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/execute][%d] pcloudV2VolumescloneExecutePostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV2VolumescloneExecutePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneExecutePostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_get_parameters.go new file mode 100644 index 00000000000..0a9c293e307 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_get_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudV2VolumescloneGetParams creates a new PcloudV2VolumescloneGetParams 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 NewPcloudV2VolumescloneGetParams() *PcloudV2VolumescloneGetParams { + return &PcloudV2VolumescloneGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2VolumescloneGetParamsWithTimeout creates a new PcloudV2VolumescloneGetParams object +// with the ability to set a timeout on a request. +func NewPcloudV2VolumescloneGetParamsWithTimeout(timeout time.Duration) *PcloudV2VolumescloneGetParams { + return &PcloudV2VolumescloneGetParams{ + timeout: timeout, + } +} + +// NewPcloudV2VolumescloneGetParamsWithContext creates a new PcloudV2VolumescloneGetParams object +// with the ability to set a context for a request. +func NewPcloudV2VolumescloneGetParamsWithContext(ctx context.Context) *PcloudV2VolumescloneGetParams { + return &PcloudV2VolumescloneGetParams{ + Context: ctx, + } +} + +// NewPcloudV2VolumescloneGetParamsWithHTTPClient creates a new PcloudV2VolumescloneGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2VolumescloneGetParamsWithHTTPClient(client *http.Client) *PcloudV2VolumescloneGetParams { + return &PcloudV2VolumescloneGetParams{ + HTTPClient: client, + } +} + +/* PcloudV2VolumescloneGetParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumesclone get operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2VolumescloneGetParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VolumesCloneID. + + Volumes Clone ID + */ + VolumesCloneID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 volumesclone get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneGetParams) WithDefaults() *PcloudV2VolumescloneGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumesclone get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 volumesclone get params +func (o *PcloudV2VolumescloneGetParams) WithTimeout(timeout time.Duration) *PcloudV2VolumescloneGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 volumesclone get params +func (o *PcloudV2VolumescloneGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 volumesclone get params +func (o *PcloudV2VolumescloneGetParams) WithContext(ctx context.Context) *PcloudV2VolumescloneGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 volumesclone get params +func (o *PcloudV2VolumescloneGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 volumesclone get params +func (o *PcloudV2VolumescloneGetParams) WithHTTPClient(client *http.Client) *PcloudV2VolumescloneGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 volumesclone get params +func (o *PcloudV2VolumescloneGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 volumesclone get params +func (o *PcloudV2VolumescloneGetParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2VolumescloneGetParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 volumesclone get params +func (o *PcloudV2VolumescloneGetParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVolumesCloneID adds the volumesCloneID to the pcloud v2 volumesclone get params +func (o *PcloudV2VolumescloneGetParams) WithVolumesCloneID(volumesCloneID string) *PcloudV2VolumescloneGetParams { + o.SetVolumesCloneID(volumesCloneID) + return o +} + +// SetVolumesCloneID adds the volumesCloneId to the pcloud v2 volumesclone get params +func (o *PcloudV2VolumescloneGetParams) SetVolumesCloneID(volumesCloneID string) { + o.VolumesCloneID = volumesCloneID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2VolumescloneGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param volumes_clone_id + if err := r.SetPathParam("volumes_clone_id", o.VolumesCloneID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_get_responses.go new file mode 100644 index 00000000000..f1dfe63fb35 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_get_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV2VolumescloneGetReader is a Reader for the PcloudV2VolumescloneGet structure. +type PcloudV2VolumescloneGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2VolumescloneGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudV2VolumescloneGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudV2VolumescloneGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudV2VolumescloneGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2VolumescloneGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2VolumescloneGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV2VolumescloneGetOK creates a PcloudV2VolumescloneGetOK with default headers values +func NewPcloudV2VolumescloneGetOK() *PcloudV2VolumescloneGetOK { + return &PcloudV2VolumescloneGetOK{} +} + +/* PcloudV2VolumescloneGetOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudV2VolumescloneGetOK struct { + Payload *models.VolumesCloneDetail +} + +func (o *PcloudV2VolumescloneGetOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneGetOK %+v", 200, o.Payload) +} +func (o *PcloudV2VolumescloneGetOK) GetPayload() *models.VolumesCloneDetail { + return o.Payload +} + +func (o *PcloudV2VolumescloneGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VolumesCloneDetail) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2VolumescloneGetBadRequest creates a PcloudV2VolumescloneGetBadRequest with default headers values +func NewPcloudV2VolumescloneGetBadRequest() *PcloudV2VolumescloneGetBadRequest { + return &PcloudV2VolumescloneGetBadRequest{} +} + +/* PcloudV2VolumescloneGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudV2VolumescloneGetBadRequest struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneGetBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneGetBadRequest %+v", 400, o.Payload) +} +func (o *PcloudV2VolumescloneGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneGetBadRequest) 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 +} + +// NewPcloudV2VolumescloneGetUnauthorized creates a PcloudV2VolumescloneGetUnauthorized with default headers values +func NewPcloudV2VolumescloneGetUnauthorized() *PcloudV2VolumescloneGetUnauthorized { + return &PcloudV2VolumescloneGetUnauthorized{} +} + +/* PcloudV2VolumescloneGetUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2VolumescloneGetUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneGetUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV2VolumescloneGetUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneGetUnauthorized) 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 +} + +// NewPcloudV2VolumescloneGetNotFound creates a PcloudV2VolumescloneGetNotFound with default headers values +func NewPcloudV2VolumescloneGetNotFound() *PcloudV2VolumescloneGetNotFound { + return &PcloudV2VolumescloneGetNotFound{} +} + +/* PcloudV2VolumescloneGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudV2VolumescloneGetNotFound struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneGetNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneGetNotFound %+v", 404, o.Payload) +} +func (o *PcloudV2VolumescloneGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneGetNotFound) 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 +} + +// NewPcloudV2VolumescloneGetInternalServerError creates a PcloudV2VolumescloneGetInternalServerError with default headers values +func NewPcloudV2VolumescloneGetInternalServerError() *PcloudV2VolumescloneGetInternalServerError { + return &PcloudV2VolumescloneGetInternalServerError{} +} + +/* PcloudV2VolumescloneGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2VolumescloneGetInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}][%d] pcloudV2VolumescloneGetInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV2VolumescloneGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_getall_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_getall_parameters.go new file mode 100644 index 00000000000..f18506d0621 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_getall_parameters.go @@ -0,0 +1,192 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudV2VolumescloneGetallParams creates a new PcloudV2VolumescloneGetallParams 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 NewPcloudV2VolumescloneGetallParams() *PcloudV2VolumescloneGetallParams { + return &PcloudV2VolumescloneGetallParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2VolumescloneGetallParamsWithTimeout creates a new PcloudV2VolumescloneGetallParams object +// with the ability to set a timeout on a request. +func NewPcloudV2VolumescloneGetallParamsWithTimeout(timeout time.Duration) *PcloudV2VolumescloneGetallParams { + return &PcloudV2VolumescloneGetallParams{ + timeout: timeout, + } +} + +// NewPcloudV2VolumescloneGetallParamsWithContext creates a new PcloudV2VolumescloneGetallParams object +// with the ability to set a context for a request. +func NewPcloudV2VolumescloneGetallParamsWithContext(ctx context.Context) *PcloudV2VolumescloneGetallParams { + return &PcloudV2VolumescloneGetallParams{ + Context: ctx, + } +} + +// NewPcloudV2VolumescloneGetallParamsWithHTTPClient creates a new PcloudV2VolumescloneGetallParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2VolumescloneGetallParamsWithHTTPClient(client *http.Client) *PcloudV2VolumescloneGetallParams { + return &PcloudV2VolumescloneGetallParams{ + HTTPClient: client, + } +} + +/* PcloudV2VolumescloneGetallParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumesclone getall operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2VolumescloneGetallParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* Filter. + + volumes-clone filter to limit list items: + prepare - includes status values (preparing, prepared) + start - includes status values (starting, available) + execute - includes status values (executing, available-rollback) + cancel - includes status values (cancelling) + completed - includes status values (completed) + failed - includes status values (failed) + cancelled - includes status values (cancelled) + finalized - included status values (completed, failed, cancelled) + + */ + Filter *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 volumesclone getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneGetallParams) WithDefaults() *PcloudV2VolumescloneGetallParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumesclone getall params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneGetallParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 volumesclone getall params +func (o *PcloudV2VolumescloneGetallParams) WithTimeout(timeout time.Duration) *PcloudV2VolumescloneGetallParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 volumesclone getall params +func (o *PcloudV2VolumescloneGetallParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 volumesclone getall params +func (o *PcloudV2VolumescloneGetallParams) WithContext(ctx context.Context) *PcloudV2VolumescloneGetallParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 volumesclone getall params +func (o *PcloudV2VolumescloneGetallParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 volumesclone getall params +func (o *PcloudV2VolumescloneGetallParams) WithHTTPClient(client *http.Client) *PcloudV2VolumescloneGetallParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 volumesclone getall params +func (o *PcloudV2VolumescloneGetallParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 volumesclone getall params +func (o *PcloudV2VolumescloneGetallParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2VolumescloneGetallParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 volumesclone getall params +func (o *PcloudV2VolumescloneGetallParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithFilter adds the filter to the pcloud v2 volumesclone getall params +func (o *PcloudV2VolumescloneGetallParams) WithFilter(filter *string) *PcloudV2VolumescloneGetallParams { + o.SetFilter(filter) + return o +} + +// SetFilter adds the filter to the pcloud v2 volumesclone getall params +func (o *PcloudV2VolumescloneGetallParams) SetFilter(filter *string) { + o.Filter = filter +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2VolumescloneGetallParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if o.Filter != nil { + + // query param filter + var qrFilter string + + if o.Filter != nil { + qrFilter = *o.Filter + } + qFilter := qrFilter + if qFilter != "" { + + if err := r.SetQueryParam("filter", qFilter); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_getall_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_getall_responses.go new file mode 100644 index 00000000000..ed1b66608fe --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_getall_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV2VolumescloneGetallReader is a Reader for the PcloudV2VolumescloneGetall structure. +type PcloudV2VolumescloneGetallReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2VolumescloneGetallReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudV2VolumescloneGetallOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudV2VolumescloneGetallBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudV2VolumescloneGetallUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2VolumescloneGetallNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2VolumescloneGetallInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV2VolumescloneGetallOK creates a PcloudV2VolumescloneGetallOK with default headers values +func NewPcloudV2VolumescloneGetallOK() *PcloudV2VolumescloneGetallOK { + return &PcloudV2VolumescloneGetallOK{} +} + +/* PcloudV2VolumescloneGetallOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudV2VolumescloneGetallOK struct { + Payload *models.VolumesClones +} + +func (o *PcloudV2VolumescloneGetallOK) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumescloneGetallOK %+v", 200, o.Payload) +} +func (o *PcloudV2VolumescloneGetallOK) GetPayload() *models.VolumesClones { + return o.Payload +} + +func (o *PcloudV2VolumescloneGetallOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VolumesClones) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2VolumescloneGetallBadRequest creates a PcloudV2VolumescloneGetallBadRequest with default headers values +func NewPcloudV2VolumescloneGetallBadRequest() *PcloudV2VolumescloneGetallBadRequest { + return &PcloudV2VolumescloneGetallBadRequest{} +} + +/* PcloudV2VolumescloneGetallBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudV2VolumescloneGetallBadRequest struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneGetallBadRequest) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumescloneGetallBadRequest %+v", 400, o.Payload) +} +func (o *PcloudV2VolumescloneGetallBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneGetallBadRequest) 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 +} + +// NewPcloudV2VolumescloneGetallUnauthorized creates a PcloudV2VolumescloneGetallUnauthorized with default headers values +func NewPcloudV2VolumescloneGetallUnauthorized() *PcloudV2VolumescloneGetallUnauthorized { + return &PcloudV2VolumescloneGetallUnauthorized{} +} + +/* PcloudV2VolumescloneGetallUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2VolumescloneGetallUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneGetallUnauthorized) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumescloneGetallUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV2VolumescloneGetallUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneGetallUnauthorized) 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 +} + +// NewPcloudV2VolumescloneGetallNotFound creates a PcloudV2VolumescloneGetallNotFound with default headers values +func NewPcloudV2VolumescloneGetallNotFound() *PcloudV2VolumescloneGetallNotFound { + return &PcloudV2VolumescloneGetallNotFound{} +} + +/* PcloudV2VolumescloneGetallNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudV2VolumescloneGetallNotFound struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneGetallNotFound) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumescloneGetallNotFound %+v", 404, o.Payload) +} +func (o *PcloudV2VolumescloneGetallNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneGetallNotFound) 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 +} + +// NewPcloudV2VolumescloneGetallInternalServerError creates a PcloudV2VolumescloneGetallInternalServerError with default headers values +func NewPcloudV2VolumescloneGetallInternalServerError() *PcloudV2VolumescloneGetallInternalServerError { + return &PcloudV2VolumescloneGetallInternalServerError{} +} + +/* PcloudV2VolumescloneGetallInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2VolumescloneGetallInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneGetallInternalServerError) Error() string { + return fmt.Sprintf("[GET /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumescloneGetallInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV2VolumescloneGetallInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneGetallInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_post_parameters.go new file mode 100644 index 00000000000..f728df4e876 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudV2VolumesclonePostParams creates a new PcloudV2VolumesclonePostParams 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 NewPcloudV2VolumesclonePostParams() *PcloudV2VolumesclonePostParams { + return &PcloudV2VolumesclonePostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2VolumesclonePostParamsWithTimeout creates a new PcloudV2VolumesclonePostParams object +// with the ability to set a timeout on a request. +func NewPcloudV2VolumesclonePostParamsWithTimeout(timeout time.Duration) *PcloudV2VolumesclonePostParams { + return &PcloudV2VolumesclonePostParams{ + timeout: timeout, + } +} + +// NewPcloudV2VolumesclonePostParamsWithContext creates a new PcloudV2VolumesclonePostParams object +// with the ability to set a context for a request. +func NewPcloudV2VolumesclonePostParamsWithContext(ctx context.Context) *PcloudV2VolumesclonePostParams { + return &PcloudV2VolumesclonePostParams{ + Context: ctx, + } +} + +// NewPcloudV2VolumesclonePostParamsWithHTTPClient creates a new PcloudV2VolumesclonePostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2VolumesclonePostParamsWithHTTPClient(client *http.Client) *PcloudV2VolumesclonePostParams { + return &PcloudV2VolumesclonePostParams{ + HTTPClient: client, + } +} + +/* PcloudV2VolumesclonePostParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumesclone post operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2VolumesclonePostParams struct { + + /* Body. + + Parameters for preparing a set of volumes to be cloned + */ + Body *models.VolumesCloneCreate + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 volumesclone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesclonePostParams) WithDefaults() *PcloudV2VolumesclonePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumesclone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumesclonePostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 volumesclone post params +func (o *PcloudV2VolumesclonePostParams) WithTimeout(timeout time.Duration) *PcloudV2VolumesclonePostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 volumesclone post params +func (o *PcloudV2VolumesclonePostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 volumesclone post params +func (o *PcloudV2VolumesclonePostParams) WithContext(ctx context.Context) *PcloudV2VolumesclonePostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 volumesclone post params +func (o *PcloudV2VolumesclonePostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 volumesclone post params +func (o *PcloudV2VolumesclonePostParams) WithHTTPClient(client *http.Client) *PcloudV2VolumesclonePostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 volumesclone post params +func (o *PcloudV2VolumesclonePostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud v2 volumesclone post params +func (o *PcloudV2VolumesclonePostParams) WithBody(body *models.VolumesCloneCreate) *PcloudV2VolumesclonePostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud v2 volumesclone post params +func (o *PcloudV2VolumesclonePostParams) SetBody(body *models.VolumesCloneCreate) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 volumesclone post params +func (o *PcloudV2VolumesclonePostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2VolumesclonePostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 volumesclone post params +func (o *PcloudV2VolumesclonePostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2VolumesclonePostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_post_responses.go new file mode 100644 index 00000000000..6caa458fd9e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_post_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV2VolumesclonePostReader is a Reader for the PcloudV2VolumesclonePost structure. +type PcloudV2VolumesclonePostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2VolumesclonePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewPcloudV2VolumesclonePostAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudV2VolumesclonePostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudV2VolumesclonePostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPcloudV2VolumesclonePostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2VolumesclonePostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2VolumesclonePostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV2VolumesclonePostAccepted creates a PcloudV2VolumesclonePostAccepted with default headers values +func NewPcloudV2VolumesclonePostAccepted() *PcloudV2VolumesclonePostAccepted { + return &PcloudV2VolumesclonePostAccepted{} +} + +/* PcloudV2VolumesclonePostAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type PcloudV2VolumesclonePostAccepted struct { + Payload *models.VolumesClone +} + +func (o *PcloudV2VolumesclonePostAccepted) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumesclonePostAccepted %+v", 202, o.Payload) +} +func (o *PcloudV2VolumesclonePostAccepted) GetPayload() *models.VolumesClone { + return o.Payload +} + +func (o *PcloudV2VolumesclonePostAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VolumesClone) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2VolumesclonePostBadRequest creates a PcloudV2VolumesclonePostBadRequest with default headers values +func NewPcloudV2VolumesclonePostBadRequest() *PcloudV2VolumesclonePostBadRequest { + return &PcloudV2VolumesclonePostBadRequest{} +} + +/* PcloudV2VolumesclonePostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudV2VolumesclonePostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesclonePostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumesclonePostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudV2VolumesclonePostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesclonePostBadRequest) 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 +} + +// NewPcloudV2VolumesclonePostUnauthorized creates a PcloudV2VolumesclonePostUnauthorized with default headers values +func NewPcloudV2VolumesclonePostUnauthorized() *PcloudV2VolumesclonePostUnauthorized { + return &PcloudV2VolumesclonePostUnauthorized{} +} + +/* PcloudV2VolumesclonePostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2VolumesclonePostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesclonePostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumesclonePostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV2VolumesclonePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesclonePostUnauthorized) 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 +} + +// NewPcloudV2VolumesclonePostForbidden creates a PcloudV2VolumesclonePostForbidden with default headers values +func NewPcloudV2VolumesclonePostForbidden() *PcloudV2VolumesclonePostForbidden { + return &PcloudV2VolumesclonePostForbidden{} +} + +/* PcloudV2VolumesclonePostForbidden describes a response with status code 403, with default header values. + +Forbidden +*/ +type PcloudV2VolumesclonePostForbidden struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesclonePostForbidden) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumesclonePostForbidden %+v", 403, o.Payload) +} +func (o *PcloudV2VolumesclonePostForbidden) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesclonePostForbidden) 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 +} + +// NewPcloudV2VolumesclonePostNotFound creates a PcloudV2VolumesclonePostNotFound with default headers values +func NewPcloudV2VolumesclonePostNotFound() *PcloudV2VolumesclonePostNotFound { + return &PcloudV2VolumesclonePostNotFound{} +} + +/* PcloudV2VolumesclonePostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudV2VolumesclonePostNotFound struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesclonePostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumesclonePostNotFound %+v", 404, o.Payload) +} +func (o *PcloudV2VolumesclonePostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesclonePostNotFound) 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 +} + +// NewPcloudV2VolumesclonePostInternalServerError creates a PcloudV2VolumesclonePostInternalServerError with default headers values +func NewPcloudV2VolumesclonePostInternalServerError() *PcloudV2VolumesclonePostInternalServerError { + return &PcloudV2VolumesclonePostInternalServerError{} +} + +/* PcloudV2VolumesclonePostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2VolumesclonePostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV2VolumesclonePostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone][%d] pcloudV2VolumesclonePostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV2VolumesclonePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumesclonePostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_start_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_start_post_parameters.go new file mode 100644 index 00000000000..86e9c246841 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_start_post_parameters.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudV2VolumescloneStartPostParams creates a new PcloudV2VolumescloneStartPostParams 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 NewPcloudV2VolumescloneStartPostParams() *PcloudV2VolumescloneStartPostParams { + return &PcloudV2VolumescloneStartPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudV2VolumescloneStartPostParamsWithTimeout creates a new PcloudV2VolumescloneStartPostParams object +// with the ability to set a timeout on a request. +func NewPcloudV2VolumescloneStartPostParamsWithTimeout(timeout time.Duration) *PcloudV2VolumescloneStartPostParams { + return &PcloudV2VolumescloneStartPostParams{ + timeout: timeout, + } +} + +// NewPcloudV2VolumescloneStartPostParamsWithContext creates a new PcloudV2VolumescloneStartPostParams object +// with the ability to set a context for a request. +func NewPcloudV2VolumescloneStartPostParamsWithContext(ctx context.Context) *PcloudV2VolumescloneStartPostParams { + return &PcloudV2VolumescloneStartPostParams{ + Context: ctx, + } +} + +// NewPcloudV2VolumescloneStartPostParamsWithHTTPClient creates a new PcloudV2VolumescloneStartPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudV2VolumescloneStartPostParamsWithHTTPClient(client *http.Client) *PcloudV2VolumescloneStartPostParams { + return &PcloudV2VolumescloneStartPostParams{ + HTTPClient: client, + } +} + +/* PcloudV2VolumescloneStartPostParams contains all the parameters to send to the API endpoint + for the pcloud v2 volumesclone start post operation. + + Typically these are written to a http.Request. +*/ +type PcloudV2VolumescloneStartPostParams struct { + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + /* VolumesCloneID. + + Volumes Clone ID + */ + VolumesCloneID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud v2 volumesclone start post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneStartPostParams) WithDefaults() *PcloudV2VolumescloneStartPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud v2 volumesclone start post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudV2VolumescloneStartPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud v2 volumesclone start post params +func (o *PcloudV2VolumescloneStartPostParams) WithTimeout(timeout time.Duration) *PcloudV2VolumescloneStartPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud v2 volumesclone start post params +func (o *PcloudV2VolumescloneStartPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud v2 volumesclone start post params +func (o *PcloudV2VolumescloneStartPostParams) WithContext(ctx context.Context) *PcloudV2VolumescloneStartPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud v2 volumesclone start post params +func (o *PcloudV2VolumescloneStartPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud v2 volumesclone start post params +func (o *PcloudV2VolumescloneStartPostParams) WithHTTPClient(client *http.Client) *PcloudV2VolumescloneStartPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud v2 volumesclone start post params +func (o *PcloudV2VolumescloneStartPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud v2 volumesclone start post params +func (o *PcloudV2VolumescloneStartPostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudV2VolumescloneStartPostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud v2 volumesclone start post params +func (o *PcloudV2VolumescloneStartPostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WithVolumesCloneID adds the volumesCloneID to the pcloud v2 volumesclone start post params +func (o *PcloudV2VolumescloneStartPostParams) WithVolumesCloneID(volumesCloneID string) *PcloudV2VolumescloneStartPostParams { + o.SetVolumesCloneID(volumesCloneID) + return o +} + +// SetVolumesCloneID adds the volumesCloneId to the pcloud v2 volumesclone start post params +func (o *PcloudV2VolumescloneStartPostParams) SetVolumesCloneID(volumesCloneID string) { + o.VolumesCloneID = volumesCloneID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudV2VolumescloneStartPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + // path param volumes_clone_id + if err := r.SetPathParam("volumes_clone_id", o.VolumesCloneID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_start_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_start_post_responses.go new file mode 100644 index 00000000000..a144d63d50e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_v2_volumesclone_start_post_responses.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudV2VolumescloneStartPostReader is a Reader for the PcloudV2VolumescloneStartPost structure. +type PcloudV2VolumescloneStartPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudV2VolumescloneStartPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudV2VolumescloneStartPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPcloudV2VolumescloneStartPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPcloudV2VolumescloneStartPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudV2VolumescloneStartPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudV2VolumescloneStartPostOK creates a PcloudV2VolumescloneStartPostOK with default headers values +func NewPcloudV2VolumescloneStartPostOK() *PcloudV2VolumescloneStartPostOK { + return &PcloudV2VolumescloneStartPostOK{} +} + +/* PcloudV2VolumescloneStartPostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudV2VolumescloneStartPostOK struct { + Payload *models.VolumesClone +} + +func (o *PcloudV2VolumescloneStartPostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/start][%d] pcloudV2VolumescloneStartPostOK %+v", 200, o.Payload) +} +func (o *PcloudV2VolumescloneStartPostOK) GetPayload() *models.VolumesClone { + return o.Payload +} + +func (o *PcloudV2VolumescloneStartPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VolumesClone) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudV2VolumescloneStartPostUnauthorized creates a PcloudV2VolumescloneStartPostUnauthorized with default headers values +func NewPcloudV2VolumescloneStartPostUnauthorized() *PcloudV2VolumescloneStartPostUnauthorized { + return &PcloudV2VolumescloneStartPostUnauthorized{} +} + +/* PcloudV2VolumescloneStartPostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudV2VolumescloneStartPostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneStartPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/start][%d] pcloudV2VolumescloneStartPostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudV2VolumescloneStartPostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneStartPostUnauthorized) 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 +} + +// NewPcloudV2VolumescloneStartPostNotFound creates a PcloudV2VolumescloneStartPostNotFound with default headers values +func NewPcloudV2VolumescloneStartPostNotFound() *PcloudV2VolumescloneStartPostNotFound { + return &PcloudV2VolumescloneStartPostNotFound{} +} + +/* PcloudV2VolumescloneStartPostNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type PcloudV2VolumescloneStartPostNotFound struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneStartPostNotFound) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/start][%d] pcloudV2VolumescloneStartPostNotFound %+v", 404, o.Payload) +} +func (o *PcloudV2VolumescloneStartPostNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneStartPostNotFound) 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 +} + +// NewPcloudV2VolumescloneStartPostInternalServerError creates a PcloudV2VolumescloneStartPostInternalServerError with default headers values +func NewPcloudV2VolumescloneStartPostInternalServerError() *PcloudV2VolumescloneStartPostInternalServerError { + return &PcloudV2VolumescloneStartPostInternalServerError{} +} + +/* PcloudV2VolumescloneStartPostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudV2VolumescloneStartPostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudV2VolumescloneStartPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v2/cloud-instances/{cloud_instance_id}/volumes-clone/{volumes_clone_id}/start][%d] pcloudV2VolumescloneStartPostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudV2VolumescloneStartPostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudV2VolumescloneStartPostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_volumes_clone_post_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_volumes_clone_post_parameters.go new file mode 100644 index 00000000000..44e22ad18e0 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_volumes_clone_post_parameters.go @@ -0,0 +1,173 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// 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" +) + +// NewPcloudVolumesClonePostParams creates a new PcloudVolumesClonePostParams 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 NewPcloudVolumesClonePostParams() *PcloudVolumesClonePostParams { + return &PcloudVolumesClonePostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPcloudVolumesClonePostParamsWithTimeout creates a new PcloudVolumesClonePostParams object +// with the ability to set a timeout on a request. +func NewPcloudVolumesClonePostParamsWithTimeout(timeout time.Duration) *PcloudVolumesClonePostParams { + return &PcloudVolumesClonePostParams{ + timeout: timeout, + } +} + +// NewPcloudVolumesClonePostParamsWithContext creates a new PcloudVolumesClonePostParams object +// with the ability to set a context for a request. +func NewPcloudVolumesClonePostParamsWithContext(ctx context.Context) *PcloudVolumesClonePostParams { + return &PcloudVolumesClonePostParams{ + Context: ctx, + } +} + +// NewPcloudVolumesClonePostParamsWithHTTPClient creates a new PcloudVolumesClonePostParams object +// with the ability to set a custom HTTPClient for a request. +func NewPcloudVolumesClonePostParamsWithHTTPClient(client *http.Client) *PcloudVolumesClonePostParams { + return &PcloudVolumesClonePostParams{ + HTTPClient: client, + } +} + +/* PcloudVolumesClonePostParams contains all the parameters to send to the API endpoint + for the pcloud volumes clone post operation. + + Typically these are written to a http.Request. +*/ +type PcloudVolumesClonePostParams struct { + + /* Body. + + Parameters for the cloning of volumes + */ + Body *models.VolumesCloneRequest + + /* CloudInstanceID. + + Cloud Instance ID of a PCloud Instance + */ + CloudInstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the pcloud volumes clone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVolumesClonePostParams) WithDefaults() *PcloudVolumesClonePostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the pcloud volumes clone post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PcloudVolumesClonePostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the pcloud volumes clone post params +func (o *PcloudVolumesClonePostParams) WithTimeout(timeout time.Duration) *PcloudVolumesClonePostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the pcloud volumes clone post params +func (o *PcloudVolumesClonePostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the pcloud volumes clone post params +func (o *PcloudVolumesClonePostParams) WithContext(ctx context.Context) *PcloudVolumesClonePostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the pcloud volumes clone post params +func (o *PcloudVolumesClonePostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the pcloud volumes clone post params +func (o *PcloudVolumesClonePostParams) WithHTTPClient(client *http.Client) *PcloudVolumesClonePostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the pcloud volumes clone post params +func (o *PcloudVolumesClonePostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the pcloud volumes clone post params +func (o *PcloudVolumesClonePostParams) WithBody(body *models.VolumesCloneRequest) *PcloudVolumesClonePostParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the pcloud volumes clone post params +func (o *PcloudVolumesClonePostParams) SetBody(body *models.VolumesCloneRequest) { + o.Body = body +} + +// WithCloudInstanceID adds the cloudInstanceID to the pcloud volumes clone post params +func (o *PcloudVolumesClonePostParams) WithCloudInstanceID(cloudInstanceID string) *PcloudVolumesClonePostParams { + o.SetCloudInstanceID(cloudInstanceID) + return o +} + +// SetCloudInstanceID adds the cloudInstanceId to the pcloud volumes clone post params +func (o *PcloudVolumesClonePostParams) SetCloudInstanceID(cloudInstanceID string) { + o.CloudInstanceID = cloudInstanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PcloudVolumesClonePostParams) 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 cloud_instance_id + if err := r.SetPathParam("cloud_instance_id", o.CloudInstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_volumes_clone_post_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_volumes_clone_post_responses.go new file mode 100644 index 00000000000..5c13855d743 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes/pcloud_volumes_clone_post_responses.go @@ -0,0 +1,219 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package p_cloud_volumes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// PcloudVolumesClonePostReader is a Reader for the PcloudVolumesClonePost structure. +type PcloudVolumesClonePostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PcloudVolumesClonePostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPcloudVolumesClonePostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPcloudVolumesClonePostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPcloudVolumesClonePostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewPcloudVolumesClonePostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPcloudVolumesClonePostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewPcloudVolumesClonePostOK creates a PcloudVolumesClonePostOK with default headers values +func NewPcloudVolumesClonePostOK() *PcloudVolumesClonePostOK { + return &PcloudVolumesClonePostOK{} +} + +/* PcloudVolumesClonePostOK describes a response with status code 200, with default header values. + +OK +*/ +type PcloudVolumesClonePostOK struct { + Payload *models.VolumesCloneResponse +} + +func (o *PcloudVolumesClonePostOK) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudVolumesClonePostOK %+v", 200, o.Payload) +} +func (o *PcloudVolumesClonePostOK) GetPayload() *models.VolumesCloneResponse { + return o.Payload +} + +func (o *PcloudVolumesClonePostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.VolumesCloneResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPcloudVolumesClonePostBadRequest creates a PcloudVolumesClonePostBadRequest with default headers values +func NewPcloudVolumesClonePostBadRequest() *PcloudVolumesClonePostBadRequest { + return &PcloudVolumesClonePostBadRequest{} +} + +/* PcloudVolumesClonePostBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type PcloudVolumesClonePostBadRequest struct { + Payload *models.Error +} + +func (o *PcloudVolumesClonePostBadRequest) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudVolumesClonePostBadRequest %+v", 400, o.Payload) +} +func (o *PcloudVolumesClonePostBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVolumesClonePostBadRequest) 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 +} + +// NewPcloudVolumesClonePostUnauthorized creates a PcloudVolumesClonePostUnauthorized with default headers values +func NewPcloudVolumesClonePostUnauthorized() *PcloudVolumesClonePostUnauthorized { + return &PcloudVolumesClonePostUnauthorized{} +} + +/* PcloudVolumesClonePostUnauthorized describes a response with status code 401, with default header values. + +Unauthorized +*/ +type PcloudVolumesClonePostUnauthorized struct { + Payload *models.Error +} + +func (o *PcloudVolumesClonePostUnauthorized) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudVolumesClonePostUnauthorized %+v", 401, o.Payload) +} +func (o *PcloudVolumesClonePostUnauthorized) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVolumesClonePostUnauthorized) 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 +} + +// NewPcloudVolumesClonePostConflict creates a PcloudVolumesClonePostConflict with default headers values +func NewPcloudVolumesClonePostConflict() *PcloudVolumesClonePostConflict { + return &PcloudVolumesClonePostConflict{} +} + +/* PcloudVolumesClonePostConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type PcloudVolumesClonePostConflict struct { + Payload *models.Error +} + +func (o *PcloudVolumesClonePostConflict) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudVolumesClonePostConflict %+v", 409, o.Payload) +} +func (o *PcloudVolumesClonePostConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVolumesClonePostConflict) 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 +} + +// NewPcloudVolumesClonePostInternalServerError creates a PcloudVolumesClonePostInternalServerError with default headers values +func NewPcloudVolumesClonePostInternalServerError() *PcloudVolumesClonePostInternalServerError { + return &PcloudVolumesClonePostInternalServerError{} +} + +/* PcloudVolumesClonePostInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type PcloudVolumesClonePostInternalServerError struct { + Payload *models.Error +} + +func (o *PcloudVolumesClonePostInternalServerError) Error() string { + return fmt.Sprintf("[POST /pcloud/v1/cloud-instances/{cloud_instance_id}/volumes/clone][%d] pcloudVolumesClonePostInternalServerError %+v", 500, o.Payload) +} +func (o *PcloudVolumesClonePostInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *PcloudVolumesClonePostInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/power_iaas_api_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/power_iaas_api_client.go new file mode 100644 index 00000000000..749813a14ce --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/power_iaas_api_client.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package client + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/client/authentication" + "github.com/IBM-Cloud/power-go-client/power/client/bluemix_service_instances" + "github.com/IBM-Cloud/power-go-client/power/client/catalog" + "github.com/IBM-Cloud/power-go-client/power/client/hardware_platforms" + "github.com/IBM-Cloud/power-go-client/power/client/iaas_service_broker" + "github.com/IBM-Cloud/power-go-client/power/client/internal_storage_regions" + "github.com/IBM-Cloud/power-go-client/power/client/open_stacks" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_cloud_connections" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_events" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_images" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_instances" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_jobs" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_networks" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_placement_groups" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_s_a_p" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_service_d_h_c_p" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_snapshots" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_storage_capacity" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_system_pools" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tasks" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_tenants_ssh_keys" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_connections" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_v_p_n_policies" + "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_volumes" + "github.com/IBM-Cloud/power-go-client/power/client/service_bindings" + "github.com/IBM-Cloud/power-go-client/power/client/service_instances" + "github.com/IBM-Cloud/power-go-client/power/client/storage_types" + "github.com/IBM-Cloud/power-go-client/power/client/swagger_spec" +) + +// Default power iaas API HTTP client. +var Default = NewHTTPClient(nil) + +const ( + // DefaultHost is the default Host + // found in Meta (info) section of spec file + DefaultHost string = "localhost" + // DefaultBasePath is the default BasePath + // found in Meta (info) section of spec file + DefaultBasePath string = "/" +) + +// DefaultSchemes are the default schemes found in Meta (info) section of spec file +var DefaultSchemes = []string{"http"} + +// NewHTTPClient creates a new power iaas API HTTP client. +func NewHTTPClient(formats strfmt.Registry) *PowerIaasAPI { + return NewHTTPClientWithConfig(formats, nil) +} + +// NewHTTPClientWithConfig creates a new power iaas API HTTP client, +// using a customizable transport config. +func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *PowerIaasAPI { + // ensure nullable parameters have default + if cfg == nil { + cfg = DefaultTransportConfig() + } + + // create transport and client + transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) + return New(transport, formats) +} + +// New creates a new power iaas API client +func New(transport runtime.ClientTransport, formats strfmt.Registry) *PowerIaasAPI { + // ensure nullable parameters have default + if formats == nil { + formats = strfmt.Default + } + + cli := new(PowerIaasAPI) + cli.Transport = transport + cli.Authentication = authentication.New(transport, formats) + cli.BluemixServiceInstances = bluemix_service_instances.New(transport, formats) + cli.Catalog = catalog.New(transport, formats) + cli.HardwarePlatforms = hardware_platforms.New(transport, formats) + cli.IaasServiceBroker = iaas_service_broker.New(transport, formats) + cli.InternalStorageRegions = internal_storage_regions.New(transport, formats) + cli.OpenStacks = open_stacks.New(transport, formats) + cli.PCloudCloudConnections = p_cloud_cloud_connections.New(transport, formats) + cli.PCloudEvents = p_cloud_events.New(transport, formats) + cli.PCloudImages = p_cloud_images.New(transport, formats) + cli.PCloudInstances = p_cloud_instances.New(transport, formats) + cli.PCloudJobs = p_cloud_jobs.New(transport, formats) + cli.PCloudNetworks = p_cloud_networks.New(transport, formats) + cli.PCloudpVMInstances = p_cloud_p_vm_instances.New(transport, formats) + cli.PCloudPlacementGroups = p_cloud_placement_groups.New(transport, formats) + cli.PCloudsap = p_cloud_s_a_p.New(transport, formats) + cli.PCloudServicedhcp = p_cloud_service_d_h_c_p.New(transport, formats) + cli.PCloudSnapshots = p_cloud_snapshots.New(transport, formats) + cli.PCloudStorageCapacity = p_cloud_storage_capacity.New(transport, formats) + cli.PCloudSystemPools = p_cloud_system_pools.New(transport, formats) + cli.PCloudTasks = p_cloud_tasks.New(transport, formats) + cli.PCloudTenants = p_cloud_tenants.New(transport, formats) + cli.PCloudTenantsSSHKeys = p_cloud_tenants_ssh_keys.New(transport, formats) + cli.PCloudvpnConnections = p_cloud_v_p_n_connections.New(transport, formats) + cli.PCloudvpnPolicies = p_cloud_v_p_n_policies.New(transport, formats) + cli.PCloudVolumes = p_cloud_volumes.New(transport, formats) + cli.ServiceBindings = service_bindings.New(transport, formats) + cli.ServiceInstances = service_instances.New(transport, formats) + cli.StorageTypes = storage_types.New(transport, formats) + cli.SwaggerSpec = swagger_spec.New(transport, formats) + return cli +} + +// DefaultTransportConfig creates a TransportConfig with the +// default settings taken from the meta section of the spec file. +func DefaultTransportConfig() *TransportConfig { + return &TransportConfig{ + Host: DefaultHost, + BasePath: DefaultBasePath, + Schemes: DefaultSchemes, + } +} + +// TransportConfig contains the transport related info, +// found in the meta section of the spec file. +type TransportConfig struct { + Host string + BasePath string + Schemes []string +} + +// WithHost overrides the default host, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithHost(host string) *TransportConfig { + cfg.Host = host + return cfg +} + +// WithBasePath overrides the default basePath, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { + cfg.BasePath = basePath + return cfg +} + +// WithSchemes overrides the default schemes, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { + cfg.Schemes = schemes + return cfg +} + +// PowerIaasAPI is a client for power iaas API +type PowerIaasAPI struct { + Authentication authentication.ClientService + + BluemixServiceInstances bluemix_service_instances.ClientService + + Catalog catalog.ClientService + + HardwarePlatforms hardware_platforms.ClientService + + IaasServiceBroker iaas_service_broker.ClientService + + InternalStorageRegions internal_storage_regions.ClientService + + OpenStacks open_stacks.ClientService + + PCloudCloudConnections p_cloud_cloud_connections.ClientService + + PCloudEvents p_cloud_events.ClientService + + PCloudImages p_cloud_images.ClientService + + PCloudInstances p_cloud_instances.ClientService + + PCloudJobs p_cloud_jobs.ClientService + + PCloudNetworks p_cloud_networks.ClientService + + PCloudpVMInstances p_cloud_p_vm_instances.ClientService + + PCloudPlacementGroups p_cloud_placement_groups.ClientService + + PCloudsap p_cloud_s_a_p.ClientService + + PCloudServicedhcp p_cloud_service_d_h_c_p.ClientService + + PCloudSnapshots p_cloud_snapshots.ClientService + + PCloudStorageCapacity p_cloud_storage_capacity.ClientService + + PCloudSystemPools p_cloud_system_pools.ClientService + + PCloudTasks p_cloud_tasks.ClientService + + PCloudTenants p_cloud_tenants.ClientService + + PCloudTenantsSSHKeys p_cloud_tenants_ssh_keys.ClientService + + PCloudvpnConnections p_cloud_v_p_n_connections.ClientService + + PCloudvpnPolicies p_cloud_v_p_n_policies.ClientService + + PCloudVolumes p_cloud_volumes.ClientService + + ServiceBindings service_bindings.ClientService + + ServiceInstances service_instances.ClientService + + StorageTypes storage_types.ClientService + + SwaggerSpec swagger_spec.ClientService + + Transport runtime.ClientTransport +} + +// SetTransport changes the transport on the client and all its subresources +func (c *PowerIaasAPI) SetTransport(transport runtime.ClientTransport) { + c.Transport = transport + c.Authentication.SetTransport(transport) + c.BluemixServiceInstances.SetTransport(transport) + c.Catalog.SetTransport(transport) + c.HardwarePlatforms.SetTransport(transport) + c.IaasServiceBroker.SetTransport(transport) + c.InternalStorageRegions.SetTransport(transport) + c.OpenStacks.SetTransport(transport) + c.PCloudCloudConnections.SetTransport(transport) + c.PCloudEvents.SetTransport(transport) + c.PCloudImages.SetTransport(transport) + c.PCloudInstances.SetTransport(transport) + c.PCloudJobs.SetTransport(transport) + c.PCloudNetworks.SetTransport(transport) + c.PCloudpVMInstances.SetTransport(transport) + c.PCloudPlacementGroups.SetTransport(transport) + c.PCloudsap.SetTransport(transport) + c.PCloudServicedhcp.SetTransport(transport) + c.PCloudSnapshots.SetTransport(transport) + c.PCloudStorageCapacity.SetTransport(transport) + c.PCloudSystemPools.SetTransport(transport) + c.PCloudTasks.SetTransport(transport) + c.PCloudTenants.SetTransport(transport) + c.PCloudTenantsSSHKeys.SetTransport(transport) + c.PCloudvpnConnections.SetTransport(transport) + c.PCloudvpnPolicies.SetTransport(transport) + c.PCloudVolumes.SetTransport(transport) + c.ServiceBindings.SetTransport(transport) + c.ServiceInstances.SetTransport(transport) + c.StorageTypes.SetTransport(transport) + c.SwaggerSpec.SetTransport(transport) +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_binding_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_binding_parameters.go new file mode 100644 index 00000000000..e2a1fc917c5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_binding_parameters.go @@ -0,0 +1,277 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_bindings + +// 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/go-openapi/swag" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// NewServiceBindingBindingParams creates a new ServiceBindingBindingParams 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 NewServiceBindingBindingParams() *ServiceBindingBindingParams { + return &ServiceBindingBindingParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBindingBindingParamsWithTimeout creates a new ServiceBindingBindingParams object +// with the ability to set a timeout on a request. +func NewServiceBindingBindingParamsWithTimeout(timeout time.Duration) *ServiceBindingBindingParams { + return &ServiceBindingBindingParams{ + timeout: timeout, + } +} + +// NewServiceBindingBindingParamsWithContext creates a new ServiceBindingBindingParams object +// with the ability to set a context for a request. +func NewServiceBindingBindingParamsWithContext(ctx context.Context) *ServiceBindingBindingParams { + return &ServiceBindingBindingParams{ + Context: ctx, + } +} + +// NewServiceBindingBindingParamsWithHTTPClient creates a new ServiceBindingBindingParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBindingBindingParamsWithHTTPClient(client *http.Client) *ServiceBindingBindingParams { + return &ServiceBindingBindingParams{ + HTTPClient: client, + } +} + +/* ServiceBindingBindingParams contains all the parameters to send to the API endpoint + for the service binding binding operation. + + Typically these are written to a http.Request. +*/ +type ServiceBindingBindingParams struct { + + /* XBrokerAPIOriginatingIdentity. + + identity of the user that initiated the request from the Platform + */ + XBrokerAPIOriginatingIdentity *string + + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use + */ + XBrokerAPIVersion string + + /* AcceptsIncomplete. + + asynchronous operations supported + */ + AcceptsIncomplete *bool + + /* BindingID. + + binding id of binding to create + */ + BindingID string + + /* Body. + + parameters for the requested service binding + */ + Body *models.ServiceBindingRequest + + /* InstanceID. + + instance id of instance to provision + */ + InstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service binding binding params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingBindingParams) WithDefaults() *ServiceBindingBindingParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service binding binding params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingBindingParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service binding binding params +func (o *ServiceBindingBindingParams) WithTimeout(timeout time.Duration) *ServiceBindingBindingParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service binding binding params +func (o *ServiceBindingBindingParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service binding binding params +func (o *ServiceBindingBindingParams) WithContext(ctx context.Context) *ServiceBindingBindingParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service binding binding params +func (o *ServiceBindingBindingParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service binding binding params +func (o *ServiceBindingBindingParams) WithHTTPClient(client *http.Client) *ServiceBindingBindingParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service binding binding params +func (o *ServiceBindingBindingParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithXBrokerAPIOriginatingIdentity adds the xBrokerAPIOriginatingIdentity to the service binding binding params +func (o *ServiceBindingBindingParams) WithXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity *string) *ServiceBindingBindingParams { + o.SetXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity) + return o +} + +// SetXBrokerAPIOriginatingIdentity adds the xBrokerApiOriginatingIdentity to the service binding binding params +func (o *ServiceBindingBindingParams) SetXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity *string) { + o.XBrokerAPIOriginatingIdentity = xBrokerAPIOriginatingIdentity +} + +// WithXBrokerAPIVersion adds the xBrokerAPIVersion to the service binding binding params +func (o *ServiceBindingBindingParams) WithXBrokerAPIVersion(xBrokerAPIVersion string) *ServiceBindingBindingParams { + o.SetXBrokerAPIVersion(xBrokerAPIVersion) + return o +} + +// SetXBrokerAPIVersion adds the xBrokerApiVersion to the service binding binding params +func (o *ServiceBindingBindingParams) SetXBrokerAPIVersion(xBrokerAPIVersion string) { + o.XBrokerAPIVersion = xBrokerAPIVersion +} + +// WithAcceptsIncomplete adds the acceptsIncomplete to the service binding binding params +func (o *ServiceBindingBindingParams) WithAcceptsIncomplete(acceptsIncomplete *bool) *ServiceBindingBindingParams { + o.SetAcceptsIncomplete(acceptsIncomplete) + return o +} + +// SetAcceptsIncomplete adds the acceptsIncomplete to the service binding binding params +func (o *ServiceBindingBindingParams) SetAcceptsIncomplete(acceptsIncomplete *bool) { + o.AcceptsIncomplete = acceptsIncomplete +} + +// WithBindingID adds the bindingID to the service binding binding params +func (o *ServiceBindingBindingParams) WithBindingID(bindingID string) *ServiceBindingBindingParams { + o.SetBindingID(bindingID) + return o +} + +// SetBindingID adds the bindingId to the service binding binding params +func (o *ServiceBindingBindingParams) SetBindingID(bindingID string) { + o.BindingID = bindingID +} + +// WithBody adds the body to the service binding binding params +func (o *ServiceBindingBindingParams) WithBody(body *models.ServiceBindingRequest) *ServiceBindingBindingParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the service binding binding params +func (o *ServiceBindingBindingParams) SetBody(body *models.ServiceBindingRequest) { + o.Body = body +} + +// WithInstanceID adds the instanceID to the service binding binding params +func (o *ServiceBindingBindingParams) WithInstanceID(instanceID string) *ServiceBindingBindingParams { + o.SetInstanceID(instanceID) + return o +} + +// SetInstanceID adds the instanceId to the service binding binding params +func (o *ServiceBindingBindingParams) SetInstanceID(instanceID string) { + o.InstanceID = instanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBindingBindingParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.XBrokerAPIOriginatingIdentity != nil { + + // header param X-Broker-API-Originating-Identity + if err := r.SetHeaderParam("X-Broker-API-Originating-Identity", *o.XBrokerAPIOriginatingIdentity); err != nil { + return err + } + } + + // header param X-Broker-API-Version + if err := r.SetHeaderParam("X-Broker-API-Version", o.XBrokerAPIVersion); err != nil { + return err + } + + if o.AcceptsIncomplete != nil { + + // query param accepts_incomplete + var qrAcceptsIncomplete bool + + if o.AcceptsIncomplete != nil { + qrAcceptsIncomplete = *o.AcceptsIncomplete + } + qAcceptsIncomplete := swag.FormatBool(qrAcceptsIncomplete) + if qAcceptsIncomplete != "" { + + if err := r.SetQueryParam("accepts_incomplete", qAcceptsIncomplete); err != nil { + return err + } + } + } + + // path param binding_id + if err := r.SetPathParam("binding_id", o.BindingID); err != nil { + return err + } + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param instance_id + if err := r.SetPathParam("instance_id", o.InstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_binding_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_binding_responses.go new file mode 100644 index 00000000000..8d6a348a2c6 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_binding_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_bindings + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBindingBindingReader is a Reader for the ServiceBindingBinding structure. +type ServiceBindingBindingReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBindingBindingReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBindingBindingOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 201: + result := NewServiceBindingBindingCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 202: + result := NewServiceBindingBindingAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceBindingBindingBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewServiceBindingBindingConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewServiceBindingBindingUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBindingBindingOK creates a ServiceBindingBindingOK with default headers values +func NewServiceBindingBindingOK() *ServiceBindingBindingOK { + return &ServiceBindingBindingOK{} +} + +/* ServiceBindingBindingOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBindingBindingOK struct { + Payload *models.ServiceBinding +} + +func (o *ServiceBindingBindingOK) Error() string { + return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingBindingOK %+v", 200, o.Payload) +} +func (o *ServiceBindingBindingOK) GetPayload() *models.ServiceBinding { + return o.Payload +} + +func (o *ServiceBindingBindingOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceBinding) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBindingBindingCreated creates a ServiceBindingBindingCreated with default headers values +func NewServiceBindingBindingCreated() *ServiceBindingBindingCreated { + return &ServiceBindingBindingCreated{} +} + +/* ServiceBindingBindingCreated describes a response with status code 201, with default header values. + +Created +*/ +type ServiceBindingBindingCreated struct { + Payload *models.ServiceBinding +} + +func (o *ServiceBindingBindingCreated) Error() string { + return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingBindingCreated %+v", 201, o.Payload) +} +func (o *ServiceBindingBindingCreated) GetPayload() *models.ServiceBinding { + return o.Payload +} + +func (o *ServiceBindingBindingCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceBinding) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBindingBindingAccepted creates a ServiceBindingBindingAccepted with default headers values +func NewServiceBindingBindingAccepted() *ServiceBindingBindingAccepted { + return &ServiceBindingBindingAccepted{} +} + +/* ServiceBindingBindingAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type ServiceBindingBindingAccepted struct { + Payload *models.AsyncOperation +} + +func (o *ServiceBindingBindingAccepted) Error() string { + return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingBindingAccepted %+v", 202, o.Payload) +} +func (o *ServiceBindingBindingAccepted) GetPayload() *models.AsyncOperation { + return o.Payload +} + +func (o *ServiceBindingBindingAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AsyncOperation) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBindingBindingBadRequest creates a ServiceBindingBindingBadRequest with default headers values +func NewServiceBindingBindingBadRequest() *ServiceBindingBindingBadRequest { + return &ServiceBindingBindingBadRequest{} +} + +/* ServiceBindingBindingBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ServiceBindingBindingBadRequest struct { + Payload *models.Error +} + +func (o *ServiceBindingBindingBadRequest) Error() string { + return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingBindingBadRequest %+v", 400, o.Payload) +} +func (o *ServiceBindingBindingBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBindingBindingBadRequest) 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 +} + +// NewServiceBindingBindingConflict creates a ServiceBindingBindingConflict with default headers values +func NewServiceBindingBindingConflict() *ServiceBindingBindingConflict { + return &ServiceBindingBindingConflict{} +} + +/* ServiceBindingBindingConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type ServiceBindingBindingConflict struct { + Payload *models.Error +} + +func (o *ServiceBindingBindingConflict) Error() string { + return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingBindingConflict %+v", 409, o.Payload) +} +func (o *ServiceBindingBindingConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBindingBindingConflict) 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 +} + +// NewServiceBindingBindingUnprocessableEntity creates a ServiceBindingBindingUnprocessableEntity with default headers values +func NewServiceBindingBindingUnprocessableEntity() *ServiceBindingBindingUnprocessableEntity { + return &ServiceBindingBindingUnprocessableEntity{} +} + +/* ServiceBindingBindingUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type ServiceBindingBindingUnprocessableEntity struct { + Payload *models.Error +} + +func (o *ServiceBindingBindingUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingBindingUnprocessableEntity %+v", 422, o.Payload) +} +func (o *ServiceBindingBindingUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBindingBindingUnprocessableEntity) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_get_parameters.go new file mode 100644 index 00000000000..98450eb6c29 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_get_parameters.go @@ -0,0 +1,218 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_bindings + +// 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" +) + +// NewServiceBindingGetParams creates a new ServiceBindingGetParams 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 NewServiceBindingGetParams() *ServiceBindingGetParams { + return &ServiceBindingGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBindingGetParamsWithTimeout creates a new ServiceBindingGetParams object +// with the ability to set a timeout on a request. +func NewServiceBindingGetParamsWithTimeout(timeout time.Duration) *ServiceBindingGetParams { + return &ServiceBindingGetParams{ + timeout: timeout, + } +} + +// NewServiceBindingGetParamsWithContext creates a new ServiceBindingGetParams object +// with the ability to set a context for a request. +func NewServiceBindingGetParamsWithContext(ctx context.Context) *ServiceBindingGetParams { + return &ServiceBindingGetParams{ + Context: ctx, + } +} + +// NewServiceBindingGetParamsWithHTTPClient creates a new ServiceBindingGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBindingGetParamsWithHTTPClient(client *http.Client) *ServiceBindingGetParams { + return &ServiceBindingGetParams{ + HTTPClient: client, + } +} + +/* ServiceBindingGetParams contains all the parameters to send to the API endpoint + for the service binding get operation. + + Typically these are written to a http.Request. +*/ +type ServiceBindingGetParams struct { + + /* XBrokerAPIOriginatingIdentity. + + identity of the user that initiated the request from the Platform + */ + XBrokerAPIOriginatingIdentity *string + + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use + */ + XBrokerAPIVersion string + + /* BindingID. + + binding id of binding to create + */ + BindingID string + + /* InstanceID. + + instance id of instance to provision + */ + InstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service binding get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingGetParams) WithDefaults() *ServiceBindingGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service binding get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service binding get params +func (o *ServiceBindingGetParams) WithTimeout(timeout time.Duration) *ServiceBindingGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service binding get params +func (o *ServiceBindingGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service binding get params +func (o *ServiceBindingGetParams) WithContext(ctx context.Context) *ServiceBindingGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service binding get params +func (o *ServiceBindingGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service binding get params +func (o *ServiceBindingGetParams) WithHTTPClient(client *http.Client) *ServiceBindingGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service binding get params +func (o *ServiceBindingGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithXBrokerAPIOriginatingIdentity adds the xBrokerAPIOriginatingIdentity to the service binding get params +func (o *ServiceBindingGetParams) WithXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity *string) *ServiceBindingGetParams { + o.SetXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity) + return o +} + +// SetXBrokerAPIOriginatingIdentity adds the xBrokerApiOriginatingIdentity to the service binding get params +func (o *ServiceBindingGetParams) SetXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity *string) { + o.XBrokerAPIOriginatingIdentity = xBrokerAPIOriginatingIdentity +} + +// WithXBrokerAPIVersion adds the xBrokerAPIVersion to the service binding get params +func (o *ServiceBindingGetParams) WithXBrokerAPIVersion(xBrokerAPIVersion string) *ServiceBindingGetParams { + o.SetXBrokerAPIVersion(xBrokerAPIVersion) + return o +} + +// SetXBrokerAPIVersion adds the xBrokerApiVersion to the service binding get params +func (o *ServiceBindingGetParams) SetXBrokerAPIVersion(xBrokerAPIVersion string) { + o.XBrokerAPIVersion = xBrokerAPIVersion +} + +// WithBindingID adds the bindingID to the service binding get params +func (o *ServiceBindingGetParams) WithBindingID(bindingID string) *ServiceBindingGetParams { + o.SetBindingID(bindingID) + return o +} + +// SetBindingID adds the bindingId to the service binding get params +func (o *ServiceBindingGetParams) SetBindingID(bindingID string) { + o.BindingID = bindingID +} + +// WithInstanceID adds the instanceID to the service binding get params +func (o *ServiceBindingGetParams) WithInstanceID(instanceID string) *ServiceBindingGetParams { + o.SetInstanceID(instanceID) + return o +} + +// SetInstanceID adds the instanceId to the service binding get params +func (o *ServiceBindingGetParams) SetInstanceID(instanceID string) { + o.InstanceID = instanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBindingGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.XBrokerAPIOriginatingIdentity != nil { + + // header param X-Broker-API-Originating-Identity + if err := r.SetHeaderParam("X-Broker-API-Originating-Identity", *o.XBrokerAPIOriginatingIdentity); err != nil { + return err + } + } + + // header param X-Broker-API-Version + if err := r.SetHeaderParam("X-Broker-API-Version", o.XBrokerAPIVersion); err != nil { + return err + } + + // path param binding_id + if err := r.SetPathParam("binding_id", o.BindingID); err != nil { + return err + } + + // path param instance_id + if err := r.SetPathParam("instance_id", o.InstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_get_responses.go new file mode 100644 index 00000000000..ba1f5d08def --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_get_responses.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_bindings + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBindingGetReader is a Reader for the ServiceBindingGet structure. +type ServiceBindingGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBindingGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBindingGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 404: + result := NewServiceBindingGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBindingGetOK creates a ServiceBindingGetOK with default headers values +func NewServiceBindingGetOK() *ServiceBindingGetOK { + return &ServiceBindingGetOK{} +} + +/* ServiceBindingGetOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBindingGetOK struct { + Payload *models.ServiceBindingResource +} + +func (o *ServiceBindingGetOK) Error() string { + return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingGetOK %+v", 200, o.Payload) +} +func (o *ServiceBindingGetOK) GetPayload() *models.ServiceBindingResource { + return o.Payload +} + +func (o *ServiceBindingGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceBindingResource) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBindingGetNotFound creates a ServiceBindingGetNotFound with default headers values +func NewServiceBindingGetNotFound() *ServiceBindingGetNotFound { + return &ServiceBindingGetNotFound{} +} + +/* ServiceBindingGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type ServiceBindingGetNotFound struct { + Payload *models.Error +} + +func (o *ServiceBindingGetNotFound) Error() string { + return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingGetNotFound %+v", 404, o.Payload) +} +func (o *ServiceBindingGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBindingGetNotFound) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_last_operation_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_last_operation_get_parameters.go new file mode 100644 index 00000000000..20ee289c29f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_last_operation_get_parameters.go @@ -0,0 +1,295 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_bindings + +// 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" +) + +// NewServiceBindingLastOperationGetParams creates a new ServiceBindingLastOperationGetParams 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 NewServiceBindingLastOperationGetParams() *ServiceBindingLastOperationGetParams { + return &ServiceBindingLastOperationGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBindingLastOperationGetParamsWithTimeout creates a new ServiceBindingLastOperationGetParams object +// with the ability to set a timeout on a request. +func NewServiceBindingLastOperationGetParamsWithTimeout(timeout time.Duration) *ServiceBindingLastOperationGetParams { + return &ServiceBindingLastOperationGetParams{ + timeout: timeout, + } +} + +// NewServiceBindingLastOperationGetParamsWithContext creates a new ServiceBindingLastOperationGetParams object +// with the ability to set a context for a request. +func NewServiceBindingLastOperationGetParamsWithContext(ctx context.Context) *ServiceBindingLastOperationGetParams { + return &ServiceBindingLastOperationGetParams{ + Context: ctx, + } +} + +// NewServiceBindingLastOperationGetParamsWithHTTPClient creates a new ServiceBindingLastOperationGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBindingLastOperationGetParamsWithHTTPClient(client *http.Client) *ServiceBindingLastOperationGetParams { + return &ServiceBindingLastOperationGetParams{ + HTTPClient: client, + } +} + +/* ServiceBindingLastOperationGetParams contains all the parameters to send to the API endpoint + for the service binding last operation get operation. + + Typically these are written to a http.Request. +*/ +type ServiceBindingLastOperationGetParams struct { + + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use + */ + XBrokerAPIVersion string + + /* BindingID. + + binding id of binding to create + */ + BindingID string + + /* InstanceID. + + instance id of instance to provision + */ + InstanceID string + + /* Operation. + + a provided identifier for the operation + */ + Operation *string + + /* PlanID. + + id of the plan associated with the instance + */ + PlanID *string + + /* ServiceID. + + id of the service associated with the instance + */ + ServiceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service binding last operation get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingLastOperationGetParams) WithDefaults() *ServiceBindingLastOperationGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service binding last operation get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingLastOperationGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) WithTimeout(timeout time.Duration) *ServiceBindingLastOperationGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) WithContext(ctx context.Context) *ServiceBindingLastOperationGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) WithHTTPClient(client *http.Client) *ServiceBindingLastOperationGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithXBrokerAPIVersion adds the xBrokerAPIVersion to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) WithXBrokerAPIVersion(xBrokerAPIVersion string) *ServiceBindingLastOperationGetParams { + o.SetXBrokerAPIVersion(xBrokerAPIVersion) + return o +} + +// SetXBrokerAPIVersion adds the xBrokerApiVersion to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) SetXBrokerAPIVersion(xBrokerAPIVersion string) { + o.XBrokerAPIVersion = xBrokerAPIVersion +} + +// WithBindingID adds the bindingID to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) WithBindingID(bindingID string) *ServiceBindingLastOperationGetParams { + o.SetBindingID(bindingID) + return o +} + +// SetBindingID adds the bindingId to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) SetBindingID(bindingID string) { + o.BindingID = bindingID +} + +// WithInstanceID adds the instanceID to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) WithInstanceID(instanceID string) *ServiceBindingLastOperationGetParams { + o.SetInstanceID(instanceID) + return o +} + +// SetInstanceID adds the instanceId to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) SetInstanceID(instanceID string) { + o.InstanceID = instanceID +} + +// WithOperation adds the operation to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) WithOperation(operation *string) *ServiceBindingLastOperationGetParams { + o.SetOperation(operation) + return o +} + +// SetOperation adds the operation to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) SetOperation(operation *string) { + o.Operation = operation +} + +// WithPlanID adds the planID to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) WithPlanID(planID *string) *ServiceBindingLastOperationGetParams { + o.SetPlanID(planID) + return o +} + +// SetPlanID adds the planId to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) SetPlanID(planID *string) { + o.PlanID = planID +} + +// WithServiceID adds the serviceID to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) WithServiceID(serviceID *string) *ServiceBindingLastOperationGetParams { + o.SetServiceID(serviceID) + return o +} + +// SetServiceID adds the serviceId to the service binding last operation get params +func (o *ServiceBindingLastOperationGetParams) SetServiceID(serviceID *string) { + o.ServiceID = serviceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBindingLastOperationGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // header param X-Broker-API-Version + if err := r.SetHeaderParam("X-Broker-API-Version", o.XBrokerAPIVersion); err != nil { + return err + } + + // path param binding_id + if err := r.SetPathParam("binding_id", o.BindingID); err != nil { + return err + } + + // path param instance_id + if err := r.SetPathParam("instance_id", o.InstanceID); err != nil { + return err + } + + if o.Operation != nil { + + // query param operation + var qrOperation string + + if o.Operation != nil { + qrOperation = *o.Operation + } + qOperation := qrOperation + if qOperation != "" { + + if err := r.SetQueryParam("operation", qOperation); err != nil { + return err + } + } + } + + if o.PlanID != nil { + + // query param plan_id + var qrPlanID string + + if o.PlanID != nil { + qrPlanID = *o.PlanID + } + qPlanID := qrPlanID + if qPlanID != "" { + + if err := r.SetQueryParam("plan_id", qPlanID); err != nil { + return err + } + } + } + + if o.ServiceID != nil { + + // query param service_id + var qrServiceID string + + if o.ServiceID != nil { + qrServiceID = *o.ServiceID + } + qServiceID := qrServiceID + if qServiceID != "" { + + if err := r.SetQueryParam("service_id", qServiceID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_last_operation_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_last_operation_get_responses.go new file mode 100644 index 00000000000..46779aad171 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_last_operation_get_responses.go @@ -0,0 +1,143 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_bindings + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBindingLastOperationGetReader is a Reader for the ServiceBindingLastOperationGet structure. +type ServiceBindingLastOperationGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBindingLastOperationGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBindingLastOperationGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceBindingLastOperationGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewServiceBindingLastOperationGetGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBindingLastOperationGetOK creates a ServiceBindingLastOperationGetOK with default headers values +func NewServiceBindingLastOperationGetOK() *ServiceBindingLastOperationGetOK { + return &ServiceBindingLastOperationGetOK{} +} + +/* ServiceBindingLastOperationGetOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBindingLastOperationGetOK struct { + Payload *models.LastOperationResource +} + +func (o *ServiceBindingLastOperationGetOK) Error() string { + return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}/last_operation][%d] serviceBindingLastOperationGetOK %+v", 200, o.Payload) +} +func (o *ServiceBindingLastOperationGetOK) GetPayload() *models.LastOperationResource { + return o.Payload +} + +func (o *ServiceBindingLastOperationGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.LastOperationResource) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBindingLastOperationGetBadRequest creates a ServiceBindingLastOperationGetBadRequest with default headers values +func NewServiceBindingLastOperationGetBadRequest() *ServiceBindingLastOperationGetBadRequest { + return &ServiceBindingLastOperationGetBadRequest{} +} + +/* ServiceBindingLastOperationGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ServiceBindingLastOperationGetBadRequest struct { + Payload *models.Error +} + +func (o *ServiceBindingLastOperationGetBadRequest) Error() string { + return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}/last_operation][%d] serviceBindingLastOperationGetBadRequest %+v", 400, o.Payload) +} +func (o *ServiceBindingLastOperationGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBindingLastOperationGetBadRequest) 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 +} + +// NewServiceBindingLastOperationGetGone creates a ServiceBindingLastOperationGetGone with default headers values +func NewServiceBindingLastOperationGetGone() *ServiceBindingLastOperationGetGone { + return &ServiceBindingLastOperationGetGone{} +} + +/* ServiceBindingLastOperationGetGone describes a response with status code 410, with default header values. + +Gone +*/ +type ServiceBindingLastOperationGetGone struct { + Payload *models.Error +} + +func (o *ServiceBindingLastOperationGetGone) Error() string { + return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/service_bindings/{binding_id}/last_operation][%d] serviceBindingLastOperationGetGone %+v", 410, o.Payload) +} +func (o *ServiceBindingLastOperationGetGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBindingLastOperationGetGone) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_unbinding_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_unbinding_parameters.go new file mode 100644 index 00000000000..fb2dc202daf --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_unbinding_parameters.go @@ -0,0 +1,307 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_bindings + +// 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/go-openapi/swag" +) + +// NewServiceBindingUnbindingParams creates a new ServiceBindingUnbindingParams 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 NewServiceBindingUnbindingParams() *ServiceBindingUnbindingParams { + return &ServiceBindingUnbindingParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBindingUnbindingParamsWithTimeout creates a new ServiceBindingUnbindingParams object +// with the ability to set a timeout on a request. +func NewServiceBindingUnbindingParamsWithTimeout(timeout time.Duration) *ServiceBindingUnbindingParams { + return &ServiceBindingUnbindingParams{ + timeout: timeout, + } +} + +// NewServiceBindingUnbindingParamsWithContext creates a new ServiceBindingUnbindingParams object +// with the ability to set a context for a request. +func NewServiceBindingUnbindingParamsWithContext(ctx context.Context) *ServiceBindingUnbindingParams { + return &ServiceBindingUnbindingParams{ + Context: ctx, + } +} + +// NewServiceBindingUnbindingParamsWithHTTPClient creates a new ServiceBindingUnbindingParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBindingUnbindingParamsWithHTTPClient(client *http.Client) *ServiceBindingUnbindingParams { + return &ServiceBindingUnbindingParams{ + HTTPClient: client, + } +} + +/* ServiceBindingUnbindingParams contains all the parameters to send to the API endpoint + for the service binding unbinding operation. + + Typically these are written to a http.Request. +*/ +type ServiceBindingUnbindingParams struct { + + /* XBrokerAPIOriginatingIdentity. + + identity of the user that initiated the request from the Platform + */ + XBrokerAPIOriginatingIdentity *string + + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use + */ + XBrokerAPIVersion string + + /* AcceptsIncomplete. + + asynchronous operations supported + */ + AcceptsIncomplete *bool + + /* BindingID. + + binding id of binding to create + */ + BindingID string + + /* InstanceID. + + instance id of instance to provision + */ + InstanceID string + + /* PlanID. + + id of the plan associated with the instance being deleted + */ + PlanID string + + /* ServiceID. + + id of the service associated with the instance being deleted + */ + ServiceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service binding unbinding params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingUnbindingParams) WithDefaults() *ServiceBindingUnbindingParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service binding unbinding params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBindingUnbindingParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) WithTimeout(timeout time.Duration) *ServiceBindingUnbindingParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) WithContext(ctx context.Context) *ServiceBindingUnbindingParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) WithHTTPClient(client *http.Client) *ServiceBindingUnbindingParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithXBrokerAPIOriginatingIdentity adds the xBrokerAPIOriginatingIdentity to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) WithXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity *string) *ServiceBindingUnbindingParams { + o.SetXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity) + return o +} + +// SetXBrokerAPIOriginatingIdentity adds the xBrokerApiOriginatingIdentity to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) SetXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity *string) { + o.XBrokerAPIOriginatingIdentity = xBrokerAPIOriginatingIdentity +} + +// WithXBrokerAPIVersion adds the xBrokerAPIVersion to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) WithXBrokerAPIVersion(xBrokerAPIVersion string) *ServiceBindingUnbindingParams { + o.SetXBrokerAPIVersion(xBrokerAPIVersion) + return o +} + +// SetXBrokerAPIVersion adds the xBrokerApiVersion to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) SetXBrokerAPIVersion(xBrokerAPIVersion string) { + o.XBrokerAPIVersion = xBrokerAPIVersion +} + +// WithAcceptsIncomplete adds the acceptsIncomplete to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) WithAcceptsIncomplete(acceptsIncomplete *bool) *ServiceBindingUnbindingParams { + o.SetAcceptsIncomplete(acceptsIncomplete) + return o +} + +// SetAcceptsIncomplete adds the acceptsIncomplete to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) SetAcceptsIncomplete(acceptsIncomplete *bool) { + o.AcceptsIncomplete = acceptsIncomplete +} + +// WithBindingID adds the bindingID to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) WithBindingID(bindingID string) *ServiceBindingUnbindingParams { + o.SetBindingID(bindingID) + return o +} + +// SetBindingID adds the bindingId to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) SetBindingID(bindingID string) { + o.BindingID = bindingID +} + +// WithInstanceID adds the instanceID to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) WithInstanceID(instanceID string) *ServiceBindingUnbindingParams { + o.SetInstanceID(instanceID) + return o +} + +// SetInstanceID adds the instanceId to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) SetInstanceID(instanceID string) { + o.InstanceID = instanceID +} + +// WithPlanID adds the planID to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) WithPlanID(planID string) *ServiceBindingUnbindingParams { + o.SetPlanID(planID) + return o +} + +// SetPlanID adds the planId to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) SetPlanID(planID string) { + o.PlanID = planID +} + +// WithServiceID adds the serviceID to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) WithServiceID(serviceID string) *ServiceBindingUnbindingParams { + o.SetServiceID(serviceID) + return o +} + +// SetServiceID adds the serviceId to the service binding unbinding params +func (o *ServiceBindingUnbindingParams) SetServiceID(serviceID string) { + o.ServiceID = serviceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBindingUnbindingParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.XBrokerAPIOriginatingIdentity != nil { + + // header param X-Broker-API-Originating-Identity + if err := r.SetHeaderParam("X-Broker-API-Originating-Identity", *o.XBrokerAPIOriginatingIdentity); err != nil { + return err + } + } + + // header param X-Broker-API-Version + if err := r.SetHeaderParam("X-Broker-API-Version", o.XBrokerAPIVersion); err != nil { + return err + } + + if o.AcceptsIncomplete != nil { + + // query param accepts_incomplete + var qrAcceptsIncomplete bool + + if o.AcceptsIncomplete != nil { + qrAcceptsIncomplete = *o.AcceptsIncomplete + } + qAcceptsIncomplete := swag.FormatBool(qrAcceptsIncomplete) + if qAcceptsIncomplete != "" { + + if err := r.SetQueryParam("accepts_incomplete", qAcceptsIncomplete); err != nil { + return err + } + } + } + + // path param binding_id + if err := r.SetPathParam("binding_id", o.BindingID); err != nil { + return err + } + + // path param instance_id + if err := r.SetPathParam("instance_id", o.InstanceID); err != nil { + return err + } + + // query param plan_id + qrPlanID := o.PlanID + qPlanID := qrPlanID + if qPlanID != "" { + + if err := r.SetQueryParam("plan_id", qPlanID); err != nil { + return err + } + } + + // query param service_id + qrServiceID := o.ServiceID + qServiceID := qrServiceID + if qServiceID != "" { + + if err := r.SetQueryParam("service_id", qServiceID); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_unbinding_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_unbinding_responses.go new file mode 100644 index 00000000000..2416449a3f8 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_binding_unbinding_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_bindings + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBindingUnbindingReader is a Reader for the ServiceBindingUnbinding structure. +type ServiceBindingUnbindingReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBindingUnbindingReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBindingUnbindingOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 202: + result := NewServiceBindingUnbindingAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceBindingUnbindingBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewServiceBindingUnbindingGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBindingUnbindingOK creates a ServiceBindingUnbindingOK with default headers values +func NewServiceBindingUnbindingOK() *ServiceBindingUnbindingOK { + return &ServiceBindingUnbindingOK{} +} + +/* ServiceBindingUnbindingOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBindingUnbindingOK struct { + Payload models.Object +} + +func (o *ServiceBindingUnbindingOK) Error() string { + return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingUnbindingOK %+v", 200, o.Payload) +} +func (o *ServiceBindingUnbindingOK) GetPayload() models.Object { + return o.Payload +} + +func (o *ServiceBindingUnbindingOK) 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 +} + +// NewServiceBindingUnbindingAccepted creates a ServiceBindingUnbindingAccepted with default headers values +func NewServiceBindingUnbindingAccepted() *ServiceBindingUnbindingAccepted { + return &ServiceBindingUnbindingAccepted{} +} + +/* ServiceBindingUnbindingAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type ServiceBindingUnbindingAccepted struct { + Payload *models.AsyncOperation +} + +func (o *ServiceBindingUnbindingAccepted) Error() string { + return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingUnbindingAccepted %+v", 202, o.Payload) +} +func (o *ServiceBindingUnbindingAccepted) GetPayload() *models.AsyncOperation { + return o.Payload +} + +func (o *ServiceBindingUnbindingAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AsyncOperation) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceBindingUnbindingBadRequest creates a ServiceBindingUnbindingBadRequest with default headers values +func NewServiceBindingUnbindingBadRequest() *ServiceBindingUnbindingBadRequest { + return &ServiceBindingUnbindingBadRequest{} +} + +/* ServiceBindingUnbindingBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ServiceBindingUnbindingBadRequest struct { + Payload *models.Error +} + +func (o *ServiceBindingUnbindingBadRequest) Error() string { + return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingUnbindingBadRequest %+v", 400, o.Payload) +} +func (o *ServiceBindingUnbindingBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBindingUnbindingBadRequest) 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 +} + +// NewServiceBindingUnbindingGone creates a ServiceBindingUnbindingGone with default headers values +func NewServiceBindingUnbindingGone() *ServiceBindingUnbindingGone { + return &ServiceBindingUnbindingGone{} +} + +/* ServiceBindingUnbindingGone describes a response with status code 410, with default header values. + +Gone +*/ +type ServiceBindingUnbindingGone struct { + Payload *models.Error +} + +func (o *ServiceBindingUnbindingGone) Error() string { + return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}/service_bindings/{binding_id}][%d] serviceBindingUnbindingGone %+v", 410, o.Payload) +} +func (o *ServiceBindingUnbindingGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBindingUnbindingGone) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_bindings_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_bindings_client.go new file mode 100644 index 00000000000..554b058d834 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_bindings/service_bindings_client.go @@ -0,0 +1,207 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_bindings + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new service bindings API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for service bindings API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceBindingBinding(params *ServiceBindingBindingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingBindingOK, *ServiceBindingBindingCreated, *ServiceBindingBindingAccepted, error) + + ServiceBindingGet(params *ServiceBindingGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingGetOK, error) + + ServiceBindingLastOperationGet(params *ServiceBindingLastOperationGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingLastOperationGetOK, error) + + ServiceBindingUnbinding(params *ServiceBindingUnbindingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingUnbindingOK, *ServiceBindingUnbindingAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + ServiceBindingBinding generations of a service binding +*/ +func (a *Client) ServiceBindingBinding(params *ServiceBindingBindingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingBindingOK, *ServiceBindingBindingCreated, *ServiceBindingBindingAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBindingBindingParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBinding.binding", + Method: "PUT", + PathPattern: "/v2/service_instances/{instance_id}/service_bindings/{binding_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBindingBindingReader{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, nil, err + } + switch value := result.(type) { + case *ServiceBindingBindingOK: + return value, nil, nil, nil + case *ServiceBindingBindingCreated: + return nil, value, nil, nil + case *ServiceBindingBindingAccepted: + return nil, 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 service_bindings: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBindingGet gets a service binding +*/ +func (a *Client) ServiceBindingGet(params *ServiceBindingGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBindingGetParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBinding.get", + Method: "GET", + PathPattern: "/v2/service_instances/{instance_id}/service_bindings/{binding_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBindingGetReader{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.(*ServiceBindingGetOK) + 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 serviceBinding.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBindingLastOperationGet lasts requested operation state for service binding +*/ +func (a *Client) ServiceBindingLastOperationGet(params *ServiceBindingLastOperationGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingLastOperationGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBindingLastOperationGetParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBinding.lastOperation.get", + Method: "GET", + PathPattern: "/v2/service_instances/{instance_id}/service_bindings/{binding_id}/last_operation", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBindingLastOperationGetReader{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.(*ServiceBindingLastOperationGetOK) + 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 serviceBinding.lastOperation.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceBindingUnbinding deprovisions of a service binding +*/ +func (a *Client) ServiceBindingUnbinding(params *ServiceBindingUnbindingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceBindingUnbindingOK, *ServiceBindingUnbindingAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBindingUnbindingParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBinding.unbinding", + Method: "DELETE", + PathPattern: "/v2/service_instances/{instance_id}/service_bindings/{binding_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBindingUnbindingReader{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 *ServiceBindingUnbindingOK: + return value, nil, nil + case *ServiceBindingUnbindingAccepted: + 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 service_bindings: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_deprovision_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_deprovision_parameters.go new file mode 100644 index 00000000000..a9f8033ef78 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_deprovision_parameters.go @@ -0,0 +1,285 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_instances + +// 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/go-openapi/swag" +) + +// NewServiceInstanceDeprovisionParams creates a new ServiceInstanceDeprovisionParams 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 NewServiceInstanceDeprovisionParams() *ServiceInstanceDeprovisionParams { + return &ServiceInstanceDeprovisionParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceInstanceDeprovisionParamsWithTimeout creates a new ServiceInstanceDeprovisionParams object +// with the ability to set a timeout on a request. +func NewServiceInstanceDeprovisionParamsWithTimeout(timeout time.Duration) *ServiceInstanceDeprovisionParams { + return &ServiceInstanceDeprovisionParams{ + timeout: timeout, + } +} + +// NewServiceInstanceDeprovisionParamsWithContext creates a new ServiceInstanceDeprovisionParams object +// with the ability to set a context for a request. +func NewServiceInstanceDeprovisionParamsWithContext(ctx context.Context) *ServiceInstanceDeprovisionParams { + return &ServiceInstanceDeprovisionParams{ + Context: ctx, + } +} + +// NewServiceInstanceDeprovisionParamsWithHTTPClient creates a new ServiceInstanceDeprovisionParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceInstanceDeprovisionParamsWithHTTPClient(client *http.Client) *ServiceInstanceDeprovisionParams { + return &ServiceInstanceDeprovisionParams{ + HTTPClient: client, + } +} + +/* ServiceInstanceDeprovisionParams contains all the parameters to send to the API endpoint + for the service instance deprovision operation. + + Typically these are written to a http.Request. +*/ +type ServiceInstanceDeprovisionParams struct { + + /* XBrokerAPIOriginatingIdentity. + + identity of the user that initiated the request from the Platform + */ + XBrokerAPIOriginatingIdentity *string + + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use + */ + XBrokerAPIVersion string + + /* AcceptsIncomplete. + + asynchronous operations supported + */ + AcceptsIncomplete *bool + + /* InstanceID. + + instance id of instance to provision + */ + InstanceID string + + /* PlanID. + + id of the plan associated with the instance being deleted + */ + PlanID string + + /* ServiceID. + + id of the service associated with the instance being deleted + */ + ServiceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service instance deprovision params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceDeprovisionParams) WithDefaults() *ServiceInstanceDeprovisionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service instance deprovision params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceDeprovisionParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) WithTimeout(timeout time.Duration) *ServiceInstanceDeprovisionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) WithContext(ctx context.Context) *ServiceInstanceDeprovisionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) WithHTTPClient(client *http.Client) *ServiceInstanceDeprovisionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithXBrokerAPIOriginatingIdentity adds the xBrokerAPIOriginatingIdentity to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) WithXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity *string) *ServiceInstanceDeprovisionParams { + o.SetXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity) + return o +} + +// SetXBrokerAPIOriginatingIdentity adds the xBrokerApiOriginatingIdentity to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) SetXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity *string) { + o.XBrokerAPIOriginatingIdentity = xBrokerAPIOriginatingIdentity +} + +// WithXBrokerAPIVersion adds the xBrokerAPIVersion to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) WithXBrokerAPIVersion(xBrokerAPIVersion string) *ServiceInstanceDeprovisionParams { + o.SetXBrokerAPIVersion(xBrokerAPIVersion) + return o +} + +// SetXBrokerAPIVersion adds the xBrokerApiVersion to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) SetXBrokerAPIVersion(xBrokerAPIVersion string) { + o.XBrokerAPIVersion = xBrokerAPIVersion +} + +// WithAcceptsIncomplete adds the acceptsIncomplete to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) WithAcceptsIncomplete(acceptsIncomplete *bool) *ServiceInstanceDeprovisionParams { + o.SetAcceptsIncomplete(acceptsIncomplete) + return o +} + +// SetAcceptsIncomplete adds the acceptsIncomplete to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) SetAcceptsIncomplete(acceptsIncomplete *bool) { + o.AcceptsIncomplete = acceptsIncomplete +} + +// WithInstanceID adds the instanceID to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) WithInstanceID(instanceID string) *ServiceInstanceDeprovisionParams { + o.SetInstanceID(instanceID) + return o +} + +// SetInstanceID adds the instanceId to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) SetInstanceID(instanceID string) { + o.InstanceID = instanceID +} + +// WithPlanID adds the planID to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) WithPlanID(planID string) *ServiceInstanceDeprovisionParams { + o.SetPlanID(planID) + return o +} + +// SetPlanID adds the planId to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) SetPlanID(planID string) { + o.PlanID = planID +} + +// WithServiceID adds the serviceID to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) WithServiceID(serviceID string) *ServiceInstanceDeprovisionParams { + o.SetServiceID(serviceID) + return o +} + +// SetServiceID adds the serviceId to the service instance deprovision params +func (o *ServiceInstanceDeprovisionParams) SetServiceID(serviceID string) { + o.ServiceID = serviceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceInstanceDeprovisionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.XBrokerAPIOriginatingIdentity != nil { + + // header param X-Broker-API-Originating-Identity + if err := r.SetHeaderParam("X-Broker-API-Originating-Identity", *o.XBrokerAPIOriginatingIdentity); err != nil { + return err + } + } + + // header param X-Broker-API-Version + if err := r.SetHeaderParam("X-Broker-API-Version", o.XBrokerAPIVersion); err != nil { + return err + } + + if o.AcceptsIncomplete != nil { + + // query param accepts_incomplete + var qrAcceptsIncomplete bool + + if o.AcceptsIncomplete != nil { + qrAcceptsIncomplete = *o.AcceptsIncomplete + } + qAcceptsIncomplete := swag.FormatBool(qrAcceptsIncomplete) + if qAcceptsIncomplete != "" { + + if err := r.SetQueryParam("accepts_incomplete", qAcceptsIncomplete); err != nil { + return err + } + } + } + + // path param instance_id + if err := r.SetPathParam("instance_id", o.InstanceID); err != nil { + return err + } + + // query param plan_id + qrPlanID := o.PlanID + qPlanID := qrPlanID + if qPlanID != "" { + + if err := r.SetQueryParam("plan_id", qPlanID); err != nil { + return err + } + } + + // query param service_id + qrServiceID := o.ServiceID + qServiceID := qrServiceID + if qServiceID != "" { + + if err := r.SetQueryParam("service_id", qServiceID); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_deprovision_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_deprovision_responses.go new file mode 100644 index 00000000000..1ae4ec9dac2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_deprovision_responses.go @@ -0,0 +1,217 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceInstanceDeprovisionReader is a Reader for the ServiceInstanceDeprovision structure. +type ServiceInstanceDeprovisionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceInstanceDeprovisionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceInstanceDeprovisionOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 202: + result := NewServiceInstanceDeprovisionAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceInstanceDeprovisionBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewServiceInstanceDeprovisionGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewServiceInstanceDeprovisionUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceInstanceDeprovisionOK creates a ServiceInstanceDeprovisionOK with default headers values +func NewServiceInstanceDeprovisionOK() *ServiceInstanceDeprovisionOK { + return &ServiceInstanceDeprovisionOK{} +} + +/* ServiceInstanceDeprovisionOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceInstanceDeprovisionOK struct { + Payload models.Object +} + +func (o *ServiceInstanceDeprovisionOK) Error() string { + return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}][%d] serviceInstanceDeprovisionOK %+v", 200, o.Payload) +} +func (o *ServiceInstanceDeprovisionOK) GetPayload() models.Object { + return o.Payload +} + +func (o *ServiceInstanceDeprovisionOK) 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 +} + +// NewServiceInstanceDeprovisionAccepted creates a ServiceInstanceDeprovisionAccepted with default headers values +func NewServiceInstanceDeprovisionAccepted() *ServiceInstanceDeprovisionAccepted { + return &ServiceInstanceDeprovisionAccepted{} +} + +/* ServiceInstanceDeprovisionAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type ServiceInstanceDeprovisionAccepted struct { + Payload *models.AsyncOperation +} + +func (o *ServiceInstanceDeprovisionAccepted) Error() string { + return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}][%d] serviceInstanceDeprovisionAccepted %+v", 202, o.Payload) +} +func (o *ServiceInstanceDeprovisionAccepted) GetPayload() *models.AsyncOperation { + return o.Payload +} + +func (o *ServiceInstanceDeprovisionAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AsyncOperation) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceInstanceDeprovisionBadRequest creates a ServiceInstanceDeprovisionBadRequest with default headers values +func NewServiceInstanceDeprovisionBadRequest() *ServiceInstanceDeprovisionBadRequest { + return &ServiceInstanceDeprovisionBadRequest{} +} + +/* ServiceInstanceDeprovisionBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ServiceInstanceDeprovisionBadRequest struct { + Payload *models.Error +} + +func (o *ServiceInstanceDeprovisionBadRequest) Error() string { + return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}][%d] serviceInstanceDeprovisionBadRequest %+v", 400, o.Payload) +} +func (o *ServiceInstanceDeprovisionBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceInstanceDeprovisionBadRequest) 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 +} + +// NewServiceInstanceDeprovisionGone creates a ServiceInstanceDeprovisionGone with default headers values +func NewServiceInstanceDeprovisionGone() *ServiceInstanceDeprovisionGone { + return &ServiceInstanceDeprovisionGone{} +} + +/* ServiceInstanceDeprovisionGone describes a response with status code 410, with default header values. + +Gone +*/ +type ServiceInstanceDeprovisionGone struct { + Payload *models.Error +} + +func (o *ServiceInstanceDeprovisionGone) Error() string { + return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}][%d] serviceInstanceDeprovisionGone %+v", 410, o.Payload) +} +func (o *ServiceInstanceDeprovisionGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceInstanceDeprovisionGone) 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 +} + +// NewServiceInstanceDeprovisionUnprocessableEntity creates a ServiceInstanceDeprovisionUnprocessableEntity with default headers values +func NewServiceInstanceDeprovisionUnprocessableEntity() *ServiceInstanceDeprovisionUnprocessableEntity { + return &ServiceInstanceDeprovisionUnprocessableEntity{} +} + +/* ServiceInstanceDeprovisionUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type ServiceInstanceDeprovisionUnprocessableEntity struct { + Payload *models.Error +} + +func (o *ServiceInstanceDeprovisionUnprocessableEntity) Error() string { + return fmt.Sprintf("[DELETE /v2/service_instances/{instance_id}][%d] serviceInstanceDeprovisionUnprocessableEntity %+v", 422, o.Payload) +} +func (o *ServiceInstanceDeprovisionUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceInstanceDeprovisionUnprocessableEntity) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_get_parameters.go new file mode 100644 index 00000000000..c3594fe6d0b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_get_parameters.go @@ -0,0 +1,196 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_instances + +// 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" +) + +// NewServiceInstanceGetParams creates a new ServiceInstanceGetParams 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 NewServiceInstanceGetParams() *ServiceInstanceGetParams { + return &ServiceInstanceGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceInstanceGetParamsWithTimeout creates a new ServiceInstanceGetParams object +// with the ability to set a timeout on a request. +func NewServiceInstanceGetParamsWithTimeout(timeout time.Duration) *ServiceInstanceGetParams { + return &ServiceInstanceGetParams{ + timeout: timeout, + } +} + +// NewServiceInstanceGetParamsWithContext creates a new ServiceInstanceGetParams object +// with the ability to set a context for a request. +func NewServiceInstanceGetParamsWithContext(ctx context.Context) *ServiceInstanceGetParams { + return &ServiceInstanceGetParams{ + Context: ctx, + } +} + +// NewServiceInstanceGetParamsWithHTTPClient creates a new ServiceInstanceGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceInstanceGetParamsWithHTTPClient(client *http.Client) *ServiceInstanceGetParams { + return &ServiceInstanceGetParams{ + HTTPClient: client, + } +} + +/* ServiceInstanceGetParams contains all the parameters to send to the API endpoint + for the service instance get operation. + + Typically these are written to a http.Request. +*/ +type ServiceInstanceGetParams struct { + + /* XBrokerAPIOriginatingIdentity. + + identity of the user that initiated the request from the Platform + */ + XBrokerAPIOriginatingIdentity *string + + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use + */ + XBrokerAPIVersion string + + /* InstanceID. + + instance id of instance to provision + */ + InstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service instance get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceGetParams) WithDefaults() *ServiceInstanceGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service instance get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service instance get params +func (o *ServiceInstanceGetParams) WithTimeout(timeout time.Duration) *ServiceInstanceGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service instance get params +func (o *ServiceInstanceGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service instance get params +func (o *ServiceInstanceGetParams) WithContext(ctx context.Context) *ServiceInstanceGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service instance get params +func (o *ServiceInstanceGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service instance get params +func (o *ServiceInstanceGetParams) WithHTTPClient(client *http.Client) *ServiceInstanceGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service instance get params +func (o *ServiceInstanceGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithXBrokerAPIOriginatingIdentity adds the xBrokerAPIOriginatingIdentity to the service instance get params +func (o *ServiceInstanceGetParams) WithXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity *string) *ServiceInstanceGetParams { + o.SetXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity) + return o +} + +// SetXBrokerAPIOriginatingIdentity adds the xBrokerApiOriginatingIdentity to the service instance get params +func (o *ServiceInstanceGetParams) SetXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity *string) { + o.XBrokerAPIOriginatingIdentity = xBrokerAPIOriginatingIdentity +} + +// WithXBrokerAPIVersion adds the xBrokerAPIVersion to the service instance get params +func (o *ServiceInstanceGetParams) WithXBrokerAPIVersion(xBrokerAPIVersion string) *ServiceInstanceGetParams { + o.SetXBrokerAPIVersion(xBrokerAPIVersion) + return o +} + +// SetXBrokerAPIVersion adds the xBrokerApiVersion to the service instance get params +func (o *ServiceInstanceGetParams) SetXBrokerAPIVersion(xBrokerAPIVersion string) { + o.XBrokerAPIVersion = xBrokerAPIVersion +} + +// WithInstanceID adds the instanceID to the service instance get params +func (o *ServiceInstanceGetParams) WithInstanceID(instanceID string) *ServiceInstanceGetParams { + o.SetInstanceID(instanceID) + return o +} + +// SetInstanceID adds the instanceId to the service instance get params +func (o *ServiceInstanceGetParams) SetInstanceID(instanceID string) { + o.InstanceID = instanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceInstanceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.XBrokerAPIOriginatingIdentity != nil { + + // header param X-Broker-API-Originating-Identity + if err := r.SetHeaderParam("X-Broker-API-Originating-Identity", *o.XBrokerAPIOriginatingIdentity); err != nil { + return err + } + } + + // header param X-Broker-API-Version + if err := r.SetHeaderParam("X-Broker-API-Version", o.XBrokerAPIVersion); err != nil { + return err + } + + // path param instance_id + if err := r.SetPathParam("instance_id", o.InstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_get_responses.go new file mode 100644 index 00000000000..94ecfeca2c9 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_get_responses.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceInstanceGetReader is a Reader for the ServiceInstanceGet structure. +type ServiceInstanceGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceInstanceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceInstanceGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 404: + result := NewServiceInstanceGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceInstanceGetOK creates a ServiceInstanceGetOK with default headers values +func NewServiceInstanceGetOK() *ServiceInstanceGetOK { + return &ServiceInstanceGetOK{} +} + +/* ServiceInstanceGetOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceInstanceGetOK struct { + Payload *models.ServiceInstanceResource +} + +func (o *ServiceInstanceGetOK) Error() string { + return fmt.Sprintf("[GET /v2/service_instances/{instance_id}][%d] serviceInstanceGetOK %+v", 200, o.Payload) +} +func (o *ServiceInstanceGetOK) GetPayload() *models.ServiceInstanceResource { + return o.Payload +} + +func (o *ServiceInstanceGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceInstanceResource) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceInstanceGetNotFound creates a ServiceInstanceGetNotFound with default headers values +func NewServiceInstanceGetNotFound() *ServiceInstanceGetNotFound { + return &ServiceInstanceGetNotFound{} +} + +/* ServiceInstanceGetNotFound describes a response with status code 404, with default header values. + +Not Found +*/ +type ServiceInstanceGetNotFound struct { + Payload *models.Error +} + +func (o *ServiceInstanceGetNotFound) Error() string { + return fmt.Sprintf("[GET /v2/service_instances/{instance_id}][%d] serviceInstanceGetNotFound %+v", 404, o.Payload) +} +func (o *ServiceInstanceGetNotFound) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceInstanceGetNotFound) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_last_operation_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_last_operation_get_parameters.go new file mode 100644 index 00000000000..8c735cce5ef --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_last_operation_get_parameters.go @@ -0,0 +1,273 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_instances + +// 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" +) + +// NewServiceInstanceLastOperationGetParams creates a new ServiceInstanceLastOperationGetParams 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 NewServiceInstanceLastOperationGetParams() *ServiceInstanceLastOperationGetParams { + return &ServiceInstanceLastOperationGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceInstanceLastOperationGetParamsWithTimeout creates a new ServiceInstanceLastOperationGetParams object +// with the ability to set a timeout on a request. +func NewServiceInstanceLastOperationGetParamsWithTimeout(timeout time.Duration) *ServiceInstanceLastOperationGetParams { + return &ServiceInstanceLastOperationGetParams{ + timeout: timeout, + } +} + +// NewServiceInstanceLastOperationGetParamsWithContext creates a new ServiceInstanceLastOperationGetParams object +// with the ability to set a context for a request. +func NewServiceInstanceLastOperationGetParamsWithContext(ctx context.Context) *ServiceInstanceLastOperationGetParams { + return &ServiceInstanceLastOperationGetParams{ + Context: ctx, + } +} + +// NewServiceInstanceLastOperationGetParamsWithHTTPClient creates a new ServiceInstanceLastOperationGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceInstanceLastOperationGetParamsWithHTTPClient(client *http.Client) *ServiceInstanceLastOperationGetParams { + return &ServiceInstanceLastOperationGetParams{ + HTTPClient: client, + } +} + +/* ServiceInstanceLastOperationGetParams contains all the parameters to send to the API endpoint + for the service instance last operation get operation. + + Typically these are written to a http.Request. +*/ +type ServiceInstanceLastOperationGetParams struct { + + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use + */ + XBrokerAPIVersion string + + /* InstanceID. + + instance id of instance to provision + */ + InstanceID string + + /* Operation. + + a provided identifier for the operation + */ + Operation *string + + /* PlanID. + + id of the plan associated with the instance + */ + PlanID *string + + /* ServiceID. + + id of the service associated with the instance + */ + ServiceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service instance last operation get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceLastOperationGetParams) WithDefaults() *ServiceInstanceLastOperationGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service instance last operation get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceLastOperationGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) WithTimeout(timeout time.Duration) *ServiceInstanceLastOperationGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) WithContext(ctx context.Context) *ServiceInstanceLastOperationGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) WithHTTPClient(client *http.Client) *ServiceInstanceLastOperationGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithXBrokerAPIVersion adds the xBrokerAPIVersion to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) WithXBrokerAPIVersion(xBrokerAPIVersion string) *ServiceInstanceLastOperationGetParams { + o.SetXBrokerAPIVersion(xBrokerAPIVersion) + return o +} + +// SetXBrokerAPIVersion adds the xBrokerApiVersion to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) SetXBrokerAPIVersion(xBrokerAPIVersion string) { + o.XBrokerAPIVersion = xBrokerAPIVersion +} + +// WithInstanceID adds the instanceID to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) WithInstanceID(instanceID string) *ServiceInstanceLastOperationGetParams { + o.SetInstanceID(instanceID) + return o +} + +// SetInstanceID adds the instanceId to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) SetInstanceID(instanceID string) { + o.InstanceID = instanceID +} + +// WithOperation adds the operation to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) WithOperation(operation *string) *ServiceInstanceLastOperationGetParams { + o.SetOperation(operation) + return o +} + +// SetOperation adds the operation to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) SetOperation(operation *string) { + o.Operation = operation +} + +// WithPlanID adds the planID to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) WithPlanID(planID *string) *ServiceInstanceLastOperationGetParams { + o.SetPlanID(planID) + return o +} + +// SetPlanID adds the planId to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) SetPlanID(planID *string) { + o.PlanID = planID +} + +// WithServiceID adds the serviceID to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) WithServiceID(serviceID *string) *ServiceInstanceLastOperationGetParams { + o.SetServiceID(serviceID) + return o +} + +// SetServiceID adds the serviceId to the service instance last operation get params +func (o *ServiceInstanceLastOperationGetParams) SetServiceID(serviceID *string) { + o.ServiceID = serviceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceInstanceLastOperationGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // header param X-Broker-API-Version + if err := r.SetHeaderParam("X-Broker-API-Version", o.XBrokerAPIVersion); err != nil { + return err + } + + // path param instance_id + if err := r.SetPathParam("instance_id", o.InstanceID); err != nil { + return err + } + + if o.Operation != nil { + + // query param operation + var qrOperation string + + if o.Operation != nil { + qrOperation = *o.Operation + } + qOperation := qrOperation + if qOperation != "" { + + if err := r.SetQueryParam("operation", qOperation); err != nil { + return err + } + } + } + + if o.PlanID != nil { + + // query param plan_id + var qrPlanID string + + if o.PlanID != nil { + qrPlanID = *o.PlanID + } + qPlanID := qrPlanID + if qPlanID != "" { + + if err := r.SetQueryParam("plan_id", qPlanID); err != nil { + return err + } + } + } + + if o.ServiceID != nil { + + // query param service_id + var qrServiceID string + + if o.ServiceID != nil { + qrServiceID = *o.ServiceID + } + qServiceID := qrServiceID + if qServiceID != "" { + + if err := r.SetQueryParam("service_id", qServiceID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_last_operation_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_last_operation_get_responses.go new file mode 100644 index 00000000000..10e635bfcd5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_last_operation_get_responses.go @@ -0,0 +1,143 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceInstanceLastOperationGetReader is a Reader for the ServiceInstanceLastOperationGet structure. +type ServiceInstanceLastOperationGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceInstanceLastOperationGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceInstanceLastOperationGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceInstanceLastOperationGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 410: + result := NewServiceInstanceLastOperationGetGone() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceInstanceLastOperationGetOK creates a ServiceInstanceLastOperationGetOK with default headers values +func NewServiceInstanceLastOperationGetOK() *ServiceInstanceLastOperationGetOK { + return &ServiceInstanceLastOperationGetOK{} +} + +/* ServiceInstanceLastOperationGetOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceInstanceLastOperationGetOK struct { + Payload *models.LastOperationResource +} + +func (o *ServiceInstanceLastOperationGetOK) Error() string { + return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/last_operation][%d] serviceInstanceLastOperationGetOK %+v", 200, o.Payload) +} +func (o *ServiceInstanceLastOperationGetOK) GetPayload() *models.LastOperationResource { + return o.Payload +} + +func (o *ServiceInstanceLastOperationGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.LastOperationResource) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceInstanceLastOperationGetBadRequest creates a ServiceInstanceLastOperationGetBadRequest with default headers values +func NewServiceInstanceLastOperationGetBadRequest() *ServiceInstanceLastOperationGetBadRequest { + return &ServiceInstanceLastOperationGetBadRequest{} +} + +/* ServiceInstanceLastOperationGetBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ServiceInstanceLastOperationGetBadRequest struct { + Payload *models.Error +} + +func (o *ServiceInstanceLastOperationGetBadRequest) Error() string { + return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/last_operation][%d] serviceInstanceLastOperationGetBadRequest %+v", 400, o.Payload) +} +func (o *ServiceInstanceLastOperationGetBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceInstanceLastOperationGetBadRequest) 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 +} + +// NewServiceInstanceLastOperationGetGone creates a ServiceInstanceLastOperationGetGone with default headers values +func NewServiceInstanceLastOperationGetGone() *ServiceInstanceLastOperationGetGone { + return &ServiceInstanceLastOperationGetGone{} +} + +/* ServiceInstanceLastOperationGetGone describes a response with status code 410, with default header values. + +Gone +*/ +type ServiceInstanceLastOperationGetGone struct { + Payload *models.Error +} + +func (o *ServiceInstanceLastOperationGetGone) Error() string { + return fmt.Sprintf("[GET /v2/service_instances/{instance_id}/last_operation][%d] serviceInstanceLastOperationGetGone %+v", 410, o.Payload) +} +func (o *ServiceInstanceLastOperationGetGone) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceInstanceLastOperationGetGone) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_provision_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_provision_parameters.go new file mode 100644 index 00000000000..89458c04fcd --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_provision_parameters.go @@ -0,0 +1,255 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_instances + +// 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/go-openapi/swag" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// NewServiceInstanceProvisionParams creates a new ServiceInstanceProvisionParams 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 NewServiceInstanceProvisionParams() *ServiceInstanceProvisionParams { + return &ServiceInstanceProvisionParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceInstanceProvisionParamsWithTimeout creates a new ServiceInstanceProvisionParams object +// with the ability to set a timeout on a request. +func NewServiceInstanceProvisionParamsWithTimeout(timeout time.Duration) *ServiceInstanceProvisionParams { + return &ServiceInstanceProvisionParams{ + timeout: timeout, + } +} + +// NewServiceInstanceProvisionParamsWithContext creates a new ServiceInstanceProvisionParams object +// with the ability to set a context for a request. +func NewServiceInstanceProvisionParamsWithContext(ctx context.Context) *ServiceInstanceProvisionParams { + return &ServiceInstanceProvisionParams{ + Context: ctx, + } +} + +// NewServiceInstanceProvisionParamsWithHTTPClient creates a new ServiceInstanceProvisionParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceInstanceProvisionParamsWithHTTPClient(client *http.Client) *ServiceInstanceProvisionParams { + return &ServiceInstanceProvisionParams{ + HTTPClient: client, + } +} + +/* ServiceInstanceProvisionParams contains all the parameters to send to the API endpoint + for the service instance provision operation. + + Typically these are written to a http.Request. +*/ +type ServiceInstanceProvisionParams struct { + + /* XBrokerAPIOriginatingIdentity. + + identity of the user that initiated the request from the Platform + */ + XBrokerAPIOriginatingIdentity *string + + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use + */ + XBrokerAPIVersion string + + /* AcceptsIncomplete. + + asynchronous operations supported + */ + AcceptsIncomplete *bool + + /* Body. + + parameters for the requested service instance provision + */ + Body *models.ServiceInstanceProvisionRequest + + /* InstanceID. + + instance id of instance to provision + */ + InstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service instance provision params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceProvisionParams) WithDefaults() *ServiceInstanceProvisionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service instance provision params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceProvisionParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service instance provision params +func (o *ServiceInstanceProvisionParams) WithTimeout(timeout time.Duration) *ServiceInstanceProvisionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service instance provision params +func (o *ServiceInstanceProvisionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service instance provision params +func (o *ServiceInstanceProvisionParams) WithContext(ctx context.Context) *ServiceInstanceProvisionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service instance provision params +func (o *ServiceInstanceProvisionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service instance provision params +func (o *ServiceInstanceProvisionParams) WithHTTPClient(client *http.Client) *ServiceInstanceProvisionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service instance provision params +func (o *ServiceInstanceProvisionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithXBrokerAPIOriginatingIdentity adds the xBrokerAPIOriginatingIdentity to the service instance provision params +func (o *ServiceInstanceProvisionParams) WithXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity *string) *ServiceInstanceProvisionParams { + o.SetXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity) + return o +} + +// SetXBrokerAPIOriginatingIdentity adds the xBrokerApiOriginatingIdentity to the service instance provision params +func (o *ServiceInstanceProvisionParams) SetXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity *string) { + o.XBrokerAPIOriginatingIdentity = xBrokerAPIOriginatingIdentity +} + +// WithXBrokerAPIVersion adds the xBrokerAPIVersion to the service instance provision params +func (o *ServiceInstanceProvisionParams) WithXBrokerAPIVersion(xBrokerAPIVersion string) *ServiceInstanceProvisionParams { + o.SetXBrokerAPIVersion(xBrokerAPIVersion) + return o +} + +// SetXBrokerAPIVersion adds the xBrokerApiVersion to the service instance provision params +func (o *ServiceInstanceProvisionParams) SetXBrokerAPIVersion(xBrokerAPIVersion string) { + o.XBrokerAPIVersion = xBrokerAPIVersion +} + +// WithAcceptsIncomplete adds the acceptsIncomplete to the service instance provision params +func (o *ServiceInstanceProvisionParams) WithAcceptsIncomplete(acceptsIncomplete *bool) *ServiceInstanceProvisionParams { + o.SetAcceptsIncomplete(acceptsIncomplete) + return o +} + +// SetAcceptsIncomplete adds the acceptsIncomplete to the service instance provision params +func (o *ServiceInstanceProvisionParams) SetAcceptsIncomplete(acceptsIncomplete *bool) { + o.AcceptsIncomplete = acceptsIncomplete +} + +// WithBody adds the body to the service instance provision params +func (o *ServiceInstanceProvisionParams) WithBody(body *models.ServiceInstanceProvisionRequest) *ServiceInstanceProvisionParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the service instance provision params +func (o *ServiceInstanceProvisionParams) SetBody(body *models.ServiceInstanceProvisionRequest) { + o.Body = body +} + +// WithInstanceID adds the instanceID to the service instance provision params +func (o *ServiceInstanceProvisionParams) WithInstanceID(instanceID string) *ServiceInstanceProvisionParams { + o.SetInstanceID(instanceID) + return o +} + +// SetInstanceID adds the instanceId to the service instance provision params +func (o *ServiceInstanceProvisionParams) SetInstanceID(instanceID string) { + o.InstanceID = instanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceInstanceProvisionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.XBrokerAPIOriginatingIdentity != nil { + + // header param X-Broker-API-Originating-Identity + if err := r.SetHeaderParam("X-Broker-API-Originating-Identity", *o.XBrokerAPIOriginatingIdentity); err != nil { + return err + } + } + + // header param X-Broker-API-Version + if err := r.SetHeaderParam("X-Broker-API-Version", o.XBrokerAPIVersion); err != nil { + return err + } + + if o.AcceptsIncomplete != nil { + + // query param accepts_incomplete + var qrAcceptsIncomplete bool + + if o.AcceptsIncomplete != nil { + qrAcceptsIncomplete = *o.AcceptsIncomplete + } + qAcceptsIncomplete := swag.FormatBool(qrAcceptsIncomplete) + if qAcceptsIncomplete != "" { + + if err := r.SetQueryParam("accepts_incomplete", qAcceptsIncomplete); err != nil { + return err + } + } + } + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param instance_id + if err := r.SetPathParam("instance_id", o.InstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_provision_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_provision_responses.go new file mode 100644 index 00000000000..1b457b956aa --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_provision_responses.go @@ -0,0 +1,257 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceInstanceProvisionReader is a Reader for the ServiceInstanceProvision structure. +type ServiceInstanceProvisionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceInstanceProvisionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceInstanceProvisionOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 201: + result := NewServiceInstanceProvisionCreated() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 202: + result := NewServiceInstanceProvisionAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceInstanceProvisionBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewServiceInstanceProvisionConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewServiceInstanceProvisionUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceInstanceProvisionOK creates a ServiceInstanceProvisionOK with default headers values +func NewServiceInstanceProvisionOK() *ServiceInstanceProvisionOK { + return &ServiceInstanceProvisionOK{} +} + +/* ServiceInstanceProvisionOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceInstanceProvisionOK struct { + Payload *models.ServiceInstanceProvision +} + +func (o *ServiceInstanceProvisionOK) Error() string { + return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}][%d] serviceInstanceProvisionOK %+v", 200, o.Payload) +} +func (o *ServiceInstanceProvisionOK) GetPayload() *models.ServiceInstanceProvision { + return o.Payload +} + +func (o *ServiceInstanceProvisionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceInstanceProvision) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceInstanceProvisionCreated creates a ServiceInstanceProvisionCreated with default headers values +func NewServiceInstanceProvisionCreated() *ServiceInstanceProvisionCreated { + return &ServiceInstanceProvisionCreated{} +} + +/* ServiceInstanceProvisionCreated describes a response with status code 201, with default header values. + +Created +*/ +type ServiceInstanceProvisionCreated struct { + Payload *models.ServiceInstanceProvision +} + +func (o *ServiceInstanceProvisionCreated) Error() string { + return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}][%d] serviceInstanceProvisionCreated %+v", 201, o.Payload) +} +func (o *ServiceInstanceProvisionCreated) GetPayload() *models.ServiceInstanceProvision { + return o.Payload +} + +func (o *ServiceInstanceProvisionCreated) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceInstanceProvision) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceInstanceProvisionAccepted creates a ServiceInstanceProvisionAccepted with default headers values +func NewServiceInstanceProvisionAccepted() *ServiceInstanceProvisionAccepted { + return &ServiceInstanceProvisionAccepted{} +} + +/* ServiceInstanceProvisionAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type ServiceInstanceProvisionAccepted struct { + Payload *models.ServiceInstanceAsyncOperation +} + +func (o *ServiceInstanceProvisionAccepted) Error() string { + return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}][%d] serviceInstanceProvisionAccepted %+v", 202, o.Payload) +} +func (o *ServiceInstanceProvisionAccepted) GetPayload() *models.ServiceInstanceAsyncOperation { + return o.Payload +} + +func (o *ServiceInstanceProvisionAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceInstanceAsyncOperation) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceInstanceProvisionBadRequest creates a ServiceInstanceProvisionBadRequest with default headers values +func NewServiceInstanceProvisionBadRequest() *ServiceInstanceProvisionBadRequest { + return &ServiceInstanceProvisionBadRequest{} +} + +/* ServiceInstanceProvisionBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ServiceInstanceProvisionBadRequest struct { + Payload *models.Error +} + +func (o *ServiceInstanceProvisionBadRequest) Error() string { + return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}][%d] serviceInstanceProvisionBadRequest %+v", 400, o.Payload) +} +func (o *ServiceInstanceProvisionBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceInstanceProvisionBadRequest) 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 +} + +// NewServiceInstanceProvisionConflict creates a ServiceInstanceProvisionConflict with default headers values +func NewServiceInstanceProvisionConflict() *ServiceInstanceProvisionConflict { + return &ServiceInstanceProvisionConflict{} +} + +/* ServiceInstanceProvisionConflict describes a response with status code 409, with default header values. + +Conflict +*/ +type ServiceInstanceProvisionConflict struct { + Payload *models.Error +} + +func (o *ServiceInstanceProvisionConflict) Error() string { + return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}][%d] serviceInstanceProvisionConflict %+v", 409, o.Payload) +} +func (o *ServiceInstanceProvisionConflict) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceInstanceProvisionConflict) 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 +} + +// NewServiceInstanceProvisionUnprocessableEntity creates a ServiceInstanceProvisionUnprocessableEntity with default headers values +func NewServiceInstanceProvisionUnprocessableEntity() *ServiceInstanceProvisionUnprocessableEntity { + return &ServiceInstanceProvisionUnprocessableEntity{} +} + +/* ServiceInstanceProvisionUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable Entity +*/ +type ServiceInstanceProvisionUnprocessableEntity struct { + Payload *models.Error +} + +func (o *ServiceInstanceProvisionUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /v2/service_instances/{instance_id}][%d] serviceInstanceProvisionUnprocessableEntity %+v", 422, o.Payload) +} +func (o *ServiceInstanceProvisionUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceInstanceProvisionUnprocessableEntity) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_update_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_update_parameters.go new file mode 100644 index 00000000000..0e27172b211 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_update_parameters.go @@ -0,0 +1,255 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_instances + +// 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/go-openapi/swag" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// NewServiceInstanceUpdateParams creates a new ServiceInstanceUpdateParams 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 NewServiceInstanceUpdateParams() *ServiceInstanceUpdateParams { + return &ServiceInstanceUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceInstanceUpdateParamsWithTimeout creates a new ServiceInstanceUpdateParams object +// with the ability to set a timeout on a request. +func NewServiceInstanceUpdateParamsWithTimeout(timeout time.Duration) *ServiceInstanceUpdateParams { + return &ServiceInstanceUpdateParams{ + timeout: timeout, + } +} + +// NewServiceInstanceUpdateParamsWithContext creates a new ServiceInstanceUpdateParams object +// with the ability to set a context for a request. +func NewServiceInstanceUpdateParamsWithContext(ctx context.Context) *ServiceInstanceUpdateParams { + return &ServiceInstanceUpdateParams{ + Context: ctx, + } +} + +// NewServiceInstanceUpdateParamsWithHTTPClient creates a new ServiceInstanceUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceInstanceUpdateParamsWithHTTPClient(client *http.Client) *ServiceInstanceUpdateParams { + return &ServiceInstanceUpdateParams{ + HTTPClient: client, + } +} + +/* ServiceInstanceUpdateParams contains all the parameters to send to the API endpoint + for the service instance update operation. + + Typically these are written to a http.Request. +*/ +type ServiceInstanceUpdateParams struct { + + /* XBrokerAPIOriginatingIdentity. + + identity of the user that initiated the request from the Platform + */ + XBrokerAPIOriginatingIdentity *string + + /* XBrokerAPIVersion. + + version number of the Service Broker API that the Platform will use + */ + XBrokerAPIVersion string + + /* AcceptsIncomplete. + + asynchronous operations supported + */ + AcceptsIncomplete *bool + + /* Body. + + parameters for the requested service instance update + */ + Body *models.ServiceInstanceUpdateRequest + + /* InstanceID. + + instance id of instance to provision + */ + InstanceID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service instance update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceUpdateParams) WithDefaults() *ServiceInstanceUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service instance update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceInstanceUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service instance update params +func (o *ServiceInstanceUpdateParams) WithTimeout(timeout time.Duration) *ServiceInstanceUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service instance update params +func (o *ServiceInstanceUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service instance update params +func (o *ServiceInstanceUpdateParams) WithContext(ctx context.Context) *ServiceInstanceUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service instance update params +func (o *ServiceInstanceUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service instance update params +func (o *ServiceInstanceUpdateParams) WithHTTPClient(client *http.Client) *ServiceInstanceUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service instance update params +func (o *ServiceInstanceUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithXBrokerAPIOriginatingIdentity adds the xBrokerAPIOriginatingIdentity to the service instance update params +func (o *ServiceInstanceUpdateParams) WithXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity *string) *ServiceInstanceUpdateParams { + o.SetXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity) + return o +} + +// SetXBrokerAPIOriginatingIdentity adds the xBrokerApiOriginatingIdentity to the service instance update params +func (o *ServiceInstanceUpdateParams) SetXBrokerAPIOriginatingIdentity(xBrokerAPIOriginatingIdentity *string) { + o.XBrokerAPIOriginatingIdentity = xBrokerAPIOriginatingIdentity +} + +// WithXBrokerAPIVersion adds the xBrokerAPIVersion to the service instance update params +func (o *ServiceInstanceUpdateParams) WithXBrokerAPIVersion(xBrokerAPIVersion string) *ServiceInstanceUpdateParams { + o.SetXBrokerAPIVersion(xBrokerAPIVersion) + return o +} + +// SetXBrokerAPIVersion adds the xBrokerApiVersion to the service instance update params +func (o *ServiceInstanceUpdateParams) SetXBrokerAPIVersion(xBrokerAPIVersion string) { + o.XBrokerAPIVersion = xBrokerAPIVersion +} + +// WithAcceptsIncomplete adds the acceptsIncomplete to the service instance update params +func (o *ServiceInstanceUpdateParams) WithAcceptsIncomplete(acceptsIncomplete *bool) *ServiceInstanceUpdateParams { + o.SetAcceptsIncomplete(acceptsIncomplete) + return o +} + +// SetAcceptsIncomplete adds the acceptsIncomplete to the service instance update params +func (o *ServiceInstanceUpdateParams) SetAcceptsIncomplete(acceptsIncomplete *bool) { + o.AcceptsIncomplete = acceptsIncomplete +} + +// WithBody adds the body to the service instance update params +func (o *ServiceInstanceUpdateParams) WithBody(body *models.ServiceInstanceUpdateRequest) *ServiceInstanceUpdateParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the service instance update params +func (o *ServiceInstanceUpdateParams) SetBody(body *models.ServiceInstanceUpdateRequest) { + o.Body = body +} + +// WithInstanceID adds the instanceID to the service instance update params +func (o *ServiceInstanceUpdateParams) WithInstanceID(instanceID string) *ServiceInstanceUpdateParams { + o.SetInstanceID(instanceID) + return o +} + +// SetInstanceID adds the instanceId to the service instance update params +func (o *ServiceInstanceUpdateParams) SetInstanceID(instanceID string) { + o.InstanceID = instanceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceInstanceUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.XBrokerAPIOriginatingIdentity != nil { + + // header param X-Broker-API-Originating-Identity + if err := r.SetHeaderParam("X-Broker-API-Originating-Identity", *o.XBrokerAPIOriginatingIdentity); err != nil { + return err + } + } + + // header param X-Broker-API-Version + if err := r.SetHeaderParam("X-Broker-API-Version", o.XBrokerAPIVersion); err != nil { + return err + } + + if o.AcceptsIncomplete != nil { + + // query param accepts_incomplete + var qrAcceptsIncomplete bool + + if o.AcceptsIncomplete != nil { + qrAcceptsIncomplete = *o.AcceptsIncomplete + } + qAcceptsIncomplete := swag.FormatBool(qrAcceptsIncomplete) + if qAcceptsIncomplete != "" { + + if err := r.SetQueryParam("accepts_incomplete", qAcceptsIncomplete); err != nil { + return err + } + } + } + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param instance_id + if err := r.SetPathParam("instance_id", o.InstanceID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_update_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_update_responses.go new file mode 100644 index 00000000000..b86564971bb --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instance_update_responses.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_instances + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceInstanceUpdateReader is a Reader for the ServiceInstanceUpdate structure. +type ServiceInstanceUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceInstanceUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceInstanceUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 202: + result := NewServiceInstanceUpdateAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewServiceInstanceUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewServiceInstanceUpdateUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceInstanceUpdateOK creates a ServiceInstanceUpdateOK with default headers values +func NewServiceInstanceUpdateOK() *ServiceInstanceUpdateOK { + return &ServiceInstanceUpdateOK{} +} + +/* ServiceInstanceUpdateOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceInstanceUpdateOK struct { + Payload models.Object +} + +func (o *ServiceInstanceUpdateOK) Error() string { + return fmt.Sprintf("[PATCH /v2/service_instances/{instance_id}][%d] serviceInstanceUpdateOK %+v", 200, o.Payload) +} +func (o *ServiceInstanceUpdateOK) GetPayload() models.Object { + return o.Payload +} + +func (o *ServiceInstanceUpdateOK) 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 +} + +// NewServiceInstanceUpdateAccepted creates a ServiceInstanceUpdateAccepted with default headers values +func NewServiceInstanceUpdateAccepted() *ServiceInstanceUpdateAccepted { + return &ServiceInstanceUpdateAccepted{} +} + +/* ServiceInstanceUpdateAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type ServiceInstanceUpdateAccepted struct { + Payload *models.ServiceInstanceAsyncOperation +} + +func (o *ServiceInstanceUpdateAccepted) Error() string { + return fmt.Sprintf("[PATCH /v2/service_instances/{instance_id}][%d] serviceInstanceUpdateAccepted %+v", 202, o.Payload) +} +func (o *ServiceInstanceUpdateAccepted) GetPayload() *models.ServiceInstanceAsyncOperation { + return o.Payload +} + +func (o *ServiceInstanceUpdateAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ServiceInstanceAsyncOperation) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewServiceInstanceUpdateBadRequest creates a ServiceInstanceUpdateBadRequest with default headers values +func NewServiceInstanceUpdateBadRequest() *ServiceInstanceUpdateBadRequest { + return &ServiceInstanceUpdateBadRequest{} +} + +/* ServiceInstanceUpdateBadRequest describes a response with status code 400, with default header values. + +Bad Request +*/ +type ServiceInstanceUpdateBadRequest struct { + Payload *models.Error +} + +func (o *ServiceInstanceUpdateBadRequest) Error() string { + return fmt.Sprintf("[PATCH /v2/service_instances/{instance_id}][%d] serviceInstanceUpdateBadRequest %+v", 400, o.Payload) +} +func (o *ServiceInstanceUpdateBadRequest) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceInstanceUpdateBadRequest) 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 +} + +// NewServiceInstanceUpdateUnprocessableEntity creates a ServiceInstanceUpdateUnprocessableEntity with default headers values +func NewServiceInstanceUpdateUnprocessableEntity() *ServiceInstanceUpdateUnprocessableEntity { + return &ServiceInstanceUpdateUnprocessableEntity{} +} + +/* ServiceInstanceUpdateUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable entity +*/ +type ServiceInstanceUpdateUnprocessableEntity struct { + Payload *models.Error +} + +func (o *ServiceInstanceUpdateUnprocessableEntity) Error() string { + return fmt.Sprintf("[PATCH /v2/service_instances/{instance_id}][%d] serviceInstanceUpdateUnprocessableEntity %+v", 422, o.Payload) +} +func (o *ServiceInstanceUpdateUnprocessableEntity) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceInstanceUpdateUnprocessableEntity) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instances_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instances_client.go new file mode 100644 index 00000000000..13b07b16890 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/service_instances/service_instances_client.go @@ -0,0 +1,249 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package service_instances + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new service instances API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for service instances API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceInstanceDeprovision(params *ServiceInstanceDeprovisionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceDeprovisionOK, *ServiceInstanceDeprovisionAccepted, error) + + ServiceInstanceGet(params *ServiceInstanceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceGetOK, error) + + ServiceInstanceLastOperationGet(params *ServiceInstanceLastOperationGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceLastOperationGetOK, error) + + ServiceInstanceProvision(params *ServiceInstanceProvisionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceProvisionOK, *ServiceInstanceProvisionCreated, *ServiceInstanceProvisionAccepted, error) + + ServiceInstanceUpdate(params *ServiceInstanceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceUpdateOK, *ServiceInstanceUpdateAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + ServiceInstanceDeprovision deprovisions a service instance +*/ +func (a *Client) ServiceInstanceDeprovision(params *ServiceInstanceDeprovisionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceDeprovisionOK, *ServiceInstanceDeprovisionAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceInstanceDeprovisionParams() + } + op := &runtime.ClientOperation{ + ID: "serviceInstance.deprovision", + Method: "DELETE", + PathPattern: "/v2/service_instances/{instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceInstanceDeprovisionReader{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 *ServiceInstanceDeprovisionOK: + return value, nil, nil + case *ServiceInstanceDeprovisionAccepted: + 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 service_instances: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceInstanceGet gets a service instance +*/ +func (a *Client) ServiceInstanceGet(params *ServiceInstanceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceInstanceGetParams() + } + op := &runtime.ClientOperation{ + ID: "serviceInstance.get", + Method: "GET", + PathPattern: "/v2/service_instances/{instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceInstanceGetReader{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.(*ServiceInstanceGetOK) + 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 serviceInstance.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceInstanceLastOperationGet lasts requested operation state for service instance +*/ +func (a *Client) ServiceInstanceLastOperationGet(params *ServiceInstanceLastOperationGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceLastOperationGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceInstanceLastOperationGetParams() + } + op := &runtime.ClientOperation{ + ID: "serviceInstance.lastOperation.get", + Method: "GET", + PathPattern: "/v2/service_instances/{instance_id}/last_operation", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceInstanceLastOperationGetReader{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.(*ServiceInstanceLastOperationGetOK) + 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 serviceInstance.lastOperation.get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceInstanceProvision provisions a service instance +*/ +func (a *Client) ServiceInstanceProvision(params *ServiceInstanceProvisionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceProvisionOK, *ServiceInstanceProvisionCreated, *ServiceInstanceProvisionAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceInstanceProvisionParams() + } + op := &runtime.ClientOperation{ + ID: "serviceInstance.provision", + Method: "PUT", + PathPattern: "/v2/service_instances/{instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceInstanceProvisionReader{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, nil, err + } + switch value := result.(type) { + case *ServiceInstanceProvisionOK: + return value, nil, nil, nil + case *ServiceInstanceProvisionCreated: + return nil, value, nil, nil + case *ServiceInstanceProvisionAccepted: + return nil, 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 service_instances: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ServiceInstanceUpdate updates a service instance +*/ +func (a *Client) ServiceInstanceUpdate(params *ServiceInstanceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ServiceInstanceUpdateOK, *ServiceInstanceUpdateAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceInstanceUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "serviceInstance.update", + Method: "PATCH", + PathPattern: "/v2/service_instances/{instance_id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceInstanceUpdateReader{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 *ServiceInstanceUpdateOK: + return value, nil, nil + case *ServiceInstanceUpdateAccepted: + 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 service_instances: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/storage_types/service_broker_storagetypes_get_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/storage_types/service_broker_storagetypes_get_parameters.go new file mode 100644 index 00000000000..932bb7a0e93 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/storage_types/service_broker_storagetypes_get_parameters.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package storage_types + +// 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" +) + +// NewServiceBrokerStoragetypesGetParams creates a new ServiceBrokerStoragetypesGetParams 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 NewServiceBrokerStoragetypesGetParams() *ServiceBrokerStoragetypesGetParams { + return &ServiceBrokerStoragetypesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerStoragetypesGetParamsWithTimeout creates a new ServiceBrokerStoragetypesGetParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerStoragetypesGetParamsWithTimeout(timeout time.Duration) *ServiceBrokerStoragetypesGetParams { + return &ServiceBrokerStoragetypesGetParams{ + timeout: timeout, + } +} + +// NewServiceBrokerStoragetypesGetParamsWithContext creates a new ServiceBrokerStoragetypesGetParams object +// with the ability to set a context for a request. +func NewServiceBrokerStoragetypesGetParamsWithContext(ctx context.Context) *ServiceBrokerStoragetypesGetParams { + return &ServiceBrokerStoragetypesGetParams{ + Context: ctx, + } +} + +// NewServiceBrokerStoragetypesGetParamsWithHTTPClient creates a new ServiceBrokerStoragetypesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerStoragetypesGetParamsWithHTTPClient(client *http.Client) *ServiceBrokerStoragetypesGetParams { + return &ServiceBrokerStoragetypesGetParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerStoragetypesGetParams contains all the parameters to send to the API endpoint + for the service broker storagetypes get operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerStoragetypesGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker storagetypes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerStoragetypesGetParams) WithDefaults() *ServiceBrokerStoragetypesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker storagetypes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerStoragetypesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker storagetypes get params +func (o *ServiceBrokerStoragetypesGetParams) WithTimeout(timeout time.Duration) *ServiceBrokerStoragetypesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker storagetypes get params +func (o *ServiceBrokerStoragetypesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker storagetypes get params +func (o *ServiceBrokerStoragetypesGetParams) WithContext(ctx context.Context) *ServiceBrokerStoragetypesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker storagetypes get params +func (o *ServiceBrokerStoragetypesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker storagetypes get params +func (o *ServiceBrokerStoragetypesGetParams) WithHTTPClient(client *http.Client) *ServiceBrokerStoragetypesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker storagetypes get params +func (o *ServiceBrokerStoragetypesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerStoragetypesGetParams) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/storage_types/service_broker_storagetypes_get_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/storage_types/service_broker_storagetypes_get_responses.go new file mode 100644 index 00000000000..30d420dd824 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/storage_types/service_broker_storagetypes_get_responses.go @@ -0,0 +1,103 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package storage_types + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerStoragetypesGetReader is a Reader for the ServiceBrokerStoragetypesGet structure. +type ServiceBrokerStoragetypesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerStoragetypesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerStoragetypesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 500: + result := NewServiceBrokerStoragetypesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerStoragetypesGetOK creates a ServiceBrokerStoragetypesGetOK with default headers values +func NewServiceBrokerStoragetypesGetOK() *ServiceBrokerStoragetypesGetOK { + return &ServiceBrokerStoragetypesGetOK{} +} + +/* ServiceBrokerStoragetypesGetOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerStoragetypesGetOK struct { + Payload models.StorageTypes +} + +func (o *ServiceBrokerStoragetypesGetOK) Error() string { + return fmt.Sprintf("[GET /broker/v1/storage-types][%d] serviceBrokerStoragetypesGetOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerStoragetypesGetOK) GetPayload() models.StorageTypes { + return o.Payload +} + +func (o *ServiceBrokerStoragetypesGetOK) 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 +} + +// NewServiceBrokerStoragetypesGetInternalServerError creates a ServiceBrokerStoragetypesGetInternalServerError with default headers values +func NewServiceBrokerStoragetypesGetInternalServerError() *ServiceBrokerStoragetypesGetInternalServerError { + return &ServiceBrokerStoragetypesGetInternalServerError{} +} + +/* ServiceBrokerStoragetypesGetInternalServerError describes a response with status code 500, with default header values. + +Internal Server Error +*/ +type ServiceBrokerStoragetypesGetInternalServerError struct { + Payload *models.Error +} + +func (o *ServiceBrokerStoragetypesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /broker/v1/storage-types][%d] serviceBrokerStoragetypesGetInternalServerError %+v", 500, o.Payload) +} +func (o *ServiceBrokerStoragetypesGetInternalServerError) GetPayload() *models.Error { + return o.Payload +} + +func (o *ServiceBrokerStoragetypesGetInternalServerError) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/storage_types/storage_types_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/storage_types/storage_types_client.go new file mode 100644 index 00000000000..5adc4f1ed4f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/storage_types/storage_types_client.go @@ -0,0 +1,79 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package storage_types + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new storage types API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for storage types API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceBrokerStoragetypesGet(params *ServiceBrokerStoragetypesGetParams, opts ...ClientOption) (*ServiceBrokerStoragetypesGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + ServiceBrokerStoragetypesGet availables storage types in a region +*/ +func (a *Client) ServiceBrokerStoragetypesGet(params *ServiceBrokerStoragetypesGetParams, opts ...ClientOption) (*ServiceBrokerStoragetypesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerStoragetypesGetParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.storagetypes.get", + Method: "GET", + PathPattern: "/broker/v1/storage-types", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerStoragetypesGetReader{formats: a.formats}, + 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.(*ServiceBrokerStoragetypesGetOK) + 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 serviceBroker.storagetypes.get: 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/swagger_spec/service_broker_swaggerspec_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/swagger_spec/service_broker_swaggerspec_parameters.go new file mode 100644 index 00000000000..12c76c9d807 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/swagger_spec/service_broker_swaggerspec_parameters.go @@ -0,0 +1,126 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package swagger_spec + +// 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" +) + +// NewServiceBrokerSwaggerspecParams creates a new ServiceBrokerSwaggerspecParams 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 NewServiceBrokerSwaggerspecParams() *ServiceBrokerSwaggerspecParams { + return &ServiceBrokerSwaggerspecParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewServiceBrokerSwaggerspecParamsWithTimeout creates a new ServiceBrokerSwaggerspecParams object +// with the ability to set a timeout on a request. +func NewServiceBrokerSwaggerspecParamsWithTimeout(timeout time.Duration) *ServiceBrokerSwaggerspecParams { + return &ServiceBrokerSwaggerspecParams{ + timeout: timeout, + } +} + +// NewServiceBrokerSwaggerspecParamsWithContext creates a new ServiceBrokerSwaggerspecParams object +// with the ability to set a context for a request. +func NewServiceBrokerSwaggerspecParamsWithContext(ctx context.Context) *ServiceBrokerSwaggerspecParams { + return &ServiceBrokerSwaggerspecParams{ + Context: ctx, + } +} + +// NewServiceBrokerSwaggerspecParamsWithHTTPClient creates a new ServiceBrokerSwaggerspecParams object +// with the ability to set a custom HTTPClient for a request. +func NewServiceBrokerSwaggerspecParamsWithHTTPClient(client *http.Client) *ServiceBrokerSwaggerspecParams { + return &ServiceBrokerSwaggerspecParams{ + HTTPClient: client, + } +} + +/* ServiceBrokerSwaggerspecParams contains all the parameters to send to the API endpoint + for the service broker swaggerspec operation. + + Typically these are written to a http.Request. +*/ +type ServiceBrokerSwaggerspecParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the service broker swaggerspec params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerSwaggerspecParams) WithDefaults() *ServiceBrokerSwaggerspecParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the service broker swaggerspec params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ServiceBrokerSwaggerspecParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the service broker swaggerspec params +func (o *ServiceBrokerSwaggerspecParams) WithTimeout(timeout time.Duration) *ServiceBrokerSwaggerspecParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the service broker swaggerspec params +func (o *ServiceBrokerSwaggerspecParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the service broker swaggerspec params +func (o *ServiceBrokerSwaggerspecParams) WithContext(ctx context.Context) *ServiceBrokerSwaggerspecParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the service broker swaggerspec params +func (o *ServiceBrokerSwaggerspecParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the service broker swaggerspec params +func (o *ServiceBrokerSwaggerspecParams) WithHTTPClient(client *http.Client) *ServiceBrokerSwaggerspecParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the service broker swaggerspec params +func (o *ServiceBrokerSwaggerspecParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ServiceBrokerSwaggerspecParams) 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/vendor/github.com/IBM-Cloud/power-go-client/power/client/swagger_spec/service_broker_swaggerspec_responses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/swagger_spec/service_broker_swaggerspec_responses.go new file mode 100644 index 00000000000..7f37f6cdbd7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/swagger_spec/service_broker_swaggerspec_responses.go @@ -0,0 +1,65 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package swagger_spec + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "github.com/IBM-Cloud/power-go-client/power/models" +) + +// ServiceBrokerSwaggerspecReader is a Reader for the ServiceBrokerSwaggerspec structure. +type ServiceBrokerSwaggerspecReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ServiceBrokerSwaggerspecReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewServiceBrokerSwaggerspecOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code()) + } +} + +// NewServiceBrokerSwaggerspecOK creates a ServiceBrokerSwaggerspecOK with default headers values +func NewServiceBrokerSwaggerspecOK() *ServiceBrokerSwaggerspecOK { + return &ServiceBrokerSwaggerspecOK{} +} + +/* ServiceBrokerSwaggerspecOK describes a response with status code 200, with default header values. + +OK +*/ +type ServiceBrokerSwaggerspecOK struct { + Payload models.Object +} + +func (o *ServiceBrokerSwaggerspecOK) Error() string { + return fmt.Sprintf("[GET /v1/swagger.json][%d] serviceBrokerSwaggerspecOK %+v", 200, o.Payload) +} +func (o *ServiceBrokerSwaggerspecOK) GetPayload() models.Object { + return o.Payload +} + +func (o *ServiceBrokerSwaggerspecOK) 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 +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/client/swagger_spec/swagger_spec_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/client/swagger_spec/swagger_spec_client.go new file mode 100644 index 00000000000..d6ba1ec15ab --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/client/swagger_spec/swagger_spec_client.go @@ -0,0 +1,79 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package swagger_spec + +// 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" + "github.com/go-openapi/strfmt" +) + +// New creates a new swagger spec API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +/* +Client for swagger spec API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption is the option for Client methods +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ServiceBrokerSwaggerspec(params *ServiceBrokerSwaggerspecParams, opts ...ClientOption) (*ServiceBrokerSwaggerspecOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + ServiceBrokerSwaggerspec gets swagger json spec +*/ +func (a *Client) ServiceBrokerSwaggerspec(params *ServiceBrokerSwaggerspecParams, opts ...ClientOption) (*ServiceBrokerSwaggerspecOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewServiceBrokerSwaggerspecParams() + } + op := &runtime.ClientOperation{ + ID: "serviceBroker.swaggerspec", + Method: "GET", + PathPattern: "/v1/swagger.json", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ServiceBrokerSwaggerspecReader{formats: a.formats}, + 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.(*ServiceBrokerSwaggerspecOK) + 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 serviceBroker.swaggerspec: 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/vendor/github.com/IBM-Cloud/power-go-client/power/models/access_token.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/access_token.go new file mode 100644 index 00000000000..adc43d9e7bb --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/access_token.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" +) + +// AccessToken access token +// +// swagger:model AccessToken +type AccessToken struct { + + // Access Token + // Required: true + AccessToken *string `json:"accessToken"` +} + +// Validate validates this access token +func (m *AccessToken) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccessToken(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AccessToken) validateAccessToken(formats strfmt.Registry) error { + + if err := validate.Required("accessToken", "body", m.AccessToken); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this access token based on context it is used +func (m *AccessToken) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *AccessToken) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AccessToken) UnmarshalBinary(b []byte) error { + var res AccessToken + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/async_operation.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/async_operation.go new file mode 100644 index 00000000000..4fe9256236e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/async_operation.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" +) + +// AsyncOperation async operation +// +// swagger:model AsyncOperation +type AsyncOperation struct { + + // operation + Operation string `json:"operation,omitempty"` +} + +// Validate validates this async operation +func (m *AsyncOperation) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this async operation based on context it is used +func (m *AsyncOperation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *AsyncOperation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AsyncOperation) UnmarshalBinary(b []byte) error { + var res AsyncOperation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/available_stock_images.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/available_stock_images.go new file mode 100644 index 00000000000..ba40ca2d337 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/available_stock_images.go @@ -0,0 +1,69 @@ +// 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/validate" +) + +// AvailableStockImages A map of an array of stock images for each available storage type +// +// swagger:model AvailableStockImages +type AvailableStockImages map[string]StockImages + +// Validate validates this available stock images +func (m AvailableStockImages) Validate(formats strfmt.Registry) error { + var res []error + + for k := range m { + + if err := validate.Required(k, "body", m[k]); err != nil { + return err + } + + if err := m[k].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(k) + } + return err + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this available stock images based on the context it is used +func (m AvailableStockImages) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for k := range m { + + if err := m[k].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(k) + } + return err + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/catalog.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/catalog.go new file mode 100644 index 00000000000..dab6aafe03e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/catalog.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" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Catalog catalog +// +// swagger:model Catalog +type Catalog struct { + + // services + Services []*Service `json:"services"` +} + +// Validate validates this catalog +func (m *Catalog) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateServices(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Catalog) validateServices(formats strfmt.Registry) error { + if swag.IsZero(m.Services) { // not required + return nil + } + + for i := 0; i < len(m.Services); i++ { + if swag.IsZero(m.Services[i]) { // not required + continue + } + + if m.Services[i] != nil { + if err := m.Services[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("services" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("services" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this catalog based on the context it is used +func (m *Catalog) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateServices(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Catalog) contextValidateServices(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Services); i++ { + + if m.Services[i] != nil { + if err := m.Services[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("services" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("services" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Catalog) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Catalog) UnmarshalBinary(b []byte) error { + var res Catalog + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/clone_task_reference.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/clone_task_reference.go new file mode 100644 index 00000000000..80464044d8c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/clone_task_reference.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" +) + +// CloneTaskReference clone task reference +// +// swagger:model CloneTaskReference +type CloneTaskReference struct { + + // ID of a long running PowerVC clone task + // Required: true + CloneTaskID *string `json:"cloneTaskID"` + + // Link to PowerVC clone task resource + // Required: true + Href *string `json:"href"` +} + +// Validate validates this clone task reference +func (m *CloneTaskReference) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCloneTaskID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHref(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloneTaskReference) validateCloneTaskID(formats strfmt.Registry) error { + + if err := validate.Required("cloneTaskID", "body", m.CloneTaskID); err != nil { + return err + } + + return nil +} + +func (m *CloneTaskReference) validateHref(formats strfmt.Registry) error { + + if err := validate.Required("href", "body", m.Href); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this clone task reference based on context it is used +func (m *CloneTaskReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CloneTaskReference) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloneTaskReference) UnmarshalBinary(b []byte) error { + var res CloneTaskReference + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/clone_task_status.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/clone_task_status.go new file mode 100644 index 00000000000..c17b76df8f4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/clone_task_status.go @@ -0,0 +1,196 @@ +// 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" +) + +// CloneTaskStatus clone task status +// +// swagger:model CloneTaskStatus +type CloneTaskStatus struct { + + // List of cloned volumes created from the clone volumes task + ClonedVolumes []*ClonedVolume `json:"clonedVolumes"` + + // The reason the clone volumes task has failed + FailedReason string `json:"failedReason,omitempty"` + + // Snapshot completion percentage + // Required: true + PercentComplete *int64 `json:"percentComplete"` + + // Status of the clone volumes task + // Required: true + // Enum: [running completed failed unknown] + Status *string `json:"status"` +} + +// Validate validates this clone task status +func (m *CloneTaskStatus) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClonedVolumes(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePercentComplete(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloneTaskStatus) validateClonedVolumes(formats strfmt.Registry) error { + if swag.IsZero(m.ClonedVolumes) { // not required + return nil + } + + for i := 0; i < len(m.ClonedVolumes); i++ { + if swag.IsZero(m.ClonedVolumes[i]) { // not required + continue + } + + if m.ClonedVolumes[i] != nil { + if err := m.ClonedVolumes[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CloneTaskStatus) validatePercentComplete(formats strfmt.Registry) error { + + if err := validate.Required("percentComplete", "body", m.PercentComplete); err != nil { + return err + } + + return nil +} + +var cloneTaskStatusTypeStatusPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["running","completed","failed","unknown"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + cloneTaskStatusTypeStatusPropEnum = append(cloneTaskStatusTypeStatusPropEnum, v) + } +} + +const ( + + // CloneTaskStatusStatusRunning captures enum value "running" + CloneTaskStatusStatusRunning string = "running" + + // CloneTaskStatusStatusCompleted captures enum value "completed" + CloneTaskStatusStatusCompleted string = "completed" + + // CloneTaskStatusStatusFailed captures enum value "failed" + CloneTaskStatusStatusFailed string = "failed" + + // CloneTaskStatusStatusUnknown captures enum value "unknown" + CloneTaskStatusStatusUnknown string = "unknown" +) + +// prop value enum +func (m *CloneTaskStatus) validateStatusEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, cloneTaskStatusTypeStatusPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *CloneTaskStatus) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + // value enum + if err := m.validateStatusEnum("status", "body", *m.Status); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this clone task status based on the context it is used +func (m *CloneTaskStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClonedVolumes(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloneTaskStatus) contextValidateClonedVolumes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ClonedVolumes); i++ { + + if m.ClonedVolumes[i] != nil { + if err := m.ClonedVolumes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CloneTaskStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloneTaskStatus) UnmarshalBinary(b []byte) error { + var res CloneTaskStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloned_volume.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloned_volume.go new file mode 100644 index 00000000000..0431ea99070 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloned_volume.go @@ -0,0 +1,53 @@ +// 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" +) + +// ClonedVolume cloned volume +// +// swagger:model ClonedVolume +type ClonedVolume struct { + + // ID of the new cloned volume + ClonedVolumeID string `json:"clonedVolumeID,omitempty"` + + // ID of the source volume to be cloned + SourceVolumeID string `json:"sourceVolumeID,omitempty"` +} + +// Validate validates this cloned volume +func (m *ClonedVolume) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this cloned volume based on context it is used +func (m *ClonedVolume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ClonedVolume) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ClonedVolume) UnmarshalBinary(b []byte) error { + var res ClonedVolume + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloned_volume_detail.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloned_volume_detail.go new file mode 100644 index 00000000000..67757963b8b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloned_volume_detail.go @@ -0,0 +1,155 @@ +// 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" +) + +// ClonedVolumeDetail cloned volume detail +// +// swagger:model ClonedVolumeDetail +type ClonedVolumeDetail struct { + + // clone + // Required: true + Clone *VolumeInfo `json:"clone"` + + // source + // Required: true + Source *VolumeInfo `json:"source"` +} + +// Validate validates this cloned volume detail +func (m *ClonedVolumeDetail) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClone(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSource(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ClonedVolumeDetail) validateClone(formats strfmt.Registry) error { + + if err := validate.Required("clone", "body", m.Clone); err != nil { + return err + } + + if m.Clone != nil { + if err := m.Clone.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("clone") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clone") + } + return err + } + } + + return nil +} + +func (m *ClonedVolumeDetail) validateSource(formats strfmt.Registry) error { + + if err := validate.Required("source", "body", m.Source); err != nil { + return err + } + + if m.Source != nil { + if err := m.Source.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloned volume detail based on the context it is used +func (m *ClonedVolumeDetail) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClone(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSource(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ClonedVolumeDetail) contextValidateClone(ctx context.Context, formats strfmt.Registry) error { + + if m.Clone != nil { + if err := m.Clone.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("clone") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clone") + } + return err + } + } + + return nil +} + +func (m *ClonedVolumeDetail) contextValidateSource(ctx context.Context, formats strfmt.Registry) error { + + if m.Source != nil { + if err := m.Source.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ClonedVolumeDetail) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ClonedVolumeDetail) UnmarshalBinary(b []byte) error { + var res ClonedVolumeDetail + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection.go new file mode 100644 index 00000000000..b61c4a054a6 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection.go @@ -0,0 +1,384 @@ +// 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" +) + +// CloudConnection cloud connection +// +// swagger:model CloudConnection +type CloudConnection struct { + + // classic + Classic *CloudConnectionEndpointClassic `json:"classic,omitempty"` + + // cloud connection ID + // Required: true + CloudConnectionID *string `json:"cloudConnectionID"` + + // creation date + // Required: true + // Format: date-time + CreationDate *strfmt.DateTime `json:"creationDate"` + + // enable global routing for this cloud connection (default=false) + // Required: true + GlobalRouting *bool `json:"globalRouting"` + + // IBM IP address + // Required: true + IbmIPAddress *string `json:"ibmIPAddress"` + + // link status + // Required: true + LinkStatus *string `json:"linkStatus"` + + // metered + // Required: true + Metered *bool `json:"metered"` + + // name of the cloud connection + // Required: true + Name *string `json:"name"` + + // Network References + Networks []*NetworkReference `json:"networks,omitempty"` + + // port + // Required: true + Port *string `json:"port"` + + // speed of the cloud connection (speed in megabits per second) + // Required: true + Speed *int64 `json:"speed"` + + // user IP address + // Required: true + UserIPAddress *string `json:"userIPAddress"` + + // vpc + Vpc *CloudConnectionEndpointVPC `json:"vpc,omitempty"` +} + +// Validate validates this cloud connection +func (m *CloudConnection) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClassic(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCloudConnectionID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCreationDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateGlobalRouting(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIbmIPAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLinkStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMetered(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetworks(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePort(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSpeed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUserIPAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVpc(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnection) validateClassic(formats strfmt.Registry) error { + if swag.IsZero(m.Classic) { // not required + return nil + } + + if m.Classic != nil { + if err := m.Classic.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("classic") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classic") + } + return err + } + } + + return nil +} + +func (m *CloudConnection) validateCloudConnectionID(formats strfmt.Registry) error { + + if err := validate.Required("cloudConnectionID", "body", m.CloudConnectionID); err != nil { + return err + } + + return nil +} + +func (m *CloudConnection) validateCreationDate(formats strfmt.Registry) error { + + if err := validate.Required("creationDate", "body", m.CreationDate); err != nil { + return err + } + + if err := validate.FormatOf("creationDate", "body", "date-time", m.CreationDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *CloudConnection) validateGlobalRouting(formats strfmt.Registry) error { + + if err := validate.Required("globalRouting", "body", m.GlobalRouting); err != nil { + return err + } + + return nil +} + +func (m *CloudConnection) validateIbmIPAddress(formats strfmt.Registry) error { + + if err := validate.Required("ibmIPAddress", "body", m.IbmIPAddress); err != nil { + return err + } + + return nil +} + +func (m *CloudConnection) validateLinkStatus(formats strfmt.Registry) error { + + if err := validate.Required("linkStatus", "body", m.LinkStatus); err != nil { + return err + } + + return nil +} + +func (m *CloudConnection) validateMetered(formats strfmt.Registry) error { + + if err := validate.Required("metered", "body", m.Metered); err != nil { + return err + } + + return nil +} + +func (m *CloudConnection) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *CloudConnection) validateNetworks(formats strfmt.Registry) error { + if swag.IsZero(m.Networks) { // not required + return nil + } + + for i := 0; i < len(m.Networks); i++ { + if swag.IsZero(m.Networks[i]) { // not required + continue + } + + if m.Networks[i] != nil { + if err := m.Networks[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CloudConnection) validatePort(formats strfmt.Registry) error { + + if err := validate.Required("port", "body", m.Port); err != nil { + return err + } + + return nil +} + +func (m *CloudConnection) validateSpeed(formats strfmt.Registry) error { + + if err := validate.Required("speed", "body", m.Speed); err != nil { + return err + } + + return nil +} + +func (m *CloudConnection) validateUserIPAddress(formats strfmt.Registry) error { + + if err := validate.Required("userIPAddress", "body", m.UserIPAddress); err != nil { + return err + } + + return nil +} + +func (m *CloudConnection) validateVpc(formats strfmt.Registry) error { + if swag.IsZero(m.Vpc) { // not required + return nil + } + + if m.Vpc != nil { + if err := m.Vpc.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpc") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpc") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloud connection based on the context it is used +func (m *CloudConnection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClassic(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVpc(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnection) contextValidateClassic(ctx context.Context, formats strfmt.Registry) error { + + if m.Classic != nil { + if err := m.Classic.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("classic") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classic") + } + return err + } + } + + return nil +} + +func (m *CloudConnection) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CloudConnection) contextValidateVpc(ctx context.Context, formats strfmt.Registry) error { + + if m.Vpc != nil { + if err := m.Vpc.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpc") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpc") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CloudConnection) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudConnection) UnmarshalBinary(b []byte) error { + var res CloudConnection + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_create.go new file mode 100644 index 00000000000..12231ad9df1 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_create.go @@ -0,0 +1,221 @@ +// 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" +) + +// CloudConnectionCreate cloud connection create +// +// swagger:model CloudConnectionCreate +type CloudConnectionCreate struct { + + // classic + Classic *CloudConnectionEndpointClassicUpdate `json:"classic,omitempty"` + + // enable global routing for this cloud connection (default=false) + GlobalRouting bool `json:"globalRouting,omitempty"` + + // enable metered for this cloud connection (default=false) + Metered bool `json:"metered,omitempty"` + + // name of the cloud connection + // Required: true + Name *string `json:"name"` + + // speed of the cloud connection (speed in megabits per second) + // Required: true + // Enum: [50 100 200 500 1000 2000 5000 10000] + Speed *int64 `json:"speed"` + + // list of subnets to attach to cloud connection + Subnets []string `json:"subnets"` + + // vpc + Vpc *CloudConnectionEndpointVPC `json:"vpc,omitempty"` +} + +// Validate validates this cloud connection create +func (m *CloudConnectionCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClassic(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSpeed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVpc(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionCreate) validateClassic(formats strfmt.Registry) error { + if swag.IsZero(m.Classic) { // not required + return nil + } + + if m.Classic != nil { + if err := m.Classic.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("classic") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classic") + } + return err + } + } + + return nil +} + +func (m *CloudConnectionCreate) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +var cloudConnectionCreateTypeSpeedPropEnum []interface{} + +func init() { + var res []int64 + if err := json.Unmarshal([]byte(`[50,100,200,500,1000,2000,5000,10000]`), &res); err != nil { + panic(err) + } + for _, v := range res { + cloudConnectionCreateTypeSpeedPropEnum = append(cloudConnectionCreateTypeSpeedPropEnum, v) + } +} + +// prop value enum +func (m *CloudConnectionCreate) validateSpeedEnum(path, location string, value int64) error { + if err := validate.EnumCase(path, location, value, cloudConnectionCreateTypeSpeedPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *CloudConnectionCreate) validateSpeed(formats strfmt.Registry) error { + + if err := validate.Required("speed", "body", m.Speed); err != nil { + return err + } + + // value enum + if err := m.validateSpeedEnum("speed", "body", *m.Speed); err != nil { + return err + } + + return nil +} + +func (m *CloudConnectionCreate) validateVpc(formats strfmt.Registry) error { + if swag.IsZero(m.Vpc) { // not required + return nil + } + + if m.Vpc != nil { + if err := m.Vpc.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpc") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpc") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloud connection create based on the context it is used +func (m *CloudConnectionCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClassic(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVpc(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionCreate) contextValidateClassic(ctx context.Context, formats strfmt.Registry) error { + + if m.Classic != nil { + if err := m.Classic.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("classic") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classic") + } + return err + } + } + + return nil +} + +func (m *CloudConnectionCreate) contextValidateVpc(ctx context.Context, formats strfmt.Registry) error { + + if m.Vpc != nil { + if err := m.Vpc.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpc") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpc") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CloudConnectionCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudConnectionCreate) UnmarshalBinary(b []byte) error { + var res CloudConnectionCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_create_response.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_create_response.go new file mode 100644 index 00000000000..cf8c089942a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_create_response.go @@ -0,0 +1,160 @@ +// 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" +) + +// CloudConnectionCreateResponse cloud connection create response +// +// swagger:model CloudConnectionCreateResponse +type CloudConnectionCreateResponse struct { + CloudConnection + + // job ref + JobRef *JobReference `json:"jobRef,omitempty"` +} + +// UnmarshalJSON unmarshals this object from a JSON structure +func (m *CloudConnectionCreateResponse) UnmarshalJSON(raw []byte) error { + // AO0 + var aO0 CloudConnection + if err := swag.ReadJSON(raw, &aO0); err != nil { + return err + } + m.CloudConnection = aO0 + + // now for regular properties + var propsCloudConnectionCreateResponse struct { + JobRef *JobReference `json:"jobRef,omitempty"` + } + if err := swag.ReadJSON(raw, &propsCloudConnectionCreateResponse); err != nil { + return err + } + m.JobRef = propsCloudConnectionCreateResponse.JobRef + + return nil +} + +// MarshalJSON marshals this object to a JSON structure +func (m CloudConnectionCreateResponse) MarshalJSON() ([]byte, error) { + _parts := make([][]byte, 0, 1) + + aO0, err := swag.WriteJSON(m.CloudConnection) + if err != nil { + return nil, err + } + _parts = append(_parts, aO0) + + // now for regular properties + var propsCloudConnectionCreateResponse struct { + JobRef *JobReference `json:"jobRef,omitempty"` + } + propsCloudConnectionCreateResponse.JobRef = m.JobRef + + jsonDataPropsCloudConnectionCreateResponse, errCloudConnectionCreateResponse := swag.WriteJSON(propsCloudConnectionCreateResponse) + if errCloudConnectionCreateResponse != nil { + return nil, errCloudConnectionCreateResponse + } + _parts = append(_parts, jsonDataPropsCloudConnectionCreateResponse) + return swag.ConcatJSON(_parts...), nil +} + +// Validate validates this cloud connection create response +func (m *CloudConnectionCreateResponse) Validate(formats strfmt.Registry) error { + var res []error + + // validation for a type composition with CloudConnection + if err := m.CloudConnection.Validate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateJobRef(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionCreateResponse) validateJobRef(formats strfmt.Registry) error { + if swag.IsZero(m.JobRef) { // not required + return nil + } + + if m.JobRef != nil { + if err := m.JobRef.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("jobRef") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("jobRef") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloud connection create response based on the context it is used +func (m *CloudConnectionCreateResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with CloudConnection + if err := m.CloudConnection.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateJobRef(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionCreateResponse) contextValidateJobRef(ctx context.Context, formats strfmt.Registry) error { + + if m.JobRef != nil { + if err := m.JobRef.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("jobRef") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("jobRef") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CloudConnectionCreateResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudConnectionCreateResponse) UnmarshalBinary(b []byte) error { + var res CloudConnectionCreateResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_endpoint_classic.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_endpoint_classic.go new file mode 100644 index 00000000000..9ca73c49d34 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_endpoint_classic.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" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CloudConnectionEndpointClassic cloud connection endpoint classic +// +// swagger:model CloudConnectionEndpointClassic +type CloudConnectionEndpointClassic struct { + + // enable classic endpoint destination (default=false) + Enabled bool `json:"enabled"` + + // gre + Gre *CloudConnectionGRETunnel `json:"gre,omitempty"` +} + +// Validate validates this cloud connection endpoint classic +func (m *CloudConnectionEndpointClassic) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateGre(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionEndpointClassic) validateGre(formats strfmt.Registry) error { + if swag.IsZero(m.Gre) { // not required + return nil + } + + if m.Gre != nil { + if err := m.Gre.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gre") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gre") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloud connection endpoint classic based on the context it is used +func (m *CloudConnectionEndpointClassic) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGre(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionEndpointClassic) contextValidateGre(ctx context.Context, formats strfmt.Registry) error { + + if m.Gre != nil { + if err := m.Gre.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gre") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gre") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CloudConnectionEndpointClassic) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudConnectionEndpointClassic) UnmarshalBinary(b []byte) error { + var res CloudConnectionEndpointClassic + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_endpoint_classic_update.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_endpoint_classic_update.go new file mode 100644 index 00000000000..300fef2a19c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_endpoint_classic_update.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" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// CloudConnectionEndpointClassicUpdate cloud connection endpoint classic update +// +// swagger:model CloudConnectionEndpointClassicUpdate +type CloudConnectionEndpointClassicUpdate struct { + + // enable classic endpoint destination (default=false) + Enabled bool `json:"enabled"` + + // gre + Gre *CloudConnectionGRETunnelCreate `json:"gre,omitempty"` +} + +// Validate validates this cloud connection endpoint classic update +func (m *CloudConnectionEndpointClassicUpdate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateGre(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionEndpointClassicUpdate) validateGre(formats strfmt.Registry) error { + if swag.IsZero(m.Gre) { // not required + return nil + } + + if m.Gre != nil { + if err := m.Gre.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gre") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gre") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloud connection endpoint classic update based on the context it is used +func (m *CloudConnectionEndpointClassicUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateGre(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionEndpointClassicUpdate) contextValidateGre(ctx context.Context, formats strfmt.Registry) error { + + if m.Gre != nil { + if err := m.Gre.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("gre") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("gre") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CloudConnectionEndpointClassicUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudConnectionEndpointClassicUpdate) UnmarshalBinary(b []byte) error { + var res CloudConnectionEndpointClassicUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_endpoint_v_p_c.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_endpoint_v_p_c.go new file mode 100644 index 00000000000..873c365c195 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_endpoint_v_p_c.go @@ -0,0 +1,119 @@ +// 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" +) + +// CloudConnectionEndpointVPC cloud connection endpoint v p c +// +// swagger:model CloudConnectionEndpointVPC +type CloudConnectionEndpointVPC struct { + + // enable vpc for this cloud connection (default=false) + Enabled bool `json:"enabled"` + + // vpc connections + Vpcs []*CloudConnectionVPC `json:"vpcs,omitempty"` +} + +// Validate validates this cloud connection endpoint v p c +func (m *CloudConnectionEndpointVPC) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVpcs(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionEndpointVPC) validateVpcs(formats strfmt.Registry) error { + if swag.IsZero(m.Vpcs) { // not required + return nil + } + + for i := 0; i < len(m.Vpcs); i++ { + if swag.IsZero(m.Vpcs[i]) { // not required + continue + } + + if m.Vpcs[i] != nil { + if err := m.Vpcs[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpcs" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpcs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this cloud connection endpoint v p c based on the context it is used +func (m *CloudConnectionEndpointVPC) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVpcs(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionEndpointVPC) contextValidateVpcs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Vpcs); i++ { + + if m.Vpcs[i] != nil { + if err := m.Vpcs[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpcs" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpcs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CloudConnectionEndpointVPC) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudConnectionEndpointVPC) UnmarshalBinary(b []byte) error { + var res CloudConnectionEndpointVPC + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_g_r_e_tunnel.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_g_r_e_tunnel.go new file mode 100644 index 00000000000..df506624058 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_g_r_e_tunnel.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" +) + +// CloudConnectionGRETunnel cloud connection g r e tunnel +// +// swagger:model CloudConnectionGRETunnel +type CloudConnectionGRETunnel struct { + + // gre destination IP address + // Required: true + DestIPAddress *string `json:"destIPAddress"` + + // gre auto-assigned source IP address + // Required: true + SourceIPAddress *string `json:"sourceIPAddress"` +} + +// Validate validates this cloud connection g r e tunnel +func (m *CloudConnectionGRETunnel) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDestIPAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSourceIPAddress(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionGRETunnel) validateDestIPAddress(formats strfmt.Registry) error { + + if err := validate.Required("destIPAddress", "body", m.DestIPAddress); err != nil { + return err + } + + return nil +} + +func (m *CloudConnectionGRETunnel) validateSourceIPAddress(formats strfmt.Registry) error { + + if err := validate.Required("sourceIPAddress", "body", m.SourceIPAddress); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this cloud connection g r e tunnel based on context it is used +func (m *CloudConnectionGRETunnel) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CloudConnectionGRETunnel) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudConnectionGRETunnel) UnmarshalBinary(b []byte) error { + var res CloudConnectionGRETunnel + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_g_r_e_tunnel_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_g_r_e_tunnel_create.go new file mode 100644 index 00000000000..3310bc0566b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_g_r_e_tunnel_create.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" +) + +// CloudConnectionGRETunnelCreate cloud connection g r e tunnel create +// +// swagger:model CloudConnectionGRETunnelCreate +type CloudConnectionGRETunnelCreate struct { + + // gre network in CIDR notation (192.168.0.0/24) + // Required: true + Cidr *string `json:"cidr"` + + // gre destination IP address + // Required: true + DestIPAddress *string `json:"destIPAddress"` +} + +// Validate validates this cloud connection g r e tunnel create +func (m *CloudConnectionGRETunnelCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCidr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDestIPAddress(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionGRETunnelCreate) validateCidr(formats strfmt.Registry) error { + + if err := validate.Required("cidr", "body", m.Cidr); err != nil { + return err + } + + return nil +} + +func (m *CloudConnectionGRETunnelCreate) validateDestIPAddress(formats strfmt.Registry) error { + + if err := validate.Required("destIPAddress", "body", m.DestIPAddress); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this cloud connection g r e tunnel create based on context it is used +func (m *CloudConnectionGRETunnelCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CloudConnectionGRETunnelCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudConnectionGRETunnelCreate) UnmarshalBinary(b []byte) error { + var res CloudConnectionGRETunnelCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_update.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_update.go new file mode 100644 index 00000000000..df7e0c302d1 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_update.go @@ -0,0 +1,202 @@ +// 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" +) + +// CloudConnectionUpdate cloud connection update +// +// swagger:model CloudConnectionUpdate +type CloudConnectionUpdate struct { + + // classic + Classic *CloudConnectionEndpointClassicUpdate `json:"classic,omitempty"` + + // enable global routing for this cloud connection (default=false) + GlobalRouting *bool `json:"globalRouting,omitempty"` + + // enable metered for this cloud connection (default=false) + Metered *bool `json:"metered,omitempty"` + + // name of the cloud connection + Name *string `json:"name,omitempty"` + + // speed of the cloud connection (speed in megabits per second) + // Enum: [50 100 200 500 1000 2000 5000 10000] + Speed *int64 `json:"speed,omitempty"` + + // vpc + Vpc *CloudConnectionEndpointVPC `json:"vpc,omitempty"` +} + +// Validate validates this cloud connection update +func (m *CloudConnectionUpdate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClassic(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSpeed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVpc(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionUpdate) validateClassic(formats strfmt.Registry) error { + if swag.IsZero(m.Classic) { // not required + return nil + } + + if m.Classic != nil { + if err := m.Classic.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("classic") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classic") + } + return err + } + } + + return nil +} + +var cloudConnectionUpdateTypeSpeedPropEnum []interface{} + +func init() { + var res []int64 + if err := json.Unmarshal([]byte(`[50,100,200,500,1000,2000,5000,10000]`), &res); err != nil { + panic(err) + } + for _, v := range res { + cloudConnectionUpdateTypeSpeedPropEnum = append(cloudConnectionUpdateTypeSpeedPropEnum, v) + } +} + +// prop value enum +func (m *CloudConnectionUpdate) validateSpeedEnum(path, location string, value int64) error { + if err := validate.EnumCase(path, location, value, cloudConnectionUpdateTypeSpeedPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *CloudConnectionUpdate) validateSpeed(formats strfmt.Registry) error { + if swag.IsZero(m.Speed) { // not required + return nil + } + + // value enum + if err := m.validateSpeedEnum("speed", "body", *m.Speed); err != nil { + return err + } + + return nil +} + +func (m *CloudConnectionUpdate) validateVpc(formats strfmt.Registry) error { + if swag.IsZero(m.Vpc) { // not required + return nil + } + + if m.Vpc != nil { + if err := m.Vpc.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpc") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpc") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloud connection update based on the context it is used +func (m *CloudConnectionUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClassic(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVpc(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionUpdate) contextValidateClassic(ctx context.Context, formats strfmt.Registry) error { + + if m.Classic != nil { + if err := m.Classic.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("classic") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("classic") + } + return err + } + } + + return nil +} + +func (m *CloudConnectionUpdate) contextValidateVpc(ctx context.Context, formats strfmt.Registry) error { + + if m.Vpc != nil { + if err := m.Vpc.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpc") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpc") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CloudConnectionUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudConnectionUpdate) UnmarshalBinary(b []byte) error { + var res CloudConnectionUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_v_p_c.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_v_p_c.go new file mode 100644 index 00000000000..7aab62b3a71 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_v_p_c.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" +) + +// CloudConnectionVPC cloud connection v p c +// +// swagger:model CloudConnectionVPC +type CloudConnectionVPC struct { + + // vpc name + Name string `json:"name,omitempty"` + + // vpc id + // Required: true + VpcID *string `json:"vpcID"` +} + +// Validate validates this cloud connection v p c +func (m *CloudConnectionVPC) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVpcID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionVPC) validateVpcID(formats strfmt.Registry) error { + + if err := validate.Required("vpcID", "body", m.VpcID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this cloud connection v p c based on context it is used +func (m *CloudConnectionVPC) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CloudConnectionVPC) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudConnectionVPC) UnmarshalBinary(b []byte) error { + var res CloudConnectionVPC + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_virtual_private_clouds.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_virtual_private_clouds.go new file mode 100644 index 00000000000..5c97aab8b7f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connection_virtual_private_clouds.go @@ -0,0 +1,226 @@ +// 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" +) + +// CloudConnectionVirtualPrivateClouds cloud connection virtual private clouds +// +// swagger:model CloudConnectionVirtualPrivateClouds +type CloudConnectionVirtualPrivateClouds struct { + + // list of available virtual private clouds + // Required: true + VirtualPrivateClouds []*CloudConnectionVirtualPrivateCloud `json:"virtualPrivateClouds"` +} + +// Validate validates this cloud connection virtual private clouds +func (m *CloudConnectionVirtualPrivateClouds) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVirtualPrivateClouds(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionVirtualPrivateClouds) validateVirtualPrivateClouds(formats strfmt.Registry) error { + + if err := validate.Required("virtualPrivateClouds", "body", m.VirtualPrivateClouds); err != nil { + return err + } + + for i := 0; i < len(m.VirtualPrivateClouds); i++ { + if swag.IsZero(m.VirtualPrivateClouds[i]) { // not required + continue + } + + if m.VirtualPrivateClouds[i] != nil { + if err := m.VirtualPrivateClouds[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualPrivateClouds" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualPrivateClouds" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this cloud connection virtual private clouds based on the context it is used +func (m *CloudConnectionVirtualPrivateClouds) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVirtualPrivateClouds(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionVirtualPrivateClouds) contextValidateVirtualPrivateClouds(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.VirtualPrivateClouds); i++ { + + if m.VirtualPrivateClouds[i] != nil { + if err := m.VirtualPrivateClouds[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualPrivateClouds" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualPrivateClouds" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CloudConnectionVirtualPrivateClouds) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudConnectionVirtualPrivateClouds) UnmarshalBinary(b []byte) error { + var res CloudConnectionVirtualPrivateClouds + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// CloudConnectionVirtualPrivateCloud cloud connection virtual private cloud +// +// swagger:model CloudConnectionVirtualPrivateCloud +type CloudConnectionVirtualPrivateCloud struct { + + // indicates if vpc uses classic architecture + // Required: true + ClassicAccess *bool `json:"classicAccess"` + + // name for the vpc + // Required: true + Name *string `json:"name"` + + // status of this vpc + // Required: true + Status *string `json:"status"` + + // virtual private cloud id + // Required: true + VpcID *string `json:"vpcID"` +} + +// Validate validates this cloud connection virtual private cloud +func (m *CloudConnectionVirtualPrivateCloud) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClassicAccess(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVpcID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnectionVirtualPrivateCloud) validateClassicAccess(formats strfmt.Registry) error { + + if err := validate.Required("classicAccess", "body", m.ClassicAccess); err != nil { + return err + } + + return nil +} + +func (m *CloudConnectionVirtualPrivateCloud) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *CloudConnectionVirtualPrivateCloud) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + return nil +} + +func (m *CloudConnectionVirtualPrivateCloud) validateVpcID(formats strfmt.Registry) error { + + if err := validate.Required("vpcID", "body", m.VpcID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this cloud connection virtual private cloud based on context it is used +func (m *CloudConnectionVirtualPrivateCloud) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CloudConnectionVirtualPrivateCloud) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudConnectionVirtualPrivateCloud) UnmarshalBinary(b []byte) error { + var res CloudConnectionVirtualPrivateCloud + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connections.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connections.go new file mode 100644 index 00000000000..1c9696c6cdb --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_connections.go @@ -0,0 +1,119 @@ +// 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" +) + +// CloudConnections cloud connections +// +// swagger:model CloudConnections +type CloudConnections struct { + + // Cloud Connections + // Required: true + CloudConnections []*CloudConnection `json:"cloudConnections"` +} + +// Validate validates this cloud connections +func (m *CloudConnections) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCloudConnections(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnections) validateCloudConnections(formats strfmt.Registry) error { + + if err := validate.Required("cloudConnections", "body", m.CloudConnections); err != nil { + return err + } + + for i := 0; i < len(m.CloudConnections); i++ { + if swag.IsZero(m.CloudConnections[i]) { // not required + continue + } + + if m.CloudConnections[i] != nil { + if err := m.CloudConnections[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this cloud connections based on the context it is used +func (m *CloudConnections) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCloudConnections(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudConnections) contextValidateCloudConnections(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.CloudConnections); i++ { + + if m.CloudConnections[i] != nil { + if err := m.CloudConnections[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CloudConnections) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudConnections) UnmarshalBinary(b []byte) error { + var res CloudConnections + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_instance.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_instance.go new file mode 100644 index 00000000000..307eab24199 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_instance.go @@ -0,0 +1,337 @@ +// 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" +) + +// CloudInstance cloud instance +// +// swagger:model CloudInstance +type CloudInstance struct { + + // Cloud Instance Capabilities + Capabilities []string `json:"capabilities"` + + // Cloud Instance ID + // Required: true + CloudInstanceID *string `json:"cloudInstanceID"` + + // Indicates if the cloud instance is enabled + // Required: true + Enabled *bool `json:"enabled"` + + // Indicates if the cloud instance is initialized and ready for use + // Required: true + Initialized *bool `json:"initialized"` + + // Limits on the cloud instance + // Required: true + Limits *CloudInstanceUsageLimits `json:"limits"` + + // Cloud Instance Name + // Required: true + Name *string `json:"name"` + + // The open stack ID that controls this cloud instance + // Required: true + OpenstackID *string `json:"openstackID"` + + // PVM instances owned by the Cloud Instance + // Required: true + PvmInstances []*PVMInstanceReference `json:"pvmInstances"` + + // The region the cloud instance lives + // Required: true + Region *string `json:"region"` + + // The tenant ID that owns this cloud instance + // Required: true + TenantID *string `json:"tenantID"` + + // Current usage on the cloud instance + // Required: true + Usage *CloudInstanceUsageLimits `json:"usage"` +} + +// Validate validates this cloud instance +func (m *CloudInstance) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCloudInstanceID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnabled(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInitialized(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLimits(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOpenstackID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePvmInstances(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTenantID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsage(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudInstance) validateCloudInstanceID(formats strfmt.Registry) error { + + if err := validate.Required("cloudInstanceID", "body", m.CloudInstanceID); err != nil { + return err + } + + return nil +} + +func (m *CloudInstance) validateEnabled(formats strfmt.Registry) error { + + if err := validate.Required("enabled", "body", m.Enabled); err != nil { + return err + } + + return nil +} + +func (m *CloudInstance) validateInitialized(formats strfmt.Registry) error { + + if err := validate.Required("initialized", "body", m.Initialized); err != nil { + return err + } + + return nil +} + +func (m *CloudInstance) validateLimits(formats strfmt.Registry) error { + + if err := validate.Required("limits", "body", m.Limits); err != nil { + return err + } + + if m.Limits != nil { + if err := m.Limits.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("limits") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("limits") + } + return err + } + } + + return nil +} + +func (m *CloudInstance) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *CloudInstance) validateOpenstackID(formats strfmt.Registry) error { + + if err := validate.Required("openstackID", "body", m.OpenstackID); err != nil { + return err + } + + return nil +} + +func (m *CloudInstance) validatePvmInstances(formats strfmt.Registry) error { + + if err := validate.Required("pvmInstances", "body", m.PvmInstances); err != nil { + return err + } + + for i := 0; i < len(m.PvmInstances); i++ { + if swag.IsZero(m.PvmInstances[i]) { // not required + continue + } + + if m.PvmInstances[i] != nil { + if err := m.PvmInstances[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CloudInstance) validateRegion(formats strfmt.Registry) error { + + if err := validate.Required("region", "body", m.Region); err != nil { + return err + } + + return nil +} + +func (m *CloudInstance) validateTenantID(formats strfmt.Registry) error { + + if err := validate.Required("tenantID", "body", m.TenantID); err != nil { + return err + } + + return nil +} + +func (m *CloudInstance) validateUsage(formats strfmt.Registry) error { + + if err := validate.Required("usage", "body", m.Usage); err != nil { + return err + } + + if m.Usage != nil { + if err := m.Usage.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("usage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("usage") + } + return err + } + } + + return nil +} + +// ContextValidate validate this cloud instance based on the context it is used +func (m *CloudInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLimits(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePvmInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUsage(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudInstance) contextValidateLimits(ctx context.Context, formats strfmt.Registry) error { + + if m.Limits != nil { + if err := m.Limits.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("limits") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("limits") + } + return err + } + } + + return nil +} + +func (m *CloudInstance) contextValidatePvmInstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PvmInstances); i++ { + + if m.PvmInstances[i] != nil { + if err := m.PvmInstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *CloudInstance) contextValidateUsage(ctx context.Context, formats strfmt.Registry) error { + + if m.Usage != nil { + if err := m.Usage.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("usage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("usage") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CloudInstance) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudInstance) UnmarshalBinary(b []byte) error { + var res CloudInstance + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_instance_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_instance_create.go new file mode 100644 index 00000000000..a94ca580bc6 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_instance_create.go @@ -0,0 +1,145 @@ +// 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" +) + +// CloudInstanceCreate cloud instance create +// +// swagger:model CloudInstanceCreate +type CloudInstanceCreate struct { + + // Number of power instances allowed + Instances *float64 `json:"instances,omitempty"` + + // Amount of memory allowed + // Required: true + Memory *float64 `json:"memory"` + + // Number of processor units allowed + // Required: true + ProcUnits *float64 `json:"procUnits"` + + // Number of processors allowed + // Required: true + Processors *float64 `json:"processors"` + + // The region the cloud instance lives + // Required: true + Region *string `json:"region"` + + // Amount of storage allowed (TB) + Storage *float64 `json:"storage,omitempty"` + + // The tenant ID that owns this cloud instance + // Required: true + TenantID *string `json:"tenantID"` +} + +// Validate validates this cloud instance create +func (m *CloudInstanceCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMemory(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProcUnits(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProcessors(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTenantID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudInstanceCreate) validateMemory(formats strfmt.Registry) error { + + if err := validate.Required("memory", "body", m.Memory); err != nil { + return err + } + + return nil +} + +func (m *CloudInstanceCreate) validateProcUnits(formats strfmt.Registry) error { + + if err := validate.Required("procUnits", "body", m.ProcUnits); err != nil { + return err + } + + return nil +} + +func (m *CloudInstanceCreate) validateProcessors(formats strfmt.Registry) error { + + if err := validate.Required("processors", "body", m.Processors); err != nil { + return err + } + + return nil +} + +func (m *CloudInstanceCreate) validateRegion(formats strfmt.Registry) error { + + if err := validate.Required("region", "body", m.Region); err != nil { + return err + } + + return nil +} + +func (m *CloudInstanceCreate) validateTenantID(formats strfmt.Registry) error { + + if err := validate.Required("tenantID", "body", m.TenantID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this cloud instance create based on context it is used +func (m *CloudInstanceCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CloudInstanceCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudInstanceCreate) UnmarshalBinary(b []byte) error { + var res CloudInstanceCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_instance_reference.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_instance_reference.go new file mode 100644 index 00000000000..22901098b01 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_instance_reference.go @@ -0,0 +1,212 @@ +// 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" +) + +// CloudInstanceReference cloud instance reference +// +// swagger:model CloudInstanceReference +type CloudInstanceReference struct { + + // Cloud Instance Capabilities + Capabilities []string `json:"capabilities"` + + // Cloud Instance ID + // Required: true + CloudInstanceID *string `json:"cloudInstanceID"` + + // Indicates if the cloud instance is enabled + // Required: true + Enabled *bool `json:"enabled"` + + // Link to Cloud Instance resource + // Required: true + Href *string `json:"href"` + + // Indicates if the cloud instance is initialized and ready for use + // Required: true + Initialized *bool `json:"initialized"` + + // Limits on the cloud instance + // Required: true + Limits *CloudInstanceUsageLimits `json:"limits"` + + // Cloud Instance Name + // Required: true + Name *string `json:"name"` + + // The region the cloud instance lives + // Required: true + Region *string `json:"region"` +} + +// Validate validates this cloud instance reference +func (m *CloudInstanceReference) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCloudInstanceID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnabled(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHref(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInitialized(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLimits(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudInstanceReference) validateCloudInstanceID(formats strfmt.Registry) error { + + if err := validate.Required("cloudInstanceID", "body", m.CloudInstanceID); err != nil { + return err + } + + return nil +} + +func (m *CloudInstanceReference) validateEnabled(formats strfmt.Registry) error { + + if err := validate.Required("enabled", "body", m.Enabled); err != nil { + return err + } + + return nil +} + +func (m *CloudInstanceReference) validateHref(formats strfmt.Registry) error { + + if err := validate.Required("href", "body", m.Href); err != nil { + return err + } + + return nil +} + +func (m *CloudInstanceReference) validateInitialized(formats strfmt.Registry) error { + + if err := validate.Required("initialized", "body", m.Initialized); err != nil { + return err + } + + return nil +} + +func (m *CloudInstanceReference) validateLimits(formats strfmt.Registry) error { + + if err := validate.Required("limits", "body", m.Limits); err != nil { + return err + } + + if m.Limits != nil { + if err := m.Limits.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("limits") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("limits") + } + return err + } + } + + return nil +} + +func (m *CloudInstanceReference) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *CloudInstanceReference) validateRegion(formats strfmt.Registry) error { + + if err := validate.Required("region", "body", m.Region); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this cloud instance reference based on the context it is used +func (m *CloudInstanceReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLimits(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudInstanceReference) contextValidateLimits(ctx context.Context, formats strfmt.Registry) error { + + if m.Limits != nil { + if err := m.Limits.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("limits") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("limits") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CloudInstanceReference) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudInstanceReference) UnmarshalBinary(b []byte) error { + var res CloudInstanceReference + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_instance_update.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_instance_update.go new file mode 100644 index 00000000000..a22c0677a83 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_instance_update.go @@ -0,0 +1,62 @@ +// 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" +) + +// CloudInstanceUpdate cloud instance update +// +// swagger:model CloudInstanceUpdate +type CloudInstanceUpdate struct { + + // Number of power instances allowed + Instances *float64 `json:"instances,omitempty"` + + // Amount of memory allowed + Memory *float64 `json:"memory,omitempty"` + + // Number of processor units allowed + ProcUnits *float64 `json:"procUnits,omitempty"` + + // Number of processors allowed + Processors *float64 `json:"processors,omitempty"` + + // Amount of storage allowed (TB) + Storage *float64 `json:"storage,omitempty"` +} + +// Validate validates this cloud instance update +func (m *CloudInstanceUpdate) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this cloud instance update based on context it is used +func (m *CloudInstanceUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CloudInstanceUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudInstanceUpdate) UnmarshalBinary(b []byte) error { + var res CloudInstanceUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_instance_usage_limits.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_instance_usage_limits.go new file mode 100644 index 00000000000..ab8710d9ab4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/cloud_instance_usage_limits.go @@ -0,0 +1,157 @@ +// 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" +) + +// CloudInstanceUsageLimits cloud instance usage limits +// +// swagger:model CloudInstanceUsageLimits +type CloudInstanceUsageLimits struct { + + // Maximum memory (in GB) per PVMInstance + InstanceMemory *float64 `json:"instanceMemory,omitempty"` + + // Maximum proc units per PVMInstance + InstanceProcUnits *float64 `json:"instanceProcUnits,omitempty"` + + // Number of power instances allowed + // Required: true + Instances *float64 `json:"instances"` + + // Amount of memory allowed + // Required: true + Memory *float64 `json:"memory"` + + // Maximum network bandwidth to GCP Mbps + PeeringBandwidth *int64 `json:"peeringBandwidth,omitempty"` + + // Amount of peering networks allowed + PeeringNetworks *int64 `json:"peeringNetworks,omitempty"` + + // Number of processor units allowed + // Required: true + ProcUnits *float64 `json:"procUnits"` + + // Number of processors allowed + // Required: true + Processors *float64 `json:"processors"` + + // Amount of storage allowed (TB) + // Required: true + Storage *float64 `json:"storage"` + + // Amount of SSD storage allowed (TB) + StorageSSD *float64 `json:"storageSSD,omitempty"` + + // Amount of standard (HDD) storage allowed (TB) + StorageStandard *float64 `json:"storageStandard,omitempty"` +} + +// Validate validates this cloud instance usage limits +func (m *CloudInstanceUsageLimits) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateInstances(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemory(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProcUnits(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProcessors(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStorage(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CloudInstanceUsageLimits) validateInstances(formats strfmt.Registry) error { + + if err := validate.Required("instances", "body", m.Instances); err != nil { + return err + } + + return nil +} + +func (m *CloudInstanceUsageLimits) validateMemory(formats strfmt.Registry) error { + + if err := validate.Required("memory", "body", m.Memory); err != nil { + return err + } + + return nil +} + +func (m *CloudInstanceUsageLimits) validateProcUnits(formats strfmt.Registry) error { + + if err := validate.Required("procUnits", "body", m.ProcUnits); err != nil { + return err + } + + return nil +} + +func (m *CloudInstanceUsageLimits) validateProcessors(formats strfmt.Registry) error { + + if err := validate.Required("processors", "body", m.Processors); err != nil { + return err + } + + return nil +} + +func (m *CloudInstanceUsageLimits) validateStorage(formats strfmt.Registry) error { + + if err := validate.Required("storage", "body", m.Storage); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this cloud instance usage limits based on context it is used +func (m *CloudInstanceUsageLimits) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CloudInstanceUsageLimits) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CloudInstanceUsageLimits) UnmarshalBinary(b []byte) error { + var res CloudInstanceUsageLimits + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/console_language.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/console_language.go new file mode 100644 index 00000000000..76399a994a3 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/console_language.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" +) + +// ConsoleLanguage console language +// +// swagger:model ConsoleLanguage +type ConsoleLanguage struct { + + // language code + // Required: true + Code *string `json:"code"` + + // language description + Language string `json:"language,omitempty"` +} + +// Validate validates this console language +func (m *ConsoleLanguage) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCode(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ConsoleLanguage) validateCode(formats strfmt.Registry) error { + + if err := validate.Required("code", "body", m.Code); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this console language based on context it is used +func (m *ConsoleLanguage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ConsoleLanguage) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ConsoleLanguage) UnmarshalBinary(b []byte) error { + var res ConsoleLanguage + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/console_languages.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/console_languages.go new file mode 100644 index 00000000000..adfe7d6540a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/console_languages.go @@ -0,0 +1,119 @@ +// 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" +) + +// ConsoleLanguages console languages +// +// swagger:model ConsoleLanguages +type ConsoleLanguages struct { + + // console languages + // Required: true + ConsoleLanguages []*ConsoleLanguage `json:"consoleLanguages"` +} + +// Validate validates this console languages +func (m *ConsoleLanguages) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateConsoleLanguages(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ConsoleLanguages) validateConsoleLanguages(formats strfmt.Registry) error { + + if err := validate.Required("consoleLanguages", "body", m.ConsoleLanguages); err != nil { + return err + } + + for i := 0; i < len(m.ConsoleLanguages); i++ { + if swag.IsZero(m.ConsoleLanguages[i]) { // not required + continue + } + + if m.ConsoleLanguages[i] != nil { + if err := m.ConsoleLanguages[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("consoleLanguages" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("consoleLanguages" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this console languages based on the context it is used +func (m *ConsoleLanguages) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateConsoleLanguages(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ConsoleLanguages) contextValidateConsoleLanguages(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ConsoleLanguages); i++ { + + if m.ConsoleLanguages[i] != nil { + if err := m.ConsoleLanguages[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("consoleLanguages" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("consoleLanguages" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ConsoleLanguages) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ConsoleLanguages) UnmarshalBinary(b []byte) error { + var res ConsoleLanguages + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/context.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/context.go new file mode 100644 index 00000000000..85e1cd011d1 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/context.go @@ -0,0 +1,11 @@ +// 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 + +// Context See [Context Conventions](https://github.com/openservicebrokerapi/servicebroker/blob/master/profile.md#context-object) for more details. +// +// swagger:model Context +type Context interface{} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/create_cos_image_import_job.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/create_cos_image_import_job.go new file mode 100644 index 00000000000..164c9a5a9da --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/create_cos_image_import_job.go @@ -0,0 +1,292 @@ +// 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" +) + +// CreateCosImageImportJob create cos image import job +// +// swagger:model CreateCosImageImportJob +type CreateCosImageImportJob struct { + + // Cloud Object Storage access key; required for buckets with private access + AccessKey string `json:"accessKey,omitempty"` + + // indicates if the bucket has public or private access public access require no authentication keys private access requires hmac authentication keys (access,secret) + // Enum: [public private] + BucketAccess *string `json:"bucketAccess,omitempty"` + + // Cloud Object Storage bucket name; bucket-name[/optional/folder] + // Required: true + BucketName *string `json:"bucketName"` + + // Cloud Object Storage image filename + // Required: true + ImageFilename *string `json:"imageFilename"` + + // Name for the image that will be loaded into the boot image catalog + // Required: true + ImageName *string `json:"imageName"` + + // Image OS Type, required if importing a raw image; raw images can only be imported using the command line interface + // Enum: [aix ibmi rhel sles] + OsType string `json:"osType,omitempty"` + + // Cloud Object Storage region + // Required: true + Region *string `json:"region"` + + // Cloud Object Storage secret key; required for buckets with private access + SecretKey string `json:"secretKey,omitempty"` + + // Storage affinity data used for storage pool selection + StorageAffinity *StorageAffinity `json:"storageAffinity,omitempty"` + + // Storage pool where the image will be loaded, if provided then storageType and storageAffinity will be ignored + StoragePool string `json:"storagePool,omitempty"` + + // Type of storage; will be ignored if storagePool or storageAffinity is provided. If only using storageType for storage selection then the storage pool with the most available space will be selected + StorageType string `json:"storageType,omitempty"` +} + +// Validate validates this create cos image import job +func (m *CreateCosImageImportJob) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBucketAccess(formats); err != nil { + res = append(res, err) + } + + if err := m.validateBucketName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateImageFilename(formats); err != nil { + res = append(res, err) + } + + if err := m.validateImageName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOsType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegion(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStorageAffinity(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var createCosImageImportJobTypeBucketAccessPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["public","private"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + createCosImageImportJobTypeBucketAccessPropEnum = append(createCosImageImportJobTypeBucketAccessPropEnum, v) + } +} + +const ( + + // CreateCosImageImportJobBucketAccessPublic captures enum value "public" + CreateCosImageImportJobBucketAccessPublic string = "public" + + // CreateCosImageImportJobBucketAccessPrivate captures enum value "private" + CreateCosImageImportJobBucketAccessPrivate string = "private" +) + +// prop value enum +func (m *CreateCosImageImportJob) validateBucketAccessEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, createCosImageImportJobTypeBucketAccessPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *CreateCosImageImportJob) validateBucketAccess(formats strfmt.Registry) error { + if swag.IsZero(m.BucketAccess) { // not required + return nil + } + + // value enum + if err := m.validateBucketAccessEnum("bucketAccess", "body", *m.BucketAccess); err != nil { + return err + } + + return nil +} + +func (m *CreateCosImageImportJob) validateBucketName(formats strfmt.Registry) error { + + if err := validate.Required("bucketName", "body", m.BucketName); err != nil { + return err + } + + return nil +} + +func (m *CreateCosImageImportJob) validateImageFilename(formats strfmt.Registry) error { + + if err := validate.Required("imageFilename", "body", m.ImageFilename); err != nil { + return err + } + + return nil +} + +func (m *CreateCosImageImportJob) validateImageName(formats strfmt.Registry) error { + + if err := validate.Required("imageName", "body", m.ImageName); err != nil { + return err + } + + return nil +} + +var createCosImageImportJobTypeOsTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["aix","ibmi","rhel","sles"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + createCosImageImportJobTypeOsTypePropEnum = append(createCosImageImportJobTypeOsTypePropEnum, v) + } +} + +const ( + + // CreateCosImageImportJobOsTypeAix captures enum value "aix" + CreateCosImageImportJobOsTypeAix string = "aix" + + // CreateCosImageImportJobOsTypeIbmi captures enum value "ibmi" + CreateCosImageImportJobOsTypeIbmi string = "ibmi" + + // CreateCosImageImportJobOsTypeRhel captures enum value "rhel" + CreateCosImageImportJobOsTypeRhel string = "rhel" + + // CreateCosImageImportJobOsTypeSles captures enum value "sles" + CreateCosImageImportJobOsTypeSles string = "sles" +) + +// prop value enum +func (m *CreateCosImageImportJob) validateOsTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, createCosImageImportJobTypeOsTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *CreateCosImageImportJob) validateOsType(formats strfmt.Registry) error { + if swag.IsZero(m.OsType) { // not required + return nil + } + + // value enum + if err := m.validateOsTypeEnum("osType", "body", m.OsType); err != nil { + return err + } + + return nil +} + +func (m *CreateCosImageImportJob) validateRegion(formats strfmt.Registry) error { + + if err := validate.Required("region", "body", m.Region); err != nil { + return err + } + + return nil +} + +func (m *CreateCosImageImportJob) validateStorageAffinity(formats strfmt.Registry) error { + if swag.IsZero(m.StorageAffinity) { // not required + return nil + } + + if m.StorageAffinity != nil { + if err := m.StorageAffinity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") + } + return err + } + } + + return nil +} + +// ContextValidate validate this create cos image import job based on the context it is used +func (m *CreateCosImageImportJob) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateStorageAffinity(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateCosImageImportJob) contextValidateStorageAffinity(ctx context.Context, formats strfmt.Registry) error { + + if m.StorageAffinity != nil { + if err := m.StorageAffinity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CreateCosImageImportJob) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CreateCosImageImportJob) UnmarshalBinary(b []byte) error { + var res CreateCosImageImportJob + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/create_data_volume.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/create_data_volume.go new file mode 100644 index 00000000000..77dd2e4b1cf --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/create_data_volume.go @@ -0,0 +1,163 @@ +// 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" +) + +// CreateDataVolume create data volume +// +// swagger:model CreateDataVolume +type CreateDataVolume struct { + + // PVM Instance (ID or Name) to base volume affinity policy against; required if requesting affinity and affinityVolume is not provided + AffinityPVMInstance *string `json:"affinityPVMInstance,omitempty"` + + // Affinity policy for data volume being created; ignored if volumePool provided; for policy 'affinity' requires one of affinityPVMInstance or affinityVolume to be specified; for policy 'anti-affinity' requires one of antiAffinityPVMInstances or antiAffinityVolumes to be specified + // Enum: [affinity anti-affinity] + AffinityPolicy *string `json:"affinityPolicy,omitempty"` + + // Volume (ID or Name) to base volume affinity policy against; required if requesting affinity and affinityPVMInstance is not provided + AffinityVolume *string `json:"affinityVolume,omitempty"` + + // List of pvmInstances to base volume anti-affinity policy against; required if requesting anti-affinity and antiAffinityVolumes is not provided + AntiAffinityPVMInstances []string `json:"antiAffinityPVMInstances"` + + // List of volumes to base volume anti-affinity policy against; required if requesting anti-affinity and antiAffinityPVMInstances is not provided + AntiAffinityVolumes []string `json:"antiAffinityVolumes"` + + // Type of Disk, required if affinityPolicy and volumePool not provided, otherwise ignored + DiskType string `json:"diskType,omitempty"` + + // Volume Name + // Required: true + Name *string `json:"name"` + + // Indicates if the volume should be replication enabled or not + ReplicationEnabled *bool `json:"replicationEnabled,omitempty"` + + // Indicates if the volume is shareable between VMs + Shareable *bool `json:"shareable,omitempty"` + + // Volume Size (GB) + // Required: true + Size *float64 `json:"size"` + + // Volume pool where the volume will be created; if provided then diskType and affinityPolicy values will be ignored + VolumePool string `json:"volumePool,omitempty"` +} + +// Validate validates this create data volume +func (m *CreateDataVolume) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAffinityPolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSize(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var createDataVolumeTypeAffinityPolicyPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["affinity","anti-affinity"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + createDataVolumeTypeAffinityPolicyPropEnum = append(createDataVolumeTypeAffinityPolicyPropEnum, v) + } +} + +const ( + + // CreateDataVolumeAffinityPolicyAffinity captures enum value "affinity" + CreateDataVolumeAffinityPolicyAffinity string = "affinity" + + // CreateDataVolumeAffinityPolicyAntiDashAffinity captures enum value "anti-affinity" + CreateDataVolumeAffinityPolicyAntiDashAffinity string = "anti-affinity" +) + +// prop value enum +func (m *CreateDataVolume) validateAffinityPolicyEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, createDataVolumeTypeAffinityPolicyPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *CreateDataVolume) validateAffinityPolicy(formats strfmt.Registry) error { + if swag.IsZero(m.AffinityPolicy) { // not required + return nil + } + + // value enum + if err := m.validateAffinityPolicyEnum("affinityPolicy", "body", *m.AffinityPolicy); err != nil { + return err + } + + return nil +} + +func (m *CreateDataVolume) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *CreateDataVolume) validateSize(formats strfmt.Registry) error { + + if err := validate.Required("size", "body", m.Size); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this create data volume based on context it is used +func (m *CreateDataVolume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *CreateDataVolume) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CreateDataVolume) UnmarshalBinary(b []byte) error { + var res CreateDataVolume + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/create_image.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/create_image.go new file mode 100644 index 00000000000..b55fb483db9 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/create_image.go @@ -0,0 +1,244 @@ +// 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" +) + +// CreateImage create image +// +// swagger:model CreateImage +type CreateImage struct { + + // Cloud Storage access key; required for import image + AccessKey string `json:"accessKey,omitempty"` + + // Cloud Storage bucket name; bucket-name[/optional/folder]; required for import image + BucketName string `json:"bucketName,omitempty"` + + // Type of Disk; will be ignored if storagePool or affinityPolicy is provided; Used only when importing an image from cloud storage. + DiskType string `json:"diskType,omitempty"` + + // Cloud Storage image filename; required for import image + ImageFilename string `json:"imageFilename,omitempty"` + + // Image ID of existing source image; required for copy image + ImageID string `json:"imageID,omitempty"` + + // Name to give created image; required for import image + ImageName string `json:"imageName,omitempty"` + + // (deprecated - replaced by region, imageFilename and bucketName) Path to image starting with service endpoint and ending with image filename + ImagePath string `json:"imagePath,omitempty"` + + // Image OS Type, required if importing a raw image; raw images can only be imported using the command line interface + // Enum: [aix ibmi rhel sles] + OsType string `json:"osType,omitempty"` + + // Cloud Storage Region; only required to access IBM Cloud Storage + Region string `json:"region,omitempty"` + + // Cloud Storage secret key; required for import image + SecretKey string `json:"secretKey,omitempty"` + + // Source of the image + // Required: true + // Enum: [root-project url] + Source *string `json:"source"` + + // The storage affinity data; ignored if storagePool is provided; Used only when importing an image from cloud storage. + StorageAffinity *StorageAffinity `json:"storageAffinity,omitempty"` + + // Storage pool where the image will be loaded; if provided then storageAffinity and diskType will be ignored; Used only when importing an image from cloud storage. + StoragePool string `json:"storagePool,omitempty"` +} + +// Validate validates this create image +func (m *CreateImage) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOsType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSource(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStorageAffinity(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var createImageTypeOsTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["aix","ibmi","rhel","sles"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + createImageTypeOsTypePropEnum = append(createImageTypeOsTypePropEnum, v) + } +} + +const ( + + // CreateImageOsTypeAix captures enum value "aix" + CreateImageOsTypeAix string = "aix" + + // CreateImageOsTypeIbmi captures enum value "ibmi" + CreateImageOsTypeIbmi string = "ibmi" + + // CreateImageOsTypeRhel captures enum value "rhel" + CreateImageOsTypeRhel string = "rhel" + + // CreateImageOsTypeSles captures enum value "sles" + CreateImageOsTypeSles string = "sles" +) + +// prop value enum +func (m *CreateImage) validateOsTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, createImageTypeOsTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *CreateImage) validateOsType(formats strfmt.Registry) error { + if swag.IsZero(m.OsType) { // not required + return nil + } + + // value enum + if err := m.validateOsTypeEnum("osType", "body", m.OsType); err != nil { + return err + } + + return nil +} + +var createImageTypeSourcePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["root-project","url"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + createImageTypeSourcePropEnum = append(createImageTypeSourcePropEnum, v) + } +} + +const ( + + // CreateImageSourceRootDashProject captures enum value "root-project" + CreateImageSourceRootDashProject string = "root-project" + + // CreateImageSourceURL captures enum value "url" + CreateImageSourceURL string = "url" +) + +// prop value enum +func (m *CreateImage) validateSourceEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, createImageTypeSourcePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *CreateImage) validateSource(formats strfmt.Registry) error { + + if err := validate.Required("source", "body", m.Source); err != nil { + return err + } + + // value enum + if err := m.validateSourceEnum("source", "body", *m.Source); err != nil { + return err + } + + return nil +} + +func (m *CreateImage) validateStorageAffinity(formats strfmt.Registry) error { + if swag.IsZero(m.StorageAffinity) { // not required + return nil + } + + if m.StorageAffinity != nil { + if err := m.StorageAffinity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") + } + return err + } + } + + return nil +} + +// ContextValidate validate this create image based on the context it is used +func (m *CreateImage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateStorageAffinity(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *CreateImage) contextValidateStorageAffinity(ctx context.Context, formats strfmt.Registry) error { + + if m.StorageAffinity != nil { + if err := m.StorageAffinity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *CreateImage) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *CreateImage) UnmarshalBinary(b []byte) error { + var res CreateImage + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_server.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_server.go new file mode 100644 index 00000000000..5602d9d0a79 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_server.go @@ -0,0 +1,141 @@ +// 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" +) + +// DHCPServer d h c p server +// +// swagger:model DHCPServer +type DHCPServer struct { + + // The ID of the DHCP Server + // Required: true + ID *string `json:"id"` + + // The DHCP Server private network + // Required: true + Network *DHCPServerNetwork `json:"network"` + + // The status of the DHCP Server + // Required: true + Status *string `json:"status"` +} + +// Validate validates this d h c p server +func (m *DHCPServer) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetwork(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DHCPServer) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *DHCPServer) validateNetwork(formats strfmt.Registry) error { + + if err := validate.Required("network", "body", m.Network); err != nil { + return err + } + + if m.Network != nil { + if err := m.Network.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("network") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("network") + } + return err + } + } + + return nil +} + +func (m *DHCPServer) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this d h c p server based on the context it is used +func (m *DHCPServer) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetwork(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DHCPServer) contextValidateNetwork(ctx context.Context, formats strfmt.Registry) error { + + if m.Network != nil { + if err := m.Network.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("network") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("network") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *DHCPServer) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DHCPServer) UnmarshalBinary(b []byte) error { + var res DHCPServer + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_server_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_server_create.go new file mode 100644 index 00000000000..2098337b997 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_server_create.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" +) + +// DHCPServerCreate d h c p server create +// +// swagger:model DHCPServerCreate +type DHCPServerCreate struct { + + // Optional cloud connection uuid to connect with DHCP private network + CloudConnectionID string `json:"cloudConnectionID,omitempty"` +} + +// Validate validates this d h c p server create +func (m *DHCPServerCreate) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this d h c p server create based on context it is used +func (m *DHCPServerCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DHCPServerCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DHCPServerCreate) UnmarshalBinary(b []byte) error { + var res DHCPServerCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_server_detail.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_server_detail.go new file mode 100644 index 00000000000..fc6284fff02 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_server_detail.go @@ -0,0 +1,199 @@ +// 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" +) + +// DHCPServerDetail d h c p server detail +// +// swagger:model DHCPServerDetail +type DHCPServerDetail struct { + + // The ID of the DHCP Server + // Required: true + ID *string `json:"id"` + + // The list of DHCP Server PVM Instance leases + Leases []*DHCPServerLeases `json:"leases"` + + // The DHCP Server private network + // Required: true + Network *DHCPServerNetwork `json:"network"` + + // The status of the DHCP Server + // Required: true + Status *string `json:"status"` +} + +// Validate validates this d h c p server detail +func (m *DHCPServerDetail) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLeases(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetwork(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DHCPServerDetail) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *DHCPServerDetail) validateLeases(formats strfmt.Registry) error { + if swag.IsZero(m.Leases) { // not required + return nil + } + + for i := 0; i < len(m.Leases); i++ { + if swag.IsZero(m.Leases[i]) { // not required + continue + } + + if m.Leases[i] != nil { + if err := m.Leases[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("leases" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("leases" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DHCPServerDetail) validateNetwork(formats strfmt.Registry) error { + + if err := validate.Required("network", "body", m.Network); err != nil { + return err + } + + if m.Network != nil { + if err := m.Network.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("network") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("network") + } + return err + } + } + + return nil +} + +func (m *DHCPServerDetail) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this d h c p server detail based on the context it is used +func (m *DHCPServerDetail) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLeases(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNetwork(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DHCPServerDetail) contextValidateLeases(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Leases); i++ { + + if m.Leases[i] != nil { + if err := m.Leases[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("leases" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("leases" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *DHCPServerDetail) contextValidateNetwork(ctx context.Context, formats strfmt.Registry) error { + + if m.Network != nil { + if err := m.Network.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("network") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("network") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *DHCPServerDetail) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DHCPServerDetail) UnmarshalBinary(b []byte) error { + var res DHCPServerDetail + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_server_leases.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_server_leases.go new file mode 100644 index 00000000000..c2b6d3384f2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_server_leases.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" +) + +// DHCPServerLeases d h c p server leases +// +// swagger:model DHCPServerLeases +type DHCPServerLeases struct { + + // The IP of the PVM Instance + // Required: true + InstanceIP *string `json:"instanceIP"` + + // The MAC Address of the PVM Instance + // Required: true + InstanceMacAddress *string `json:"instanceMacAddress"` +} + +// Validate validates this d h c p server leases +func (m *DHCPServerLeases) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateInstanceIP(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInstanceMacAddress(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DHCPServerLeases) validateInstanceIP(formats strfmt.Registry) error { + + if err := validate.Required("instanceIP", "body", m.InstanceIP); err != nil { + return err + } + + return nil +} + +func (m *DHCPServerLeases) validateInstanceMacAddress(formats strfmt.Registry) error { + + if err := validate.Required("instanceMacAddress", "body", m.InstanceMacAddress); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this d h c p server leases based on context it is used +func (m *DHCPServerLeases) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DHCPServerLeases) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DHCPServerLeases) UnmarshalBinary(b []byte) error { + var res DHCPServerLeases + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_server_network.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_server_network.go new file mode 100644 index 00000000000..52e05233de5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_server_network.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" +) + +// DHCPServerNetwork d h c p server network +// +// swagger:model DHCPServerNetwork +type DHCPServerNetwork struct { + + // The ID of the network + // Required: true + ID *string `json:"id"` + + // The name of the network + // Required: true + Name *string `json:"name"` +} + +// Validate validates this d h c p server network +func (m *DHCPServerNetwork) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(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 *DHCPServerNetwork) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *DHCPServerNetwork) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this d h c p server network based on context it is used +func (m *DHCPServerNetwork) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DHCPServerNetwork) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DHCPServerNetwork) UnmarshalBinary(b []byte) error { + var res DHCPServerNetwork + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_servers.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_servers.go new file mode 100644 index 00000000000..947db73c45e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/d_h_c_p_servers.go @@ -0,0 +1,73 @@ +// 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" +) + +// DHCPServers The list of DHCP Servers +// +// swagger:model DHCPServers +type DHCPServers []*DHCPServer + +// Validate validates this d h c p servers +func (m DHCPServers) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this d h c p servers based on the context it is used +func (m DHCPServers) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/dashboard_client.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/dashboard_client.go new file mode 100644 index 00000000000..bb752401bd8 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/dashboard_client.go @@ -0,0 +1,56 @@ +// 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" +) + +// DashboardClient dashboard client +// +// swagger:model DashboardClient +type DashboardClient struct { + + // id + ID string `json:"id,omitempty"` + + // redirect uri + RedirectURI string `json:"redirect_uri,omitempty"` + + // secret + Secret string `json:"secret,omitempty"` +} + +// Validate validates this dashboard client +func (m *DashboardClient) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this dashboard client based on context it is used +func (m *DashboardClient) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DashboardClient) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DashboardClient) UnmarshalBinary(b []byte) error { + var res DashboardClient + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/dead_peer_detection.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/dead_peer_detection.go new file mode 100644 index 00000000000..89688eaa114 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/dead_peer_detection.go @@ -0,0 +1,160 @@ +// 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" +) + +// DeadPeerDetection Dead Peer Detection of the VPN Connection +// +// swagger:model DeadPeerDetection +type DeadPeerDetection struct { + + // Action to take when a Peer Gateway stops responding + // Required: true + // Enum: [restart] + Action *string `json:"action"` + + // How often to test that the Peer Gateway is responsive + // Example: 10 + // Required: true + // Maximum: 60 + // Minimum: 2 + Interval *int64 `json:"interval"` + + // The number of attempts to connect before tearing down the connection + // Example: 5 + // Required: true + // Maximum: 5 + // Minimum: 1 + Threshold *int64 `json:"threshold"` +} + +// Validate validates this dead peer detection +func (m *DeadPeerDetection) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAction(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInterval(formats); err != nil { + res = append(res, err) + } + + if err := m.validateThreshold(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var deadPeerDetectionTypeActionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["restart"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + deadPeerDetectionTypeActionPropEnum = append(deadPeerDetectionTypeActionPropEnum, v) + } +} + +const ( + + // DeadPeerDetectionActionRestart captures enum value "restart" + DeadPeerDetectionActionRestart string = "restart" +) + +// prop value enum +func (m *DeadPeerDetection) validateActionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, deadPeerDetectionTypeActionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *DeadPeerDetection) 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 *DeadPeerDetection) validateInterval(formats strfmt.Registry) error { + + if err := validate.Required("interval", "body", m.Interval); err != nil { + return err + } + + if err := validate.MinimumInt("interval", "body", *m.Interval, 2, false); err != nil { + return err + } + + if err := validate.MaximumInt("interval", "body", *m.Interval, 60, false); err != nil { + return err + } + + return nil +} + +func (m *DeadPeerDetection) validateThreshold(formats strfmt.Registry) error { + + if err := validate.Required("threshold", "body", m.Threshold); err != nil { + return err + } + + if err := validate.MinimumInt("threshold", "body", *m.Threshold, 1, false); err != nil { + return err + } + + if err := validate.MaximumInt("threshold", "body", *m.Threshold, 5, false); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this dead peer detection based on context it is used +func (m *DeadPeerDetection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DeadPeerDetection) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DeadPeerDetection) UnmarshalBinary(b []byte) error { + var res DeadPeerDetection + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/device_code.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/device_code.go new file mode 100644 index 00000000000..7cb9a748806 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/device_code.go @@ -0,0 +1,139 @@ +// 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" +) + +// DeviceCode device code +// +// swagger:model DeviceCode +type DeviceCode struct { + + // This code lets the device running the app securely determine whether the user has granted or denied access + // Required: true + DeviceCode *string `json:"deviceCode"` + + // The length of time, in seconds, that the device_code and user_code are valid + // Required: true + ExpiresIn *float64 `json:"expiresIn"` + + // The length of time, in seconds, that your device should wait between polling requests + // Required: true + Interval *float64 `json:"interval"` + + // The value given to the user to enter on device authentication page + // Required: true + UserCode *string `json:"userCode"` + + // A URL that the user must navigate to, on a separate device, to enter the user_code and grant or deny access to your application. Your user interface will also display this value + // Required: true + VerificationURL *string `json:"verificationURL"` +} + +// Validate validates this device code +func (m *DeviceCode) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDeviceCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateExpiresIn(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInterval(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUserCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVerificationURL(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DeviceCode) validateDeviceCode(formats strfmt.Registry) error { + + if err := validate.Required("deviceCode", "body", m.DeviceCode); err != nil { + return err + } + + return nil +} + +func (m *DeviceCode) validateExpiresIn(formats strfmt.Registry) error { + + if err := validate.Required("expiresIn", "body", m.ExpiresIn); err != nil { + return err + } + + return nil +} + +func (m *DeviceCode) validateInterval(formats strfmt.Registry) error { + + if err := validate.Required("interval", "body", m.Interval); err != nil { + return err + } + + return nil +} + +func (m *DeviceCode) validateUserCode(formats strfmt.Registry) error { + + if err := validate.Required("userCode", "body", m.UserCode); err != nil { + return err + } + + return nil +} + +func (m *DeviceCode) validateVerificationURL(formats strfmt.Registry) error { + + if err := validate.Required("verificationURL", "body", m.VerificationURL); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this device code based on context it is used +func (m *DeviceCode) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DeviceCode) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DeviceCode) UnmarshalBinary(b []byte) error { + var res DeviceCode + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/error.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/error.go new file mode 100644 index 00000000000..a7c90934c30 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/error.go @@ -0,0 +1,59 @@ +// 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" +) + +// Error error +// +// swagger:model Error +type Error struct { + + // code + Code int64 `json:"code,omitempty"` + + // description + Description string `json:"description,omitempty"` + + // error + Error string `json:"error,omitempty"` + + // message + Message string `json:"message,omitempty"` +} + +// Validate validates this error +func (m *Error) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this error based on context it is used +func (m *Error) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Error) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Error) UnmarshalBinary(b []byte) error { + var res Error + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/event.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/event.go new file mode 100644 index 00000000000..b9190c8f625 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/event.go @@ -0,0 +1,274 @@ +// 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" +) + +// Event event +// +// swagger:model Event +type Event struct { + + // Type of action for this event + // Required: true + Action *string `json:"action"` + + // ID of the Activity + // Required: true + EventID *string `json:"eventID"` + + // Level of the event (notice, info, warning, error) + // Required: true + // Enum: [notice info warning error] + Level *string `json:"level"` + + // The (translated) message of the event + // Required: true + Message *string `json:"message"` + + // Any metadata associated with the event + Metadata interface{} `json:"metadata,omitempty"` + + // Type of resource for this event + // Required: true + Resource *string `json:"resource"` + + // Time of activity in ISO 8601 - RFC3339 + // Required: true + // Format: date-time + Time *strfmt.DateTime `json:"time"` + + // Time of activity in unix epoch + // Required: true + Timestamp *int64 `json:"timestamp"` + + // user + User *EventUser `json:"user,omitempty"` +} + +// Validate validates this event +func (m *Event) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAction(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEventID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLevel(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMessage(formats); err != nil { + res = append(res, err) + } + + if err := m.validateResource(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTimestamp(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUser(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Event) validateAction(formats strfmt.Registry) error { + + if err := validate.Required("action", "body", m.Action); err != nil { + return err + } + + return nil +} + +func (m *Event) validateEventID(formats strfmt.Registry) error { + + if err := validate.Required("eventID", "body", m.EventID); err != nil { + return err + } + + return nil +} + +var eventTypeLevelPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["notice","info","warning","error"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + eventTypeLevelPropEnum = append(eventTypeLevelPropEnum, v) + } +} + +const ( + + // EventLevelNotice captures enum value "notice" + EventLevelNotice string = "notice" + + // EventLevelInfo captures enum value "info" + EventLevelInfo string = "info" + + // EventLevelWarning captures enum value "warning" + EventLevelWarning string = "warning" + + // EventLevelError captures enum value "error" + EventLevelError string = "error" +) + +// prop value enum +func (m *Event) validateLevelEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, eventTypeLevelPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *Event) validateLevel(formats strfmt.Registry) error { + + if err := validate.Required("level", "body", m.Level); err != nil { + return err + } + + // value enum + if err := m.validateLevelEnum("level", "body", *m.Level); err != nil { + return err + } + + return nil +} + +func (m *Event) validateMessage(formats strfmt.Registry) error { + + if err := validate.Required("message", "body", m.Message); err != nil { + return err + } + + return nil +} + +func (m *Event) validateResource(formats strfmt.Registry) error { + + if err := validate.Required("resource", "body", m.Resource); err != nil { + return err + } + + return nil +} + +func (m *Event) validateTime(formats strfmt.Registry) error { + + if err := validate.Required("time", "body", m.Time); err != nil { + return err + } + + if err := validate.FormatOf("time", "body", "date-time", m.Time.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Event) validateTimestamp(formats strfmt.Registry) error { + + if err := validate.Required("timestamp", "body", m.Timestamp); err != nil { + return err + } + + return nil +} + +func (m *Event) validateUser(formats strfmt.Registry) error { + if swag.IsZero(m.User) { // not required + return nil + } + + if m.User != nil { + if err := m.User.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// ContextValidate validate this event based on the context it is used +func (m *Event) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUser(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Event) contextValidateUser(ctx context.Context, formats strfmt.Registry) error { + + if m.User != nil { + if err := m.User.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("user") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("user") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Event) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Event) UnmarshalBinary(b []byte) error { + var res Event + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/event_user.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/event_user.go new file mode 100644 index 00000000000..a20b42b1e9a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/event_user.go @@ -0,0 +1,77 @@ +// 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" +) + +// EventUser event user +// +// swagger:model EventUser +type EventUser struct { + + // Email of the User + Email string `json:"email,omitempty"` + + // Name of the User + Name string `json:"name,omitempty"` + + // ID of user who created/caused the event + // Required: true + UserID *string `json:"userID"` +} + +// Validate validates this event user +func (m *EventUser) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateUserID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *EventUser) validateUserID(formats strfmt.Registry) error { + + if err := validate.Required("userID", "body", m.UserID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this event user based on context it is used +func (m *EventUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *EventUser) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *EventUser) UnmarshalBinary(b []byte) error { + var res EventUser + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/events.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/events.go new file mode 100644 index 00000000000..721b97fcf45 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/events.go @@ -0,0 +1,119 @@ +// 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" +) + +// Events events +// +// swagger:model Events +type Events struct { + + // Events + // Required: true + Events []*Event `json:"events"` +} + +// Validate validates this events +func (m *Events) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEvents(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Events) validateEvents(formats strfmt.Registry) error { + + if err := validate.Required("events", "body", m.Events); err != nil { + return err + } + + for i := 0; i < len(m.Events); i++ { + if swag.IsZero(m.Events[i]) { // not required + continue + } + + if m.Events[i] != nil { + if err := m.Events[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("events" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("events" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this events based on the context it is used +func (m *Events) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEvents(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Events) contextValidateEvents(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Events); i++ { + + if m.Events[i] != nil { + if err := m.Events[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("events" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("events" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Events) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Events) UnmarshalBinary(b []byte) error { + var res Events + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/export_image.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/export_image.go new file mode 100644 index 00000000000..1f8a17dd228 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/export_image.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" +) + +// ExportImage export image +// +// swagger:model ExportImage +type ExportImage struct { + + // Cloud Object Storage Access key + // Required: true + AccessKey *string `json:"accessKey"` + + // Cloud Object Storage Bucket name + // Required: true + BucketName *string `json:"bucketName"` + + // Cloud Object Storage Region; required for IBM COS + Region string `json:"region,omitempty"` + + // Cloud Object Storage Secret key + SecretKey string `json:"secretKey,omitempty"` +} + +// Validate validates this export image +func (m *ExportImage) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccessKey(formats); err != nil { + res = append(res, err) + } + + if err := m.validateBucketName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ExportImage) validateAccessKey(formats strfmt.Registry) error { + + if err := validate.Required("accessKey", "body", m.AccessKey); err != nil { + return err + } + + return nil +} + +func (m *ExportImage) validateBucketName(formats strfmt.Registry) error { + + if err := validate.Required("bucketName", "body", m.BucketName); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this export image based on context it is used +func (m *ExportImage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ExportImage) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ExportImage) UnmarshalBinary(b []byte) error { + var res ExportImage + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/hardware_platform.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/hardware_platform.go new file mode 100644 index 00000000000..8c78c41fcf9 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/hardware_platform.go @@ -0,0 +1,134 @@ +// 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" +) + +// HardwarePlatform Hardware platform detailing its limits and statistics +// +// swagger:model HardwarePlatform +type HardwarePlatform struct { + + // Description + Description string `json:"description,omitempty"` + + // The DataCenter list of servers and their available resources + HostsResources []*HostResources `json:"hostsResources"` + + // Configured Memory GB + Memory float64 `json:"memory,omitempty"` + + // Processor to Memory (GB) Ratio + ProcessorMemoryRatio float64 `json:"processorMemoryRatio,omitempty"` + + // Configured Processors + Processors float64 `json:"processors,omitempty"` + + // Allowable granularity for shared processors + SharedProcessorStep float64 `json:"sharedProcessorStep,omitempty"` + + // Short code for hardware + Type string `json:"type,omitempty"` +} + +// Validate validates this hardware platform +func (m *HardwarePlatform) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHostsResources(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HardwarePlatform) validateHostsResources(formats strfmt.Registry) error { + if swag.IsZero(m.HostsResources) { // not required + return nil + } + + for i := 0; i < len(m.HostsResources); i++ { + if swag.IsZero(m.HostsResources[i]) { // not required + continue + } + + if m.HostsResources[i] != nil { + if err := m.HostsResources[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hostsResources" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hostsResources" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this hardware platform based on the context it is used +func (m *HardwarePlatform) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHostsResources(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HardwarePlatform) contextValidateHostsResources(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.HostsResources); i++ { + + if m.HostsResources[i] != nil { + if err := m.HostsResources[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hostsResources" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hostsResources" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HardwarePlatform) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HardwarePlatform) UnmarshalBinary(b []byte) error { + var res HardwarePlatform + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/hardware_platforms.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/hardware_platforms.go new file mode 100644 index 00000000000..8e98a5e08e2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/hardware_platforms.go @@ -0,0 +1,67 @@ +// 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/validate" +) + +// HardwarePlatforms A map of hardware platforms detailing their limits and statistics +// +// swagger:model HardwarePlatforms +type HardwarePlatforms map[string]HardwarePlatform + +// Validate validates this hardware platforms +func (m HardwarePlatforms) Validate(formats strfmt.Registry) error { + var res []error + + for k := range m { + + if err := validate.Required(k, "body", m[k]); err != nil { + return err + } + if val, ok := m[k]; ok { + if err := val.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(k) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this hardware platforms based on the context it is used +func (m HardwarePlatforms) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for k := range m { + + if val, ok := m[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/health.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/health.go new file mode 100644 index 00000000000..b94914a5e75 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/health.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" +) + +// Health health +// +// swagger:model Health +type Health struct { + + // Returns a description of the current servers health + // Required: true + Status *string `json:"status"` +} + +// Validate validates this health +func (m *Health) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Health) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this health based on context it is used +func (m *Health) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Health) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Health) UnmarshalBinary(b []byte) error { + var res Health + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/host_info.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/host_info.go new file mode 100644 index 00000000000..ab262805407 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/host_info.go @@ -0,0 +1,249 @@ +// 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" +) + +// HostInfo host info +// +// swagger:model HostInfo +type HostInfo struct { + + // Host core information + // Required: true + Cores *HostResource `json:"cores"` + + // Hostname + // Required: true + Hostname *string `json:"hostname"` + + // IP Address + // Required: true + IPAddress *string `json:"ipAddress"` + + // Host memory information + // Required: true + Memory *HostResource `json:"memory"` + + // PVM Instances on host + // Required: true + PvmInstances []*HostPVMInstance `json:"pvmInstances"` +} + +// Validate validates this host info +func (m *HostInfo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCores(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHostname(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIPAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemory(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePvmInstances(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostInfo) validateCores(formats strfmt.Registry) error { + + if err := validate.Required("cores", "body", m.Cores); err != nil { + return err + } + + if m.Cores != nil { + if err := m.Cores.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cores") + } + return err + } + } + + return nil +} + +func (m *HostInfo) validateHostname(formats strfmt.Registry) error { + + if err := validate.Required("hostname", "body", m.Hostname); err != nil { + return err + } + + return nil +} + +func (m *HostInfo) validateIPAddress(formats strfmt.Registry) error { + + if err := validate.Required("ipAddress", "body", m.IPAddress); err != nil { + return err + } + + return nil +} + +func (m *HostInfo) validateMemory(formats strfmt.Registry) error { + + if err := validate.Required("memory", "body", m.Memory); err != nil { + return err + } + + if m.Memory != nil { + if err := m.Memory.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("memory") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("memory") + } + return err + } + } + + return nil +} + +func (m *HostInfo) validatePvmInstances(formats strfmt.Registry) error { + + if err := validate.Required("pvmInstances", "body", m.PvmInstances); err != nil { + return err + } + + for i := 0; i < len(m.PvmInstances); i++ { + if swag.IsZero(m.PvmInstances[i]) { // not required + continue + } + + if m.PvmInstances[i] != nil { + if err := m.PvmInstances[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this host info based on the context it is used +func (m *HostInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCores(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMemory(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePvmInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostInfo) contextValidateCores(ctx context.Context, formats strfmt.Registry) error { + + if m.Cores != nil { + if err := m.Cores.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cores") + } + return err + } + } + + return nil +} + +func (m *HostInfo) contextValidateMemory(ctx context.Context, formats strfmt.Registry) error { + + if m.Memory != nil { + if err := m.Memory.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("memory") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("memory") + } + return err + } + } + + return nil +} + +func (m *HostInfo) contextValidatePvmInstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PvmInstances); i++ { + + if m.PvmInstances[i] != nil { + if err := m.PvmInstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HostInfo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HostInfo) UnmarshalBinary(b []byte) error { + var res HostInfo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/host_p_vm_instance.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/host_p_vm_instance.go new file mode 100644 index 00000000000..5a04d4fbd87 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/host_p_vm_instance.go @@ -0,0 +1,192 @@ +// 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" +) + +// HostPVMInstance A pvm instance on host +// +// swagger:model HostPVMInstance +type HostPVMInstance struct { + + // Cloud Instance ID pvm instance is a member of + // Required: true + CloudInstanceID *string `json:"cloudInstanceID"` + + // Owner information of pvm instance + // Required: true + Owner *OwnerInfo `json:"owner"` + + // Instance ID + // Required: true + PvmInstanceID *string `json:"pvmInstanceID"` + + // Instance name + // Required: true + PvmName *string `json:"pvmName"` + + // State of pvm instance + // Required: true + State *string `json:"state"` + + // Tenant ID of pvm instance + // Required: true + TenantID *string `json:"tenantID"` +} + +// Validate validates this host p VM instance +func (m *HostPVMInstance) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCloudInstanceID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOwner(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePvmInstanceID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePvmName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTenantID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostPVMInstance) validateCloudInstanceID(formats strfmt.Registry) error { + + if err := validate.Required("cloudInstanceID", "body", m.CloudInstanceID); err != nil { + return err + } + + return nil +} + +func (m *HostPVMInstance) validateOwner(formats strfmt.Registry) error { + + if err := validate.Required("owner", "body", m.Owner); err != nil { + return err + } + + if m.Owner != nil { + if err := m.Owner.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("owner") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("owner") + } + return err + } + } + + return nil +} + +func (m *HostPVMInstance) validatePvmInstanceID(formats strfmt.Registry) error { + + if err := validate.Required("pvmInstanceID", "body", m.PvmInstanceID); err != nil { + return err + } + + return nil +} + +func (m *HostPVMInstance) validatePvmName(formats strfmt.Registry) error { + + if err := validate.Required("pvmName", "body", m.PvmName); err != nil { + return err + } + + return nil +} + +func (m *HostPVMInstance) validateState(formats strfmt.Registry) error { + + if err := validate.Required("state", "body", m.State); err != nil { + return err + } + + return nil +} + +func (m *HostPVMInstance) validateTenantID(formats strfmt.Registry) error { + + if err := validate.Required("tenantID", "body", m.TenantID); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this host p VM instance based on the context it is used +func (m *HostPVMInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOwner(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostPVMInstance) contextValidateOwner(ctx context.Context, formats strfmt.Registry) error { + + if m.Owner != nil { + if err := m.Owner.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("owner") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("owner") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HostPVMInstance) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HostPVMInstance) UnmarshalBinary(b []byte) error { + var res HostPVMInstance + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/host_resource.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/host_resource.go new file mode 100644 index 00000000000..aef626fbe8e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/host_resource.go @@ -0,0 +1,105 @@ +// 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" +) + +// HostResource host resource +// +// swagger:model HostResource +type HostResource struct { + + // Free + // Required: true + Free *float64 `json:"free"` + + // Total + // Required: true + Total *float64 `json:"total"` + + // Used + // Required: true + Used *float64 `json:"used"` +} + +// Validate validates this host resource +func (m *HostResource) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFree(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTotal(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsed(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostResource) validateFree(formats strfmt.Registry) error { + + if err := validate.Required("free", "body", m.Free); err != nil { + return err + } + + return nil +} + +func (m *HostResource) validateTotal(formats strfmt.Registry) error { + + if err := validate.Required("total", "body", m.Total); err != nil { + return err + } + + return nil +} + +func (m *HostResource) validateUsed(formats strfmt.Registry) error { + + if err := validate.Required("used", "body", m.Used); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this host resource based on context it is used +func (m *HostResource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HostResource) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HostResource) UnmarshalBinary(b []byte) error { + var res HostResource + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/host_resources.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/host_resources.go new file mode 100644 index 00000000000..40b3b8652f1 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/host_resources.go @@ -0,0 +1,105 @@ +// 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" +) + +// HostResources host resources +// +// swagger:model HostResources +type HostResources struct { + + // The host available Processor units + // Required: true + Cores *float64 `json:"cores"` + + // The host identifier + // Required: true + ID *int64 `json:"id"` + + // The host available RAM memory in GiB + // Required: true + Memory *int64 `json:"memory"` +} + +// Validate validates this host resources +func (m *HostResources) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCores(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemory(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostResources) validateCores(formats strfmt.Registry) error { + + if err := validate.Required("cores", "body", m.Cores); err != nil { + return err + } + + return nil +} + +func (m *HostResources) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *HostResources) validateMemory(formats strfmt.Registry) error { + + if err := validate.Required("memory", "body", m.Memory); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this host resources based on context it is used +func (m *HostResources) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HostResources) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HostResources) UnmarshalBinary(b []byte) error { + var res HostResources + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policies.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policies.go new file mode 100644 index 00000000000..5cfe23d7a87 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policies.go @@ -0,0 +1,119 @@ +// 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" +) + +// IKEPolicies i k e policies +// +// swagger:model IKEPolicies +type IKEPolicies struct { + + // IKE Policies array + // Required: true + IkePolicies []*IKEPolicy `json:"ikePolicies"` +} + +// Validate validates this i k e policies +func (m *IKEPolicies) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIkePolicies(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicies) validateIkePolicies(formats strfmt.Registry) error { + + if err := validate.Required("ikePolicies", "body", m.IkePolicies); err != nil { + return err + } + + for i := 0; i < len(m.IkePolicies); i++ { + if swag.IsZero(m.IkePolicies[i]) { // not required + continue + } + + if m.IkePolicies[i] != nil { + if err := m.IkePolicies[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ikePolicies" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicies" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this i k e policies based on the context it is used +func (m *IKEPolicies) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIkePolicies(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicies) contextValidateIkePolicies(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.IkePolicies); i++ { + + if m.IkePolicies[i] != nil { + if err := m.IkePolicies[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ikePolicies" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicies" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *IKEPolicies) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IKEPolicies) UnmarshalBinary(b []byte) error { + var res IKEPolicies + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy.go new file mode 100644 index 00000000000..c6eb1bd7968 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy.go @@ -0,0 +1,353 @@ +// 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" +) + +// IKEPolicy IKE Policy object +// +// swagger:model IKEPolicy +type IKEPolicy struct { + + // authentication + // Required: true + Authentication *IKEPolicyAuthentication `json:"authentication"` + + // DH group of the IKE Policy + // Example: 2 + // Required: true + // Enum: [1 2 5 14 19 20 24] + DhGroup *int64 `json:"dhGroup"` + + // encryption of the IKE Policy + // Example: aes-256-cbc + // Required: true + // Enum: [aes-256-cbc aes-192-cbc aes-128-cbc aes-256-gcm aes-128-gcm 3des-cbc] + Encryption *string `json:"encryption"` + + // unique identifier of the IKE Policy object + // Example: 7edc8988-eb18-4b5c-a594-0d73d8254463 + // Required: true + ID *string `json:"id"` + + // key lifetime + // Required: true + KeyLifetime *KeyLifetime `json:"keyLifetime"` + + // name of the IKE Policy + // Example: ikePolicy1 + // Required: true + Name *string `json:"name"` + + // version of the IKE Policy + // Example: 2 + // Required: true + // Enum: [1 2] + Version *int64 `json:"version"` +} + +// Validate validates this i k e policy +func (m *IKEPolicy) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAuthentication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDhGroup(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEncryption(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeyLifetime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVersion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicy) validateAuthentication(formats strfmt.Registry) error { + + if err := validate.Required("authentication", "body", m.Authentication); err != nil { + return err + } + + if err := validate.Required("authentication", "body", m.Authentication); err != nil { + return err + } + + if m.Authentication != nil { + if err := m.Authentication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + } + + return nil +} + +var iKEPolicyTypeDhGroupPropEnum []interface{} + +func init() { + var res []int64 + if err := json.Unmarshal([]byte(`[1,2,5,14,19,20,24]`), &res); err != nil { + panic(err) + } + for _, v := range res { + iKEPolicyTypeDhGroupPropEnum = append(iKEPolicyTypeDhGroupPropEnum, v) + } +} + +// prop value enum +func (m *IKEPolicy) validateDhGroupEnum(path, location string, value int64) error { + if err := validate.EnumCase(path, location, value, iKEPolicyTypeDhGroupPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *IKEPolicy) validateDhGroup(formats strfmt.Registry) error { + + if err := validate.Required("dhGroup", "body", m.DhGroup); err != nil { + return err + } + + // value enum + if err := m.validateDhGroupEnum("dhGroup", "body", *m.DhGroup); err != nil { + return err + } + + return nil +} + +var iKEPolicyTypeEncryptionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["aes-256-cbc","aes-192-cbc","aes-128-cbc","aes-256-gcm","aes-128-gcm","3des-cbc"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + iKEPolicyTypeEncryptionPropEnum = append(iKEPolicyTypeEncryptionPropEnum, v) + } +} + +const ( + + // IKEPolicyEncryptionAesDash256DashCbc captures enum value "aes-256-cbc" + IKEPolicyEncryptionAesDash256DashCbc string = "aes-256-cbc" + + // IKEPolicyEncryptionAesDash192DashCbc captures enum value "aes-192-cbc" + IKEPolicyEncryptionAesDash192DashCbc string = "aes-192-cbc" + + // IKEPolicyEncryptionAesDash128DashCbc captures enum value "aes-128-cbc" + IKEPolicyEncryptionAesDash128DashCbc string = "aes-128-cbc" + + // IKEPolicyEncryptionAesDash256DashGcm captures enum value "aes-256-gcm" + IKEPolicyEncryptionAesDash256DashGcm string = "aes-256-gcm" + + // IKEPolicyEncryptionAesDash128DashGcm captures enum value "aes-128-gcm" + IKEPolicyEncryptionAesDash128DashGcm string = "aes-128-gcm" + + // IKEPolicyEncryptionNr3desDashCbc captures enum value "3des-cbc" + IKEPolicyEncryptionNr3desDashCbc string = "3des-cbc" +) + +// prop value enum +func (m *IKEPolicy) validateEncryptionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, iKEPolicyTypeEncryptionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *IKEPolicy) validateEncryption(formats strfmt.Registry) error { + + if err := validate.Required("encryption", "body", m.Encryption); err != nil { + return err + } + + // value enum + if err := m.validateEncryptionEnum("encryption", "body", *m.Encryption); err != nil { + return err + } + + return nil +} + +func (m *IKEPolicy) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *IKEPolicy) validateKeyLifetime(formats strfmt.Registry) error { + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + +func (m *IKEPolicy) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +var iKEPolicyTypeVersionPropEnum []interface{} + +func init() { + var res []int64 + if err := json.Unmarshal([]byte(`[1,2]`), &res); err != nil { + panic(err) + } + for _, v := range res { + iKEPolicyTypeVersionPropEnum = append(iKEPolicyTypeVersionPropEnum, v) + } +} + +// prop value enum +func (m *IKEPolicy) validateVersionEnum(path, location string, value int64) error { + if err := validate.EnumCase(path, location, value, iKEPolicyTypeVersionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *IKEPolicy) validateVersion(formats strfmt.Registry) error { + + if err := validate.Required("version", "body", m.Version); err != nil { + return err + } + + // value enum + if err := m.validateVersionEnum("version", "body", *m.Version); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this i k e policy based on the context it is used +func (m *IKEPolicy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicy) contextValidateAuthentication(ctx context.Context, formats strfmt.Registry) error { + + if m.Authentication != nil { + if err := m.Authentication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + } + + return nil +} + +func (m *IKEPolicy) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *IKEPolicy) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IKEPolicy) UnmarshalBinary(b []byte) error { + var res IKEPolicy + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_authentication.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_authentication.go new file mode 100644 index 00000000000..8cdd1e861f4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_authentication.go @@ -0,0 +1,85 @@ +// 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/validate" +) + +// IKEPolicyAuthentication authentication of the IKE policy +// Example: sha-256 +// +// swagger:model IKEPolicyAuthentication +type IKEPolicyAuthentication string + +func NewIKEPolicyAuthentication(value IKEPolicyAuthentication) *IKEPolicyAuthentication { + return &value +} + +// Pointer returns a pointer to a freshly-allocated IKEPolicyAuthentication. +func (m IKEPolicyAuthentication) Pointer() *IKEPolicyAuthentication { + return &m +} + +const ( + + // IKEPolicyAuthenticationShaDash256 captures enum value "sha-256" + IKEPolicyAuthenticationShaDash256 IKEPolicyAuthentication = "sha-256" + + // IKEPolicyAuthenticationShaDash384 captures enum value "sha-384" + IKEPolicyAuthenticationShaDash384 IKEPolicyAuthentication = "sha-384" + + // IKEPolicyAuthenticationSha1 captures enum value "sha1" + IKEPolicyAuthenticationSha1 IKEPolicyAuthentication = "sha1" + + // IKEPolicyAuthenticationNone captures enum value "none" + IKEPolicyAuthenticationNone IKEPolicyAuthentication = "none" +) + +// for schema +var iKEPolicyAuthenticationEnum []interface{} + +func init() { + var res []IKEPolicyAuthentication + if err := json.Unmarshal([]byte(`["sha-256","sha-384","sha1","none"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + iKEPolicyAuthenticationEnum = append(iKEPolicyAuthenticationEnum, v) + } +} + +func (m IKEPolicyAuthentication) validateIKEPolicyAuthenticationEnum(path, location string, value IKEPolicyAuthentication) error { + if err := validate.EnumCase(path, location, value, iKEPolicyAuthenticationEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this i k e policy authentication +func (m IKEPolicyAuthentication) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateIKEPolicyAuthenticationEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this i k e policy authentication based on context it is used +func (m IKEPolicyAuthentication) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_authentications.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_authentications.go new file mode 100644 index 00000000000..930a3d61fb6 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_authentications.go @@ -0,0 +1,28 @@ +// 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" +) + +// IKEPolicyAuthentications i k e policy authentications +// Example: ["sha-256","sha-384","sha1","none"] +// +// swagger:model IKEPolicyAuthentications +type IKEPolicyAuthentications []string + +// Validate validates this i k e policy authentications +func (m IKEPolicyAuthentications) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this i k e policy authentications based on context it is used +func (m IKEPolicyAuthentications) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_create.go new file mode 100644 index 00000000000..decb59aa550 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_create.go @@ -0,0 +1,352 @@ +// 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" +) + +// IKEPolicyCreate IKE Policy object used for creation +// +// swagger:model IKEPolicyCreate +type IKEPolicyCreate struct { + + // authentication + Authentication IKEPolicyAuthentication `json:"authentication,omitempty"` + + // DH group of the IKE Policy + // Example: 2 + // Required: true + // Enum: [1 2 5 14 19 20 24] + DhGroup *int64 `json:"dhGroup"` + + // encryption of the IKE Policy + // Example: aes-256-cbc + // Required: true + // Enum: [aes-256-cbc aes-192-cbc aes-128-cbc aes-256-gcm aes-128-gcm 3des-cbc] + Encryption *string `json:"encryption"` + + // key lifetime + // Required: true + KeyLifetime *KeyLifetime `json:"keyLifetime"` + + // name of the IKE Policy + // Example: ikePolicy1 + // Required: true + // Max Length: 47 + // Min Length: 1 + Name *string `json:"name"` + + // Preshared key used in this IKE Policy (length of preshared key must be even) + // Required: true + PresharedKey *string `json:"presharedKey"` + + // version of the IKE Policy + // Example: 2 + // Required: true + // Enum: [1 2] + Version *int64 `json:"version"` +} + +// Validate validates this i k e policy create +func (m *IKEPolicyCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAuthentication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDhGroup(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEncryption(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeyLifetime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePresharedKey(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVersion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicyCreate) validateAuthentication(formats strfmt.Registry) error { + if swag.IsZero(m.Authentication) { // not required + return nil + } + + if err := m.Authentication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + + return nil +} + +var iKEPolicyCreateTypeDhGroupPropEnum []interface{} + +func init() { + var res []int64 + if err := json.Unmarshal([]byte(`[1,2,5,14,19,20,24]`), &res); err != nil { + panic(err) + } + for _, v := range res { + iKEPolicyCreateTypeDhGroupPropEnum = append(iKEPolicyCreateTypeDhGroupPropEnum, v) + } +} + +// prop value enum +func (m *IKEPolicyCreate) validateDhGroupEnum(path, location string, value int64) error { + if err := validate.EnumCase(path, location, value, iKEPolicyCreateTypeDhGroupPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *IKEPolicyCreate) validateDhGroup(formats strfmt.Registry) error { + + if err := validate.Required("dhGroup", "body", m.DhGroup); err != nil { + return err + } + + // value enum + if err := m.validateDhGroupEnum("dhGroup", "body", *m.DhGroup); err != nil { + return err + } + + return nil +} + +var iKEPolicyCreateTypeEncryptionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["aes-256-cbc","aes-192-cbc","aes-128-cbc","aes-256-gcm","aes-128-gcm","3des-cbc"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + iKEPolicyCreateTypeEncryptionPropEnum = append(iKEPolicyCreateTypeEncryptionPropEnum, v) + } +} + +const ( + + // IKEPolicyCreateEncryptionAesDash256DashCbc captures enum value "aes-256-cbc" + IKEPolicyCreateEncryptionAesDash256DashCbc string = "aes-256-cbc" + + // IKEPolicyCreateEncryptionAesDash192DashCbc captures enum value "aes-192-cbc" + IKEPolicyCreateEncryptionAesDash192DashCbc string = "aes-192-cbc" + + // IKEPolicyCreateEncryptionAesDash128DashCbc captures enum value "aes-128-cbc" + IKEPolicyCreateEncryptionAesDash128DashCbc string = "aes-128-cbc" + + // IKEPolicyCreateEncryptionAesDash256DashGcm captures enum value "aes-256-gcm" + IKEPolicyCreateEncryptionAesDash256DashGcm string = "aes-256-gcm" + + // IKEPolicyCreateEncryptionAesDash128DashGcm captures enum value "aes-128-gcm" + IKEPolicyCreateEncryptionAesDash128DashGcm string = "aes-128-gcm" + + // IKEPolicyCreateEncryptionNr3desDashCbc captures enum value "3des-cbc" + IKEPolicyCreateEncryptionNr3desDashCbc string = "3des-cbc" +) + +// prop value enum +func (m *IKEPolicyCreate) validateEncryptionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, iKEPolicyCreateTypeEncryptionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *IKEPolicyCreate) validateEncryption(formats strfmt.Registry) error { + + if err := validate.Required("encryption", "body", m.Encryption); err != nil { + return err + } + + // value enum + if err := m.validateEncryptionEnum("encryption", "body", *m.Encryption); err != nil { + return err + } + + return nil +} + +func (m *IKEPolicyCreate) validateKeyLifetime(formats strfmt.Registry) error { + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + +func (m *IKEPolicyCreate) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 1); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 47); err != nil { + return err + } + + return nil +} + +func (m *IKEPolicyCreate) validatePresharedKey(formats strfmt.Registry) error { + + if err := validate.Required("presharedKey", "body", m.PresharedKey); err != nil { + return err + } + + return nil +} + +var iKEPolicyCreateTypeVersionPropEnum []interface{} + +func init() { + var res []int64 + if err := json.Unmarshal([]byte(`[1,2]`), &res); err != nil { + panic(err) + } + for _, v := range res { + iKEPolicyCreateTypeVersionPropEnum = append(iKEPolicyCreateTypeVersionPropEnum, v) + } +} + +// prop value enum +func (m *IKEPolicyCreate) validateVersionEnum(path, location string, value int64) error { + if err := validate.EnumCase(path, location, value, iKEPolicyCreateTypeVersionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *IKEPolicyCreate) validateVersion(formats strfmt.Registry) error { + + if err := validate.Required("version", "body", m.Version); err != nil { + return err + } + + // value enum + if err := m.validateVersionEnum("version", "body", *m.Version); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this i k e policy create based on the context it is used +func (m *IKEPolicyCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicyCreate) contextValidateAuthentication(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Authentication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + + return nil +} + +func (m *IKEPolicyCreate) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *IKEPolicyCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IKEPolicyCreate) UnmarshalBinary(b []byte) error { + var res IKEPolicyCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_dh_groups.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_dh_groups.go new file mode 100644 index 00000000000..a41c32d0117 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_dh_groups.go @@ -0,0 +1,28 @@ +// 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" +) + +// IKEPolicyDhGroups i k e policy dh groups +// Example: [1,2,5,14,19,20,24] +// +// swagger:model IKEPolicyDhGroups +type IKEPolicyDhGroups []float64 + +// Validate validates this i k e policy dh groups +func (m IKEPolicyDhGroups) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this i k e policy dh groups based on context it is used +func (m IKEPolicyDhGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_encryptions.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_encryptions.go new file mode 100644 index 00000000000..e4642753795 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_encryptions.go @@ -0,0 +1,28 @@ +// 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" +) + +// IKEPolicyEncryptions i k e policy encryptions +// Example: ["aes-256-cbc","aes-192-cbc","aes-128-cbc","aes-256-gcm","aes-128-gcm","3des-cbc"] +// +// swagger:model IKEPolicyEncryptions +type IKEPolicyEncryptions []string + +// Validate validates this i k e policy encryptions +func (m IKEPolicyEncryptions) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this i k e policy encryptions based on context it is used +func (m IKEPolicyEncryptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_options.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_options.go new file mode 100644 index 00000000000..20103eec80d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_options.go @@ -0,0 +1,235 @@ +// 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" +) + +// IKEPolicyOptions i k e policy options +// +// swagger:model IKEPolicyOptions +type IKEPolicyOptions struct { + + // authentications + // Required: true + Authentications IKEPolicyAuthentications `json:"authentications"` + + // dh groups + // Required: true + DhGroups IKEPolicyDhGroups `json:"dhGroups"` + + // encryptions + // Required: true + Encryptions IKEPolicyEncryptions `json:"encryptions"` + + // versions + // Required: true + Versions PolicyVersions `json:"versions"` +} + +// Validate validates this i k e policy options +func (m *IKEPolicyOptions) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAuthentications(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDhGroups(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEncryptions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVersions(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicyOptions) validateAuthentications(formats strfmt.Registry) error { + + if err := validate.Required("authentications", "body", m.Authentications); err != nil { + return err + } + + if err := m.Authentications.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentications") + } + return err + } + + return nil +} + +func (m *IKEPolicyOptions) validateDhGroups(formats strfmt.Registry) error { + + if err := validate.Required("dhGroups", "body", m.DhGroups); err != nil { + return err + } + + if err := m.DhGroups.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dhGroups") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dhGroups") + } + return err + } + + return nil +} + +func (m *IKEPolicyOptions) validateEncryptions(formats strfmt.Registry) error { + + if err := validate.Required("encryptions", "body", m.Encryptions); err != nil { + return err + } + + if err := m.Encryptions.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encryptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encryptions") + } + return err + } + + return nil +} + +func (m *IKEPolicyOptions) validateVersions(formats strfmt.Registry) error { + + if err := validate.Required("versions", "body", m.Versions); err != nil { + return err + } + + if err := m.Versions.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("versions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("versions") + } + return err + } + + return nil +} + +// ContextValidate validate this i k e policy options based on the context it is used +func (m *IKEPolicyOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentications(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDhGroups(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateEncryptions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVersions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicyOptions) contextValidateAuthentications(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Authentications.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentications") + } + return err + } + + return nil +} + +func (m *IKEPolicyOptions) contextValidateDhGroups(ctx context.Context, formats strfmt.Registry) error { + + if err := m.DhGroups.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dhGroups") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dhGroups") + } + return err + } + + return nil +} + +func (m *IKEPolicyOptions) contextValidateEncryptions(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Encryptions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encryptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encryptions") + } + return err + } + + return nil +} + +func (m *IKEPolicyOptions) contextValidateVersions(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Versions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("versions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("versions") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *IKEPolicyOptions) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IKEPolicyOptions) UnmarshalBinary(b []byte) error { + var res IKEPolicyOptions + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_ref.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_ref.go new file mode 100644 index 00000000000..4efb0751f3f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_ref.go @@ -0,0 +1,90 @@ +// 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" +) + +// IKEPolicyRef IKE Policy reference object +// +// swagger:model IKEPolicyRef +type IKEPolicyRef struct { + + // unique identifier of IKE Policy + // Example: 6edc8988-ab18-4b5c-b123-0d73e8254463 + // Required: true + ID *string `json:"id"` + + // name of IKE Policy + // Example: IKE Policy 1 + // Required: true + Name *string `json:"name"` +} + +// Validate validates this i k e policy ref +func (m *IKEPolicyRef) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(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 *IKEPolicyRef) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *IKEPolicyRef) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this i k e policy ref based on context it is used +func (m *IKEPolicyRef) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *IKEPolicyRef) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IKEPolicyRef) UnmarshalBinary(b []byte) error { + var res IKEPolicyRef + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_template.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_template.go new file mode 100644 index 00000000000..ac09368f8ee --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_template.go @@ -0,0 +1,183 @@ +// 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" +) + +// IKEPolicyTemplate i k e policy template +// +// swagger:model IKEPolicyTemplate +type IKEPolicyTemplate struct { + + // ikePolicy Authentication default value + // Example: sha256 + // Required: true + Authentication *string `json:"authentication"` + + // ikePolicy DHGroup default value + // Example: 2 + // Required: true + DhGroup *int64 `json:"dhGroup"` + + // ikePolicy Encryption default value + // Example: aes-256-cbc + // Required: true + Encryption *string `json:"encryption"` + + // key lifetime + // Required: true + KeyLifetime *KeyLifetime `json:"keyLifetime"` + + // ikePolicy Version default value + // Example: 2 + // Required: true + Version *float64 `json:"version"` +} + +// Validate validates this i k e policy template +func (m *IKEPolicyTemplate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAuthentication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDhGroup(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEncryption(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeyLifetime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVersion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicyTemplate) validateAuthentication(formats strfmt.Registry) error { + + if err := validate.Required("authentication", "body", m.Authentication); err != nil { + return err + } + + return nil +} + +func (m *IKEPolicyTemplate) validateDhGroup(formats strfmt.Registry) error { + + if err := validate.Required("dhGroup", "body", m.DhGroup); err != nil { + return err + } + + return nil +} + +func (m *IKEPolicyTemplate) validateEncryption(formats strfmt.Registry) error { + + if err := validate.Required("encryption", "body", m.Encryption); err != nil { + return err + } + + return nil +} + +func (m *IKEPolicyTemplate) validateKeyLifetime(formats strfmt.Registry) error { + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + +func (m *IKEPolicyTemplate) validateVersion(formats strfmt.Registry) error { + + if err := validate.Required("version", "body", m.Version); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this i k e policy template based on the context it is used +func (m *IKEPolicyTemplate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicyTemplate) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *IKEPolicyTemplate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IKEPolicyTemplate) UnmarshalBinary(b []byte) error { + var res IKEPolicyTemplate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_update.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_update.go new file mode 100644 index 00000000000..5d92a6607fe --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/i_k_e_policy_update.go @@ -0,0 +1,492 @@ +// 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" +) + +// IKEPolicyUpdate IKE Policy object used for update +// +// Min Properties: 1 +// +// swagger:model IKEPolicyUpdate +type IKEPolicyUpdate struct { + + // authentication + Authentication IKEPolicyAuthentication `json:"authentication,omitempty"` + + // DH group of the IKE Policy + // Example: 2 + // Enum: [1 2 5 14 19 20 24] + DhGroup int64 `json:"dhGroup,omitempty"` + + // encryption of the IKE Policy + // Example: aes-256-cbc + // Enum: [aes-256-cbc aes-192-cbc aes-128-cbc aes-256-gcm aes-128-gcm 3des-cbc] + Encryption string `json:"encryption,omitempty"` + + // key lifetime + KeyLifetime KeyLifetime `json:"keyLifetime,omitempty"` + + // name of the IKE Policy + // Example: ikePolicy1 + // Max Length: 47 + // Min Length: 1 + Name string `json:"name,omitempty"` + + // Preshared key used in this IKE Policy (length of preshared key must be even) + PresharedKey string `json:"presharedKey,omitempty"` + + // version of the IKE Policy + // Example: 2 + // Enum: [1 2] + Version int64 `json:"version,omitempty"` + + // i k e policy update additional properties + IKEPolicyUpdateAdditionalProperties map[string]interface{} `json:"-"` +} + +// UnmarshalJSON unmarshals this object with additional properties from JSON +func (m *IKEPolicyUpdate) UnmarshalJSON(data []byte) error { + // stage 1, bind the properties + var stage1 struct { + + // authentication + Authentication IKEPolicyAuthentication `json:"authentication,omitempty"` + + // DH group of the IKE Policy + // Example: 2 + // Enum: [1 2 5 14 19 20 24] + DhGroup int64 `json:"dhGroup,omitempty"` + + // encryption of the IKE Policy + // Example: aes-256-cbc + // Enum: [aes-256-cbc aes-192-cbc aes-128-cbc aes-256-gcm aes-128-gcm 3des-cbc] + Encryption string `json:"encryption,omitempty"` + + // key lifetime + KeyLifetime KeyLifetime `json:"keyLifetime,omitempty"` + + // name of the IKE Policy + // Example: ikePolicy1 + // Max Length: 47 + // Min Length: 1 + Name string `json:"name,omitempty"` + + // Preshared key used in this IKE Policy (length of preshared key must be even) + PresharedKey string `json:"presharedKey,omitempty"` + + // version of the IKE Policy + // Example: 2 + // Enum: [1 2] + Version int64 `json:"version,omitempty"` + } + if err := json.Unmarshal(data, &stage1); err != nil { + return err + } + var rcv IKEPolicyUpdate + + rcv.Authentication = stage1.Authentication + rcv.DhGroup = stage1.DhGroup + rcv.Encryption = stage1.Encryption + rcv.KeyLifetime = stage1.KeyLifetime + rcv.Name = stage1.Name + rcv.PresharedKey = stage1.PresharedKey + rcv.Version = stage1.Version + *m = rcv + + // stage 2, remove properties and add to map + stage2 := make(map[string]json.RawMessage) + if err := json.Unmarshal(data, &stage2); err != nil { + return err + } + + delete(stage2, "authentication") + delete(stage2, "dhGroup") + delete(stage2, "encryption") + delete(stage2, "keyLifetime") + delete(stage2, "name") + delete(stage2, "presharedKey") + delete(stage2, "version") + // stage 3, add additional properties values + if len(stage2) > 0 { + result := make(map[string]interface{}) + for k, v := range stage2 { + var toadd interface{} + if err := json.Unmarshal(v, &toadd); err != nil { + return err + } + result[k] = toadd + } + m.IKEPolicyUpdateAdditionalProperties = result + } + + return nil +} + +// MarshalJSON marshals this object with additional properties into a JSON object +func (m IKEPolicyUpdate) MarshalJSON() ([]byte, error) { + var stage1 struct { + + // authentication + Authentication IKEPolicyAuthentication `json:"authentication,omitempty"` + + // DH group of the IKE Policy + // Example: 2 + // Enum: [1 2 5 14 19 20 24] + DhGroup int64 `json:"dhGroup,omitempty"` + + // encryption of the IKE Policy + // Example: aes-256-cbc + // Enum: [aes-256-cbc aes-192-cbc aes-128-cbc aes-256-gcm aes-128-gcm 3des-cbc] + Encryption string `json:"encryption,omitempty"` + + // key lifetime + KeyLifetime KeyLifetime `json:"keyLifetime,omitempty"` + + // name of the IKE Policy + // Example: ikePolicy1 + // Max Length: 47 + // Min Length: 1 + Name string `json:"name,omitempty"` + + // Preshared key used in this IKE Policy (length of preshared key must be even) + PresharedKey string `json:"presharedKey,omitempty"` + + // version of the IKE Policy + // Example: 2 + // Enum: [1 2] + Version int64 `json:"version,omitempty"` + } + + stage1.Authentication = m.Authentication + stage1.DhGroup = m.DhGroup + stage1.Encryption = m.Encryption + stage1.KeyLifetime = m.KeyLifetime + stage1.Name = m.Name + stage1.PresharedKey = m.PresharedKey + stage1.Version = m.Version + + // make JSON object for known properties + props, err := json.Marshal(stage1) + if err != nil { + return nil, err + } + + if len(m.IKEPolicyUpdateAdditionalProperties) == 0 { // no additional properties + return props, nil + } + + // make JSON object for the additional properties + additional, err := json.Marshal(m.IKEPolicyUpdateAdditionalProperties) + if err != nil { + return nil, err + } + + if len(props) < 3 { // "{}": only additional properties + return additional, nil + } + + // concatenate the 2 objects + return swag.ConcatJSON(props, additional), nil +} + +// Validate validates this i k e policy update +func (m *IKEPolicyUpdate) Validate(formats strfmt.Registry) error { + var res []error + + // short circuits minProperties > 0 + if m == nil { + return errors.TooFewProperties("", "body", 1) + } + + props := make(map[string]json.RawMessage, 7+10) + j, err := swag.WriteJSON(m) + if err != nil { + return err + } + + if err = swag.ReadJSON(j, &props); err != nil { + return err + } + + nprops := len(props) + + // minProperties: 1 + if nprops < 1 { + return errors.TooFewProperties("", "body", 1) + } + + if err := m.validateAuthentication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDhGroup(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEncryption(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeyLifetime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVersion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicyUpdate) validateAuthentication(formats strfmt.Registry) error { + if swag.IsZero(m.Authentication) { // not required + return nil + } + + if err := m.Authentication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + + return nil +} + +var iKEPolicyUpdateTypeDhGroupPropEnum []interface{} + +func init() { + var res []int64 + if err := json.Unmarshal([]byte(`[1,2,5,14,19,20,24]`), &res); err != nil { + panic(err) + } + for _, v := range res { + iKEPolicyUpdateTypeDhGroupPropEnum = append(iKEPolicyUpdateTypeDhGroupPropEnum, v) + } +} + +// prop value enum +func (m *IKEPolicyUpdate) validateDhGroupEnum(path, location string, value int64) error { + if err := validate.EnumCase(path, location, value, iKEPolicyUpdateTypeDhGroupPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *IKEPolicyUpdate) validateDhGroup(formats strfmt.Registry) error { + if swag.IsZero(m.DhGroup) { // not required + return nil + } + + // value enum + if err := m.validateDhGroupEnum("dhGroup", "body", m.DhGroup); err != nil { + return err + } + + return nil +} + +var iKEPolicyUpdateTypeEncryptionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["aes-256-cbc","aes-192-cbc","aes-128-cbc","aes-256-gcm","aes-128-gcm","3des-cbc"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + iKEPolicyUpdateTypeEncryptionPropEnum = append(iKEPolicyUpdateTypeEncryptionPropEnum, v) + } +} + +const ( + + // IKEPolicyUpdateEncryptionAesDash256DashCbc captures enum value "aes-256-cbc" + IKEPolicyUpdateEncryptionAesDash256DashCbc string = "aes-256-cbc" + + // IKEPolicyUpdateEncryptionAesDash192DashCbc captures enum value "aes-192-cbc" + IKEPolicyUpdateEncryptionAesDash192DashCbc string = "aes-192-cbc" + + // IKEPolicyUpdateEncryptionAesDash128DashCbc captures enum value "aes-128-cbc" + IKEPolicyUpdateEncryptionAesDash128DashCbc string = "aes-128-cbc" + + // IKEPolicyUpdateEncryptionAesDash256DashGcm captures enum value "aes-256-gcm" + IKEPolicyUpdateEncryptionAesDash256DashGcm string = "aes-256-gcm" + + // IKEPolicyUpdateEncryptionAesDash128DashGcm captures enum value "aes-128-gcm" + IKEPolicyUpdateEncryptionAesDash128DashGcm string = "aes-128-gcm" + + // IKEPolicyUpdateEncryptionNr3desDashCbc captures enum value "3des-cbc" + IKEPolicyUpdateEncryptionNr3desDashCbc string = "3des-cbc" +) + +// prop value enum +func (m *IKEPolicyUpdate) validateEncryptionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, iKEPolicyUpdateTypeEncryptionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *IKEPolicyUpdate) validateEncryption(formats strfmt.Registry) error { + if swag.IsZero(m.Encryption) { // not required + return nil + } + + // value enum + if err := m.validateEncryptionEnum("encryption", "body", m.Encryption); err != nil { + return err + } + + return nil +} + +func (m *IKEPolicyUpdate) validateKeyLifetime(formats strfmt.Registry) error { + if swag.IsZero(m.KeyLifetime) { // not required + return nil + } + + if err := m.KeyLifetime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + + return nil +} + +func (m *IKEPolicyUpdate) validateName(formats strfmt.Registry) error { + if swag.IsZero(m.Name) { // not required + return nil + } + + if err := validate.MinLength("name", "body", m.Name, 1); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", m.Name, 47); err != nil { + return err + } + + return nil +} + +var iKEPolicyUpdateTypeVersionPropEnum []interface{} + +func init() { + var res []int64 + if err := json.Unmarshal([]byte(`[1,2]`), &res); err != nil { + panic(err) + } + for _, v := range res { + iKEPolicyUpdateTypeVersionPropEnum = append(iKEPolicyUpdateTypeVersionPropEnum, v) + } +} + +// prop value enum +func (m *IKEPolicyUpdate) validateVersionEnum(path, location string, value int64) error { + if err := validate.EnumCase(path, location, value, iKEPolicyUpdateTypeVersionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *IKEPolicyUpdate) validateVersion(formats strfmt.Registry) error { + if swag.IsZero(m.Version) { // not required + return nil + } + + // value enum + if err := m.validateVersionEnum("version", "body", m.Version); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this i k e policy update based on the context it is used +func (m *IKEPolicyUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IKEPolicyUpdate) contextValidateAuthentication(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Authentication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + + return nil +} + +func (m *IKEPolicyUpdate) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *IKEPolicyUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IKEPolicyUpdate) UnmarshalBinary(b []byte) error { + var res IKEPolicyUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/image.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/image.go new file mode 100644 index 00000000000..1d79e34d139 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/image.go @@ -0,0 +1,347 @@ +// 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" +) + +// Image image +// +// swagger:model Image +type Image struct { + + // Creation Date + // Required: true + // Format: date-time + CreationDate *strfmt.DateTime `json:"creationDate"` + + // Description + Description string `json:"description,omitempty"` + + // Image ID + // Required: true + ImageID *string `json:"imageID"` + + // Last Update Date + // Required: true + // Format: date-time + LastUpdateDate *strfmt.DateTime `json:"lastUpdateDate"` + + // Image Name + // Required: true + Name *string `json:"name"` + + // List of Servers that have deployed the image + Servers []string `json:"servers"` + + // Image Size + // Required: true + Size *float64 `json:"size"` + + // specifications + Specifications *ImageSpecifications `json:"specifications,omitempty"` + + // Image State + State string `json:"state,omitempty"` + + // Storage pool where the image resides + // Required: true + StoragePool *string `json:"storagePool"` + + // Storage type for image + // Required: true + StorageType *string `json:"storageType"` + + // taskref + Taskref *TaskReference `json:"taskref,omitempty"` + + // Image Volumes + Volumes []*ImageVolume `json:"volumes"` +} + +// Validate validates this image +func (m *Image) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreationDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateImageID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastUpdateDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSize(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSpecifications(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStoragePool(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStorageType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTaskref(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVolumes(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Image) validateCreationDate(formats strfmt.Registry) error { + + if err := validate.Required("creationDate", "body", m.CreationDate); err != nil { + return err + } + + if err := validate.FormatOf("creationDate", "body", "date-time", m.CreationDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Image) validateImageID(formats strfmt.Registry) error { + + if err := validate.Required("imageID", "body", m.ImageID); err != nil { + return err + } + + return nil +} + +func (m *Image) validateLastUpdateDate(formats strfmt.Registry) error { + + if err := validate.Required("lastUpdateDate", "body", m.LastUpdateDate); err != nil { + return err + } + + if err := validate.FormatOf("lastUpdateDate", "body", "date-time", m.LastUpdateDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Image) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *Image) validateSize(formats strfmt.Registry) error { + + if err := validate.Required("size", "body", m.Size); err != nil { + return err + } + + return nil +} + +func (m *Image) validateSpecifications(formats strfmt.Registry) error { + if swag.IsZero(m.Specifications) { // not required + return nil + } + + if m.Specifications != nil { + if err := m.Specifications.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("specifications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("specifications") + } + return err + } + } + + return nil +} + +func (m *Image) validateStoragePool(formats strfmt.Registry) error { + + if err := validate.Required("storagePool", "body", m.StoragePool); err != nil { + return err + } + + return nil +} + +func (m *Image) validateStorageType(formats strfmt.Registry) error { + + if err := validate.Required("storageType", "body", m.StorageType); err != nil { + return err + } + + return nil +} + +func (m *Image) validateTaskref(formats strfmt.Registry) error { + if swag.IsZero(m.Taskref) { // not required + return nil + } + + if m.Taskref != nil { + if err := m.Taskref.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taskref") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("taskref") + } + return err + } + } + + return nil +} + +func (m *Image) validateVolumes(formats strfmt.Registry) error { + if swag.IsZero(m.Volumes) { // not required + return nil + } + + for i := 0; i < len(m.Volumes); i++ { + if swag.IsZero(m.Volumes[i]) { // not required + continue + } + + if m.Volumes[i] != nil { + if err := m.Volumes[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this image based on the context it is used +func (m *Image) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSpecifications(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTaskref(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVolumes(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Image) contextValidateSpecifications(ctx context.Context, formats strfmt.Registry) error { + + if m.Specifications != nil { + if err := m.Specifications.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("specifications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("specifications") + } + return err + } + } + + return nil +} + +func (m *Image) contextValidateTaskref(ctx context.Context, formats strfmt.Registry) error { + + if m.Taskref != nil { + if err := m.Taskref.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("taskref") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("taskref") + } + return err + } + } + + return nil +} + +func (m *Image) contextValidateVolumes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Volumes); i++ { + + if m.Volumes[i] != nil { + if err := m.Volumes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Image) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Image) UnmarshalBinary(b []byte) error { + var res Image + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/image_reference.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/image_reference.go new file mode 100644 index 00000000000..0d1fb25dcb0 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/image_reference.go @@ -0,0 +1,270 @@ +// 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" +) + +// ImageReference image reference +// +// swagger:model ImageReference +type ImageReference struct { + + // Creation Date + // Required: true + // Format: date-time + CreationDate *strfmt.DateTime `json:"creationDate"` + + // Description + // Required: true + Description *string `json:"description"` + + // Link to Image resource + // Required: true + Href *string `json:"href"` + + // Image ID + // Required: true + ImageID *string `json:"imageID"` + + // Last Update Date + // Required: true + // Format: date-time + LastUpdateDate *strfmt.DateTime `json:"lastUpdateDate"` + + // Image Name + // Required: true + Name *string `json:"name"` + + // specifications + // Required: true + Specifications *ImageSpecifications `json:"specifications"` + + // Image State + // Required: true + State *string `json:"state"` + + // Storage pool where image resides + // Required: true + StoragePool *string `json:"storagePool"` + + // Storage type for image + // Required: true + StorageType *string `json:"storageType"` +} + +// Validate validates this image reference +func (m *ImageReference) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreationDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHref(formats); err != nil { + res = append(res, err) + } + + if err := m.validateImageID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastUpdateDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSpecifications(formats); err != nil { + res = append(res, err) + } + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStoragePool(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStorageType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ImageReference) validateCreationDate(formats strfmt.Registry) error { + + if err := validate.Required("creationDate", "body", m.CreationDate); err != nil { + return err + } + + if err := validate.FormatOf("creationDate", "body", "date-time", m.CreationDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *ImageReference) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *ImageReference) validateHref(formats strfmt.Registry) error { + + if err := validate.Required("href", "body", m.Href); err != nil { + return err + } + + return nil +} + +func (m *ImageReference) validateImageID(formats strfmt.Registry) error { + + if err := validate.Required("imageID", "body", m.ImageID); err != nil { + return err + } + + return nil +} + +func (m *ImageReference) validateLastUpdateDate(formats strfmt.Registry) error { + + if err := validate.Required("lastUpdateDate", "body", m.LastUpdateDate); err != nil { + return err + } + + if err := validate.FormatOf("lastUpdateDate", "body", "date-time", m.LastUpdateDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *ImageReference) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *ImageReference) validateSpecifications(formats strfmt.Registry) error { + + if err := validate.Required("specifications", "body", m.Specifications); err != nil { + return err + } + + if m.Specifications != nil { + if err := m.Specifications.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("specifications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("specifications") + } + return err + } + } + + return nil +} + +func (m *ImageReference) validateState(formats strfmt.Registry) error { + + if err := validate.Required("state", "body", m.State); err != nil { + return err + } + + return nil +} + +func (m *ImageReference) validateStoragePool(formats strfmt.Registry) error { + + if err := validate.Required("storagePool", "body", m.StoragePool); err != nil { + return err + } + + return nil +} + +func (m *ImageReference) validateStorageType(formats strfmt.Registry) error { + + if err := validate.Required("storageType", "body", m.StorageType); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this image reference based on the context it is used +func (m *ImageReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSpecifications(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ImageReference) contextValidateSpecifications(ctx context.Context, formats strfmt.Registry) error { + + if m.Specifications != nil { + if err := m.Specifications.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("specifications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("specifications") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ImageReference) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ImageReference) UnmarshalBinary(b []byte) error { + var res ImageReference + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/image_specifications.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/image_specifications.go new file mode 100644 index 00000000000..d5f71a0ea0b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/image_specifications.go @@ -0,0 +1,68 @@ +// 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" +) + +// ImageSpecifications image specifications +// +// swagger:model ImageSpecifications +type ImageSpecifications struct { + + // Architecture + Architecture string `json:"architecture,omitempty"` + + // Container Format + ContainerFormat string `json:"containerFormat,omitempty"` + + // Disk Format + DiskFormat string `json:"diskFormat,omitempty"` + + // Endianness + Endianness string `json:"endianness,omitempty"` + + // Hypervisor Type + HypervisorType string `json:"hypervisorType,omitempty"` + + // Image Type + ImageType string `json:"imageType,omitempty"` + + // Operating System + OperatingSystem string `json:"operatingSystem,omitempty"` +} + +// Validate validates this image specifications +func (m *ImageSpecifications) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this image specifications based on context it is used +func (m *ImageSpecifications) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ImageSpecifications) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ImageSpecifications) UnmarshalBinary(b []byte) error { + var res ImageSpecifications + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/image_volume.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/image_volume.go new file mode 100644 index 00000000000..44e1899db85 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/image_volume.go @@ -0,0 +1,122 @@ +// 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" +) + +// ImageVolume image volume +// +// swagger:model ImageVolume +type ImageVolume struct { + + // Indicates if the volume is boot capable + // Required: true + Bootable *bool `json:"bootable"` + + // Volume Name + // Required: true + Name *string `json:"name"` + + // Volume Size + // Required: true + Size *float64 `json:"size"` + + // Volume ID + // Required: true + VolumeID *string `json:"volumeID"` +} + +// Validate validates this image volume +func (m *ImageVolume) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBootable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSize(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVolumeID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ImageVolume) validateBootable(formats strfmt.Registry) error { + + if err := validate.Required("bootable", "body", m.Bootable); err != nil { + return err + } + + return nil +} + +func (m *ImageVolume) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *ImageVolume) validateSize(formats strfmt.Registry) error { + + if err := validate.Required("size", "body", m.Size); err != nil { + return err + } + + return nil +} + +func (m *ImageVolume) validateVolumeID(formats strfmt.Registry) error { + + if err := validate.Required("volumeID", "body", m.VolumeID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this image volume based on context it is used +func (m *ImageVolume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ImageVolume) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ImageVolume) UnmarshalBinary(b []byte) error { + var res ImageVolume + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/images.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/images.go new file mode 100644 index 00000000000..b9c4473c0c1 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/images.go @@ -0,0 +1,119 @@ +// 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" +) + +// Images images +// +// swagger:model Images +type Images struct { + + // Images + // Required: true + Images []*ImageReference `json:"images"` +} + +// Validate validates this images +func (m *Images) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateImages(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Images) validateImages(formats strfmt.Registry) error { + + if err := validate.Required("images", "body", m.Images); err != nil { + return err + } + + for i := 0; i < len(m.Images); i++ { + if swag.IsZero(m.Images[i]) { // not required + continue + } + + if m.Images[i] != nil { + if err := m.Images[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("images" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("images" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this images based on the context it is used +func (m *Images) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateImages(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Images) contextValidateImages(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Images); i++ { + + if m.Images[i] != nil { + if err := m.Images[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("images" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("images" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Images) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Images) UnmarshalBinary(b []byte) error { + var res Images + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_address_range.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_address_range.go new file mode 100644 index 00000000000..58cbfff9186 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_address_range.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" +) + +// IPAddressRange IP address range +// +// swagger:model IPAddressRange +type IPAddressRange struct { + + // Ending IP Address + // Required: true + EndingIPAddress *string `json:"endingIPAddress"` + + // Starting IP Address + // Required: true + StartingIPAddress *string `json:"startingIPAddress"` +} + +// Validate validates this IP address range +func (m *IPAddressRange) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEndingIPAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStartingIPAddress(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPAddressRange) validateEndingIPAddress(formats strfmt.Registry) error { + + if err := validate.Required("endingIPAddress", "body", m.EndingIPAddress); err != nil { + return err + } + + return nil +} + +func (m *IPAddressRange) validateStartingIPAddress(formats strfmt.Registry) error { + + if err := validate.Required("startingIPAddress", "body", m.StartingIPAddress); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this IP address range based on context it is used +func (m *IPAddressRange) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *IPAddressRange) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IPAddressRange) UnmarshalBinary(b []byte) error { + var res IPAddressRange + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_s_e_c_policy_authentication.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_s_e_c_policy_authentication.go new file mode 100644 index 00000000000..d3f704f02a5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_s_e_c_policy_authentication.go @@ -0,0 +1,82 @@ +// 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/validate" +) + +// IPSECPolicyAuthentication authentication for IPSec policy +// Example: hmac-sha-256-128 +// +// swagger:model IPSECPolicyAuthentication +type IPSECPolicyAuthentication string + +func NewIPSECPolicyAuthentication(value IPSECPolicyAuthentication) *IPSECPolicyAuthentication { + return &value +} + +// Pointer returns a pointer to a freshly-allocated IPSECPolicyAuthentication. +func (m IPSECPolicyAuthentication) Pointer() *IPSECPolicyAuthentication { + return &m +} + +const ( + + // IPSECPolicyAuthenticationHmacDashShaDash256Dash128 captures enum value "hmac-sha-256-128" + IPSECPolicyAuthenticationHmacDashShaDash256Dash128 IPSECPolicyAuthentication = "hmac-sha-256-128" + + // IPSECPolicyAuthenticationHmacDashSha1Dash96 captures enum value "hmac-sha1-96" + IPSECPolicyAuthenticationHmacDashSha1Dash96 IPSECPolicyAuthentication = "hmac-sha1-96" + + // IPSECPolicyAuthenticationNone captures enum value "none" + IPSECPolicyAuthenticationNone IPSECPolicyAuthentication = "none" +) + +// for schema +var ipSECPolicyAuthenticationEnum []interface{} + +func init() { + var res []IPSECPolicyAuthentication + if err := json.Unmarshal([]byte(`["hmac-sha-256-128","hmac-sha1-96","none"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + ipSECPolicyAuthenticationEnum = append(ipSECPolicyAuthenticationEnum, v) + } +} + +func (m IPSECPolicyAuthentication) validateIPSECPolicyAuthenticationEnum(path, location string, value IPSECPolicyAuthentication) error { + if err := validate.EnumCase(path, location, value, ipSECPolicyAuthenticationEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this IP s e c policy authentication +func (m IPSECPolicyAuthentication) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateIPSECPolicyAuthenticationEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this IP s e c policy authentication based on context it is used +func (m IPSECPolicyAuthentication) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_s_e_c_policy_authentications.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_s_e_c_policy_authentications.go new file mode 100644 index 00000000000..e7d49a6bfe4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_s_e_c_policy_authentications.go @@ -0,0 +1,28 @@ +// 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" +) + +// IPSECPolicyAuthentications IP s e c policy authentications +// Example: ["hmac-sha-256-128","hmac-sha1-96","none"] +// +// swagger:model IPSECPolicyAuthentications +type IPSECPolicyAuthentications []string + +// Validate validates this IP s e c policy authentications +func (m IPSECPolicyAuthentications) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this IP s e c policy authentications based on context it is used +func (m IPSECPolicyAuthentications) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_s_e_c_policy_dh_groups.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_s_e_c_policy_dh_groups.go new file mode 100644 index 00000000000..3db313e56a4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_s_e_c_policy_dh_groups.go @@ -0,0 +1,28 @@ +// 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" +) + +// IPSECPolicyDhGroups IP s e c policy dh groups +// Example: [1,2,5,14,19,20] +// +// swagger:model IPSECPolicyDhGroups +type IPSECPolicyDhGroups []float64 + +// Validate validates this IP s e c policy dh groups +func (m IPSECPolicyDhGroups) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this IP s e c policy dh groups based on context it is used +func (m IPSECPolicyDhGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_s_e_c_policy_encryptions.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_s_e_c_policy_encryptions.go new file mode 100644 index 00000000000..be20e38f432 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_s_e_c_policy_encryptions.go @@ -0,0 +1,28 @@ +// 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" +) + +// IPSECPolicyEncryptions IP s e c policy encryptions +// Example: ["aes-256-cbc","aes-192-cbc","aes-128-cbc","aes-256-gcm","aes-128-gcm","3des-cbc"] +// +// swagger:model IPSECPolicyEncryptions +type IPSECPolicyEncryptions []string + +// Validate validates this IP s e c policy encryptions +func (m IPSECPolicyEncryptions) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this IP s e c policy encryptions based on context it is used +func (m IPSECPolicyEncryptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policies.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policies.go new file mode 100644 index 00000000000..6e0996a4a39 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policies.go @@ -0,0 +1,119 @@ +// 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" +) + +// IPSecPolicies IP sec policies +// +// swagger:model IPSecPolicies +type IPSecPolicies struct { + + // IPSec Policies array + // Required: true + IPSecPolicies []*IPSecPolicy `json:"ipSecPolicies"` +} + +// Validate validates this IP sec policies +func (m *IPSecPolicies) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIPSecPolicies(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicies) validateIPSecPolicies(formats strfmt.Registry) error { + + if err := validate.Required("ipSecPolicies", "body", m.IPSecPolicies); err != nil { + return err + } + + for i := 0; i < len(m.IPSecPolicies); i++ { + if swag.IsZero(m.IPSecPolicies[i]) { // not required + continue + } + + if m.IPSecPolicies[i] != nil { + if err := m.IPSecPolicies[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipSecPolicies" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicies" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this IP sec policies based on the context it is used +func (m *IPSecPolicies) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIPSecPolicies(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicies) contextValidateIPSecPolicies(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.IPSecPolicies); i++ { + + if m.IPSecPolicies[i] != nil { + if err := m.IPSecPolicies[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipSecPolicies" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicies" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *IPSecPolicies) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IPSecPolicies) UnmarshalBinary(b []byte) error { + var res IPSecPolicies + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy.go new file mode 100644 index 00000000000..d13ba5a5631 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy.go @@ -0,0 +1,330 @@ +// 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" +) + +// IPSecPolicy IPSec Policy object +// +// swagger:model IPSecPolicy +type IPSecPolicy struct { + + // authentication + // Required: true + Authentication *IPSECPolicyAuthentication `json:"authentication"` + + // Diffie-Hellman group + // Example: 2 + // Required: true + // Enum: [1 2 5 14 19 20 24] + DhGroup *int64 `json:"dhGroup"` + + // connection encryption policy + // Example: aes-256-cbc + // Required: true + // Enum: [aes-256-cbc aes-192-cbc aes-128-cbc aes-256-gcm aes-192-gcm aes-128-gcm 3des-cbc] + Encryption *string `json:"encryption"` + + // unique identifier of the IPSec Policy + // Example: 6edc8988-eb18-4b5c-a594-0d73d8254463 + // Required: true + ID *string `json:"id"` + + // key lifetime + // Required: true + KeyLifetime *KeyLifetime `json:"keyLifetime"` + + // IPSec Policy name + // Example: ipSecPolicy2 + // Required: true + Name *string `json:"name"` + + // Perfect Forward Secrecy + // Example: true + // Required: true + Pfs *bool `json:"pfs"` +} + +// Validate validates this IP sec policy +func (m *IPSecPolicy) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAuthentication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDhGroup(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEncryption(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeyLifetime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePfs(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicy) validateAuthentication(formats strfmt.Registry) error { + + if err := validate.Required("authentication", "body", m.Authentication); err != nil { + return err + } + + if err := validate.Required("authentication", "body", m.Authentication); err != nil { + return err + } + + if m.Authentication != nil { + if err := m.Authentication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + } + + return nil +} + +var ipSecPolicyTypeDhGroupPropEnum []interface{} + +func init() { + var res []int64 + if err := json.Unmarshal([]byte(`[1,2,5,14,19,20,24]`), &res); err != nil { + panic(err) + } + for _, v := range res { + ipSecPolicyTypeDhGroupPropEnum = append(ipSecPolicyTypeDhGroupPropEnum, v) + } +} + +// prop value enum +func (m *IPSecPolicy) validateDhGroupEnum(path, location string, value int64) error { + if err := validate.EnumCase(path, location, value, ipSecPolicyTypeDhGroupPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *IPSecPolicy) validateDhGroup(formats strfmt.Registry) error { + + if err := validate.Required("dhGroup", "body", m.DhGroup); err != nil { + return err + } + + // value enum + if err := m.validateDhGroupEnum("dhGroup", "body", *m.DhGroup); err != nil { + return err + } + + return nil +} + +var ipSecPolicyTypeEncryptionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["aes-256-cbc","aes-192-cbc","aes-128-cbc","aes-256-gcm","aes-192-gcm","aes-128-gcm","3des-cbc"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + ipSecPolicyTypeEncryptionPropEnum = append(ipSecPolicyTypeEncryptionPropEnum, v) + } +} + +const ( + + // IPSecPolicyEncryptionAesDash256DashCbc captures enum value "aes-256-cbc" + IPSecPolicyEncryptionAesDash256DashCbc string = "aes-256-cbc" + + // IPSecPolicyEncryptionAesDash192DashCbc captures enum value "aes-192-cbc" + IPSecPolicyEncryptionAesDash192DashCbc string = "aes-192-cbc" + + // IPSecPolicyEncryptionAesDash128DashCbc captures enum value "aes-128-cbc" + IPSecPolicyEncryptionAesDash128DashCbc string = "aes-128-cbc" + + // IPSecPolicyEncryptionAesDash256DashGcm captures enum value "aes-256-gcm" + IPSecPolicyEncryptionAesDash256DashGcm string = "aes-256-gcm" + + // IPSecPolicyEncryptionAesDash192DashGcm captures enum value "aes-192-gcm" + IPSecPolicyEncryptionAesDash192DashGcm string = "aes-192-gcm" + + // IPSecPolicyEncryptionAesDash128DashGcm captures enum value "aes-128-gcm" + IPSecPolicyEncryptionAesDash128DashGcm string = "aes-128-gcm" + + // IPSecPolicyEncryptionNr3desDashCbc captures enum value "3des-cbc" + IPSecPolicyEncryptionNr3desDashCbc string = "3des-cbc" +) + +// prop value enum +func (m *IPSecPolicy) validateEncryptionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, ipSecPolicyTypeEncryptionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *IPSecPolicy) validateEncryption(formats strfmt.Registry) error { + + if err := validate.Required("encryption", "body", m.Encryption); err != nil { + return err + } + + // value enum + if err := m.validateEncryptionEnum("encryption", "body", *m.Encryption); err != nil { + return err + } + + return nil +} + +func (m *IPSecPolicy) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *IPSecPolicy) validateKeyLifetime(formats strfmt.Registry) error { + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + +func (m *IPSecPolicy) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *IPSecPolicy) validatePfs(formats strfmt.Registry) error { + + if err := validate.Required("pfs", "body", m.Pfs); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this IP sec policy based on the context it is used +func (m *IPSecPolicy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicy) contextValidateAuthentication(ctx context.Context, formats strfmt.Registry) error { + + if m.Authentication != nil { + if err := m.Authentication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + } + + return nil +} + +func (m *IPSecPolicy) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *IPSecPolicy) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IPSecPolicy) UnmarshalBinary(b []byte) error { + var res IPSecPolicy + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy_create.go new file mode 100644 index 00000000000..2dbcb92c074 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy_create.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" +) + +// IPSecPolicyCreate IPSec Policy object used for creation +// +// swagger:model IPSecPolicyCreate +type IPSecPolicyCreate struct { + + // authentication + Authentication IPSECPolicyAuthentication `json:"authentication,omitempty"` + + // Diffie-Hellman group + // Example: 2 + // Required: true + // Enum: [1 2 5 14 19 20 24] + DhGroup *int64 `json:"dhGroup"` + + // connection encryption policy + // Example: aes-256-cbc + // Required: true + // Enum: [aes-256-cbc aes-192-cbc aes-128-cbc aes-256-gcm aes-192-gcm aes-128-gcm 3des-cbc] + Encryption *string `json:"encryption"` + + // key lifetime + // Required: true + KeyLifetime *KeyLifetime `json:"keyLifetime"` + + // IPSec Policy name + // Example: ipSecPolicy2 + // Required: true + // Max Length: 47 + // Min Length: 1 + Name *string `json:"name"` + + // Perfect Forward Secrecy + // Example: true + // Required: true + Pfs *bool `json:"pfs"` +} + +// Validate validates this IP sec policy create +func (m *IPSecPolicyCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAuthentication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDhGroup(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEncryption(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeyLifetime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePfs(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicyCreate) validateAuthentication(formats strfmt.Registry) error { + if swag.IsZero(m.Authentication) { // not required + return nil + } + + if err := m.Authentication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + + return nil +} + +var ipSecPolicyCreateTypeDhGroupPropEnum []interface{} + +func init() { + var res []int64 + if err := json.Unmarshal([]byte(`[1,2,5,14,19,20,24]`), &res); err != nil { + panic(err) + } + for _, v := range res { + ipSecPolicyCreateTypeDhGroupPropEnum = append(ipSecPolicyCreateTypeDhGroupPropEnum, v) + } +} + +// prop value enum +func (m *IPSecPolicyCreate) validateDhGroupEnum(path, location string, value int64) error { + if err := validate.EnumCase(path, location, value, ipSecPolicyCreateTypeDhGroupPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *IPSecPolicyCreate) validateDhGroup(formats strfmt.Registry) error { + + if err := validate.Required("dhGroup", "body", m.DhGroup); err != nil { + return err + } + + // value enum + if err := m.validateDhGroupEnum("dhGroup", "body", *m.DhGroup); err != nil { + return err + } + + return nil +} + +var ipSecPolicyCreateTypeEncryptionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["aes-256-cbc","aes-192-cbc","aes-128-cbc","aes-256-gcm","aes-192-gcm","aes-128-gcm","3des-cbc"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + ipSecPolicyCreateTypeEncryptionPropEnum = append(ipSecPolicyCreateTypeEncryptionPropEnum, v) + } +} + +const ( + + // IPSecPolicyCreateEncryptionAesDash256DashCbc captures enum value "aes-256-cbc" + IPSecPolicyCreateEncryptionAesDash256DashCbc string = "aes-256-cbc" + + // IPSecPolicyCreateEncryptionAesDash192DashCbc captures enum value "aes-192-cbc" + IPSecPolicyCreateEncryptionAesDash192DashCbc string = "aes-192-cbc" + + // IPSecPolicyCreateEncryptionAesDash128DashCbc captures enum value "aes-128-cbc" + IPSecPolicyCreateEncryptionAesDash128DashCbc string = "aes-128-cbc" + + // IPSecPolicyCreateEncryptionAesDash256DashGcm captures enum value "aes-256-gcm" + IPSecPolicyCreateEncryptionAesDash256DashGcm string = "aes-256-gcm" + + // IPSecPolicyCreateEncryptionAesDash192DashGcm captures enum value "aes-192-gcm" + IPSecPolicyCreateEncryptionAesDash192DashGcm string = "aes-192-gcm" + + // IPSecPolicyCreateEncryptionAesDash128DashGcm captures enum value "aes-128-gcm" + IPSecPolicyCreateEncryptionAesDash128DashGcm string = "aes-128-gcm" + + // IPSecPolicyCreateEncryptionNr3desDashCbc captures enum value "3des-cbc" + IPSecPolicyCreateEncryptionNr3desDashCbc string = "3des-cbc" +) + +// prop value enum +func (m *IPSecPolicyCreate) validateEncryptionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, ipSecPolicyCreateTypeEncryptionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *IPSecPolicyCreate) validateEncryption(formats strfmt.Registry) error { + + if err := validate.Required("encryption", "body", m.Encryption); err != nil { + return err + } + + // value enum + if err := m.validateEncryptionEnum("encryption", "body", *m.Encryption); err != nil { + return err + } + + return nil +} + +func (m *IPSecPolicyCreate) validateKeyLifetime(formats strfmt.Registry) error { + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + +func (m *IPSecPolicyCreate) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + if err := validate.MinLength("name", "body", *m.Name, 1); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", *m.Name, 47); err != nil { + return err + } + + return nil +} + +func (m *IPSecPolicyCreate) validatePfs(formats strfmt.Registry) error { + + if err := validate.Required("pfs", "body", m.Pfs); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this IP sec policy create based on the context it is used +func (m *IPSecPolicyCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicyCreate) contextValidateAuthentication(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Authentication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + + return nil +} + +func (m *IPSecPolicyCreate) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *IPSecPolicyCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IPSecPolicyCreate) UnmarshalBinary(b []byte) error { + var res IPSecPolicyCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy_options.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy_options.go new file mode 100644 index 00000000000..07841dffc48 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy_options.go @@ -0,0 +1,191 @@ +// 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" +) + +// IPSecPolicyOptions IP sec policy options +// +// swagger:model IPSecPolicyOptions +type IPSecPolicyOptions struct { + + // authentications + // Required: true + Authentications IPSECPolicyAuthentications `json:"authentications"` + + // dh groups + // Required: true + DhGroups IPSECPolicyDhGroups `json:"dhGroups"` + + // encryptions + // Required: true + Encryptions IPSECPolicyEncryptions `json:"encryptions"` +} + +// Validate validates this IP sec policy options +func (m *IPSecPolicyOptions) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAuthentications(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDhGroups(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEncryptions(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicyOptions) validateAuthentications(formats strfmt.Registry) error { + + if err := validate.Required("authentications", "body", m.Authentications); err != nil { + return err + } + + if err := m.Authentications.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentications") + } + return err + } + + return nil +} + +func (m *IPSecPolicyOptions) validateDhGroups(formats strfmt.Registry) error { + + if err := validate.Required("dhGroups", "body", m.DhGroups); err != nil { + return err + } + + if err := m.DhGroups.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dhGroups") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dhGroups") + } + return err + } + + return nil +} + +func (m *IPSecPolicyOptions) validateEncryptions(formats strfmt.Registry) error { + + if err := validate.Required("encryptions", "body", m.Encryptions); err != nil { + return err + } + + if err := m.Encryptions.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encryptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encryptions") + } + return err + } + + return nil +} + +// ContextValidate validate this IP sec policy options based on the context it is used +func (m *IPSecPolicyOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentications(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDhGroups(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateEncryptions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicyOptions) contextValidateAuthentications(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Authentications.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentications") + } + return err + } + + return nil +} + +func (m *IPSecPolicyOptions) contextValidateDhGroups(ctx context.Context, formats strfmt.Registry) error { + + if err := m.DhGroups.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dhGroups") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dhGroups") + } + return err + } + + return nil +} + +func (m *IPSecPolicyOptions) contextValidateEncryptions(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Encryptions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("encryptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("encryptions") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *IPSecPolicyOptions) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IPSecPolicyOptions) UnmarshalBinary(b []byte) error { + var res IPSecPolicyOptions + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy_ref.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy_ref.go new file mode 100644 index 00000000000..4b5a384f235 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy_ref.go @@ -0,0 +1,90 @@ +// 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" +) + +// IPSecPolicyRef IPSec Policy reference object +// +// swagger:model IPSecPolicyRef +type IPSecPolicyRef struct { + + // unique identifier of IPSec Policy + // Example: 7abc1234-ab18-4b5c-b123-0d73e8254463 + // Required: true + ID *string `json:"id"` + + // name of IPSec Policy + // Example: IPSec Policy 1 + // Required: true + Name *string `json:"name"` +} + +// Validate validates this IP sec policy ref +func (m *IPSecPolicyRef) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(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 *IPSecPolicyRef) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *IPSecPolicyRef) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this IP sec policy ref based on context it is used +func (m *IPSecPolicyRef) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *IPSecPolicyRef) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IPSecPolicyRef) UnmarshalBinary(b []byte) error { + var res IPSecPolicyRef + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy_template.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy_template.go new file mode 100644 index 00000000000..7f8c3413714 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy_template.go @@ -0,0 +1,165 @@ +// 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" +) + +// IPSecPolicyTemplate IP sec policy template +// +// swagger:model IPSecPolicyTemplate +type IPSecPolicyTemplate struct { + + // ipSecPolicy Authentication default value + // Example: sha256 + // Required: true + Authentication *string `json:"authentication"` + + // ipSecPolicy DHGroup default value + // Example: 2 + // Required: true + DhGroup *int64 `json:"dhGroup"` + + // ipSecPolicy Encryption default value + // Example: aes-256-cbc + // Required: true + Encryption *string `json:"encryption"` + + // key lifetime + // Required: true + KeyLifetime *KeyLifetime `json:"keyLifetime"` +} + +// Validate validates this IP sec policy template +func (m *IPSecPolicyTemplate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAuthentication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDhGroup(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEncryption(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeyLifetime(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicyTemplate) validateAuthentication(formats strfmt.Registry) error { + + if err := validate.Required("authentication", "body", m.Authentication); err != nil { + return err + } + + return nil +} + +func (m *IPSecPolicyTemplate) validateDhGroup(formats strfmt.Registry) error { + + if err := validate.Required("dhGroup", "body", m.DhGroup); err != nil { + return err + } + + return nil +} + +func (m *IPSecPolicyTemplate) validateEncryption(formats strfmt.Registry) error { + + if err := validate.Required("encryption", "body", m.Encryption); err != nil { + return err + } + + return nil +} + +func (m *IPSecPolicyTemplate) validateKeyLifetime(formats strfmt.Registry) error { + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if err := validate.Required("keyLifetime", "body", m.KeyLifetime); err != nil { + return err + } + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + +// ContextValidate validate this IP sec policy template based on the context it is used +func (m *IPSecPolicyTemplate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicyTemplate) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if m.KeyLifetime != nil { + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *IPSecPolicyTemplate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IPSecPolicyTemplate) UnmarshalBinary(b []byte) error { + var res IPSecPolicyTemplate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy_update.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy_update.go new file mode 100644 index 00000000000..7ec614b2ba3 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ip_sec_policy_update.go @@ -0,0 +1,443 @@ +// 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" +) + +// IPSecPolicyUpdate IPSEc Policy object used for update +// +// Min Properties: 1 +// +// swagger:model IPSecPolicyUpdate +type IPSecPolicyUpdate struct { + + // authentication + Authentication IPSECPolicyAuthentication `json:"authentication,omitempty"` + + // Diffie-Hellman group + // Example: 2 + // Enum: [1 2 5 14 19 20 24] + DhGroup int64 `json:"dhGroup,omitempty"` + + // connection encryption policy + // Example: aes-256-cbc + // Enum: [aes-256-cbc aes-192-cbc aes-128-cbc aes-256-gcm aes-192-gcm aes-128-gcm 3des-cbc] + Encryption string `json:"encryption,omitempty"` + + // key lifetime + KeyLifetime KeyLifetime `json:"keyLifetime,omitempty"` + + // IPSec Policy name + // Example: ipSecPolicy2 + // Max Length: 47 + // Min Length: 1 + Name string `json:"name,omitempty"` + + // Perfect Forward Secrecy + // Example: true + Pfs *bool `json:"pfs,omitempty"` + + // IP sec policy update additional properties + IPSecPolicyUpdateAdditionalProperties map[string]interface{} `json:"-"` +} + +// UnmarshalJSON unmarshals this object with additional properties from JSON +func (m *IPSecPolicyUpdate) UnmarshalJSON(data []byte) error { + // stage 1, bind the properties + var stage1 struct { + + // authentication + Authentication IPSECPolicyAuthentication `json:"authentication,omitempty"` + + // Diffie-Hellman group + // Example: 2 + // Enum: [1 2 5 14 19 20 24] + DhGroup int64 `json:"dhGroup,omitempty"` + + // connection encryption policy + // Example: aes-256-cbc + // Enum: [aes-256-cbc aes-192-cbc aes-128-cbc aes-256-gcm aes-192-gcm aes-128-gcm 3des-cbc] + Encryption string `json:"encryption,omitempty"` + + // key lifetime + KeyLifetime KeyLifetime `json:"keyLifetime,omitempty"` + + // IPSec Policy name + // Example: ipSecPolicy2 + // Max Length: 47 + // Min Length: 1 + Name string `json:"name,omitempty"` + + // Perfect Forward Secrecy + // Example: true + Pfs *bool `json:"pfs,omitempty"` + } + if err := json.Unmarshal(data, &stage1); err != nil { + return err + } + var rcv IPSecPolicyUpdate + + rcv.Authentication = stage1.Authentication + rcv.DhGroup = stage1.DhGroup + rcv.Encryption = stage1.Encryption + rcv.KeyLifetime = stage1.KeyLifetime + rcv.Name = stage1.Name + rcv.Pfs = stage1.Pfs + *m = rcv + + // stage 2, remove properties and add to map + stage2 := make(map[string]json.RawMessage) + if err := json.Unmarshal(data, &stage2); err != nil { + return err + } + + delete(stage2, "authentication") + delete(stage2, "dhGroup") + delete(stage2, "encryption") + delete(stage2, "keyLifetime") + delete(stage2, "name") + delete(stage2, "pfs") + // stage 3, add additional properties values + if len(stage2) > 0 { + result := make(map[string]interface{}) + for k, v := range stage2 { + var toadd interface{} + if err := json.Unmarshal(v, &toadd); err != nil { + return err + } + result[k] = toadd + } + m.IPSecPolicyUpdateAdditionalProperties = result + } + + return nil +} + +// MarshalJSON marshals this object with additional properties into a JSON object +func (m IPSecPolicyUpdate) MarshalJSON() ([]byte, error) { + var stage1 struct { + + // authentication + Authentication IPSECPolicyAuthentication `json:"authentication,omitempty"` + + // Diffie-Hellman group + // Example: 2 + // Enum: [1 2 5 14 19 20 24] + DhGroup int64 `json:"dhGroup,omitempty"` + + // connection encryption policy + // Example: aes-256-cbc + // Enum: [aes-256-cbc aes-192-cbc aes-128-cbc aes-256-gcm aes-192-gcm aes-128-gcm 3des-cbc] + Encryption string `json:"encryption,omitempty"` + + // key lifetime + KeyLifetime KeyLifetime `json:"keyLifetime,omitempty"` + + // IPSec Policy name + // Example: ipSecPolicy2 + // Max Length: 47 + // Min Length: 1 + Name string `json:"name,omitempty"` + + // Perfect Forward Secrecy + // Example: true + Pfs *bool `json:"pfs,omitempty"` + } + + stage1.Authentication = m.Authentication + stage1.DhGroup = m.DhGroup + stage1.Encryption = m.Encryption + stage1.KeyLifetime = m.KeyLifetime + stage1.Name = m.Name + stage1.Pfs = m.Pfs + + // make JSON object for known properties + props, err := json.Marshal(stage1) + if err != nil { + return nil, err + } + + if len(m.IPSecPolicyUpdateAdditionalProperties) == 0 { // no additional properties + return props, nil + } + + // make JSON object for the additional properties + additional, err := json.Marshal(m.IPSecPolicyUpdateAdditionalProperties) + if err != nil { + return nil, err + } + + if len(props) < 3 { // "{}": only additional properties + return additional, nil + } + + // concatenate the 2 objects + return swag.ConcatJSON(props, additional), nil +} + +// Validate validates this IP sec policy update +func (m *IPSecPolicyUpdate) Validate(formats strfmt.Registry) error { + var res []error + + // short circuits minProperties > 0 + if m == nil { + return errors.TooFewProperties("", "body", 1) + } + + props := make(map[string]json.RawMessage, 6+10) + j, err := swag.WriteJSON(m) + if err != nil { + return err + } + + if err = swag.ReadJSON(j, &props); err != nil { + return err + } + + nprops := len(props) + + // minProperties: 1 + if nprops < 1 { + return errors.TooFewProperties("", "body", 1) + } + + if err := m.validateAuthentication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDhGroup(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEncryption(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeyLifetime(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 *IPSecPolicyUpdate) validateAuthentication(formats strfmt.Registry) error { + if swag.IsZero(m.Authentication) { // not required + return nil + } + + if err := m.Authentication.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + + return nil +} + +var ipSecPolicyUpdateTypeDhGroupPropEnum []interface{} + +func init() { + var res []int64 + if err := json.Unmarshal([]byte(`[1,2,5,14,19,20,24]`), &res); err != nil { + panic(err) + } + for _, v := range res { + ipSecPolicyUpdateTypeDhGroupPropEnum = append(ipSecPolicyUpdateTypeDhGroupPropEnum, v) + } +} + +// prop value enum +func (m *IPSecPolicyUpdate) validateDhGroupEnum(path, location string, value int64) error { + if err := validate.EnumCase(path, location, value, ipSecPolicyUpdateTypeDhGroupPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *IPSecPolicyUpdate) validateDhGroup(formats strfmt.Registry) error { + if swag.IsZero(m.DhGroup) { // not required + return nil + } + + // value enum + if err := m.validateDhGroupEnum("dhGroup", "body", m.DhGroup); err != nil { + return err + } + + return nil +} + +var ipSecPolicyUpdateTypeEncryptionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["aes-256-cbc","aes-192-cbc","aes-128-cbc","aes-256-gcm","aes-192-gcm","aes-128-gcm","3des-cbc"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + ipSecPolicyUpdateTypeEncryptionPropEnum = append(ipSecPolicyUpdateTypeEncryptionPropEnum, v) + } +} + +const ( + + // IPSecPolicyUpdateEncryptionAesDash256DashCbc captures enum value "aes-256-cbc" + IPSecPolicyUpdateEncryptionAesDash256DashCbc string = "aes-256-cbc" + + // IPSecPolicyUpdateEncryptionAesDash192DashCbc captures enum value "aes-192-cbc" + IPSecPolicyUpdateEncryptionAesDash192DashCbc string = "aes-192-cbc" + + // IPSecPolicyUpdateEncryptionAesDash128DashCbc captures enum value "aes-128-cbc" + IPSecPolicyUpdateEncryptionAesDash128DashCbc string = "aes-128-cbc" + + // IPSecPolicyUpdateEncryptionAesDash256DashGcm captures enum value "aes-256-gcm" + IPSecPolicyUpdateEncryptionAesDash256DashGcm string = "aes-256-gcm" + + // IPSecPolicyUpdateEncryptionAesDash192DashGcm captures enum value "aes-192-gcm" + IPSecPolicyUpdateEncryptionAesDash192DashGcm string = "aes-192-gcm" + + // IPSecPolicyUpdateEncryptionAesDash128DashGcm captures enum value "aes-128-gcm" + IPSecPolicyUpdateEncryptionAesDash128DashGcm string = "aes-128-gcm" + + // IPSecPolicyUpdateEncryptionNr3desDashCbc captures enum value "3des-cbc" + IPSecPolicyUpdateEncryptionNr3desDashCbc string = "3des-cbc" +) + +// prop value enum +func (m *IPSecPolicyUpdate) validateEncryptionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, ipSecPolicyUpdateTypeEncryptionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *IPSecPolicyUpdate) validateEncryption(formats strfmt.Registry) error { + if swag.IsZero(m.Encryption) { // not required + return nil + } + + // value enum + if err := m.validateEncryptionEnum("encryption", "body", m.Encryption); err != nil { + return err + } + + return nil +} + +func (m *IPSecPolicyUpdate) validateKeyLifetime(formats strfmt.Registry) error { + if swag.IsZero(m.KeyLifetime) { // not required + return nil + } + + if err := m.KeyLifetime.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + + return nil +} + +func (m *IPSecPolicyUpdate) validateName(formats strfmt.Registry) error { + if swag.IsZero(m.Name) { // not required + return nil + } + + if err := validate.MinLength("name", "body", m.Name, 1); err != nil { + return err + } + + if err := validate.MaxLength("name", "body", m.Name, 47); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this IP sec policy update based on the context it is used +func (m *IPSecPolicyUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAuthentication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeyLifetime(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *IPSecPolicyUpdate) contextValidateAuthentication(ctx context.Context, formats strfmt.Registry) error { + + if err := m.Authentication.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("authentication") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("authentication") + } + return err + } + + return nil +} + +func (m *IPSecPolicyUpdate) contextValidateKeyLifetime(ctx context.Context, formats strfmt.Registry) error { + + if err := m.KeyLifetime.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keyLifetime") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keyLifetime") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *IPSecPolicyUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *IPSecPolicyUpdate) UnmarshalBinary(b []byte) error { + var res IPSecPolicyUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/job.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/job.go new file mode 100644 index 00000000000..fd59b76c97e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/job.go @@ -0,0 +1,192 @@ +// 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" +) + +// Job job +// +// swagger:model Job +type Job struct { + + // create timestamp for the job + // Format: date-time + CreateTimestamp strfmt.DateTime `json:"createTimestamp,omitempty"` + + // id of a job + // Required: true + ID *string `json:"id"` + + // operation + // Required: true + Operation *Operation `json:"operation"` + + // status + // Required: true + Status *Status `json:"status"` +} + +// Validate validates this job +func (m *Job) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreateTimestamp(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOperation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Job) validateCreateTimestamp(formats strfmt.Registry) error { + if swag.IsZero(m.CreateTimestamp) { // not required + return nil + } + + if err := validate.FormatOf("createTimestamp", "body", "date-time", m.CreateTimestamp.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Job) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *Job) validateOperation(formats strfmt.Registry) error { + + if err := validate.Required("operation", "body", m.Operation); err != nil { + return err + } + + if m.Operation != nil { + if err := m.Operation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") + } + return err + } + } + + return nil +} + +func (m *Job) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + if m.Status != nil { + if err := m.Status.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + } + + return nil +} + +// ContextValidate validate this job based on the context it is used +func (m *Job) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOperation(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Job) contextValidateOperation(ctx context.Context, formats strfmt.Registry) error { + + if m.Operation != nil { + if err := m.Operation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") + } + return err + } + } + + return nil +} + +func (m *Job) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.Status != nil { + if err := m.Status.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Job) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Job) UnmarshalBinary(b []byte) error { + var res Job + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/job_reference.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/job_reference.go new file mode 100644 index 00000000000..dc09f76fe84 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/job_reference.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" +) + +// JobReference job reference +// +// swagger:model JobReference +type JobReference struct { + + // Link to job resource + // Required: true + Href *string `json:"href"` + + // id of a job used to get status of long running operation + // Required: true + ID *string `json:"id"` +} + +// Validate validates this job reference +func (m *JobReference) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHref(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 *JobReference) validateHref(formats strfmt.Registry) error { + + if err := validate.Required("href", "body", m.Href); err != nil { + return err + } + + return nil +} + +func (m *JobReference) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this job reference based on context it is used +func (m *JobReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *JobReference) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *JobReference) UnmarshalBinary(b []byte) error { + var res JobReference + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/jobs.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/jobs.go new file mode 100644 index 00000000000..99fd189bf69 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/jobs.go @@ -0,0 +1,119 @@ +// 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" +) + +// Jobs jobs +// +// swagger:model Jobs +type Jobs struct { + + // Jobs + // Required: true + Jobs []*Job `json:"jobs"` +} + +// Validate validates this jobs +func (m *Jobs) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateJobs(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Jobs) validateJobs(formats strfmt.Registry) error { + + if err := validate.Required("jobs", "body", m.Jobs); err != nil { + return err + } + + for i := 0; i < len(m.Jobs); i++ { + if swag.IsZero(m.Jobs[i]) { // not required + continue + } + + if m.Jobs[i] != nil { + if err := m.Jobs[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("jobs" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("jobs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this jobs based on the context it is used +func (m *Jobs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateJobs(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Jobs) contextValidateJobs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Jobs); i++ { + + if m.Jobs[i] != nil { + if err := m.Jobs[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("jobs" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("jobs" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Jobs) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Jobs) UnmarshalBinary(b []byte) error { + var res Jobs + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/json_schema_object.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/json_schema_object.go new file mode 100644 index 00000000000..9fec438a573 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/json_schema_object.go @@ -0,0 +1,11 @@ +// 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 + +// JSONSchemaObject JSON schema object +// +// swagger:model JSONSchemaObject +type JSONSchemaObject interface{} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/key_lifetime.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/key_lifetime.go new file mode 100644 index 00000000000..053deebb2e3 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/key_lifetime.go @@ -0,0 +1,43 @@ +// 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/validate" +) + +// KeyLifetime Policy key lifetime +// Example: 28800 +// +// swagger:model KeyLifetime +type KeyLifetime int64 + +// Validate validates this key lifetime +func (m KeyLifetime) Validate(formats strfmt.Registry) error { + var res []error + + if err := validate.MinimumInt("", "body", int64(m), 180, false); err != nil { + return err + } + + if err := validate.MaximumInt("", "body", int64(m), 86400, false); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this key lifetime based on context it is used +func (m KeyLifetime) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/last_operation_resource.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/last_operation_resource.go new file mode 100644 index 00000000000..37596b72c29 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/last_operation_resource.go @@ -0,0 +1,113 @@ +// 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" +) + +// LastOperationResource last operation resource +// +// swagger:model LastOperationResource +type LastOperationResource struct { + + // description + Description string `json:"description,omitempty"` + + // state + // Required: true + // Enum: [in progress succeeded failed] + State *string `json:"state"` +} + +// Validate validates this last operation resource +func (m *LastOperationResource) 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 lastOperationResourceTypeStatePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["in progress","succeeded","failed"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + lastOperationResourceTypeStatePropEnum = append(lastOperationResourceTypeStatePropEnum, v) + } +} + +const ( + + // LastOperationResourceStateInProgress captures enum value "in progress" + LastOperationResourceStateInProgress string = "in progress" + + // LastOperationResourceStateSucceeded captures enum value "succeeded" + LastOperationResourceStateSucceeded string = "succeeded" + + // LastOperationResourceStateFailed captures enum value "failed" + LastOperationResourceStateFailed string = "failed" +) + +// prop value enum +func (m *LastOperationResource) validateStateEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, lastOperationResourceTypeStatePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *LastOperationResource) 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 last operation resource based on context it is used +func (m *LastOperationResource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *LastOperationResource) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *LastOperationResource) UnmarshalBinary(b []byte) error { + var res LastOperationResource + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/maximum_storage_allocation.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/maximum_storage_allocation.go new file mode 100644 index 00000000000..d33f36f3f56 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/maximum_storage_allocation.go @@ -0,0 +1,105 @@ +// 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" +) + +// MaximumStorageAllocation Maximum storage allocation +// +// swagger:model MaximumStorageAllocation +type MaximumStorageAllocation struct { + + // Maximum allocation storage size (GB) + // Required: true + MaxAllocationSize *int64 `json:"maxAllocationSize"` + + // Storage pool + // Required: true + StoragePool *string `json:"storagePool"` + + // Storage type + // Required: true + StorageType *string `json:"storageType"` +} + +// Validate validates this maximum storage allocation +func (m *MaximumStorageAllocation) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMaxAllocationSize(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStoragePool(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStorageType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MaximumStorageAllocation) validateMaxAllocationSize(formats strfmt.Registry) error { + + if err := validate.Required("maxAllocationSize", "body", m.MaxAllocationSize); err != nil { + return err + } + + return nil +} + +func (m *MaximumStorageAllocation) validateStoragePool(formats strfmt.Registry) error { + + if err := validate.Required("storagePool", "body", m.StoragePool); err != nil { + return err + } + + return nil +} + +func (m *MaximumStorageAllocation) validateStorageType(formats strfmt.Registry) error { + + if err := validate.Required("storageType", "body", m.StorageType); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this maximum storage allocation based on context it is used +func (m *MaximumStorageAllocation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *MaximumStorageAllocation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MaximumStorageAllocation) UnmarshalBinary(b []byte) error { + var res MaximumStorageAllocation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/metadata.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/metadata.go new file mode 100644 index 00000000000..fcebea3ace2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/metadata.go @@ -0,0 +1,11 @@ +// 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 + +// Metadata See [Service Metadata Conventions](https://github.com/openservicebrokerapi/servicebroker/blob/master/profile.md#service-metadata) for more details. +// +// swagger:model Metadata +type Metadata interface{} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/min_max_default.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/min_max_default.go new file mode 100644 index 00000000000..1237d64c310 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/min_max_default.go @@ -0,0 +1,105 @@ +// 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" +) + +// MinMaxDefault min max default +// +// swagger:model MinMaxDefault +type MinMaxDefault struct { + + // default value + // Required: true + Default *float64 `json:"default"` + + // max value + // Required: true + Max *float64 `json:"max"` + + // min value + // Required: true + Min *float64 `json:"min"` +} + +// Validate validates this min max default +func (m *MinMaxDefault) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDefault(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMax(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMin(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MinMaxDefault) validateDefault(formats strfmt.Registry) error { + + if err := validate.Required("default", "body", m.Default); err != nil { + return err + } + + return nil +} + +func (m *MinMaxDefault) validateMax(formats strfmt.Registry) error { + + if err := validate.Required("max", "body", m.Max); err != nil { + return err + } + + return nil +} + +func (m *MinMaxDefault) validateMin(formats strfmt.Registry) error { + + if err := validate.Required("min", "body", m.Min); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this min max default based on context it is used +func (m *MinMaxDefault) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *MinMaxDefault) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MinMaxDefault) UnmarshalBinary(b []byte) error { + var res MinMaxDefault + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/multi_volumes_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/multi_volumes_create.go new file mode 100644 index 00000000000..46527787737 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/multi_volumes_create.go @@ -0,0 +1,166 @@ +// 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" +) + +// MultiVolumesCreate multi volumes create +// +// swagger:model MultiVolumesCreate +type MultiVolumesCreate struct { + + // PVM Instance (ID or Name)to base volume affinity policy against; required if requesting affinity and affinityVolume is not provided + AffinityPVMInstance *string `json:"affinityPVMInstance,omitempty"` + + // Affinity policy for data volume being created; ignored if volumePool provided; for policy 'affinity' requires one of affinityPVMInstance or affinityVolume to be specified; for policy 'anti-affinity' requires one of antiAffinityPVMInstances or antiAffinityVolumes to be specified + // Enum: [affinity anti-affinity] + AffinityPolicy *string `json:"affinityPolicy,omitempty"` + + // Volume (ID or Name) to base volume affinity policy against; required if requesting affinity and affinityPVMInstance is not provided + AffinityVolume *string `json:"affinityVolume,omitempty"` + + // List of pvmInstances to base volume anti-affinity policy against; required if requesting anti-affinity and antiAffinityVolumes is not provided + AntiAffinityPVMInstances []string `json:"antiAffinityPVMInstances"` + + // List of volumes to base volume anti-affinity policy against; required if requesting anti-affinity and antiAffinityPVMInstances is not provided + AntiAffinityVolumes []string `json:"antiAffinityVolumes"` + + // Number of volumes to create + Count int64 `json:"count,omitempty"` + + // Type of Disk, required if affinityPolicy and volumePool not provided, otherwise ignored + DiskType string `json:"diskType,omitempty"` + + // Base name of the volume(s) + // Required: true + Name *string `json:"name"` + + // Indicates if the volume should be replication enabled or not + ReplicationEnabled *bool `json:"replicationEnabled,omitempty"` + + // Indicates if the volume is shareable between VMs + Shareable *bool `json:"shareable,omitempty"` + + // Volume Size (GB) + // Required: true + Size *int64 `json:"size"` + + // Volume pool where the volume will be created; if provided then diskType and affinityPolicy values will be ignored + VolumePool string `json:"volumePool,omitempty"` +} + +// Validate validates this multi volumes create +func (m *MultiVolumesCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAffinityPolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSize(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var multiVolumesCreateTypeAffinityPolicyPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["affinity","anti-affinity"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + multiVolumesCreateTypeAffinityPolicyPropEnum = append(multiVolumesCreateTypeAffinityPolicyPropEnum, v) + } +} + +const ( + + // MultiVolumesCreateAffinityPolicyAffinity captures enum value "affinity" + MultiVolumesCreateAffinityPolicyAffinity string = "affinity" + + // MultiVolumesCreateAffinityPolicyAntiDashAffinity captures enum value "anti-affinity" + MultiVolumesCreateAffinityPolicyAntiDashAffinity string = "anti-affinity" +) + +// prop value enum +func (m *MultiVolumesCreate) validateAffinityPolicyEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, multiVolumesCreateTypeAffinityPolicyPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *MultiVolumesCreate) validateAffinityPolicy(formats strfmt.Registry) error { + if swag.IsZero(m.AffinityPolicy) { // not required + return nil + } + + // value enum + if err := m.validateAffinityPolicyEnum("affinityPolicy", "body", *m.AffinityPolicy); err != nil { + return err + } + + return nil +} + +func (m *MultiVolumesCreate) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *MultiVolumesCreate) validateSize(formats strfmt.Registry) error { + + if err := validate.Required("size", "body", m.Size); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this multi volumes create based on context it is used +func (m *MultiVolumesCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *MultiVolumesCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MultiVolumesCreate) UnmarshalBinary(b []byte) error { + var res MultiVolumesCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/network.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network.go new file mode 100644 index 00000000000..0d008cd8111 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network.go @@ -0,0 +1,589 @@ +// 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" +) + +// Network network +// +// swagger:model Network +type Network struct { + + // Network in CIDR notation (192.168.0.0/24) + // Required: true + Cidr *string `json:"cidr"` + + // (currently not available) cloud connections this network is attached + CloudConnections []*NetworkCloudConnectionsItems0 `json:"cloudConnections,omitempty"` + + // DHCP Managed Network + DhcpManaged bool `json:"dhcpManaged,omitempty"` + + // DNS Servers + // Required: true + DNSServers []string `json:"dnsServers"` + + // Gateway IP Address + Gateway string `json:"gateway,omitempty"` + + // ip address metrics + // Required: true + IPAddressMetrics *NetworkIPAddressMetrics `json:"ipAddressMetrics"` + + // IP Address Ranges + // Required: true + IPAddressRanges []*IPAddressRange `json:"ipAddressRanges"` + + // MTU Jumbo Network enabled + // Required: true + Jumbo *bool `json:"jumbo"` + + // Network Name + // Required: true + Name *string `json:"name"` + + // Unique Network ID + // Required: true + NetworkID *string `json:"networkID"` + + // Public IP Address Ranges (for pub-vlan networks) + PublicIPAddressRanges []*IPAddressRange `json:"publicIPAddressRanges,omitempty"` + + // Type of Network {vlan, pub-vlan} + // Required: true + // Enum: [vlan pub-vlan] + Type *string `json:"type"` + + // VLAN ID + // Required: true + VlanID *float64 `json:"vlanID"` +} + +// Validate validates this network +func (m *Network) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCidr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCloudConnections(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDNSServers(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIPAddressMetrics(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIPAddressRanges(formats); err != nil { + res = append(res, err) + } + + if err := m.validateJumbo(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetworkID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePublicIPAddressRanges(formats); err != nil { + res = append(res, err) + } + + if err := m.validateType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVlanID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Network) validateCidr(formats strfmt.Registry) error { + + if err := validate.Required("cidr", "body", m.Cidr); err != nil { + return err + } + + return nil +} + +func (m *Network) validateCloudConnections(formats strfmt.Registry) error { + if swag.IsZero(m.CloudConnections) { // not required + return nil + } + + for i := 0; i < len(m.CloudConnections); i++ { + if swag.IsZero(m.CloudConnections[i]) { // not required + continue + } + + if m.CloudConnections[i] != nil { + if err := m.CloudConnections[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Network) validateDNSServers(formats strfmt.Registry) error { + + if err := validate.Required("dnsServers", "body", m.DNSServers); err != nil { + return err + } + + return nil +} + +func (m *Network) validateIPAddressMetrics(formats strfmt.Registry) error { + + if err := validate.Required("ipAddressMetrics", "body", m.IPAddressMetrics); err != nil { + return err + } + + if m.IPAddressMetrics != nil { + if err := m.IPAddressMetrics.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipAddressMetrics") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressMetrics") + } + return err + } + } + + return nil +} + +func (m *Network) validateIPAddressRanges(formats strfmt.Registry) error { + + if err := validate.Required("ipAddressRanges", "body", m.IPAddressRanges); err != nil { + return err + } + + for i := 0; i < len(m.IPAddressRanges); i++ { + if swag.IsZero(m.IPAddressRanges[i]) { // not required + continue + } + + if m.IPAddressRanges[i] != nil { + if err := m.IPAddressRanges[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Network) validateJumbo(formats strfmt.Registry) error { + + if err := validate.Required("jumbo", "body", m.Jumbo); err != nil { + return err + } + + return nil +} + +func (m *Network) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *Network) validateNetworkID(formats strfmt.Registry) error { + + if err := validate.Required("networkID", "body", m.NetworkID); err != nil { + return err + } + + return nil +} + +func (m *Network) validatePublicIPAddressRanges(formats strfmt.Registry) error { + if swag.IsZero(m.PublicIPAddressRanges) { // not required + return nil + } + + for i := 0; i < len(m.PublicIPAddressRanges); i++ { + if swag.IsZero(m.PublicIPAddressRanges[i]) { // not required + continue + } + + if m.PublicIPAddressRanges[i] != nil { + if err := m.PublicIPAddressRanges[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("publicIPAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("publicIPAddressRanges" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +var networkTypeTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["vlan","pub-vlan"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkTypeTypePropEnum = append(networkTypeTypePropEnum, v) + } +} + +const ( + + // NetworkTypeVlan captures enum value "vlan" + NetworkTypeVlan string = "vlan" + + // NetworkTypePubDashVlan captures enum value "pub-vlan" + NetworkTypePubDashVlan string = "pub-vlan" +) + +// prop value enum +func (m *Network) validateTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkTypeTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *Network) 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 +} + +func (m *Network) validateVlanID(formats strfmt.Registry) error { + + if err := validate.Required("vlanID", "body", m.VlanID); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this network based on the context it is used +func (m *Network) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCloudConnections(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIPAddressMetrics(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIPAddressRanges(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePublicIPAddressRanges(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Network) contextValidateCloudConnections(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.CloudConnections); i++ { + + if m.CloudConnections[i] != nil { + if err := m.CloudConnections[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cloudConnections" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Network) contextValidateIPAddressMetrics(ctx context.Context, formats strfmt.Registry) error { + + if m.IPAddressMetrics != nil { + if err := m.IPAddressMetrics.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipAddressMetrics") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressMetrics") + } + return err + } + } + + return nil +} + +func (m *Network) contextValidateIPAddressRanges(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.IPAddressRanges); i++ { + + if m.IPAddressRanges[i] != nil { + if err := m.IPAddressRanges[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Network) contextValidatePublicIPAddressRanges(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PublicIPAddressRanges); i++ { + + if m.PublicIPAddressRanges[i] != nil { + if err := m.PublicIPAddressRanges[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("publicIPAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("publicIPAddressRanges" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Network) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Network) UnmarshalBinary(b []byte) error { + var res Network + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// NetworkCloudConnectionsItems0 network cloud connections items0 +// +// swagger:model NetworkCloudConnectionsItems0 +type NetworkCloudConnectionsItems0 struct { + + // the cloud connection id + CloudConnectionID string `json:"cloudConnectionID,omitempty"` + + // link to the cloud connection resource + Href string `json:"href,omitempty"` +} + +// Validate validates this network cloud connections items0 +func (m *NetworkCloudConnectionsItems0) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network cloud connections items0 based on context it is used +func (m *NetworkCloudConnectionsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkCloudConnectionsItems0) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkCloudConnectionsItems0) UnmarshalBinary(b []byte) error { + var res NetworkCloudConnectionsItems0 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// NetworkIPAddressMetrics IP Address Metrics +// +// swagger:model NetworkIPAddressMetrics +type NetworkIPAddressMetrics struct { + + // Number of available IP addresses + // Required: true + Available *float64 `json:"available"` + + // Total number of all IP addresses in all ipAddressRanges + // Required: true + Total *float64 `json:"total"` + + // Number of IP addresses currently in use + // Required: true + Used *float64 `json:"used"` + + // Utilization of IP addresses in percent form (used / total) [0 - 100] + // Required: true + Utilization *float64 `json:"utilization"` +} + +// Validate validates this network IP address metrics +func (m *NetworkIPAddressMetrics) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAvailable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTotal(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsed(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUtilization(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkIPAddressMetrics) validateAvailable(formats strfmt.Registry) error { + + if err := validate.Required("ipAddressMetrics"+"."+"available", "body", m.Available); err != nil { + return err + } + + return nil +} + +func (m *NetworkIPAddressMetrics) validateTotal(formats strfmt.Registry) error { + + if err := validate.Required("ipAddressMetrics"+"."+"total", "body", m.Total); err != nil { + return err + } + + return nil +} + +func (m *NetworkIPAddressMetrics) validateUsed(formats strfmt.Registry) error { + + if err := validate.Required("ipAddressMetrics"+"."+"used", "body", m.Used); err != nil { + return err + } + + return nil +} + +func (m *NetworkIPAddressMetrics) validateUtilization(formats strfmt.Registry) error { + + if err := validate.Required("ipAddressMetrics"+"."+"utilization", "body", m.Utilization); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network IP address metrics based on context it is used +func (m *NetworkIPAddressMetrics) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkIPAddressMetrics) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkIPAddressMetrics) UnmarshalBinary(b []byte) error { + var res NetworkIPAddressMetrics + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_create.go new file mode 100644 index 00000000000..c5a54d8f6fa --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_create.go @@ -0,0 +1,185 @@ +// 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" +) + +// NetworkCreate network create +// +// swagger:model NetworkCreate +type NetworkCreate struct { + + // Network in CIDR notation (192.168.0.0/24) + Cidr string `json:"cidr,omitempty"` + + // DNS Servers + DNSServers []string `json:"dnsServers"` + + // Gateway IP Address + Gateway string `json:"gateway,omitempty"` + + // IP Address Ranges + IPAddressRanges []*IPAddressRange `json:"ipAddressRanges"` + + // Enable MTU Jumbo Network + Jumbo bool `json:"jumbo,omitempty"` + + // Network Name + Name string `json:"name,omitempty"` + + // Type of Network - 'vlan' (private network) 'pub-vlan' (public network) + // Required: true + // Enum: [vlan pub-vlan] + Type *string `json:"type"` +} + +// Validate validates this network create +func (m *NetworkCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIPAddressRanges(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 *NetworkCreate) validateIPAddressRanges(formats strfmt.Registry) error { + if swag.IsZero(m.IPAddressRanges) { // not required + return nil + } + + for i := 0; i < len(m.IPAddressRanges); i++ { + if swag.IsZero(m.IPAddressRanges[i]) { // not required + continue + } + + if m.IPAddressRanges[i] != nil { + if err := m.IPAddressRanges[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +var networkCreateTypeTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["vlan","pub-vlan"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkCreateTypeTypePropEnum = append(networkCreateTypeTypePropEnum, v) + } +} + +const ( + + // NetworkCreateTypeVlan captures enum value "vlan" + NetworkCreateTypeVlan string = "vlan" + + // NetworkCreateTypePubDashVlan captures enum value "pub-vlan" + NetworkCreateTypePubDashVlan string = "pub-vlan" +) + +// prop value enum +func (m *NetworkCreate) validateTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkCreateTypeTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkCreate) 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 validate this network create based on the context it is used +func (m *NetworkCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIPAddressRanges(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkCreate) contextValidateIPAddressRanges(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.IPAddressRanges); i++ { + + if m.IPAddressRanges[i] != nil { + if err := m.IPAddressRanges[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkCreate) UnmarshalBinary(b []byte) error { + var res NetworkCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_i_ds.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_i_ds.go new file mode 100644 index 00000000000..e2ceb6fca31 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_i_ds.go @@ -0,0 +1,51 @@ +// 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" +) + +// NetworkIDs network i ds +// +// swagger:model NetworkIDs +type NetworkIDs struct { + + // an array of network IDs + // Example: ["7f950c76-8582-11qeb-8dcd-0242ac143","7f950c76-8582-11veb-8dcd-0242ac153","7f950c76-8582-11deb-8dcd-0242ac163"] + NetworkIDs []string `json:"networkIDs"` +} + +// Validate validates this network i ds +func (m *NetworkIDs) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network i ds based on context it is used +func (m *NetworkIDs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkIDs) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkIDs) UnmarshalBinary(b []byte) error { + var res NetworkIDs + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_id.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_id.go new file mode 100644 index 00000000000..98ab9bddc15 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_id.go @@ -0,0 +1,72 @@ +// 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" +) + +// NetworkID unique identifier of a network +// +// swagger:model NetworkID +type NetworkID struct { + + // network ID + // Example: 7f950c76-8582-11qeb-8dcd-0242ac172 + // Required: true + NetworkID *string `json:"networkID"` +} + +// Validate validates this network ID +func (m *NetworkID) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateNetworkID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkID) validateNetworkID(formats strfmt.Registry) error { + + if err := validate.Required("networkID", "body", m.NetworkID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network ID based on context it is used +func (m *NetworkID) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkID) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkID) UnmarshalBinary(b []byte) error { + var res NetworkID + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_port.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_port.go new file mode 100644 index 00000000000..360de77afd7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_port.go @@ -0,0 +1,236 @@ +// 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" +) + +// NetworkPort network port +// +// swagger:model NetworkPort +type NetworkPort struct { + + // Description of the port (not unique or indexable) + // Required: true + Description *string `json:"description"` + + // The external ip address (for pub-vlan networks) + ExternalIP string `json:"externalIP,omitempty"` + + // Link to port resource + Href string `json:"href,omitempty"` + + // The ip address of this port + // Required: true + IPAddress *string `json:"ipAddress"` + + // The mac address of the network interface + // Required: true + MacAddress *string `json:"macAddress"` + + // The unique Port ID + // Required: true + PortID *string `json:"portID"` + + // pvm instance + PvmInstance *NetworkPortPvmInstance `json:"pvmInstance,omitempty"` + + // Te + // Required: true + Status *string `json:"status"` +} + +// Validate validates this network port +func (m *NetworkPort) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIPAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMacAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePortID(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePvmInstance(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkPort) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *NetworkPort) validateIPAddress(formats strfmt.Registry) error { + + if err := validate.Required("ipAddress", "body", m.IPAddress); err != nil { + return err + } + + return nil +} + +func (m *NetworkPort) validateMacAddress(formats strfmt.Registry) error { + + if err := validate.Required("macAddress", "body", m.MacAddress); err != nil { + return err + } + + return nil +} + +func (m *NetworkPort) validatePortID(formats strfmt.Registry) error { + + if err := validate.Required("portID", "body", m.PortID); err != nil { + return err + } + + return nil +} + +func (m *NetworkPort) validatePvmInstance(formats strfmt.Registry) error { + if swag.IsZero(m.PvmInstance) { // not required + return nil + } + + if m.PvmInstance != nil { + if err := m.PvmInstance.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pvmInstance") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstance") + } + return err + } + } + + return nil +} + +func (m *NetworkPort) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this network port based on the context it is used +func (m *NetworkPort) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePvmInstance(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkPort) contextValidatePvmInstance(ctx context.Context, formats strfmt.Registry) error { + + if m.PvmInstance != nil { + if err := m.PvmInstance.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pvmInstance") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstance") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkPort) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkPort) UnmarshalBinary(b []byte) error { + var res NetworkPort + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} + +// NetworkPortPvmInstance The attached pvm-instance to this port +// +// swagger:model NetworkPortPvmInstance +type NetworkPortPvmInstance struct { + + // Link to pvm-instance resource + Href string `json:"href,omitempty"` + + // The attahed pvm-instance ID + PvmInstanceID string `json:"pvmInstanceID,omitempty"` +} + +// Validate validates this network port pvm instance +func (m *NetworkPortPvmInstance) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network port pvm instance based on context it is used +func (m *NetworkPortPvmInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkPortPvmInstance) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkPortPvmInstance) UnmarshalBinary(b []byte) error { + var res NetworkPortPvmInstance + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_port_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_port_create.go new file mode 100644 index 00000000000..d9c99e85160 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_port_create.go @@ -0,0 +1,53 @@ +// 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" +) + +// NetworkPortCreate network port create +// +// swagger:model NetworkPortCreate +type NetworkPortCreate struct { + + // Description of the port (not unique or indexable) + Description string `json:"description,omitempty"` + + // The requested ip address of this port + IPAddress string `json:"ipAddress,omitempty"` +} + +// Validate validates this network port create +func (m *NetworkPortCreate) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network port create based on context it is used +func (m *NetworkPortCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkPortCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkPortCreate) UnmarshalBinary(b []byte) error { + var res NetworkPortCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_port_update.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_port_update.go new file mode 100644 index 00000000000..6b438efb735 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_port_update.go @@ -0,0 +1,53 @@ +// 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" +) + +// NetworkPortUpdate network port update +// +// swagger:model NetworkPortUpdate +type NetworkPortUpdate struct { + + // Description of the port (not unique or indexable) + Description *string `json:"description,omitempty"` + + // If supplied populated it attaches to the PVMInstanceID, if empty detaches from PVMInstanceID + PvmInstanceID *string `json:"pvmInstanceID,omitempty"` +} + +// Validate validates this network port update +func (m *NetworkPortUpdate) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this network port update based on context it is used +func (m *NetworkPortUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkPortUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkPortUpdate) UnmarshalBinary(b []byte) error { + var res NetworkPortUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_ports.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_ports.go new file mode 100644 index 00000000000..78f26b2249c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_ports.go @@ -0,0 +1,119 @@ +// 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" +) + +// NetworkPorts network ports +// +// swagger:model NetworkPorts +type NetworkPorts struct { + + // Network Ports + // Required: true + Ports []*NetworkPort `json:"ports"` +} + +// Validate validates this network ports +func (m *NetworkPorts) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePorts(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkPorts) validatePorts(formats strfmt.Registry) error { + + if err := validate.Required("ports", "body", m.Ports); err != nil { + return err + } + + for i := 0; i < len(m.Ports); i++ { + if swag.IsZero(m.Ports[i]) { // not required + continue + } + + if m.Ports[i] != nil { + if err := m.Ports[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ports" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ports" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this network ports based on the context it is used +func (m *NetworkPorts) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePorts(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkPorts) contextValidatePorts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Ports); i++ { + + if m.Ports[i] != nil { + if err := m.Ports[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ports" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ports" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkPorts) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkPorts) UnmarshalBinary(b []byte) error { + var res NetworkPorts + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_reference.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_reference.go new file mode 100644 index 00000000000..0398445e891 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_reference.go @@ -0,0 +1,195 @@ +// 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" +) + +// NetworkReference network reference +// +// swagger:model NetworkReference +type NetworkReference struct { + + // DHCP Managed Network + DhcpManaged bool `json:"dhcpManaged,omitempty"` + + // Link to Network resource + // Required: true + Href *string `json:"href"` + + // MTU Jumbo Network enabled + // Required: true + Jumbo *bool `json:"jumbo"` + + // Network Name + // Required: true + Name *string `json:"name"` + + // Unique Network ID + // Required: true + NetworkID *string `json:"networkID"` + + // Type of Network {vlan, pub-vlan} + // Required: true + // Enum: [vlan pub-vlan] + Type *string `json:"type"` + + // VLAN ID + // Required: true + VlanID *float64 `json:"vlanID"` +} + +// Validate validates this network reference +func (m *NetworkReference) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHref(formats); err != nil { + res = append(res, err) + } + + if err := m.validateJumbo(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetworkID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVlanID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkReference) validateHref(formats strfmt.Registry) error { + + if err := validate.Required("href", "body", m.Href); err != nil { + return err + } + + return nil +} + +func (m *NetworkReference) validateJumbo(formats strfmt.Registry) error { + + if err := validate.Required("jumbo", "body", m.Jumbo); err != nil { + return err + } + + return nil +} + +func (m *NetworkReference) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *NetworkReference) validateNetworkID(formats strfmt.Registry) error { + + if err := validate.Required("networkID", "body", m.NetworkID); err != nil { + return err + } + + return nil +} + +var networkReferenceTypeTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["vlan","pub-vlan"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + networkReferenceTypeTypePropEnum = append(networkReferenceTypeTypePropEnum, v) + } +} + +const ( + + // NetworkReferenceTypeVlan captures enum value "vlan" + NetworkReferenceTypeVlan string = "vlan" + + // NetworkReferenceTypePubDashVlan captures enum value "pub-vlan" + NetworkReferenceTypePubDashVlan string = "pub-vlan" +) + +// prop value enum +func (m *NetworkReference) validateTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, networkReferenceTypeTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *NetworkReference) 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 +} + +func (m *NetworkReference) validateVlanID(formats strfmt.Registry) error { + + if err := validate.Required("vlanID", "body", m.VlanID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this network reference based on context it is used +func (m *NetworkReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkReference) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkReference) UnmarshalBinary(b []byte) error { + var res NetworkReference + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_update.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_update.go new file mode 100644 index 00000000000..af849c48872 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/network_update.go @@ -0,0 +1,125 @@ +// 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" +) + +// NetworkUpdate network update +// +// swagger:model NetworkUpdate +type NetworkUpdate struct { + + // Replaces the current DNS Servers + DNSServers []string `json:"dnsServers"` + + // Replaces the current Gateway IP Address + Gateway *string `json:"gateway,omitempty"` + + // Replaces the current IP Address Ranges + IPAddressRanges []*IPAddressRange `json:"ipAddressRanges"` + + // Replaces the current Network Name + Name *string `json:"name,omitempty"` +} + +// Validate validates this network update +func (m *NetworkUpdate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIPAddressRanges(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkUpdate) validateIPAddressRanges(formats strfmt.Registry) error { + if swag.IsZero(m.IPAddressRanges) { // not required + return nil + } + + for i := 0; i < len(m.IPAddressRanges); i++ { + if swag.IsZero(m.IPAddressRanges[i]) { // not required + continue + } + + if m.IPAddressRanges[i] != nil { + if err := m.IPAddressRanges[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this network update based on the context it is used +func (m *NetworkUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateIPAddressRanges(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NetworkUpdate) contextValidateIPAddressRanges(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.IPAddressRanges); i++ { + + if m.IPAddressRanges[i] != nil { + if err := m.IPAddressRanges[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipAddressRanges" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NetworkUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NetworkUpdate) UnmarshalBinary(b []byte) error { + var res NetworkUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/networks.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/networks.go new file mode 100644 index 00000000000..42428ee31df --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/networks.go @@ -0,0 +1,119 @@ +// 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" +) + +// Networks networks +// +// swagger:model Networks +type Networks struct { + + // Network References + // Required: true + Networks []*NetworkReference `json:"networks"` +} + +// Validate validates this networks +func (m *Networks) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateNetworks(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Networks) validateNetworks(formats strfmt.Registry) error { + + if err := validate.Required("networks", "body", m.Networks); err != nil { + return err + } + + for i := 0; i < len(m.Networks); i++ { + if swag.IsZero(m.Networks[i]) { // not required + continue + } + + if m.Networks[i] != nil { + if err := m.Networks[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this networks based on the context it is used +func (m *Networks) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Networks) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Networks) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Networks) UnmarshalBinary(b []byte) error { + var res Networks + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/object.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/object.go new file mode 100644 index 00000000000..cf28d25ee33 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/object.go @@ -0,0 +1,11 @@ +// 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 + +// Object object +// +// swagger:model Object +type Object interface{} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/open_stack.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/open_stack.go new file mode 100644 index 00000000000..6654773e098 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/open_stack.go @@ -0,0 +1,139 @@ +// 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" +) + +// OpenStack open stack +// +// swagger:model OpenStack +type OpenStack struct { + + // Unique identifier for the OpenStack instance + // Required: true + ID *string `json:"id"` + + // Internal IP address of the OpenStack instance + // Required: true + IPAddress *string `json:"ipAddress"` + + // Shortname of the OpenStack instance + // Required: true + Name *string `json:"name"` + + // Next available VLAN ID to be used for a network creation + // Required: true + NextVLANID *float64 `json:"nextVLANID"` + + // The region where the open stack lives + // Required: true + Region *string `json:"region"` +} + +// Validate validates this open stack +func (m *OpenStack) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIPAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNextVLANID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OpenStack) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *OpenStack) validateIPAddress(formats strfmt.Registry) error { + + if err := validate.Required("ipAddress", "body", m.IPAddress); err != nil { + return err + } + + return nil +} + +func (m *OpenStack) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *OpenStack) validateNextVLANID(formats strfmt.Registry) error { + + if err := validate.Required("nextVLANID", "body", m.NextVLANID); err != nil { + return err + } + + return nil +} + +func (m *OpenStack) validateRegion(formats strfmt.Registry) error { + + if err := validate.Required("region", "body", m.Region); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this open stack based on context it is used +func (m *OpenStack) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *OpenStack) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *OpenStack) UnmarshalBinary(b []byte) error { + var res OpenStack + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/open_stack_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/open_stack_create.go new file mode 100644 index 00000000000..9c63f292e68 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/open_stack_create.go @@ -0,0 +1,105 @@ +// 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" +) + +// OpenStackCreate open stack create +// +// swagger:model OpenStackCreate +type OpenStackCreate struct { + + // Internal IP address of the OpenStack instance + // Required: true + IPAddress *string `json:"ipAddress"` + + // Shortname of the OpenStack instance + // Required: true + Name *string `json:"name"` + + // The region where the open stack lives + // Required: true + Region *string `json:"region"` +} + +// Validate validates this open stack create +func (m *OpenStackCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIPAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OpenStackCreate) validateIPAddress(formats strfmt.Registry) error { + + if err := validate.Required("ipAddress", "body", m.IPAddress); err != nil { + return err + } + + return nil +} + +func (m *OpenStackCreate) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *OpenStackCreate) validateRegion(formats strfmt.Registry) error { + + if err := validate.Required("region", "body", m.Region); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this open stack create based on context it is used +func (m *OpenStackCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *OpenStackCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *OpenStackCreate) UnmarshalBinary(b []byte) error { + var res OpenStackCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/open_stack_info.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/open_stack_info.go new file mode 100644 index 00000000000..b98ee9762c7 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/open_stack_info.go @@ -0,0 +1,136 @@ +// 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" +) + +// OpenStackInfo open stack info +// +// swagger:model OpenStackInfo +type OpenStackInfo struct { + + // Hosts on OpenStack + // Required: true + Hosts []*HostInfo `json:"hosts"` + + // Requested region + // Required: true + Region *string `json:"region"` +} + +// Validate validates this open stack info +func (m *OpenStackInfo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHosts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OpenStackInfo) validateHosts(formats strfmt.Registry) error { + + if err := validate.Required("hosts", "body", m.Hosts); err != nil { + return err + } + + for i := 0; i < len(m.Hosts); i++ { + if swag.IsZero(m.Hosts[i]) { // not required + continue + } + + if m.Hosts[i] != nil { + if err := m.Hosts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hosts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hosts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *OpenStackInfo) validateRegion(formats strfmt.Registry) error { + + if err := validate.Required("region", "body", m.Region); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this open stack info based on the context it is used +func (m *OpenStackInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHosts(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OpenStackInfo) contextValidateHosts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Hosts); i++ { + + if m.Hosts[i] != nil { + if err := m.Hosts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("hosts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("hosts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *OpenStackInfo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *OpenStackInfo) UnmarshalBinary(b []byte) error { + var res OpenStackInfo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/open_stacks.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/open_stacks.go new file mode 100644 index 00000000000..3b4c526548c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/open_stacks.go @@ -0,0 +1,119 @@ +// 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" +) + +// OpenStacks open stacks +// +// swagger:model OpenStacks +type OpenStacks struct { + + // OpenStacks managed by Power IAAS + // Required: true + OpenStacks []*OpenStack `json:"openStacks"` +} + +// Validate validates this open stacks +func (m *OpenStacks) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOpenStacks(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OpenStacks) validateOpenStacks(formats strfmt.Registry) error { + + if err := validate.Required("openStacks", "body", m.OpenStacks); err != nil { + return err + } + + for i := 0; i < len(m.OpenStacks); i++ { + if swag.IsZero(m.OpenStacks[i]) { // not required + continue + } + + if m.OpenStacks[i] != nil { + if err := m.OpenStacks[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("openStacks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("openStacks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this open stacks based on the context it is used +func (m *OpenStacks) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOpenStacks(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OpenStacks) contextValidateOpenStacks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.OpenStacks); i++ { + + if m.OpenStacks[i] != nil { + if err := m.OpenStacks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("openStacks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("openStacks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *OpenStacks) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *OpenStacks) UnmarshalBinary(b []byte) error { + var res OpenStacks + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/operation.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/operation.go new file mode 100644 index 00000000000..3423d9e7b09 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/operation.go @@ -0,0 +1,105 @@ +// 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" +) + +// Operation operation +// +// swagger:model Operation +type Operation struct { + + // current action of the operation + // Required: true + Action *string `json:"action"` + + // ID of an operation + // Required: true + ID *string `json:"id"` + + // target resource of the operation + // Required: true + Target *string `json:"target"` +} + +// Validate validates this operation +func (m *Operation) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAction(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTarget(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Operation) validateAction(formats strfmt.Registry) error { + + if err := validate.Required("action", "body", m.Action); err != nil { + return err + } + + return nil +} + +func (m *Operation) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *Operation) validateTarget(formats strfmt.Registry) error { + + if err := validate.Required("target", "body", m.Target); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this operation based on context it is used +func (m *Operation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Operation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Operation) UnmarshalBinary(b []byte) error { + var res Operation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/operations.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/operations.go new file mode 100644 index 00000000000..4c2d8b0808b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/operations.go @@ -0,0 +1,229 @@ +// 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" +) + +// Operations operations +// +// swagger:model Operations +type Operations struct { + + // Name of the server boot mode a(Boot from disk using copy A), b(Boot from disk using copy B), c(Reserved for IBM lab use only), d(Boot from media/drives) + // Enum: [a b c d] + BootMode string `json:"bootMode,omitempty"` + + // Name of the server operating mode + // Enum: [normal manual] + OperatingMode string `json:"operatingMode,omitempty"` + + // Name of the job task to execute + // Enum: [dston retrydump consoleservice iopreset remotedstoff remotedston iopdump dumprestart] + Task string `json:"task,omitempty"` +} + +// Validate validates this operations +func (m *Operations) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBootMode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOperatingMode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTask(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var operationsTypeBootModePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["a","b","c","d"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + operationsTypeBootModePropEnum = append(operationsTypeBootModePropEnum, v) + } +} + +const ( + + // OperationsBootModeA captures enum value "a" + OperationsBootModeA string = "a" + + // OperationsBootModeB captures enum value "b" + OperationsBootModeB string = "b" + + // OperationsBootModeC captures enum value "c" + OperationsBootModeC string = "c" + + // OperationsBootModeD captures enum value "d" + OperationsBootModeD string = "d" +) + +// prop value enum +func (m *Operations) validateBootModeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, operationsTypeBootModePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *Operations) validateBootMode(formats strfmt.Registry) error { + if swag.IsZero(m.BootMode) { // not required + return nil + } + + // value enum + if err := m.validateBootModeEnum("bootMode", "body", m.BootMode); err != nil { + return err + } + + return nil +} + +var operationsTypeOperatingModePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["normal","manual"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + operationsTypeOperatingModePropEnum = append(operationsTypeOperatingModePropEnum, v) + } +} + +const ( + + // OperationsOperatingModeNormal captures enum value "normal" + OperationsOperatingModeNormal string = "normal" + + // OperationsOperatingModeManual captures enum value "manual" + OperationsOperatingModeManual string = "manual" +) + +// prop value enum +func (m *Operations) validateOperatingModeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, operationsTypeOperatingModePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *Operations) validateOperatingMode(formats strfmt.Registry) error { + if swag.IsZero(m.OperatingMode) { // not required + return nil + } + + // value enum + if err := m.validateOperatingModeEnum("operatingMode", "body", m.OperatingMode); err != nil { + return err + } + + return nil +} + +var operationsTypeTaskPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["dston","retrydump","consoleservice","iopreset","remotedstoff","remotedston","iopdump","dumprestart"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + operationsTypeTaskPropEnum = append(operationsTypeTaskPropEnum, v) + } +} + +const ( + + // OperationsTaskDston captures enum value "dston" + OperationsTaskDston string = "dston" + + // OperationsTaskRetrydump captures enum value "retrydump" + OperationsTaskRetrydump string = "retrydump" + + // OperationsTaskConsoleservice captures enum value "consoleservice" + OperationsTaskConsoleservice string = "consoleservice" + + // OperationsTaskIopreset captures enum value "iopreset" + OperationsTaskIopreset string = "iopreset" + + // OperationsTaskRemotedstoff captures enum value "remotedstoff" + OperationsTaskRemotedstoff string = "remotedstoff" + + // OperationsTaskRemotedston captures enum value "remotedston" + OperationsTaskRemotedston string = "remotedston" + + // OperationsTaskIopdump captures enum value "iopdump" + OperationsTaskIopdump string = "iopdump" + + // OperationsTaskDumprestart captures enum value "dumprestart" + OperationsTaskDumprestart string = "dumprestart" +) + +// prop value enum +func (m *Operations) validateTaskEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, operationsTypeTaskPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *Operations) validateTask(formats strfmt.Registry) error { + if swag.IsZero(m.Task) { // not required + return nil + } + + // value enum + if err := m.validateTaskEnum("task", "body", m.Task); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this operations based on context it is used +func (m *Operations) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Operations) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Operations) UnmarshalBinary(b []byte) error { + var res Operations + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/options.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/options.go new file mode 100644 index 00000000000..f0738536b33 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/options.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" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// Options options +// +// swagger:model Options +type Options struct { + + // vpnaas options + // Required: true + VpnaasOptions *VPNaaSOptions `json:"vpnaasOptions"` +} + +// Validate validates this options +func (m *Options) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVpnaasOptions(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Options) validateVpnaasOptions(formats strfmt.Registry) error { + + if err := validate.Required("vpnaasOptions", "body", m.VpnaasOptions); err != nil { + return err + } + + if m.VpnaasOptions != nil { + if err := m.VpnaasOptions.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpnaasOptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpnaasOptions") + } + return err + } + } + + return nil +} + +// ContextValidate validate this options based on the context it is used +func (m *Options) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVpnaasOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Options) contextValidateVpnaasOptions(ctx context.Context, formats strfmt.Registry) error { + + if m.VpnaasOptions != nil { + if err := m.VpnaasOptions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpnaasOptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpnaasOptions") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Options) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Options) UnmarshalBinary(b []byte) error { + var res Options + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/owner_info.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/owner_info.go new file mode 100644 index 00000000000..3ed158c49e4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/owner_info.go @@ -0,0 +1,241 @@ +// 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" +) + +// OwnerInfo owner info +// +// swagger:model OwnerInfo +type OwnerInfo struct { + + // Country code of user + // Required: true + CountryCode *string `json:"countryCode"` + + // Currency code of user + // Required: true + CurrencyCode *string `json:"currencyCode"` + + // Email address of user + // Required: true + Email *string `json:"email"` + + // IAM id of user + // Required: true + IamID *string `json:"iamID"` + + // Indicates if user is an IBMer + // Required: true + IsIBMer *bool `json:"isIBMer"` + + // Name of user + // Required: true + Name *string `json:"name"` + + // (deprecated - replaced by softlayerSubscriptions) Array of Soft Layer IDs + SoftlayerIDs []string `json:"softlayerIDs"` + + // Array of softlayer subscriptions + // Required: true + SoftlayerSubscriptions []*SoftlayerSubscription `json:"softlayerSubscriptions"` + + // User id of user + // Required: true + UserID *string `json:"userID"` +} + +// Validate validates this owner info +func (m *OwnerInfo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCountryCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCurrencyCode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEmail(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIamID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIsIBMer(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSoftlayerSubscriptions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUserID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OwnerInfo) validateCountryCode(formats strfmt.Registry) error { + + if err := validate.Required("countryCode", "body", m.CountryCode); err != nil { + return err + } + + return nil +} + +func (m *OwnerInfo) validateCurrencyCode(formats strfmt.Registry) error { + + if err := validate.Required("currencyCode", "body", m.CurrencyCode); err != nil { + return err + } + + return nil +} + +func (m *OwnerInfo) validateEmail(formats strfmt.Registry) error { + + if err := validate.Required("email", "body", m.Email); err != nil { + return err + } + + return nil +} + +func (m *OwnerInfo) validateIamID(formats strfmt.Registry) error { + + if err := validate.Required("iamID", "body", m.IamID); err != nil { + return err + } + + return nil +} + +func (m *OwnerInfo) validateIsIBMer(formats strfmt.Registry) error { + + if err := validate.Required("isIBMer", "body", m.IsIBMer); err != nil { + return err + } + + return nil +} + +func (m *OwnerInfo) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *OwnerInfo) validateSoftlayerSubscriptions(formats strfmt.Registry) error { + + if err := validate.Required("softlayerSubscriptions", "body", m.SoftlayerSubscriptions); err != nil { + return err + } + + for i := 0; i < len(m.SoftlayerSubscriptions); i++ { + if swag.IsZero(m.SoftlayerSubscriptions[i]) { // not required + continue + } + + if m.SoftlayerSubscriptions[i] != nil { + if err := m.SoftlayerSubscriptions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softlayerSubscriptions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softlayerSubscriptions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *OwnerInfo) validateUserID(formats strfmt.Registry) error { + + if err := validate.Required("userID", "body", m.UserID); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this owner info based on the context it is used +func (m *OwnerInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSoftlayerSubscriptions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *OwnerInfo) contextValidateSoftlayerSubscriptions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.SoftlayerSubscriptions); i++ { + + if m.SoftlayerSubscriptions[i] != nil { + if err := m.SoftlayerSubscriptions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softlayerSubscriptions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softlayerSubscriptions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *OwnerInfo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *OwnerInfo) UnmarshalBinary(b []byte) error { + var res OwnerInfo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance.go new file mode 100644 index 00000000000..5e0a9f10e3f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance.go @@ -0,0 +1,843 @@ +// 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" +) + +// PVMInstance p VM instance +// +// swagger:model PVMInstance +type PVMInstance struct { + + // (deprecated - replaced by networks) The list of addresses and their network information + Addresses []*PVMInstanceNetwork `json:"addresses"` + + // Console language and code + ConsoleLanguage *ConsoleLanguage `json:"consoleLanguage,omitempty"` + + // Date/Time of PVM creation + // Format: date-time + CreationDate strfmt.DateTime `json:"creationDate,omitempty"` + + // Size of allocated disk (in GB) + // Required: true + DiskSize *float64 `json:"diskSize"` + + // fault + Fault *PVMInstanceFault `json:"fault,omitempty"` + + // health + Health *PVMInstanceHealth `json:"health,omitempty"` + + // The PVM Instance Host ID (Internal Use Only) + HostID int64 `json:"hostID,omitempty"` + + // The ImageID used by the server + // Required: true + ImageID *string `json:"imageID"` + + // The VTL license repository capacity TB value + LicenseRepositoryCapacity int64 `json:"licenseRepositoryCapacity,omitempty"` + + // Maximum amount of memory that can be allocated (in GB, for resize) + Maxmem float64 `json:"maxmem,omitempty"` + + // Maximum number of processors that can be allocated (for resize) + Maxproc float64 `json:"maxproc,omitempty"` + + // Amount of memory allocated (in GB) + // Required: true + Memory *float64 `json:"memory"` + + // whether the instance can be migrated + Migratable *bool `json:"migratable,omitempty"` + + // Minimum amount of memory that can be allocated (in GB, for resize) + Minmem float64 `json:"minmem,omitempty"` + + // Minimum number of processors that can be allocated (for resize) + Minproc float64 `json:"minproc,omitempty"` + + // (deprecated - replaced by networks) List of Network IDs + // Required: true + NetworkIDs []string `json:"networkIDs"` + + // The pvm instance networks information + Networks []*PVMInstanceNetwork `json:"networks"` + + // OS system information (usually version and build) + OperatingSystem string `json:"operatingSystem,omitempty"` + + // Type of the OS [aix, ibmi, rhel, sles, vtl, rhcos] + // Required: true + OsType *string `json:"osType"` + + // VM pinning policy to use [none, soft, hard] + PinPolicy string `json:"pinPolicy,omitempty"` + + // The placement group of the server + PlacementGroup *string `json:"placementGroup,omitempty"` + + // Processor type (dedicated, shared, capped) + // Required: true + // Enum: [dedicated shared capped ] + ProcType *string `json:"procType"` + + // Number of processors allocated + // Required: true + Processors *float64 `json:"processors"` + + // The progress of an operation + Progress float64 `json:"progress,omitempty"` + + // PCloud PVM Instance ID + // Required: true + PvmInstanceID *string `json:"pvmInstanceID"` + + // If this is an SAP pvm-instance the profile reference will link to the SAP profile + SapProfile *SAPProfileReference `json:"sapProfile,omitempty"` + + // Name of the server + // Required: true + ServerName *string `json:"serverName"` + + // The pvm instance Software Licenses + SoftwareLicenses *SoftwareLicenses `json:"softwareLicenses,omitempty"` + + // The pvm instance SRC lists + Srcs [][]*SRC `json:"srcs"` + + // The status of the instance + // Required: true + Status *string `json:"status"` + + // Storage Pool where server is deployed + StoragePool string `json:"storagePool,omitempty"` + + // Indicates if all volumes attached to the server must reside in the same storage pool; Defaults to true when initially deploying a PVMInstance + StoragePoolAffinity *bool `json:"storagePoolAffinity,omitempty"` + + // Storage type where server is deployed + // Required: true + StorageType *string `json:"storageType"` + + // System type used to host the instance + SysType string `json:"sysType,omitempty"` + + // Date/Time of PVM last update + // Format: date-time + UpdatedDate strfmt.DateTime `json:"updatedDate,omitempty"` + + // The pvm instance virtual CPU information + VirtualCores *VirtualCores `json:"virtualCores,omitempty"` + + // List of volume IDs + // Required: true + VolumeIDs []string `json:"volumeIDs"` +} + +// Validate validates this p VM instance +func (m *PVMInstance) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAddresses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateConsoleLanguage(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCreationDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDiskSize(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFault(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHealth(formats); err != nil { + res = append(res, err) + } + + if err := m.validateImageID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemory(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetworkIDs(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetworks(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOsType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProcType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProcessors(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePvmInstanceID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSapProfile(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServerName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSoftwareLicenses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSrcs(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStorageType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVirtualCores(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVolumeIDs(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstance) validateAddresses(formats strfmt.Registry) error { + if swag.IsZero(m.Addresses) { // not required + return nil + } + + for i := 0; i < len(m.Addresses); i++ { + if swag.IsZero(m.Addresses[i]) { // not required + continue + } + + if m.Addresses[i] != nil { + if err := m.Addresses[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("addresses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("addresses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstance) validateConsoleLanguage(formats strfmt.Registry) error { + if swag.IsZero(m.ConsoleLanguage) { // not required + return nil + } + + if m.ConsoleLanguage != nil { + if err := m.ConsoleLanguage.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("consoleLanguage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("consoleLanguage") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) validateCreationDate(formats strfmt.Registry) error { + if swag.IsZero(m.CreationDate) { // not required + return nil + } + + if err := validate.FormatOf("creationDate", "body", "date-time", m.CreationDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *PVMInstance) validateDiskSize(formats strfmt.Registry) error { + + if err := validate.Required("diskSize", "body", m.DiskSize); err != nil { + return err + } + + return nil +} + +func (m *PVMInstance) validateFault(formats strfmt.Registry) error { + if swag.IsZero(m.Fault) { // not required + return nil + } + + if m.Fault != nil { + if err := m.Fault.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fault") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fault") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) validateHealth(formats strfmt.Registry) error { + if swag.IsZero(m.Health) { // not required + return nil + } + + if m.Health != nil { + if err := m.Health.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("health") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("health") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) validateImageID(formats strfmt.Registry) error { + + if err := validate.Required("imageID", "body", m.ImageID); err != nil { + return err + } + + return nil +} + +func (m *PVMInstance) validateMemory(formats strfmt.Registry) error { + + if err := validate.Required("memory", "body", m.Memory); err != nil { + return err + } + + return nil +} + +func (m *PVMInstance) validateNetworkIDs(formats strfmt.Registry) error { + + if err := validate.Required("networkIDs", "body", m.NetworkIDs); err != nil { + return err + } + + return nil +} + +func (m *PVMInstance) validateNetworks(formats strfmt.Registry) error { + if swag.IsZero(m.Networks) { // not required + return nil + } + + for i := 0; i < len(m.Networks); i++ { + if swag.IsZero(m.Networks[i]) { // not required + continue + } + + if m.Networks[i] != nil { + if err := m.Networks[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstance) validateOsType(formats strfmt.Registry) error { + + if err := validate.Required("osType", "body", m.OsType); err != nil { + return err + } + + return nil +} + +var pVmInstanceTypeProcTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["dedicated","shared","capped",""]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pVmInstanceTypeProcTypePropEnum = append(pVmInstanceTypeProcTypePropEnum, v) + } +} + +const ( + + // PVMInstanceProcTypeDedicated captures enum value "dedicated" + PVMInstanceProcTypeDedicated string = "dedicated" + + // PVMInstanceProcTypeShared captures enum value "shared" + PVMInstanceProcTypeShared string = "shared" + + // PVMInstanceProcTypeCapped captures enum value "capped" + PVMInstanceProcTypeCapped string = "capped" + + // PVMInstanceProcTypeEmpty captures enum value "" + PVMInstanceProcTypeEmpty string = "" +) + +// prop value enum +func (m *PVMInstance) validateProcTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pVmInstanceTypeProcTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PVMInstance) validateProcType(formats strfmt.Registry) error { + + if err := validate.Required("procType", "body", m.ProcType); err != nil { + return err + } + + // value enum + if err := m.validateProcTypeEnum("procType", "body", *m.ProcType); err != nil { + return err + } + + return nil +} + +func (m *PVMInstance) validateProcessors(formats strfmt.Registry) error { + + if err := validate.Required("processors", "body", m.Processors); err != nil { + return err + } + + return nil +} + +func (m *PVMInstance) validatePvmInstanceID(formats strfmt.Registry) error { + + if err := validate.Required("pvmInstanceID", "body", m.PvmInstanceID); err != nil { + return err + } + + return nil +} + +func (m *PVMInstance) validateSapProfile(formats strfmt.Registry) error { + if swag.IsZero(m.SapProfile) { // not required + return nil + } + + if m.SapProfile != nil { + if err := m.SapProfile.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sapProfile") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sapProfile") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) validateServerName(formats strfmt.Registry) error { + + if err := validate.Required("serverName", "body", m.ServerName); err != nil { + return err + } + + return nil +} + +func (m *PVMInstance) validateSoftwareLicenses(formats strfmt.Registry) error { + if swag.IsZero(m.SoftwareLicenses) { // not required + return nil + } + + if m.SoftwareLicenses != nil { + if err := m.SoftwareLicenses.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) validateSrcs(formats strfmt.Registry) error { + if swag.IsZero(m.Srcs) { // not required + return nil + } + + for i := 0; i < len(m.Srcs); i++ { + + for ii := 0; ii < len(m.Srcs[i]); ii++ { + if swag.IsZero(m.Srcs[i][ii]) { // not required + continue + } + + if m.Srcs[i][ii] != nil { + if err := m.Srcs[i][ii].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) + } + return err + } + } + + } + + } + + return nil +} + +func (m *PVMInstance) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + return nil +} + +func (m *PVMInstance) validateStorageType(formats strfmt.Registry) error { + + if err := validate.Required("storageType", "body", m.StorageType); err != nil { + return err + } + + return nil +} + +func (m *PVMInstance) validateUpdatedDate(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedDate) { // not required + return nil + } + + if err := validate.FormatOf("updatedDate", "body", "date-time", m.UpdatedDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *PVMInstance) validateVirtualCores(formats strfmt.Registry) error { + if swag.IsZero(m.VirtualCores) { // not required + return nil + } + + if m.VirtualCores != nil { + if err := m.VirtualCores.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) validateVolumeIDs(formats strfmt.Registry) error { + + if err := validate.Required("volumeIDs", "body", m.VolumeIDs); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this p VM instance based on the context it is used +func (m *PVMInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddresses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateConsoleLanguage(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFault(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateHealth(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSapProfile(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSoftwareLicenses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSrcs(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVirtualCores(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstance) contextValidateAddresses(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Addresses); i++ { + + if m.Addresses[i] != nil { + if err := m.Addresses[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("addresses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("addresses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstance) contextValidateConsoleLanguage(ctx context.Context, formats strfmt.Registry) error { + + if m.ConsoleLanguage != nil { + if err := m.ConsoleLanguage.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("consoleLanguage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("consoleLanguage") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) contextValidateFault(ctx context.Context, formats strfmt.Registry) error { + + if m.Fault != nil { + if err := m.Fault.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fault") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fault") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) contextValidateHealth(ctx context.Context, formats strfmt.Registry) error { + + if m.Health != nil { + if err := m.Health.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("health") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("health") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstance) contextValidateSapProfile(ctx context.Context, formats strfmt.Registry) error { + + if m.SapProfile != nil { + if err := m.SapProfile.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sapProfile") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sapProfile") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) contextValidateSoftwareLicenses(ctx context.Context, formats strfmt.Registry) error { + + if m.SoftwareLicenses != nil { + if err := m.SoftwareLicenses.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") + } + return err + } + } + + return nil +} + +func (m *PVMInstance) contextValidateSrcs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Srcs); i++ { + + for ii := 0; ii < len(m.Srcs[i]); ii++ { + + if m.Srcs[i][ii] != nil { + if err := m.Srcs[i][ii].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) + } + return err + } + } + + } + + } + + return nil +} + +func (m *PVMInstance) contextValidateVirtualCores(ctx context.Context, formats strfmt.Registry) error { + + if m.VirtualCores != nil { + if err := m.VirtualCores.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstance) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstance) UnmarshalBinary(b []byte) error { + var res PVMInstance + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_action.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_action.go new file mode 100644 index 00000000000..3c927919d61 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_action.go @@ -0,0 +1,119 @@ +// 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" +) + +// PVMInstanceAction p VM instance action +// +// swagger:model PVMInstanceAction +type PVMInstanceAction struct { + + // Name of the action to take; can be start, stop, hard-reboot, soft-reboot, immediate-shutdown, reset-state + // Required: true + // Enum: [start stop immediate-shutdown hard-reboot soft-reboot reset-state] + Action *string `json:"action"` +} + +// Validate validates this p VM instance action +func (m *PVMInstanceAction) 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 pVmInstanceActionTypeActionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["start","stop","immediate-shutdown","hard-reboot","soft-reboot","reset-state"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pVmInstanceActionTypeActionPropEnum = append(pVmInstanceActionTypeActionPropEnum, v) + } +} + +const ( + + // PVMInstanceActionActionStart captures enum value "start" + PVMInstanceActionActionStart string = "start" + + // PVMInstanceActionActionStop captures enum value "stop" + PVMInstanceActionActionStop string = "stop" + + // PVMInstanceActionActionImmediateDashShutdown captures enum value "immediate-shutdown" + PVMInstanceActionActionImmediateDashShutdown string = "immediate-shutdown" + + // PVMInstanceActionActionHardDashReboot captures enum value "hard-reboot" + PVMInstanceActionActionHardDashReboot string = "hard-reboot" + + // PVMInstanceActionActionSoftDashReboot captures enum value "soft-reboot" + PVMInstanceActionActionSoftDashReboot string = "soft-reboot" + + // PVMInstanceActionActionResetDashState captures enum value "reset-state" + PVMInstanceActionActionResetDashState string = "reset-state" +) + +// prop value enum +func (m *PVMInstanceAction) validateActionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pVmInstanceActionTypeActionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PVMInstanceAction) 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 p VM instance action based on context it is used +func (m *PVMInstanceAction) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceAction) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceAction) UnmarshalBinary(b []byte) error { + var res PVMInstanceAction + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_add_network.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_add_network.go new file mode 100644 index 00000000000..d0c9f7569e3 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_add_network.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" +) + +// PVMInstanceAddNetwork p VM instance add network +// +// swagger:model PVMInstanceAddNetwork +type PVMInstanceAddNetwork struct { + + // The requested ip address of this network interface + IPAddress string `json:"ipAddress,omitempty"` + + // ID of the network + // Required: true + NetworkID *string `json:"networkID"` +} + +// Validate validates this p VM instance add network +func (m *PVMInstanceAddNetwork) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateNetworkID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceAddNetwork) validateNetworkID(formats strfmt.Registry) error { + + if err := validate.Required("networkID", "body", m.NetworkID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this p VM instance add network based on context it is used +func (m *PVMInstanceAddNetwork) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceAddNetwork) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceAddNetwork) UnmarshalBinary(b []byte) error { + var res PVMInstanceAddNetwork + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_address.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_address.go new file mode 100644 index 00000000000..2e7ad6b98d8 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_address.go @@ -0,0 +1,65 @@ +// 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" +) + +// PVMInstanceAddress deprecated - replaced by PVMInstanceNetwork +// +// swagger:model PVMInstanceAddress +type PVMInstanceAddress struct { + PVMInstanceNetwork +} + +// UnmarshalJSON unmarshals this object from a JSON structure +func (m *PVMInstanceAddress) UnmarshalJSON(raw []byte) error { + // AO0 + var aO0 PVMInstanceNetwork + if err := swag.ReadJSON(raw, &aO0); err != nil { + return err + } + m.PVMInstanceNetwork = aO0 + + return nil +} + +// MarshalJSON marshals this object to a JSON structure +func (m PVMInstanceAddress) MarshalJSON() ([]byte, error) { + _parts := make([][]byte, 0, 1) + + aO0, err := swag.WriteJSON(m.PVMInstanceNetwork) + if err != nil { + return nil, err + } + _parts = append(_parts, aO0) + return swag.ConcatJSON(_parts...), nil +} + +// Validate validates this p VM instance address +func (m *PVMInstanceAddress) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validate this p VM instance address based on the context it is used +func (m *PVMInstanceAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with PVMInstanceNetwork + if err := m.PVMInstanceNetwork.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_capture.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_capture.go new file mode 100644 index 00000000000..7f925c28c09 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_capture.go @@ -0,0 +1,142 @@ +// 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" +) + +// PVMInstanceCapture p VM instance capture +// +// swagger:model PVMInstanceCapture +type PVMInstanceCapture struct { + + // Destination for the deployable image + // Required: true + // Enum: [image-catalog cloud-storage both] + CaptureDestination *string `json:"captureDestination"` + + // Name of the deployable image created for the captured PVMInstance + // Required: true + CaptureName *string `json:"captureName"` + + // List of Data volume IDs to include in the captured PVMInstance + CaptureVolumeIDs []string `json:"captureVolumeIDs"` + + // Cloud Storage Access key + CloudStorageAccessKey string `json:"cloudStorageAccessKey,omitempty"` + + // Cloud Storage Image Path (bucket-name [/folder/../..]) + CloudStorageImagePath string `json:"cloudStorageImagePath,omitempty"` + + // Cloud Storage Region + CloudStorageRegion string `json:"cloudStorageRegion,omitempty"` + + // Cloud Storage Secret key + CloudStorageSecretKey string `json:"cloudStorageSecretKey,omitempty"` +} + +// Validate validates this p VM instance capture +func (m *PVMInstanceCapture) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCaptureDestination(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCaptureName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var pVmInstanceCaptureTypeCaptureDestinationPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["image-catalog","cloud-storage","both"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pVmInstanceCaptureTypeCaptureDestinationPropEnum = append(pVmInstanceCaptureTypeCaptureDestinationPropEnum, v) + } +} + +const ( + + // PVMInstanceCaptureCaptureDestinationImageDashCatalog captures enum value "image-catalog" + PVMInstanceCaptureCaptureDestinationImageDashCatalog string = "image-catalog" + + // PVMInstanceCaptureCaptureDestinationCloudDashStorage captures enum value "cloud-storage" + PVMInstanceCaptureCaptureDestinationCloudDashStorage string = "cloud-storage" + + // PVMInstanceCaptureCaptureDestinationBoth captures enum value "both" + PVMInstanceCaptureCaptureDestinationBoth string = "both" +) + +// prop value enum +func (m *PVMInstanceCapture) validateCaptureDestinationEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pVmInstanceCaptureTypeCaptureDestinationPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PVMInstanceCapture) validateCaptureDestination(formats strfmt.Registry) error { + + if err := validate.Required("captureDestination", "body", m.CaptureDestination); err != nil { + return err + } + + // value enum + if err := m.validateCaptureDestinationEnum("captureDestination", "body", *m.CaptureDestination); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceCapture) validateCaptureName(formats strfmt.Registry) error { + + if err := validate.Required("captureName", "body", m.CaptureName); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this p VM instance capture based on context it is used +func (m *PVMInstanceCapture) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceCapture) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceCapture) UnmarshalBinary(b []byte) error { + var res PVMInstanceCapture + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_clone.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_clone.go new file mode 100644 index 00000000000..c517f97070f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_clone.go @@ -0,0 +1,248 @@ +// 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" +) + +// PVMInstanceClone p VM instance clone +// +// swagger:model PVMInstanceClone +type PVMInstanceClone struct { + + // The name of the SSH key pair provided to the server for authenticating users (looked up in the tenant's list of keys) + KeyPairName string `json:"keyPairName,omitempty"` + + // Amount of memory allocated (in GB) + Memory *float64 `json:"memory,omitempty"` + + // Name of the server to create + // Required: true + Name *string `json:"name"` + + // The pvm instance networks information + // Required: true + Networks []*PVMInstanceAddNetwork `json:"networks"` + + // Processor type (dedicated, shared, capped) + // Enum: [dedicated shared capped] + ProcType *string `json:"procType,omitempty"` + + // Number of processors allocated + Processors *float64 `json:"processors,omitempty"` + + // The pvm instance Software Licenses + SoftwareLicenses *SoftwareLicenses `json:"softwareLicenses,omitempty"` + + // List of volume IDs + VolumeIDs []string `json:"volumeIDs"` +} + +// Validate validates this p VM instance clone +func (m *PVMInstanceClone) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetworks(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProcType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSoftwareLicenses(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceClone) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceClone) validateNetworks(formats strfmt.Registry) error { + + if err := validate.Required("networks", "body", m.Networks); err != nil { + return err + } + + for i := 0; i < len(m.Networks); i++ { + if swag.IsZero(m.Networks[i]) { // not required + continue + } + + if m.Networks[i] != nil { + if err := m.Networks[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +var pVmInstanceCloneTypeProcTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["dedicated","shared","capped"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pVmInstanceCloneTypeProcTypePropEnum = append(pVmInstanceCloneTypeProcTypePropEnum, v) + } +} + +const ( + + // PVMInstanceCloneProcTypeDedicated captures enum value "dedicated" + PVMInstanceCloneProcTypeDedicated string = "dedicated" + + // PVMInstanceCloneProcTypeShared captures enum value "shared" + PVMInstanceCloneProcTypeShared string = "shared" + + // PVMInstanceCloneProcTypeCapped captures enum value "capped" + PVMInstanceCloneProcTypeCapped string = "capped" +) + +// prop value enum +func (m *PVMInstanceClone) validateProcTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pVmInstanceCloneTypeProcTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PVMInstanceClone) validateProcType(formats strfmt.Registry) error { + if swag.IsZero(m.ProcType) { // not required + return nil + } + + // value enum + if err := m.validateProcTypeEnum("procType", "body", *m.ProcType); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceClone) validateSoftwareLicenses(formats strfmt.Registry) error { + if swag.IsZero(m.SoftwareLicenses) { // not required + return nil + } + + if m.SoftwareLicenses != nil { + if err := m.SoftwareLicenses.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") + } + return err + } + } + + return nil +} + +// ContextValidate validate this p VM instance clone based on the context it is used +func (m *PVMInstanceClone) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSoftwareLicenses(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceClone) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstanceClone) contextValidateSoftwareLicenses(ctx context.Context, formats strfmt.Registry) error { + + if m.SoftwareLicenses != nil { + if err := m.SoftwareLicenses.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceClone) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceClone) UnmarshalBinary(b []byte) error { + var res PVMInstanceClone + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_console.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_console.go new file mode 100644 index 00000000000..0ed92109ad4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_console.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" +) + +// PVMInstanceConsole p VM instance console +// +// swagger:model PVMInstanceConsole +type PVMInstanceConsole struct { + + // The URL to the noVNC console for the PVM Instance + // Required: true + ConsoleURL *string `json:"consoleURL"` +} + +// Validate validates this p VM instance console +func (m *PVMInstanceConsole) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateConsoleURL(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceConsole) validateConsoleURL(formats strfmt.Registry) error { + + if err := validate.Required("consoleURL", "body", m.ConsoleURL); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this p VM instance console based on context it is used +func (m *PVMInstanceConsole) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceConsole) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceConsole) UnmarshalBinary(b []byte) error { + var res PVMInstanceConsole + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_create.go new file mode 100644 index 00000000000..c5bcc1046d6 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_create.go @@ -0,0 +1,604 @@ +// 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" +) + +// PVMInstanceCreate p VM instance create +// +// swagger:model PVMInstanceCreate +type PVMInstanceCreate struct { + + // Image ID of the image to use for the server + // Required: true + ImageID *string `json:"imageID"` + + // The name of the SSH key pair provided to the server for authenticating users (looked up in the tenant's list of keys) + KeyPairName string `json:"keyPairName,omitempty"` + + // The VTL license repository capacity TB value + LicenseRepositoryCapacity int64 `json:"licenseRepositoryCapacity,omitempty"` + + // Amount of memory allocated (in GB) + // Required: true + Memory *float64 `json:"memory"` + + // Indicates if the server is allowed to migrate between hosts + Migratable *bool `json:"migratable,omitempty"` + + // (deprecated - replaced by networks) List of Network IDs + NetworkIDs []string `json:"networkIDs"` + + // The pvm instance networks information + Networks []*PVMInstanceAddNetwork `json:"networks"` + + // pin policy + PinPolicy PinPolicy `json:"pinPolicy,omitempty"` + + // The placement group for the server + PlacementGroup string `json:"placementGroup,omitempty"` + + // Processor type (dedicated, shared, capped) + // Required: true + // Enum: [dedicated shared capped] + ProcType *string `json:"procType"` + + // Number of processors allocated + // Required: true + Processors *float64 `json:"processors"` + + // Affinity policy for replicants being created; affinity for the same host, anti-affinity for different hosts, none for no preference + // Enum: [affinity anti-affinity none] + ReplicantAffinityPolicy *string `json:"replicantAffinityPolicy,omitempty"` + + // How to name the created vms + // Enum: [prefix suffix] + ReplicantNamingScheme *string `json:"replicantNamingScheme,omitempty"` + + // Number of duplicate instances to create in this request + Replicants float64 `json:"replicants,omitempty"` + + // Name of the server to create + // Required: true + ServerName *string `json:"serverName"` + + // The pvm instance Software Licenses + SoftwareLicenses *SoftwareLicenses `json:"softwareLicenses,omitempty"` + + // The storage affinity data; ignored if storagePool is provided; Only valid when you deploy one of the IBM supplied stock images. Storage type and pool for a custom image (an imported image or an image that is created from a PVMInstance capture) defaults to the storage type and pool the image was created in + StorageAffinity *StorageAffinity `json:"storageAffinity,omitempty"` + + // The storage connection type + // Enum: [vSCSI] + StorageConnection string `json:"storageConnection,omitempty"` + + // Storage Pool for server deployment; if provided then storageAffinity and storageType will be ignored; Only valid when you deploy one of the IBM supplied stock images. Storage type and pool for a custom image (an imported image or an image that is created from a PVMInstance capture) defaults to the storage type and pool the image was created in + StoragePool string `json:"storagePool,omitempty"` + + // Storage type for server deployment; will be ignored if storagePool or storageAffinity is provided; Only valid when you deploy one of the IBM supplied stock images. Storage type and pool for a custom image (an imported image or an image that is created from a PVMInstance capture) defaults to the storage type and pool the image was created in + StorageType string `json:"storageType,omitempty"` + + // System type used to host the instance + SysType string `json:"sysType,omitempty"` + + // Cloud init user defined data + UserData string `json:"userData,omitempty"` + + // The pvm instance virtual CPU information + VirtualCores *VirtualCores `json:"virtualCores,omitempty"` + + // List of volume IDs + VolumeIDs []string `json:"volumeIDs"` +} + +// Validate validates this p VM instance create +func (m *PVMInstanceCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateImageID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemory(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetworks(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePinPolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProcType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProcessors(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReplicantAffinityPolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReplicantNamingScheme(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServerName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSoftwareLicenses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStorageAffinity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStorageConnection(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVirtualCores(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceCreate) validateImageID(formats strfmt.Registry) error { + + if err := validate.Required("imageID", "body", m.ImageID); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceCreate) validateMemory(formats strfmt.Registry) error { + + if err := validate.Required("memory", "body", m.Memory); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceCreate) validateNetworks(formats strfmt.Registry) error { + if swag.IsZero(m.Networks) { // not required + return nil + } + + for i := 0; i < len(m.Networks); i++ { + if swag.IsZero(m.Networks[i]) { // not required + continue + } + + if m.Networks[i] != nil { + if err := m.Networks[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstanceCreate) validatePinPolicy(formats strfmt.Registry) error { + if swag.IsZero(m.PinPolicy) { // not required + return nil + } + + if err := m.PinPolicy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") + } + return err + } + + return nil +} + +var pVmInstanceCreateTypeProcTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["dedicated","shared","capped"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pVmInstanceCreateTypeProcTypePropEnum = append(pVmInstanceCreateTypeProcTypePropEnum, v) + } +} + +const ( + + // PVMInstanceCreateProcTypeDedicated captures enum value "dedicated" + PVMInstanceCreateProcTypeDedicated string = "dedicated" + + // PVMInstanceCreateProcTypeShared captures enum value "shared" + PVMInstanceCreateProcTypeShared string = "shared" + + // PVMInstanceCreateProcTypeCapped captures enum value "capped" + PVMInstanceCreateProcTypeCapped string = "capped" +) + +// prop value enum +func (m *PVMInstanceCreate) validateProcTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pVmInstanceCreateTypeProcTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PVMInstanceCreate) validateProcType(formats strfmt.Registry) error { + + if err := validate.Required("procType", "body", m.ProcType); err != nil { + return err + } + + // value enum + if err := m.validateProcTypeEnum("procType", "body", *m.ProcType); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceCreate) validateProcessors(formats strfmt.Registry) error { + + if err := validate.Required("processors", "body", m.Processors); err != nil { + return err + } + + return nil +} + +var pVmInstanceCreateTypeReplicantAffinityPolicyPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["affinity","anti-affinity","none"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pVmInstanceCreateTypeReplicantAffinityPolicyPropEnum = append(pVmInstanceCreateTypeReplicantAffinityPolicyPropEnum, v) + } +} + +const ( + + // PVMInstanceCreateReplicantAffinityPolicyAffinity captures enum value "affinity" + PVMInstanceCreateReplicantAffinityPolicyAffinity string = "affinity" + + // PVMInstanceCreateReplicantAffinityPolicyAntiDashAffinity captures enum value "anti-affinity" + PVMInstanceCreateReplicantAffinityPolicyAntiDashAffinity string = "anti-affinity" + + // PVMInstanceCreateReplicantAffinityPolicyNone captures enum value "none" + PVMInstanceCreateReplicantAffinityPolicyNone string = "none" +) + +// prop value enum +func (m *PVMInstanceCreate) validateReplicantAffinityPolicyEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pVmInstanceCreateTypeReplicantAffinityPolicyPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PVMInstanceCreate) validateReplicantAffinityPolicy(formats strfmt.Registry) error { + if swag.IsZero(m.ReplicantAffinityPolicy) { // not required + return nil + } + + // value enum + if err := m.validateReplicantAffinityPolicyEnum("replicantAffinityPolicy", "body", *m.ReplicantAffinityPolicy); err != nil { + return err + } + + return nil +} + +var pVmInstanceCreateTypeReplicantNamingSchemePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["prefix","suffix"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pVmInstanceCreateTypeReplicantNamingSchemePropEnum = append(pVmInstanceCreateTypeReplicantNamingSchemePropEnum, v) + } +} + +const ( + + // PVMInstanceCreateReplicantNamingSchemePrefix captures enum value "prefix" + PVMInstanceCreateReplicantNamingSchemePrefix string = "prefix" + + // PVMInstanceCreateReplicantNamingSchemeSuffix captures enum value "suffix" + PVMInstanceCreateReplicantNamingSchemeSuffix string = "suffix" +) + +// prop value enum +func (m *PVMInstanceCreate) validateReplicantNamingSchemeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pVmInstanceCreateTypeReplicantNamingSchemePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PVMInstanceCreate) validateReplicantNamingScheme(formats strfmt.Registry) error { + if swag.IsZero(m.ReplicantNamingScheme) { // not required + return nil + } + + // value enum + if err := m.validateReplicantNamingSchemeEnum("replicantNamingScheme", "body", *m.ReplicantNamingScheme); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceCreate) validateServerName(formats strfmt.Registry) error { + + if err := validate.Required("serverName", "body", m.ServerName); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceCreate) validateSoftwareLicenses(formats strfmt.Registry) error { + if swag.IsZero(m.SoftwareLicenses) { // not required + return nil + } + + if m.SoftwareLicenses != nil { + if err := m.SoftwareLicenses.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceCreate) validateStorageAffinity(formats strfmt.Registry) error { + if swag.IsZero(m.StorageAffinity) { // not required + return nil + } + + if m.StorageAffinity != nil { + if err := m.StorageAffinity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") + } + return err + } + } + + return nil +} + +var pVmInstanceCreateTypeStorageConnectionPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["vSCSI"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pVmInstanceCreateTypeStorageConnectionPropEnum = append(pVmInstanceCreateTypeStorageConnectionPropEnum, v) + } +} + +const ( + + // PVMInstanceCreateStorageConnectionVSCSI captures enum value "vSCSI" + PVMInstanceCreateStorageConnectionVSCSI string = "vSCSI" +) + +// prop value enum +func (m *PVMInstanceCreate) validateStorageConnectionEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pVmInstanceCreateTypeStorageConnectionPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PVMInstanceCreate) validateStorageConnection(formats strfmt.Registry) error { + if swag.IsZero(m.StorageConnection) { // not required + return nil + } + + // value enum + if err := m.validateStorageConnectionEnum("storageConnection", "body", m.StorageConnection); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceCreate) validateVirtualCores(formats strfmt.Registry) error { + if swag.IsZero(m.VirtualCores) { // not required + return nil + } + + if m.VirtualCores != nil { + if err := m.VirtualCores.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") + } + return err + } + } + + return nil +} + +// ContextValidate validate this p VM instance create based on the context it is used +func (m *PVMInstanceCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePinPolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSoftwareLicenses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStorageAffinity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVirtualCores(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceCreate) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstanceCreate) contextValidatePinPolicy(ctx context.Context, formats strfmt.Registry) error { + + if err := m.PinPolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") + } + return err + } + + return nil +} + +func (m *PVMInstanceCreate) contextValidateSoftwareLicenses(ctx context.Context, formats strfmt.Registry) error { + + if m.SoftwareLicenses != nil { + if err := m.SoftwareLicenses.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceCreate) contextValidateStorageAffinity(ctx context.Context, formats strfmt.Registry) error { + + if m.StorageAffinity != nil { + if err := m.StorageAffinity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceCreate) contextValidateVirtualCores(ctx context.Context, formats strfmt.Registry) error { + + if m.VirtualCores != nil { + if err := m.VirtualCores.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceCreate) UnmarshalBinary(b []byte) error { + var res PVMInstanceCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_fault.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_fault.go new file mode 100644 index 00000000000..bc5133e8aad --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_fault.go @@ -0,0 +1,83 @@ +// 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" +) + +// PVMInstanceFault Fault information (if occurred) +// +// swagger:model PVMInstanceFault +type PVMInstanceFault struct { + + // The fault status of the server, if any + Code float64 `json:"code,omitempty"` + + // The date and time the fault occurred + // Format: date-time + Created strfmt.DateTime `json:"created,omitempty"` + + // The fault details of the server, if any + Details string `json:"details,omitempty"` + + // The fault message of the server, if any + Message string `json:"message,omitempty"` +} + +// Validate validates this p VM instance fault +func (m *PVMInstanceFault) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreated(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceFault) validateCreated(formats strfmt.Registry) error { + if swag.IsZero(m.Created) { // not required + return nil + } + + if err := validate.FormatOf("created", "body", "date-time", m.Created.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this p VM instance fault based on context it is used +func (m *PVMInstanceFault) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceFault) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceFault) UnmarshalBinary(b []byte) error { + var res PVMInstanceFault + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_health.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_health.go new file mode 100644 index 00000000000..11c21c9ab44 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_health.go @@ -0,0 +1,56 @@ +// 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" +) + +// PVMInstanceHealth PVM's health status details +// +// swagger:model PVMInstanceHealth +type PVMInstanceHealth struct { + + // Date/Time of PVM last health status change + LastUpdate string `json:"lastUpdate,omitempty"` + + // The health status reason, if any + Reason string `json:"reason,omitempty"` + + // The PVM's health status value + Status string `json:"status,omitempty"` +} + +// Validate validates this p VM instance health +func (m *PVMInstanceHealth) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this p VM instance health based on context it is used +func (m *PVMInstanceHealth) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceHealth) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceHealth) UnmarshalBinary(b []byte) error { + var res PVMInstanceHealth + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_list.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_list.go new file mode 100644 index 00000000000..2345d10dd6c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_list.go @@ -0,0 +1,73 @@ +// 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" +) + +// PVMInstanceList A list of PVMInstances +// +// swagger:model PVMInstanceList +type PVMInstanceList []*PVMInstance + +// Validate validates this p VM instance list +func (m PVMInstanceList) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this p VM instance list based on the context it is used +func (m PVMInstanceList) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_multi_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_multi_create.go new file mode 100644 index 00000000000..682af222cdc --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_multi_create.go @@ -0,0 +1,161 @@ +// 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" +) + +// PVMInstanceMultiCreate p VM instance multi create +// +// swagger:model PVMInstanceMultiCreate +type PVMInstanceMultiCreate struct { + + // Affinity policy for pvm-instances being created; affinity for the same host, anti-affinity for different hosts, none for no preference + // Enum: [affinity anti-affinity none] + AffinityPolicy *string `json:"affinityPolicy,omitempty"` + + // Number of pvm-instances to create + Count int64 `json:"count,omitempty"` + + // Where to place the numerical number of the multi-created instance + // Enum: [prefix suffix] + Numerical *string `json:"numerical,omitempty"` +} + +// Validate validates this p VM instance multi create +func (m *PVMInstanceMultiCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAffinityPolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNumerical(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var pVmInstanceMultiCreateTypeAffinityPolicyPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["affinity","anti-affinity","none"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pVmInstanceMultiCreateTypeAffinityPolicyPropEnum = append(pVmInstanceMultiCreateTypeAffinityPolicyPropEnum, v) + } +} + +const ( + + // PVMInstanceMultiCreateAffinityPolicyAffinity captures enum value "affinity" + PVMInstanceMultiCreateAffinityPolicyAffinity string = "affinity" + + // PVMInstanceMultiCreateAffinityPolicyAntiDashAffinity captures enum value "anti-affinity" + PVMInstanceMultiCreateAffinityPolicyAntiDashAffinity string = "anti-affinity" + + // PVMInstanceMultiCreateAffinityPolicyNone captures enum value "none" + PVMInstanceMultiCreateAffinityPolicyNone string = "none" +) + +// prop value enum +func (m *PVMInstanceMultiCreate) validateAffinityPolicyEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pVmInstanceMultiCreateTypeAffinityPolicyPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PVMInstanceMultiCreate) validateAffinityPolicy(formats strfmt.Registry) error { + if swag.IsZero(m.AffinityPolicy) { // not required + return nil + } + + // value enum + if err := m.validateAffinityPolicyEnum("affinityPolicy", "body", *m.AffinityPolicy); err != nil { + return err + } + + return nil +} + +var pVmInstanceMultiCreateTypeNumericalPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["prefix","suffix"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pVmInstanceMultiCreateTypeNumericalPropEnum = append(pVmInstanceMultiCreateTypeNumericalPropEnum, v) + } +} + +const ( + + // PVMInstanceMultiCreateNumericalPrefix captures enum value "prefix" + PVMInstanceMultiCreateNumericalPrefix string = "prefix" + + // PVMInstanceMultiCreateNumericalSuffix captures enum value "suffix" + PVMInstanceMultiCreateNumericalSuffix string = "suffix" +) + +// prop value enum +func (m *PVMInstanceMultiCreate) validateNumericalEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pVmInstanceMultiCreateTypeNumericalPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PVMInstanceMultiCreate) validateNumerical(formats strfmt.Registry) error { + if swag.IsZero(m.Numerical) { // not required + return nil + } + + // value enum + if err := m.validateNumericalEnum("numerical", "body", *m.Numerical); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this p VM instance multi create based on context it is used +func (m *PVMInstanceMultiCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceMultiCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceMultiCreate) UnmarshalBinary(b []byte) error { + var res PVMInstanceMultiCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_network.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_network.go new file mode 100644 index 00000000000..94e6426411b --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_network.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/strfmt" + "github.com/go-openapi/swag" +) + +// PVMInstanceNetwork A map containing information about a network address +// +// swagger:model PVMInstanceNetwork +type PVMInstanceNetwork struct { + + // The external ip address (for pub-vlan networks) + ExternalIP string `json:"externalIP,omitempty"` + + // Link to PVM Instance Network + Href string `json:"href,omitempty"` + + // (deprecated - replaced by ipAddress) + IP string `json:"ip,omitempty"` + + // The ip address of this network interface + IPAddress string `json:"ipAddress,omitempty"` + + // The mac address of the network interface + MacAddress string `json:"macAddress,omitempty"` + + // ID of the network + NetworkID string `json:"networkID,omitempty"` + + // The name of the network the address is on + NetworkName string `json:"networkName,omitempty"` + + // The address type (fixed or dynamic) + Type string `json:"type,omitempty"` + + // The version of the information provided + Version float64 `json:"version,omitempty"` +} + +// Validate validates this p VM instance network +func (m *PVMInstanceNetwork) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this p VM instance network based on context it is used +func (m *PVMInstanceNetwork) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceNetwork) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceNetwork) UnmarshalBinary(b []byte) error { + var res PVMInstanceNetwork + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_networks.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_networks.go new file mode 100644 index 00000000000..e511b64dfc3 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_networks.go @@ -0,0 +1,119 @@ +// 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" +) + +// PVMInstanceNetworks p VM instance networks +// +// swagger:model PVMInstanceNetworks +type PVMInstanceNetworks struct { + + // PVM Instance Networks + // Required: true + Networks []*PVMInstanceNetwork `json:"networks"` +} + +// Validate validates this p VM instance networks +func (m *PVMInstanceNetworks) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateNetworks(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceNetworks) validateNetworks(formats strfmt.Registry) error { + + if err := validate.Required("networks", "body", m.Networks); err != nil { + return err + } + + for i := 0; i < len(m.Networks); i++ { + if swag.IsZero(m.Networks[i]) { // not required + continue + } + + if m.Networks[i] != nil { + if err := m.Networks[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this p VM instance networks based on the context it is used +func (m *PVMInstanceNetworks) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceNetworks) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceNetworks) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceNetworks) UnmarshalBinary(b []byte) error { + var res PVMInstanceNetworks + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_operation.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_operation.go new file mode 100644 index 00000000000..f9c202e542a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_operation.go @@ -0,0 +1,160 @@ +// 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" +) + +// PVMInstanceOperation p VM instance operation +// +// swagger:model PVMInstanceOperation +type PVMInstanceOperation struct { + + // operation + // Required: true + Operation *Operations `json:"operation"` + + // Name of the operation to execute; can be job or boot + // Required: true + // Enum: [job boot] + OperationType *string `json:"operationType"` +} + +// Validate validates this p VM instance operation +func (m *PVMInstanceOperation) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOperation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOperationType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceOperation) validateOperation(formats strfmt.Registry) error { + + if err := validate.Required("operation", "body", m.Operation); err != nil { + return err + } + + if m.Operation != nil { + if err := m.Operation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") + } + return err + } + } + + return nil +} + +var pVmInstanceOperationTypeOperationTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["job","boot"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pVmInstanceOperationTypeOperationTypePropEnum = append(pVmInstanceOperationTypeOperationTypePropEnum, v) + } +} + +const ( + + // PVMInstanceOperationOperationTypeJob captures enum value "job" + PVMInstanceOperationOperationTypeJob string = "job" + + // PVMInstanceOperationOperationTypeBoot captures enum value "boot" + PVMInstanceOperationOperationTypeBoot string = "boot" +) + +// prop value enum +func (m *PVMInstanceOperation) validateOperationTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pVmInstanceOperationTypeOperationTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PVMInstanceOperation) validateOperationType(formats strfmt.Registry) error { + + if err := validate.Required("operationType", "body", m.OperationType); err != nil { + return err + } + + // value enum + if err := m.validateOperationTypeEnum("operationType", "body", *m.OperationType); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this p VM instance operation based on the context it is used +func (m *PVMInstanceOperation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOperation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceOperation) contextValidateOperation(ctx context.Context, formats strfmt.Registry) error { + + if m.Operation != nil { + if err := m.Operation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceOperation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceOperation) UnmarshalBinary(b []byte) error { + var res PVMInstanceOperation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_reference.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_reference.go new file mode 100644 index 00000000000..33303e9d9c5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_reference.go @@ -0,0 +1,806 @@ +// 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" +) + +// PVMInstanceReference p VM instance reference +// +// swagger:model PVMInstanceReference +type PVMInstanceReference struct { + + // (deprecated - replaced by networks) The list of addresses and their network information + Addresses []*PVMInstanceNetwork `json:"addresses"` + + // Console language and code + ConsoleLanguage *ConsoleLanguage `json:"consoleLanguage,omitempty"` + + // Date/Time of PVM creation + // Format: date-time + CreationDate strfmt.DateTime `json:"creationDate,omitempty"` + + // Size of allocated disk (in GB) + // Required: true + DiskSize *float64 `json:"diskSize"` + + // fault + Fault *PVMInstanceFault `json:"fault,omitempty"` + + // health + Health *PVMInstanceHealth `json:"health,omitempty"` + + // The PVM Instance Host ID (Internal Use Only) + HostID int64 `json:"hostID,omitempty"` + + // Link to Cloud Instance resource + // Required: true + Href *string `json:"href"` + + // The ImageID used by the server + // Required: true + ImageID *string `json:"imageID"` + + // The VTL license repository capacity TB value + LicenseRepositoryCapacity int64 `json:"licenseRepositoryCapacity,omitempty"` + + // Maximum amount of memory that can be allocated (in GB, for resize) + Maxmem float64 `json:"maxmem,omitempty"` + + // Maximum number of processors that can be allocated (for resize) + Maxproc float64 `json:"maxproc,omitempty"` + + // Amount of memory allocated (in GB) + // Required: true + Memory *float64 `json:"memory"` + + // Minimum amount of memory that can be allocated (in GB, for resize) + Minmem float64 `json:"minmem,omitempty"` + + // Minimum number of processors that can be allocated (for resize) + Minproc float64 `json:"minproc,omitempty"` + + // The list of addresses and their network information + Networks []*PVMInstanceNetwork `json:"networks"` + + // OS system information (usually version and build) + OperatingSystem string `json:"operatingSystem,omitempty"` + + // Type of the OS [aix, ibmi, rhel, sles, vtl, rhcos] + // Required: true + OsType *string `json:"osType"` + + // VM pinning policy to use [none, soft, hard] + PinPolicy string `json:"pinPolicy,omitempty"` + + // The placement group of the server + PlacementGroup *string `json:"placementGroup,omitempty"` + + // Processor type (dedicated, shared, capped) + // Required: true + // Enum: [dedicated shared capped] + ProcType *string `json:"procType"` + + // Number of processors allocated + // Required: true + Processors *float64 `json:"processors"` + + // The progress of an operation + Progress float64 `json:"progress,omitempty"` + + // PCloud PVM Instance ID + // Required: true + PvmInstanceID *string `json:"pvmInstanceID"` + + // If this is an SAP pvm-instance the profile reference will link to the SAP profile + SapProfile *SAPProfileReference `json:"sapProfile,omitempty"` + + // Name of the server + // Required: true + ServerName *string `json:"serverName"` + + // The pvm instance Software Licenses + SoftwareLicenses *SoftwareLicenses `json:"softwareLicenses,omitempty"` + + // The pvm instance SRC lists + Srcs [][]*SRC `json:"srcs"` + + // The status of the instance + // Required: true + Status *string `json:"status"` + + // Storage Pool where server is deployed + StoragePool string `json:"storagePool,omitempty"` + + // Indicates if all volumes attached to the server must reside in the same storage pool + StoragePoolAffinity *bool `json:"storagePoolAffinity,omitempty"` + + // Storage type of the deployment storage pool + StorageType string `json:"storageType,omitempty"` + + // System type used to host the instance + SysType string `json:"sysType,omitempty"` + + // Date/Time of PVM last update + // Format: date-time + UpdatedDate strfmt.DateTime `json:"updatedDate,omitempty"` + + // The pvm instance virtual CPU information + VirtualCores *VirtualCores `json:"virtualCores,omitempty"` +} + +// Validate validates this p VM instance reference +func (m *PVMInstanceReference) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAddresses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateConsoleLanguage(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCreationDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDiskSize(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFault(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHealth(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHref(formats); err != nil { + res = append(res, err) + } + + if err := m.validateImageID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemory(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetworks(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOsType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProcType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProcessors(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePvmInstanceID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSapProfile(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServerName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSoftwareLicenses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSrcs(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdatedDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVirtualCores(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceReference) validateAddresses(formats strfmt.Registry) error { + if swag.IsZero(m.Addresses) { // not required + return nil + } + + for i := 0; i < len(m.Addresses); i++ { + if swag.IsZero(m.Addresses[i]) { // not required + continue + } + + if m.Addresses[i] != nil { + if err := m.Addresses[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("addresses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("addresses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstanceReference) validateConsoleLanguage(formats strfmt.Registry) error { + if swag.IsZero(m.ConsoleLanguage) { // not required + return nil + } + + if m.ConsoleLanguage != nil { + if err := m.ConsoleLanguage.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("consoleLanguage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("consoleLanguage") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceReference) validateCreationDate(formats strfmt.Registry) error { + if swag.IsZero(m.CreationDate) { // not required + return nil + } + + if err := validate.FormatOf("creationDate", "body", "date-time", m.CreationDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceReference) validateDiskSize(formats strfmt.Registry) error { + + if err := validate.Required("diskSize", "body", m.DiskSize); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceReference) validateFault(formats strfmt.Registry) error { + if swag.IsZero(m.Fault) { // not required + return nil + } + + if m.Fault != nil { + if err := m.Fault.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fault") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fault") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceReference) validateHealth(formats strfmt.Registry) error { + if swag.IsZero(m.Health) { // not required + return nil + } + + if m.Health != nil { + if err := m.Health.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("health") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("health") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceReference) validateHref(formats strfmt.Registry) error { + + if err := validate.Required("href", "body", m.Href); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceReference) validateImageID(formats strfmt.Registry) error { + + if err := validate.Required("imageID", "body", m.ImageID); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceReference) validateMemory(formats strfmt.Registry) error { + + if err := validate.Required("memory", "body", m.Memory); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceReference) validateNetworks(formats strfmt.Registry) error { + if swag.IsZero(m.Networks) { // not required + return nil + } + + for i := 0; i < len(m.Networks); i++ { + if swag.IsZero(m.Networks[i]) { // not required + continue + } + + if m.Networks[i] != nil { + if err := m.Networks[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstanceReference) validateOsType(formats strfmt.Registry) error { + + if err := validate.Required("osType", "body", m.OsType); err != nil { + return err + } + + return nil +} + +var pVmInstanceReferenceTypeProcTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["dedicated","shared","capped"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pVmInstanceReferenceTypeProcTypePropEnum = append(pVmInstanceReferenceTypeProcTypePropEnum, v) + } +} + +const ( + + // PVMInstanceReferenceProcTypeDedicated captures enum value "dedicated" + PVMInstanceReferenceProcTypeDedicated string = "dedicated" + + // PVMInstanceReferenceProcTypeShared captures enum value "shared" + PVMInstanceReferenceProcTypeShared string = "shared" + + // PVMInstanceReferenceProcTypeCapped captures enum value "capped" + PVMInstanceReferenceProcTypeCapped string = "capped" +) + +// prop value enum +func (m *PVMInstanceReference) validateProcTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pVmInstanceReferenceTypeProcTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PVMInstanceReference) validateProcType(formats strfmt.Registry) error { + + if err := validate.Required("procType", "body", m.ProcType); err != nil { + return err + } + + // value enum + if err := m.validateProcTypeEnum("procType", "body", *m.ProcType); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceReference) validateProcessors(formats strfmt.Registry) error { + + if err := validate.Required("processors", "body", m.Processors); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceReference) validatePvmInstanceID(formats strfmt.Registry) error { + + if err := validate.Required("pvmInstanceID", "body", m.PvmInstanceID); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceReference) validateSapProfile(formats strfmt.Registry) error { + if swag.IsZero(m.SapProfile) { // not required + return nil + } + + if m.SapProfile != nil { + if err := m.SapProfile.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sapProfile") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sapProfile") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceReference) validateServerName(formats strfmt.Registry) error { + + if err := validate.Required("serverName", "body", m.ServerName); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceReference) validateSoftwareLicenses(formats strfmt.Registry) error { + if swag.IsZero(m.SoftwareLicenses) { // not required + return nil + } + + if m.SoftwareLicenses != nil { + if err := m.SoftwareLicenses.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceReference) validateSrcs(formats strfmt.Registry) error { + if swag.IsZero(m.Srcs) { // not required + return nil + } + + for i := 0; i < len(m.Srcs); i++ { + + for ii := 0; ii < len(m.Srcs[i]); ii++ { + if swag.IsZero(m.Srcs[i][ii]) { // not required + continue + } + + if m.Srcs[i][ii] != nil { + if err := m.Srcs[i][ii].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) + } + return err + } + } + + } + + } + + return nil +} + +func (m *PVMInstanceReference) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceReference) validateUpdatedDate(formats strfmt.Registry) error { + if swag.IsZero(m.UpdatedDate) { // not required + return nil + } + + if err := validate.FormatOf("updatedDate", "body", "date-time", m.UpdatedDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceReference) validateVirtualCores(formats strfmt.Registry) error { + if swag.IsZero(m.VirtualCores) { // not required + return nil + } + + if m.VirtualCores != nil { + if err := m.VirtualCores.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") + } + return err + } + } + + return nil +} + +// ContextValidate validate this p VM instance reference based on the context it is used +func (m *PVMInstanceReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAddresses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateConsoleLanguage(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFault(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateHealth(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSapProfile(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSoftwareLicenses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSrcs(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVirtualCores(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceReference) contextValidateAddresses(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Addresses); i++ { + + if m.Addresses[i] != nil { + if err := m.Addresses[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("addresses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("addresses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateConsoleLanguage(ctx context.Context, formats strfmt.Registry) error { + + if m.ConsoleLanguage != nil { + if err := m.ConsoleLanguage.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("consoleLanguage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("consoleLanguage") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateFault(ctx context.Context, formats strfmt.Registry) error { + + if m.Fault != nil { + if err := m.Fault.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fault") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fault") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateHealth(ctx context.Context, formats strfmt.Registry) error { + + if m.Health != nil { + if err := m.Health.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("health") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("health") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateSapProfile(ctx context.Context, formats strfmt.Registry) error { + + if m.SapProfile != nil { + if err := m.SapProfile.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sapProfile") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sapProfile") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateSoftwareLicenses(ctx context.Context, formats strfmt.Registry) error { + + if m.SoftwareLicenses != nil { + if err := m.SoftwareLicenses.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateSrcs(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Srcs); i++ { + + for ii := 0; ii < len(m.Srcs[i]); ii++ { + + if m.Srcs[i][ii] != nil { + if err := m.Srcs[i][ii].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("srcs" + "." + strconv.Itoa(i) + "." + strconv.Itoa(ii)) + } + return err + } + } + + } + + } + + return nil +} + +func (m *PVMInstanceReference) contextValidateVirtualCores(ctx context.Context, formats strfmt.Registry) error { + + if m.VirtualCores != nil { + if err := m.VirtualCores.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceReference) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceReference) UnmarshalBinary(b []byte) error { + var res PVMInstanceReference + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_remove_network.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_remove_network.go new file mode 100644 index 00000000000..937e609decd --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_remove_network.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" +) + +// PVMInstanceRemoveNetwork p VM instance remove network +// +// swagger:model PVMInstanceRemoveNetwork +type PVMInstanceRemoveNetwork struct { + + // The mac address of the network interface to be removed + MacAddress string `json:"macAddress,omitempty"` +} + +// Validate validates this p VM instance remove network +func (m *PVMInstanceRemoveNetwork) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this p VM instance remove network based on context it is used +func (m *PVMInstanceRemoveNetwork) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceRemoveNetwork) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceRemoveNetwork) UnmarshalBinary(b []byte) error { + var res PVMInstanceRemoveNetwork + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_update.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_update.go new file mode 100644 index 00000000000..89cb7788825 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_update.go @@ -0,0 +1,268 @@ +// 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" +) + +// PVMInstanceUpdate p VM instance update +// +// swagger:model PVMInstanceUpdate +type PVMInstanceUpdate struct { + + // The VTL license repository capacity TB value + LicenseRepositoryCapacity int64 `json:"licenseRepositoryCapacity,omitempty"` + + // Amount of memory allocated (in GB) + Memory float64 `json:"memory,omitempty"` + + // Indicates if the server is allowed to migrate between hosts + Migratable *bool `json:"migratable,omitempty"` + + // pin policy + PinPolicy PinPolicy `json:"pinPolicy,omitempty"` + + // Processor type (dedicated, shared, capped) + // Enum: [dedicated shared capped] + ProcType string `json:"procType,omitempty"` + + // Number of processors allocated + Processors float64 `json:"processors,omitempty"` + + // If an SAP pvm-instance, the SAP profile ID to switch to (only while shutdown) + SapProfileID string `json:"sapProfileID,omitempty"` + + // Name of the server to create + ServerName string `json:"serverName,omitempty"` + + // The pvm instance Software Licenses + SoftwareLicenses *SoftwareLicenses `json:"softwareLicenses,omitempty"` + + // Indicates if all volumes attached to the server must reside in the same storage pool; If set to false then volumes from any storage type and pool can be attached to the PVMInstance; Impacts PVMInstance snapshot, capture, and clone, for capture and clone - only data volumes that are of the same storage type and in the same storage pool of the PVMInstance's boot volume can be included; for snapshot - all data volumes to be included in the snapshot must reside in the same storage type and pool. Once set to false, cannot be set back to true unless all volumes attached reside in the same storage type and pool. + StoragePoolAffinity *bool `json:"storagePoolAffinity,omitempty"` + + // The pvm instance virtual CPU information + VirtualCores *VirtualCores `json:"virtualCores,omitempty"` +} + +// Validate validates this p VM instance update +func (m *PVMInstanceUpdate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePinPolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProcType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSoftwareLicenses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVirtualCores(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceUpdate) validatePinPolicy(formats strfmt.Registry) error { + if swag.IsZero(m.PinPolicy) { // not required + return nil + } + + if err := m.PinPolicy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") + } + return err + } + + return nil +} + +var pVmInstanceUpdateTypeProcTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["dedicated","shared","capped"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pVmInstanceUpdateTypeProcTypePropEnum = append(pVmInstanceUpdateTypeProcTypePropEnum, v) + } +} + +const ( + + // PVMInstanceUpdateProcTypeDedicated captures enum value "dedicated" + PVMInstanceUpdateProcTypeDedicated string = "dedicated" + + // PVMInstanceUpdateProcTypeShared captures enum value "shared" + PVMInstanceUpdateProcTypeShared string = "shared" + + // PVMInstanceUpdateProcTypeCapped captures enum value "capped" + PVMInstanceUpdateProcTypeCapped string = "capped" +) + +// prop value enum +func (m *PVMInstanceUpdate) validateProcTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pVmInstanceUpdateTypeProcTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PVMInstanceUpdate) validateProcType(formats strfmt.Registry) error { + if swag.IsZero(m.ProcType) { // not required + return nil + } + + // value enum + if err := m.validateProcTypeEnum("procType", "body", m.ProcType); err != nil { + return err + } + + return nil +} + +func (m *PVMInstanceUpdate) validateSoftwareLicenses(formats strfmt.Registry) error { + if swag.IsZero(m.SoftwareLicenses) { // not required + return nil + } + + if m.SoftwareLicenses != nil { + if err := m.SoftwareLicenses.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceUpdate) validateVirtualCores(formats strfmt.Registry) error { + if swag.IsZero(m.VirtualCores) { // not required + return nil + } + + if m.VirtualCores != nil { + if err := m.VirtualCores.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") + } + return err + } + } + + return nil +} + +// ContextValidate validate this p VM instance update based on the context it is used +func (m *PVMInstanceUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePinPolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSoftwareLicenses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVirtualCores(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceUpdate) contextValidatePinPolicy(ctx context.Context, formats strfmt.Registry) error { + + if err := m.PinPolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") + } + return err + } + + return nil +} + +func (m *PVMInstanceUpdate) contextValidateSoftwareLicenses(ctx context.Context, formats strfmt.Registry) error { + + if m.SoftwareLicenses != nil { + if err := m.SoftwareLicenses.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("softwareLicenses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("softwareLicenses") + } + return err + } + } + + return nil +} + +func (m *PVMInstanceUpdate) contextValidateVirtualCores(ctx context.Context, formats strfmt.Registry) error { + + if m.VirtualCores != nil { + if err := m.VirtualCores.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("virtualCores") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("virtualCores") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceUpdate) UnmarshalBinary(b []byte) error { + var res PVMInstanceUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_update_response.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_update_response.go new file mode 100644 index 00000000000..5f19935c501 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_update_response.go @@ -0,0 +1,170 @@ +// 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" +) + +// PVMInstanceUpdateResponse p VM instance update response +// +// swagger:model PVMInstanceUpdateResponse +type PVMInstanceUpdateResponse struct { + + // The VTL license repository capacity TB value + LicenseRepositoryCapacity int64 `json:"licenseRepositoryCapacity,omitempty"` + + // Amount of memory allocated (in GB) + Memory float64 `json:"memory,omitempty"` + + // pin policy + PinPolicy PinPolicy `json:"pinPolicy,omitempty"` + + // Processor type (dedicated, shared, capped) + // Enum: [dedicated shared capped] + ProcType string `json:"procType,omitempty"` + + // Number of processors allocated + Processors float64 `json:"processors,omitempty"` + + // Name of the server to create + ServerName string `json:"serverName,omitempty"` + + // URL to check for status of the operation (for now, just the URL for the GET on the server, which has status information from powervc) + StatusURL string `json:"statusUrl,omitempty"` +} + +// Validate validates this p VM instance update response +func (m *PVMInstanceUpdateResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePinPolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProcType(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceUpdateResponse) validatePinPolicy(formats strfmt.Registry) error { + if swag.IsZero(m.PinPolicy) { // not required + return nil + } + + if err := m.PinPolicy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") + } + return err + } + + return nil +} + +var pVmInstanceUpdateResponseTypeProcTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["dedicated","shared","capped"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pVmInstanceUpdateResponseTypeProcTypePropEnum = append(pVmInstanceUpdateResponseTypeProcTypePropEnum, v) + } +} + +const ( + + // PVMInstanceUpdateResponseProcTypeDedicated captures enum value "dedicated" + PVMInstanceUpdateResponseProcTypeDedicated string = "dedicated" + + // PVMInstanceUpdateResponseProcTypeShared captures enum value "shared" + PVMInstanceUpdateResponseProcTypeShared string = "shared" + + // PVMInstanceUpdateResponseProcTypeCapped captures enum value "capped" + PVMInstanceUpdateResponseProcTypeCapped string = "capped" +) + +// prop value enum +func (m *PVMInstanceUpdateResponse) validateProcTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, pVmInstanceUpdateResponseTypeProcTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PVMInstanceUpdateResponse) validateProcType(formats strfmt.Registry) error { + if swag.IsZero(m.ProcType) { // not required + return nil + } + + // value enum + if err := m.validateProcTypeEnum("procType", "body", m.ProcType); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this p VM instance update response based on the context it is used +func (m *PVMInstanceUpdateResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePinPolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceUpdateResponse) contextValidatePinPolicy(ctx context.Context, formats strfmt.Registry) error { + + if err := m.PinPolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceUpdateResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceUpdateResponse) UnmarshalBinary(b []byte) error { + var res PVMInstanceUpdateResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_volume_update.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_volume_update.go new file mode 100644 index 00000000000..d3ab5a7cc46 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instance_volume_update.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" +) + +// PVMInstanceVolumeUpdate p VM instance volume update +// +// swagger:model PVMInstanceVolumeUpdate +type PVMInstanceVolumeUpdate struct { + + // Indicates if the volume should be deleted when the PVMInstance is terminated + // Required: true + DeleteOnTermination *bool `json:"deleteOnTermination"` +} + +// Validate validates this p VM instance volume update +func (m *PVMInstanceVolumeUpdate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDeleteOnTermination(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstanceVolumeUpdate) validateDeleteOnTermination(formats strfmt.Registry) error { + + if err := validate.Required("deleteOnTermination", "body", m.DeleteOnTermination); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this p VM instance volume update based on context it is used +func (m *PVMInstanceVolumeUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstanceVolumeUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstanceVolumeUpdate) UnmarshalBinary(b []byte) error { + var res PVMInstanceVolumeUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instances.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instances.go new file mode 100644 index 00000000000..c535bc5fb0d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/p_vm_instances.go @@ -0,0 +1,119 @@ +// 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" +) + +// PVMInstances p VM instances +// +// swagger:model PVMInstances +type PVMInstances struct { + + // PVM Instance References + // Required: true + PvmInstances []*PVMInstanceReference `json:"pvmInstances"` +} + +// Validate validates this p VM instances +func (m *PVMInstances) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePvmInstances(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstances) validatePvmInstances(formats strfmt.Registry) error { + + if err := validate.Required("pvmInstances", "body", m.PvmInstances); err != nil { + return err + } + + for i := 0; i < len(m.PvmInstances); i++ { + if swag.IsZero(m.PvmInstances[i]) { // not required + continue + } + + if m.PvmInstances[i] != nil { + if err := m.PvmInstances[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this p VM instances based on the context it is used +func (m *PVMInstances) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePvmInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PVMInstances) contextValidatePvmInstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PvmInstances); i++ { + + if m.PvmInstances[i] != nil { + if err := m.PvmInstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pvmInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PVMInstances) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PVMInstances) UnmarshalBinary(b []byte) error { + var res PVMInstances + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/peer_gateway_address.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/peer_gateway_address.go new file mode 100644 index 00000000000..1a060a63659 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/peer_gateway_address.go @@ -0,0 +1,39 @@ +// 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/validate" +) + +// PeerGatewayAddress IP address of the Peer Gateway attached to this VPNConnection +// Example: 192.168.1.1 +// +// swagger:model PeerGatewayAddress +type PeerGatewayAddress strfmt.IPv4 + +// Validate validates this peer gateway address +func (m PeerGatewayAddress) Validate(formats strfmt.Registry) error { + var res []error + + if err := validate.FormatOf("", "body", "ipv4", strfmt.IPv4(m).String(), formats); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this peer gateway address based on context it is used +func (m PeerGatewayAddress) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/peer_subnet_update.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/peer_subnet_update.go new file mode 100644 index 00000000000..863dd974721 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/peer_subnet_update.go @@ -0,0 +1,72 @@ +// 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" +) + +// PeerSubnetUpdate CIDR of peer subnet to attach/detach +// +// swagger:model PeerSubnetUpdate +type PeerSubnetUpdate struct { + + // cidr + // Example: 128.170.1.0/32 + // Required: true + Cidr *string `json:"cidr"` +} + +// Validate validates this peer subnet update +func (m *PeerSubnetUpdate) 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 *PeerSubnetUpdate) validateCidr(formats strfmt.Registry) error { + + if err := validate.Required("cidr", "body", m.Cidr); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this peer subnet update based on context it is used +func (m *PeerSubnetUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PeerSubnetUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PeerSubnetUpdate) UnmarshalBinary(b []byte) error { + var res PeerSubnetUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/peer_subnets.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/peer_subnets.go new file mode 100644 index 00000000000..42c108d628a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/peer_subnets.go @@ -0,0 +1,51 @@ +// 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" +) + +// PeerSubnets peer subnets +// +// swagger:model PeerSubnets +type PeerSubnets struct { + + // an array of strings containing CIDR of peer subnets + // Example: ["128.170.1.0/20","128.169.1.0/24","128.168.1.0/27","128.170.1.0/32"] + PeerSubnets []string `json:"peerSubnets"` +} + +// Validate validates this peer subnets +func (m *PeerSubnets) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this peer subnets based on context it is used +func (m *PeerSubnets) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PeerSubnets) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PeerSubnets) UnmarshalBinary(b []byte) error { + var res PeerSubnets + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/peering_network.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/peering_network.go new file mode 100644 index 00000000000..9530fe17486 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/peering_network.go @@ -0,0 +1,91 @@ +// 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" +) + +// PeeringNetwork peering network +// +// swagger:model PeeringNetwork +type PeeringNetwork struct { + + // Network in CIDR notation (192.168.0.0/24) + // Required: true + Cidr *string `json:"cidr" datastore:"cidr"` + + // DNS Servers + DNSServers []string `json:"dnsServers,omitempty" datastore:"dnsServers"` + + // Name of project to be peered + // Required: true + ProjectName *string `json:"projectName" datastore:"projectName"` +} + +// Validate validates this peering network +func (m *PeeringNetwork) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCidr(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProjectName(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PeeringNetwork) validateCidr(formats strfmt.Registry) error { + + if err := validate.Required("cidr", "body", m.Cidr); err != nil { + return err + } + + return nil +} + +func (m *PeeringNetwork) validateProjectName(formats strfmt.Registry) error { + + if err := validate.Required("projectName", "body", m.ProjectName); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this peering network based on context it is used +func (m *PeeringNetwork) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PeeringNetwork) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PeeringNetwork) UnmarshalBinary(b []byte) error { + var res PeeringNetwork + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/pin_policy.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/pin_policy.go new file mode 100644 index 00000000000..9a1f4e45267 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/pin_policy.go @@ -0,0 +1,81 @@ +// 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/validate" +) + +// PinPolicy Specify PVM pin policy +// +// swagger:model PinPolicy +type PinPolicy string + +func NewPinPolicy(value PinPolicy) *PinPolicy { + return &value +} + +// Pointer returns a pointer to a freshly-allocated PinPolicy. +func (m PinPolicy) Pointer() *PinPolicy { + return &m +} + +const ( + + // PinPolicyNone captures enum value "none" + PinPolicyNone PinPolicy = "none" + + // PinPolicySoft captures enum value "soft" + PinPolicySoft PinPolicy = "soft" + + // PinPolicyHard captures enum value "hard" + PinPolicyHard PinPolicy = "hard" +) + +// for schema +var pinPolicyEnum []interface{} + +func init() { + var res []PinPolicy + if err := json.Unmarshal([]byte(`["none","soft","hard"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + pinPolicyEnum = append(pinPolicyEnum, v) + } +} + +func (m PinPolicy) validatePinPolicyEnum(path, location string, value PinPolicy) error { + if err := validate.EnumCase(path, location, value, pinPolicyEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this pin policy +func (m PinPolicy) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validatePinPolicyEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this pin policy based on context it is used +func (m PinPolicy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/placement_group.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/placement_group.go new file mode 100644 index 00000000000..31661603fab --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/placement_group.go @@ -0,0 +1,158 @@ +// 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" +) + +// PlacementGroup placement group +// +// swagger:model PlacementGroup +type PlacementGroup struct { + + // The id of the Placement Group + // Required: true + ID *string `json:"id"` + + // The List of PVM Instance IDs associated with the Placement Group + // Required: true + Members []string `json:"members"` + + // The name of the Placement Group + // Required: true + Name *string `json:"name"` + + // The Placement Group Policy + // Required: true + // Enum: [affinity anti-affinity] + Policy *string `json:"policy"` +} + +// Validate validates this placement group +func (m *PlacementGroup) Validate(formats strfmt.Registry) error { + var res []error + + 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.validatePolicy(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PlacementGroup) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *PlacementGroup) validateMembers(formats strfmt.Registry) error { + + if err := validate.Required("members", "body", m.Members); err != nil { + return err + } + + return nil +} + +func (m *PlacementGroup) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +var placementGroupTypePolicyPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["affinity","anti-affinity"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + placementGroupTypePolicyPropEnum = append(placementGroupTypePolicyPropEnum, v) + } +} + +const ( + + // PlacementGroupPolicyAffinity captures enum value "affinity" + PlacementGroupPolicyAffinity string = "affinity" + + // PlacementGroupPolicyAntiDashAffinity captures enum value "anti-affinity" + PlacementGroupPolicyAntiDashAffinity string = "anti-affinity" +) + +// prop value enum +func (m *PlacementGroup) validatePolicyEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, placementGroupTypePolicyPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PlacementGroup) validatePolicy(formats strfmt.Registry) error { + + if err := validate.Required("policy", "body", m.Policy); err != nil { + return err + } + + // value enum + if err := m.validatePolicyEnum("policy", "body", *m.Policy); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this placement group based on context it is used +func (m *PlacementGroup) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PlacementGroup) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PlacementGroup) UnmarshalBinary(b []byte) error { + var res PlacementGroup + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/placement_group_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/placement_group_create.go new file mode 100644 index 00000000000..2fd3d083d71 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/placement_group_create.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" +) + +// PlacementGroupCreate placement group create +// +// swagger:model PlacementGroupCreate +type PlacementGroupCreate struct { + + // The name of the Placement Group + // Required: true + Name *string `json:"name"` + + // The Placement Group Policy + // Required: true + // Enum: [affinity anti-affinity] + Policy *string `json:"policy"` +} + +// Validate validates this placement group create +func (m *PlacementGroupCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePolicy(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PlacementGroupCreate) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +var placementGroupCreateTypePolicyPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["affinity","anti-affinity"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + placementGroupCreateTypePolicyPropEnum = append(placementGroupCreateTypePolicyPropEnum, v) + } +} + +const ( + + // PlacementGroupCreatePolicyAffinity captures enum value "affinity" + PlacementGroupCreatePolicyAffinity string = "affinity" + + // PlacementGroupCreatePolicyAntiDashAffinity captures enum value "anti-affinity" + PlacementGroupCreatePolicyAntiDashAffinity string = "anti-affinity" +) + +// prop value enum +func (m *PlacementGroupCreate) validatePolicyEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, placementGroupCreateTypePolicyPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *PlacementGroupCreate) validatePolicy(formats strfmt.Registry) error { + + if err := validate.Required("policy", "body", m.Policy); err != nil { + return err + } + + // value enum + if err := m.validatePolicyEnum("policy", "body", *m.Policy); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this placement group create based on context it is used +func (m *PlacementGroupCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PlacementGroupCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PlacementGroupCreate) UnmarshalBinary(b []byte) error { + var res PlacementGroupCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/placement_group_server.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/placement_group_server.go new file mode 100644 index 00000000000..73d29188fd6 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/placement_group_server.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" +) + +// PlacementGroupServer placement group server +// +// swagger:model PlacementGroupServer +type PlacementGroupServer struct { + + // The ID of the Server + // Required: true + ID *string `json:"id"` +} + +// Validate validates this placement group server +func (m *PlacementGroupServer) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PlacementGroupServer) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this placement group server based on context it is used +func (m *PlacementGroupServer) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PlacementGroupServer) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PlacementGroupServer) UnmarshalBinary(b []byte) error { + var res PlacementGroupServer + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/placement_groups.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/placement_groups.go new file mode 100644 index 00000000000..9c033b6937a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/placement_groups.go @@ -0,0 +1,119 @@ +// 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" +) + +// PlacementGroups placement groups +// +// swagger:model PlacementGroups +type PlacementGroups struct { + + // List of Server Placement Groups + // Required: true + PlacementGroups []*PlacementGroup `json:"placementGroups"` +} + +// Validate validates this placement groups +func (m *PlacementGroups) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePlacementGroups(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PlacementGroups) validatePlacementGroups(formats strfmt.Registry) error { + + if err := validate.Required("placementGroups", "body", m.PlacementGroups); err != nil { + return err + } + + for i := 0; i < len(m.PlacementGroups); i++ { + if swag.IsZero(m.PlacementGroups[i]) { // not required + continue + } + + if m.PlacementGroups[i] != nil { + if err := m.PlacementGroups[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("placementGroups" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("placementGroups" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this placement groups based on the context it is used +func (m *PlacementGroups) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePlacementGroups(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PlacementGroups) contextValidatePlacementGroups(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PlacementGroups); i++ { + + if m.PlacementGroups[i] != nil { + if err := m.PlacementGroups[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("placementGroups" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("placementGroups" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PlacementGroups) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PlacementGroups) UnmarshalBinary(b []byte) error { + var res PlacementGroups + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/plan.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/plan.go new file mode 100644 index 00000000000..8a3eb9c4613 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/plan.go @@ -0,0 +1,165 @@ +// 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" +) + +// Plan plan +// +// swagger:model Plan +type Plan struct { + + // bindable + Bindable bool `json:"bindable,omitempty"` + + // description + // Required: true + Description *string `json:"description"` + + // free + Free *bool `json:"free,omitempty"` + + // id + // Required: true + ID *string `json:"id"` + + // metadata + Metadata Metadata `json:"metadata,omitempty"` + + // name + // Required: true + Name *string `json:"name"` + + // schemas + Schemas *SchemasObject `json:"schemas,omitempty"` +} + +// Validate validates this plan +func (m *Plan) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSchemas(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Plan) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *Plan) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *Plan) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *Plan) validateSchemas(formats strfmt.Registry) error { + if swag.IsZero(m.Schemas) { // not required + return nil + } + + if m.Schemas != nil { + if err := m.Schemas.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("schemas") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("schemas") + } + return err + } + } + + return nil +} + +// ContextValidate validate this plan based on the context it is used +func (m *Plan) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSchemas(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Plan) contextValidateSchemas(ctx context.Context, formats strfmt.Registry) error { + + if m.Schemas != nil { + if err := m.Schemas.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("schemas") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("schemas") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Plan) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Plan) UnmarshalBinary(b []byte) error { + var res Plan + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/policy_versions.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/policy_versions.go new file mode 100644 index 00000000000..fa426855a90 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/policy_versions.go @@ -0,0 +1,28 @@ +// 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" +) + +// PolicyVersions policy versions +// Example: [1,2] +// +// swagger:model PolicyVersions +type PolicyVersions []float64 + +// Validate validates this policy versions +func (m PolicyVersions) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this policy versions based on context it is used +func (m PolicyVersions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/region_storage_types.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/region_storage_types.go new file mode 100644 index 00000000000..768bc4b51fa --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/region_storage_types.go @@ -0,0 +1,73 @@ +// 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" +) + +// RegionStorageTypes An array of of storage types supported in a region +// +// swagger:model RegionStorageTypes +type RegionStorageTypes []*StorageType + +// Validate validates this region storage types +func (m RegionStorageTypes) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this region storage types based on the context it is used +func (m RegionStorageTypes) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/s_a_p_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/s_a_p_create.go new file mode 100644 index 00000000000..b03b60f7d4d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/s_a_p_create.go @@ -0,0 +1,325 @@ +// 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" +) + +// SAPCreate s a p create +// +// swagger:model SAPCreate +type SAPCreate struct { + + // Image ID of the sap image to use for the server + // Required: true + ImageID *string `json:"imageID"` + + // instances + Instances *PVMInstanceMultiCreate `json:"instances,omitempty"` + + // Name of the sap pvm-instance + // Required: true + Name *string `json:"name"` + + // The pvm instance networks information + // Required: true + Networks []*PVMInstanceAddNetwork `json:"networks"` + + // pin policy + PinPolicy PinPolicy `json:"pinPolicy,omitempty"` + + // The placement group for the server + PlacementGroup string `json:"placementGroup,omitempty"` + + // SAP Profile ID for the amount of cores and memory + // Required: true + ProfileID *string `json:"profileID"` + + // The name of the SSH Key to provide to the server for authenticating + SSHKeyName string `json:"sshKeyName,omitempty"` + + // The storage affinity data; ignored if storagePool is provided; Only valid when you deploy one of the IBM supplied stock images. Storage type and pool for a custom image (an imported image or an image that is created from a PVMInstance capture) defaults to the storage type and pool the image was created in + StorageAffinity *StorageAffinity `json:"storageAffinity,omitempty"` + + // Storage Pool for server deployment; if provided then storageAffinity and storageType will be ignored; Only valid when you deploy one of the IBM supplied stock images. Storage type and pool for a custom image (an imported image or an image that is created from a PVMInstance capture) defaults to the storage type and pool the image was created in + StoragePool string `json:"storagePool,omitempty"` + + // Storage type for server deployment; will be ignored if storagePool or storageAffinity is provided; Only valid when you deploy one of the IBM supplied stock images. Storage type and pool for a custom image (an imported image or an image that is created from a PVMInstance capture) defaults to the storage type and pool the image was created in + StorageType string `json:"storageType,omitempty"` + + // System type used to host the instance. Only e880, e980, e1080 are supported + SysType string `json:"sysType,omitempty"` + + // Cloud init user defined data + UserData string `json:"userData,omitempty"` + + // List of Volume IDs to attach to the pvm-instance on creation + VolumeIDs []string `json:"volumeIDs"` +} + +// Validate validates this s a p create +func (m *SAPCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateImageID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInstances(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetworks(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePinPolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProfileID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStorageAffinity(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SAPCreate) validateImageID(formats strfmt.Registry) error { + + if err := validate.Required("imageID", "body", m.ImageID); err != nil { + return err + } + + return nil +} + +func (m *SAPCreate) validateInstances(formats strfmt.Registry) error { + if swag.IsZero(m.Instances) { // not required + return nil + } + + if m.Instances != nil { + if err := m.Instances.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("instances") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("instances") + } + return err + } + } + + return nil +} + +func (m *SAPCreate) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *SAPCreate) validateNetworks(formats strfmt.Registry) error { + + if err := validate.Required("networks", "body", m.Networks); err != nil { + return err + } + + for i := 0; i < len(m.Networks); i++ { + if swag.IsZero(m.Networks[i]) { // not required + continue + } + + if m.Networks[i] != nil { + if err := m.Networks[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SAPCreate) validatePinPolicy(formats strfmt.Registry) error { + if swag.IsZero(m.PinPolicy) { // not required + return nil + } + + if err := m.PinPolicy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") + } + return err + } + + return nil +} + +func (m *SAPCreate) validateProfileID(formats strfmt.Registry) error { + + if err := validate.Required("profileID", "body", m.ProfileID); err != nil { + return err + } + + return nil +} + +func (m *SAPCreate) validateStorageAffinity(formats strfmt.Registry) error { + if swag.IsZero(m.StorageAffinity) { // not required + return nil + } + + if m.StorageAffinity != nil { + if err := m.StorageAffinity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") + } + return err + } + } + + return nil +} + +// ContextValidate validate this s a p create based on the context it is used +func (m *SAPCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePinPolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStorageAffinity(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SAPCreate) contextValidateInstances(ctx context.Context, formats strfmt.Registry) error { + + if m.Instances != nil { + if err := m.Instances.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("instances") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("instances") + } + return err + } + } + + return nil +} + +func (m *SAPCreate) contextValidateNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Networks); i++ { + + if m.Networks[i] != nil { + if err := m.Networks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("networks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("networks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SAPCreate) contextValidatePinPolicy(ctx context.Context, formats strfmt.Registry) error { + + if err := m.PinPolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pinPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pinPolicy") + } + return err + } + + return nil +} + +func (m *SAPCreate) contextValidateStorageAffinity(ctx context.Context, formats strfmt.Registry) error { + + if m.StorageAffinity != nil { + if err := m.StorageAffinity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageAffinity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageAffinity") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SAPCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SAPCreate) UnmarshalBinary(b []byte) error { + var res SAPCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/s_a_p_profile.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/s_a_p_profile.go new file mode 100644 index 00000000000..73096fa60ed --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/s_a_p_profile.go @@ -0,0 +1,184 @@ +// 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" +) + +// SAPProfile s a p profile +// +// swagger:model SAPProfile +type SAPProfile struct { + + // Has certification been performed on profile + // Required: true + Certified *bool `json:"certified"` + + // Amount of cores + // Required: true + Cores *int64 `json:"cores"` + + // Amount of memory (in GB) + // Required: true + Memory *int64 `json:"memory"` + + // SAP Profile ID + // Required: true + ProfileID *string `json:"profileID"` + + // Type of profile + // Required: true + // Enum: [balanced compute memory non-production ultra-memory] + Type *string `json:"type"` +} + +// Validate validates this s a p profile +func (m *SAPProfile) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCertified(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCores(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemory(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProfileID(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 *SAPProfile) validateCertified(formats strfmt.Registry) error { + + if err := validate.Required("certified", "body", m.Certified); err != nil { + return err + } + + return nil +} + +func (m *SAPProfile) validateCores(formats strfmt.Registry) error { + + if err := validate.Required("cores", "body", m.Cores); err != nil { + return err + } + + return nil +} + +func (m *SAPProfile) validateMemory(formats strfmt.Registry) error { + + if err := validate.Required("memory", "body", m.Memory); err != nil { + return err + } + + return nil +} + +func (m *SAPProfile) validateProfileID(formats strfmt.Registry) error { + + if err := validate.Required("profileID", "body", m.ProfileID); err != nil { + return err + } + + return nil +} + +var sAPProfileTypeTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["balanced","compute","memory","non-production","ultra-memory"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + sAPProfileTypeTypePropEnum = append(sAPProfileTypeTypePropEnum, v) + } +} + +const ( + + // SAPProfileTypeBalanced captures enum value "balanced" + SAPProfileTypeBalanced string = "balanced" + + // SAPProfileTypeCompute captures enum value "compute" + SAPProfileTypeCompute string = "compute" + + // SAPProfileTypeMemory captures enum value "memory" + SAPProfileTypeMemory string = "memory" + + // SAPProfileTypeNonDashProduction captures enum value "non-production" + SAPProfileTypeNonDashProduction string = "non-production" + + // SAPProfileTypeUltraDashMemory captures enum value "ultra-memory" + SAPProfileTypeUltraDashMemory string = "ultra-memory" +) + +// prop value enum +func (m *SAPProfile) validateTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, sAPProfileTypeTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *SAPProfile) 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 s a p profile based on context it is used +func (m *SAPProfile) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SAPProfile) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SAPProfile) UnmarshalBinary(b []byte) error { + var res SAPProfile + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/s_a_p_profile_reference.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/s_a_p_profile_reference.go new file mode 100644 index 00000000000..9f7cd91f548 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/s_a_p_profile_reference.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" +) + +// SAPProfileReference s a p profile reference +// +// swagger:model SAPProfileReference +type SAPProfileReference struct { + + // Link to SAP profile resource + // Required: true + Href *string `json:"href"` + + // SAP Profile ID + // Required: true + ProfileID *string `json:"profileID"` +} + +// Validate validates this s a p profile reference +func (m *SAPProfileReference) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHref(formats); err != nil { + res = append(res, err) + } + + if err := m.validateProfileID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SAPProfileReference) validateHref(formats strfmt.Registry) error { + + if err := validate.Required("href", "body", m.Href); err != nil { + return err + } + + return nil +} + +func (m *SAPProfileReference) validateProfileID(formats strfmt.Registry) error { + + if err := validate.Required("profileID", "body", m.ProfileID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this s a p profile reference based on context it is used +func (m *SAPProfileReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SAPProfileReference) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SAPProfileReference) UnmarshalBinary(b []byte) error { + var res SAPProfileReference + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/s_a_p_profiles.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/s_a_p_profiles.go new file mode 100644 index 00000000000..02c67b962ed --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/s_a_p_profiles.go @@ -0,0 +1,119 @@ +// 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" +) + +// SAPProfiles s a p profiles +// +// swagger:model SAPProfiles +type SAPProfiles struct { + + // SAP Profiles + // Required: true + Profiles []*SAPProfile `json:"profiles"` +} + +// Validate validates this s a p profiles +func (m *SAPProfiles) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateProfiles(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SAPProfiles) validateProfiles(formats strfmt.Registry) error { + + if err := validate.Required("profiles", "body", m.Profiles); err != nil { + return err + } + + for i := 0; i < len(m.Profiles); i++ { + if swag.IsZero(m.Profiles[i]) { // not required + continue + } + + if m.Profiles[i] != nil { + if err := m.Profiles[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("profiles" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("profiles" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this s a p profiles based on the context it is used +func (m *SAPProfiles) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateProfiles(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SAPProfiles) contextValidateProfiles(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Profiles); i++ { + + if m.Profiles[i] != nil { + if err := m.Profiles[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("profiles" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("profiles" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SAPProfiles) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SAPProfiles) UnmarshalBinary(b []byte) error { + var res SAPProfiles + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/s_r_c.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/s_r_c.go new file mode 100644 index 00000000000..e9d191fa7a4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/s_r_c.go @@ -0,0 +1,53 @@ +// 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" +) + +// SRC s r c +// +// swagger:model SRC +type SRC struct { + + // The SRC reference code + Src string `json:"src,omitempty"` + + // The date stamp of the SRC + Timestamp string `json:"timestamp,omitempty"` +} + +// Validate validates this s r c +func (m *SRC) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this s r c based on context it is used +func (m *SRC) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SRC) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SRC) UnmarshalBinary(b []byte) error { + var res SRC + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/schema_parameters.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/schema_parameters.go new file mode 100644 index 00000000000..118c6b0f975 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/schema_parameters.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" +) + +// SchemaParameters schema parameters +// +// swagger:model SchemaParameters +type SchemaParameters struct { + + // parameters + Parameters JSONSchemaObject `json:"parameters,omitempty"` +} + +// Validate validates this schema parameters +func (m *SchemaParameters) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this schema parameters based on context it is used +func (m *SchemaParameters) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SchemaParameters) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SchemaParameters) UnmarshalBinary(b []byte) error { + var res SchemaParameters + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/schemas_object.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/schemas_object.go new file mode 100644 index 00000000000..1f7ce4efe2d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/schemas_object.go @@ -0,0 +1,150 @@ +// 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" +) + +// SchemasObject schemas object +// +// swagger:model SchemasObject +type SchemasObject struct { + + // service binding + ServiceBinding *ServiceBindingSchemaObject `json:"service_binding,omitempty"` + + // service instance + ServiceInstance *ServiceInstanceSchemaObject `json:"service_instance,omitempty"` +} + +// Validate validates this schemas object +func (m *SchemasObject) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateServiceBinding(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServiceInstance(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SchemasObject) validateServiceBinding(formats strfmt.Registry) error { + if swag.IsZero(m.ServiceBinding) { // not required + return nil + } + + if m.ServiceBinding != nil { + if err := m.ServiceBinding.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("service_binding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("service_binding") + } + return err + } + } + + return nil +} + +func (m *SchemasObject) validateServiceInstance(formats strfmt.Registry) error { + if swag.IsZero(m.ServiceInstance) { // not required + return nil + } + + if m.ServiceInstance != nil { + if err := m.ServiceInstance.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("service_instance") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("service_instance") + } + return err + } + } + + return nil +} + +// ContextValidate validate this schemas object based on the context it is used +func (m *SchemasObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateServiceBinding(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateServiceInstance(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SchemasObject) contextValidateServiceBinding(ctx context.Context, formats strfmt.Registry) error { + + if m.ServiceBinding != nil { + if err := m.ServiceBinding.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("service_binding") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("service_binding") + } + return err + } + } + + return nil +} + +func (m *SchemasObject) contextValidateServiceInstance(ctx context.Context, formats strfmt.Registry) error { + + if m.ServiceInstance != nil { + if err := m.ServiceInstance.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("service_instance") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("service_instance") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SchemasObject) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SchemasObject) UnmarshalBinary(b []byte) error { + var res SchemasObject + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service.go new file mode 100644 index 00000000000..8df437e38b6 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service.go @@ -0,0 +1,298 @@ +// 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" +) + +// Service service +// +// swagger:model Service +type Service struct { + + // bindable + // Required: true + Bindable *bool `json:"bindable"` + + // dashboard client + DashboardClient *DashboardClient `json:"dashboard_client,omitempty"` + + // description + // Required: true + Description *string `json:"description"` + + // iam compatible + IamCompatible bool `json:"iam_compatible,omitempty"` + + // id + // Required: true + ID *string `json:"id"` + + // metadata + Metadata Metadata `json:"metadata,omitempty"` + + // name + // Required: true + Name *string `json:"name"` + + // plan updateable + PlanUpdateable bool `json:"plan_updateable,omitempty"` + + // plans + // Required: true + Plans []*Plan `json:"plans"` + + // provisionable + Provisionable bool `json:"provisionable,omitempty"` + + // rc compatible + RcCompatible bool `json:"rc_compatible,omitempty"` + + // requires + Requires []string `json:"requires"` + + // tags + Tags []string `json:"tags"` + + // unique api key + UniqueAPIKey bool `json:"unique_api_key,omitempty"` +} + +// Validate validates this service +func (m *Service) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBindable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDashboardClient(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDescription(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePlans(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRequires(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Service) validateBindable(formats strfmt.Registry) error { + + if err := validate.Required("bindable", "body", m.Bindable); err != nil { + return err + } + + return nil +} + +func (m *Service) validateDashboardClient(formats strfmt.Registry) error { + if swag.IsZero(m.DashboardClient) { // not required + return nil + } + + if m.DashboardClient != nil { + if err := m.DashboardClient.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dashboard_client") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dashboard_client") + } + return err + } + } + + return nil +} + +func (m *Service) validateDescription(formats strfmt.Registry) error { + + if err := validate.Required("description", "body", m.Description); err != nil { + return err + } + + return nil +} + +func (m *Service) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *Service) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *Service) validatePlans(formats strfmt.Registry) error { + + if err := validate.Required("plans", "body", m.Plans); err != nil { + return err + } + + for i := 0; i < len(m.Plans); i++ { + if swag.IsZero(m.Plans[i]) { // not required + continue + } + + if m.Plans[i] != nil { + if err := m.Plans[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("plans" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("plans" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +var serviceRequiresItemsEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["syslog_drain","route_forwarding","volume_mount"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + serviceRequiresItemsEnum = append(serviceRequiresItemsEnum, v) + } +} + +func (m *Service) validateRequiresItemsEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, serviceRequiresItemsEnum, true); err != nil { + return err + } + return nil +} + +func (m *Service) validateRequires(formats strfmt.Registry) error { + if swag.IsZero(m.Requires) { // not required + return nil + } + + for i := 0; i < len(m.Requires); i++ { + + // value enum + if err := m.validateRequiresItemsEnum("requires"+"."+strconv.Itoa(i), "body", m.Requires[i]); err != nil { + return err + } + + } + + return nil +} + +// ContextValidate validate this service based on the context it is used +func (m *Service) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDashboardClient(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePlans(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Service) contextValidateDashboardClient(ctx context.Context, formats strfmt.Registry) error { + + if m.DashboardClient != nil { + if err := m.DashboardClient.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("dashboard_client") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("dashboard_client") + } + return err + } + } + + return nil +} + +func (m *Service) contextValidatePlans(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Plans); i++ { + + if m.Plans[i] != nil { + if err := m.Plans[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("plans" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("plans" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Service) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Service) UnmarshalBinary(b []byte) error { + var res Service + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding.go new file mode 100644 index 00000000000..a20665cc8d4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding.go @@ -0,0 +1,125 @@ +// 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" +) + +// ServiceBinding service binding +// +// swagger:model ServiceBinding +type ServiceBinding struct { + + // credentials + Credentials Object `json:"credentials,omitempty"` + + // route service url + RouteServiceURL string `json:"route_service_url,omitempty"` + + // syslog drain url + SyslogDrainURL string `json:"syslog_drain_url,omitempty"` + + // volume mounts + VolumeMounts []*ServiceBindingVolumeMount `json:"volume_mounts"` +} + +// Validate validates this service binding +func (m *ServiceBinding) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVolumeMounts(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBinding) validateVolumeMounts(formats strfmt.Registry) error { + if swag.IsZero(m.VolumeMounts) { // not required + return nil + } + + for i := 0; i < len(m.VolumeMounts); i++ { + if swag.IsZero(m.VolumeMounts[i]) { // not required + continue + } + + if m.VolumeMounts[i] != nil { + if err := m.VolumeMounts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this service binding based on the context it is used +func (m *ServiceBinding) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVolumeMounts(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBinding) contextValidateVolumeMounts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.VolumeMounts); i++ { + + if m.VolumeMounts[i] != nil { + if err := m.VolumeMounts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceBinding) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceBinding) UnmarshalBinary(b []byte) error { + var res ServiceBinding + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_request.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_request.go new file mode 100644 index 00000000000..dbadb948009 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_request.go @@ -0,0 +1,148 @@ +// 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" +) + +// ServiceBindingRequest service binding request +// +// swagger:model ServiceBindingRequest +type ServiceBindingRequest struct { + + // app guid + AppGUID string `json:"app_guid,omitempty"` + + // bind resource + BindResource *ServiceBindingResourceObject `json:"bind_resource,omitempty"` + + // context + Context Context `json:"context,omitempty"` + + // parameters + Parameters Object `json:"parameters,omitempty"` + + // plan id + // Required: true + PlanID *string `json:"plan_id"` + + // service id + // Required: true + ServiceID *string `json:"service_id"` +} + +// Validate validates this service binding request +func (m *ServiceBindingRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBindResource(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePlanID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServiceID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBindingRequest) validateBindResource(formats strfmt.Registry) error { + if swag.IsZero(m.BindResource) { // not required + return nil + } + + if m.BindResource != nil { + if err := m.BindResource.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bind_resource") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("bind_resource") + } + return err + } + } + + return nil +} + +func (m *ServiceBindingRequest) validatePlanID(formats strfmt.Registry) error { + + if err := validate.Required("plan_id", "body", m.PlanID); err != nil { + return err + } + + return nil +} + +func (m *ServiceBindingRequest) validateServiceID(formats strfmt.Registry) error { + + if err := validate.Required("service_id", "body", m.ServiceID); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this service binding request based on the context it is used +func (m *ServiceBindingRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateBindResource(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBindingRequest) contextValidateBindResource(ctx context.Context, formats strfmt.Registry) error { + + if m.BindResource != nil { + if err := m.BindResource.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("bind_resource") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("bind_resource") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceBindingRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceBindingRequest) UnmarshalBinary(b []byte) error { + var res ServiceBindingRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_resource.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_resource.go new file mode 100644 index 00000000000..4fcb7ce71c0 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_resource.go @@ -0,0 +1,128 @@ +// 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" +) + +// ServiceBindingResource service binding resource +// +// swagger:model ServiceBindingResource +type ServiceBindingResource struct { + + // credentials + Credentials Object `json:"credentials,omitempty"` + + // parameters + Parameters Object `json:"parameters,omitempty"` + + // route service url + RouteServiceURL string `json:"route_service_url,omitempty"` + + // syslog drain url + SyslogDrainURL string `json:"syslog_drain_url,omitempty"` + + // volume mounts + VolumeMounts []*ServiceBindingVolumeMount `json:"volume_mounts"` +} + +// Validate validates this service binding resource +func (m *ServiceBindingResource) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVolumeMounts(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBindingResource) validateVolumeMounts(formats strfmt.Registry) error { + if swag.IsZero(m.VolumeMounts) { // not required + return nil + } + + for i := 0; i < len(m.VolumeMounts); i++ { + if swag.IsZero(m.VolumeMounts[i]) { // not required + continue + } + + if m.VolumeMounts[i] != nil { + if err := m.VolumeMounts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this service binding resource based on the context it is used +func (m *ServiceBindingResource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVolumeMounts(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBindingResource) contextValidateVolumeMounts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.VolumeMounts); i++ { + + if m.VolumeMounts[i] != nil { + if err := m.VolumeMounts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volume_mounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceBindingResource) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceBindingResource) UnmarshalBinary(b []byte) error { + var res ServiceBindingResource + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_resource_object.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_resource_object.go new file mode 100644 index 00000000000..dc89fff63e5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_resource_object.go @@ -0,0 +1,53 @@ +// 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" +) + +// ServiceBindingResourceObject service binding resource object +// +// swagger:model ServiceBindingResourceObject +type ServiceBindingResourceObject struct { + + // app guid + AppGUID string `json:"app_guid,omitempty"` + + // route + Route string `json:"route,omitempty"` +} + +// Validate validates this service binding resource object +func (m *ServiceBindingResourceObject) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this service binding resource object based on context it is used +func (m *ServiceBindingResourceObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceBindingResourceObject) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceBindingResourceObject) UnmarshalBinary(b []byte) error { + var res ServiceBindingResourceObject + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_schema_object.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_schema_object.go new file mode 100644 index 00000000000..bb3ba6acc09 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_schema_object.go @@ -0,0 +1,104 @@ +// 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" +) + +// ServiceBindingSchemaObject service binding schema object +// +// swagger:model ServiceBindingSchemaObject +type ServiceBindingSchemaObject struct { + + // create + Create *SchemaParameters `json:"create,omitempty"` +} + +// Validate validates this service binding schema object +func (m *ServiceBindingSchemaObject) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBindingSchemaObject) validateCreate(formats strfmt.Registry) error { + if swag.IsZero(m.Create) { // not required + return nil + } + + if m.Create != nil { + if err := m.Create.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("create") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("create") + } + return err + } + } + + return nil +} + +// ContextValidate validate this service binding schema object based on the context it is used +func (m *ServiceBindingSchemaObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCreate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBindingSchemaObject) contextValidateCreate(ctx context.Context, formats strfmt.Registry) error { + + if m.Create != nil { + if err := m.Create.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("create") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("create") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceBindingSchemaObject) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceBindingSchemaObject) UnmarshalBinary(b []byte) error { + var res ServiceBindingSchemaObject + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_volume_mount.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_volume_mount.go new file mode 100644 index 00000000000..c077d6c0c45 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_volume_mount.go @@ -0,0 +1,243 @@ +// 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" +) + +// ServiceBindingVolumeMount service binding volume mount +// +// swagger:model ServiceBindingVolumeMount +type ServiceBindingVolumeMount struct { + + // container dir + // Required: true + ContainerDir *string `json:"container_dir"` + + // device + // Required: true + Device *ServiceBindingVolumeMountDevice `json:"device"` + + // device type + // Required: true + // Enum: [shared] + DeviceType *string `json:"device_type"` + + // driver + // Required: true + Driver *string `json:"driver"` + + // mode + // Required: true + // Enum: [r rw] + Mode *string `json:"mode"` +} + +// Validate validates this service binding volume mount +func (m *ServiceBindingVolumeMount) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateContainerDir(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDevice(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDeviceType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDriver(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMode(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBindingVolumeMount) validateContainerDir(formats strfmt.Registry) error { + + if err := validate.Required("container_dir", "body", m.ContainerDir); err != nil { + return err + } + + return nil +} + +func (m *ServiceBindingVolumeMount) validateDevice(formats strfmt.Registry) error { + + if err := validate.Required("device", "body", m.Device); err != nil { + return err + } + + if m.Device != nil { + if err := m.Device.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("device") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("device") + } + return err + } + } + + return nil +} + +var serviceBindingVolumeMountTypeDeviceTypePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["shared"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + serviceBindingVolumeMountTypeDeviceTypePropEnum = append(serviceBindingVolumeMountTypeDeviceTypePropEnum, v) + } +} + +const ( + + // ServiceBindingVolumeMountDeviceTypeShared captures enum value "shared" + ServiceBindingVolumeMountDeviceTypeShared string = "shared" +) + +// prop value enum +func (m *ServiceBindingVolumeMount) validateDeviceTypeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, serviceBindingVolumeMountTypeDeviceTypePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *ServiceBindingVolumeMount) validateDeviceType(formats strfmt.Registry) error { + + if err := validate.Required("device_type", "body", m.DeviceType); err != nil { + return err + } + + // value enum + if err := m.validateDeviceTypeEnum("device_type", "body", *m.DeviceType); err != nil { + return err + } + + return nil +} + +func (m *ServiceBindingVolumeMount) validateDriver(formats strfmt.Registry) error { + + if err := validate.Required("driver", "body", m.Driver); err != nil { + return err + } + + return nil +} + +var serviceBindingVolumeMountTypeModePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["r","rw"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + serviceBindingVolumeMountTypeModePropEnum = append(serviceBindingVolumeMountTypeModePropEnum, v) + } +} + +const ( + + // ServiceBindingVolumeMountModeR captures enum value "r" + ServiceBindingVolumeMountModeR string = "r" + + // ServiceBindingVolumeMountModeRw captures enum value "rw" + ServiceBindingVolumeMountModeRw string = "rw" +) + +// prop value enum +func (m *ServiceBindingVolumeMount) validateModeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, serviceBindingVolumeMountTypeModePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *ServiceBindingVolumeMount) validateMode(formats strfmt.Registry) error { + + if err := validate.Required("mode", "body", m.Mode); err != nil { + return err + } + + // value enum + if err := m.validateModeEnum("mode", "body", *m.Mode); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this service binding volume mount based on the context it is used +func (m *ServiceBindingVolumeMount) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDevice(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBindingVolumeMount) contextValidateDevice(ctx context.Context, formats strfmt.Registry) error { + + if m.Device != nil { + if err := m.Device.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("device") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("device") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceBindingVolumeMount) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceBindingVolumeMount) UnmarshalBinary(b []byte) error { + var res ServiceBindingVolumeMount + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_volume_mount_device.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_volume_mount_device.go new file mode 100644 index 00000000000..f95ff3f730a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_binding_volume_mount_device.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" +) + +// ServiceBindingVolumeMountDevice service binding volume mount device +// +// swagger:model ServiceBindingVolumeMountDevice +type ServiceBindingVolumeMountDevice struct { + + // mount config + MountConfig Object `json:"mount_config,omitempty"` + + // volume id + // Required: true + VolumeID *string `json:"volume_id"` +} + +// Validate validates this service binding volume mount device +func (m *ServiceBindingVolumeMountDevice) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVolumeID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceBindingVolumeMountDevice) validateVolumeID(formats strfmt.Registry) error { + + if err := validate.Required("volume_id", "body", m.VolumeID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this service binding volume mount device based on context it is used +func (m *ServiceBindingVolumeMountDevice) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceBindingVolumeMountDevice) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceBindingVolumeMountDevice) UnmarshalBinary(b []byte) error { + var res ServiceBindingVolumeMountDevice + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance.go new file mode 100644 index 00000000000..2c6ca23cdc2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance.go @@ -0,0 +1,105 @@ +// 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" +) + +// ServiceInstance service instance +// +// swagger:model ServiceInstance +type ServiceInstance struct { + + // Indicates (from the viewpoint of the provider) whether the service instance is (perceived) active or not and is meaningful if enabled is true. The default value is true if not specified. + // Required: true + Active *bool `json:"active"` + + // Indicates the current state of the service instance. + // Required: true + Enable *bool `json:"enable"` + + // Indicates when the service instance was last accessed or modified, and is meaningful if enabled is true AND active is false. Represented as milliseconds since the epoch, but does not need to be accurate to the second/hour. + // Required: true + LastActive *float64 `json:"last_active"` +} + +// Validate validates this service instance +func (m *ServiceInstance) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateActive(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastActive(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceInstance) validateActive(formats strfmt.Registry) error { + + if err := validate.Required("active", "body", m.Active); err != nil { + return err + } + + return nil +} + +func (m *ServiceInstance) validateEnable(formats strfmt.Registry) error { + + if err := validate.Required("enable", "body", m.Enable); err != nil { + return err + } + + return nil +} + +func (m *ServiceInstance) validateLastActive(formats strfmt.Registry) error { + + if err := validate.Required("last_active", "body", m.LastActive); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this service instance based on context it is used +func (m *ServiceInstance) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceInstance) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceInstance) UnmarshalBinary(b []byte) error { + var res ServiceInstance + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_async_operation.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_async_operation.go new file mode 100644 index 00000000000..2711e66730d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_async_operation.go @@ -0,0 +1,53 @@ +// 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" +) + +// ServiceInstanceAsyncOperation service instance async operation +// +// swagger:model ServiceInstanceAsyncOperation +type ServiceInstanceAsyncOperation struct { + + // dashboard url + DashboardURL string `json:"dashboard_url,omitempty"` + + // operation + Operation string `json:"operation,omitempty"` +} + +// Validate validates this service instance async operation +func (m *ServiceInstanceAsyncOperation) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this service instance async operation based on context it is used +func (m *ServiceInstanceAsyncOperation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceInstanceAsyncOperation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceInstanceAsyncOperation) UnmarshalBinary(b []byte) error { + var res ServiceInstanceAsyncOperation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_previous_values.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_previous_values.go new file mode 100644 index 00000000000..33c2f1c90bc --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_previous_values.go @@ -0,0 +1,59 @@ +// 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" +) + +// ServiceInstancePreviousValues service instance previous values +// +// swagger:model ServiceInstancePreviousValues +type ServiceInstancePreviousValues struct { + + // organization id + OrganizationID string `json:"organization_id,omitempty"` + + // plan id + PlanID string `json:"plan_id,omitempty"` + + // service id + ServiceID string `json:"service_id,omitempty"` + + // space id + SpaceID string `json:"space_id,omitempty"` +} + +// Validate validates this service instance previous values +func (m *ServiceInstancePreviousValues) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this service instance previous values based on context it is used +func (m *ServiceInstancePreviousValues) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceInstancePreviousValues) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceInstancePreviousValues) UnmarshalBinary(b []byte) error { + var res ServiceInstancePreviousValues + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_provision.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_provision.go new file mode 100644 index 00000000000..7fb520f2ef2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_provision.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" +) + +// ServiceInstanceProvision service instance provision +// +// swagger:model ServiceInstanceProvision +type ServiceInstanceProvision struct { + + // dashboard url + DashboardURL string `json:"dashboard_url,omitempty"` +} + +// Validate validates this service instance provision +func (m *ServiceInstanceProvision) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this service instance provision based on context it is used +func (m *ServiceInstanceProvision) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceInstanceProvision) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceInstanceProvision) UnmarshalBinary(b []byte) error { + var res ServiceInstanceProvision + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_provision_request.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_provision_request.go new file mode 100644 index 00000000000..6e84dd46502 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_provision_request.go @@ -0,0 +1,100 @@ +// 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" +) + +// ServiceInstanceProvisionRequest service instance provision request +// +// swagger:model ServiceInstanceProvisionRequest +type ServiceInstanceProvisionRequest struct { + + // context + Context Context `json:"context,omitempty"` + + // organization guid + OrganizationGUID string `json:"organization_guid,omitempty"` + + // parameters + Parameters Object `json:"parameters,omitempty"` + + // plan id + // Required: true + PlanID *string `json:"plan_id"` + + // service id + // Required: true + ServiceID *string `json:"service_id"` + + // space guid + SpaceGUID string `json:"space_guid,omitempty"` +} + +// Validate validates this service instance provision request +func (m *ServiceInstanceProvisionRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePlanID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServiceID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceInstanceProvisionRequest) validatePlanID(formats strfmt.Registry) error { + + if err := validate.Required("plan_id", "body", m.PlanID); err != nil { + return err + } + + return nil +} + +func (m *ServiceInstanceProvisionRequest) validateServiceID(formats strfmt.Registry) error { + + if err := validate.Required("service_id", "body", m.ServiceID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this service instance provision request based on context it is used +func (m *ServiceInstanceProvisionRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceInstanceProvisionRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceInstanceProvisionRequest) UnmarshalBinary(b []byte) error { + var res ServiceInstanceProvisionRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_request.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_request.go new file mode 100644 index 00000000000..67afe7a14eb --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_request.go @@ -0,0 +1,77 @@ +// 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" +) + +// ServiceInstanceRequest service instance request +// +// swagger:model ServiceInstanceRequest +type ServiceInstanceRequest struct { + + // Indicates the current state of the service instance. + // Required: true + Enabled *bool `json:"enabled"` + + // Optional string stating the reason code for the service instance state change. Valid values are BMX_ACCT_ACTIVATE, BMX_SERVICE_INSTANCE_BELOW_CAP for enable calls, and BMX_ACCT_SUSPEND, BMX_SERVICE_INSTANCE_ABOVE_CAP for disable calls. + InitiatorID string `json:"initiator_id,omitempty"` + + // Optional string showing the user id initiating the call + ReasonCode string `json:"reason_code,omitempty"` +} + +// Validate validates this service instance request +func (m *ServiceInstanceRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEnabled(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceInstanceRequest) validateEnabled(formats strfmt.Registry) error { + + if err := validate.Required("enabled", "body", m.Enabled); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this service instance request based on context it is used +func (m *ServiceInstanceRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceInstanceRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceInstanceRequest) UnmarshalBinary(b []byte) error { + var res ServiceInstanceRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_resource.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_resource.go new file mode 100644 index 00000000000..1a7b2da7e78 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_resource.go @@ -0,0 +1,59 @@ +// 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" +) + +// ServiceInstanceResource service instance resource +// +// swagger:model ServiceInstanceResource +type ServiceInstanceResource struct { + + // dashboard url + DashboardURL string `json:"dashboard_url,omitempty"` + + // parameters + Parameters Object `json:"parameters,omitempty"` + + // plan id + PlanID string `json:"plan_id,omitempty"` + + // service id + ServiceID string `json:"service_id,omitempty"` +} + +// Validate validates this service instance resource +func (m *ServiceInstanceResource) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this service instance resource based on context it is used +func (m *ServiceInstanceResource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceInstanceResource) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceInstanceResource) UnmarshalBinary(b []byte) error { + var res ServiceInstanceResource + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_schema_object.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_schema_object.go new file mode 100644 index 00000000000..fb085f5fbea --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_schema_object.go @@ -0,0 +1,150 @@ +// 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" +) + +// ServiceInstanceSchemaObject service instance schema object +// +// swagger:model ServiceInstanceSchemaObject +type ServiceInstanceSchemaObject struct { + + // create + Create *SchemaParameters `json:"create,omitempty"` + + // update + Update *SchemaParameters `json:"update,omitempty"` +} + +// Validate validates this service instance schema object +func (m *ServiceInstanceSchemaObject) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUpdate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceInstanceSchemaObject) validateCreate(formats strfmt.Registry) error { + if swag.IsZero(m.Create) { // not required + return nil + } + + if m.Create != nil { + if err := m.Create.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("create") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("create") + } + return err + } + } + + return nil +} + +func (m *ServiceInstanceSchemaObject) validateUpdate(formats strfmt.Registry) error { + if swag.IsZero(m.Update) { // not required + return nil + } + + if m.Update != nil { + if err := m.Update.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("update") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("update") + } + return err + } + } + + return nil +} + +// ContextValidate validate this service instance schema object based on the context it is used +func (m *ServiceInstanceSchemaObject) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCreate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUpdate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceInstanceSchemaObject) contextValidateCreate(ctx context.Context, formats strfmt.Registry) error { + + if m.Create != nil { + if err := m.Create.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("create") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("create") + } + return err + } + } + + return nil +} + +func (m *ServiceInstanceSchemaObject) contextValidateUpdate(ctx context.Context, formats strfmt.Registry) error { + + if m.Update != nil { + if err := m.Update.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("update") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("update") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceInstanceSchemaObject) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceInstanceSchemaObject) UnmarshalBinary(b []byte) error { + var res ServiceInstanceSchemaObject + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_update_request.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_update_request.go new file mode 100644 index 00000000000..b4a4079544e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/service_instance_update_request.go @@ -0,0 +1,131 @@ +// 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" +) + +// ServiceInstanceUpdateRequest service instance update request +// +// swagger:model ServiceInstanceUpdateRequest +type ServiceInstanceUpdateRequest struct { + + // context + Context Context `json:"context,omitempty"` + + // parameters + Parameters Object `json:"parameters,omitempty"` + + // plan id + PlanID string `json:"plan_id,omitempty"` + + // previous values + PreviousValues *ServiceInstancePreviousValues `json:"previous_values,omitempty"` + + // service id + // Required: true + ServiceID *string `json:"service_id"` +} + +// Validate validates this service instance update request +func (m *ServiceInstanceUpdateRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePreviousValues(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServiceID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceInstanceUpdateRequest) validatePreviousValues(formats strfmt.Registry) error { + if swag.IsZero(m.PreviousValues) { // not required + return nil + } + + if m.PreviousValues != nil { + if err := m.PreviousValues.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("previous_values") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("previous_values") + } + return err + } + } + + return nil +} + +func (m *ServiceInstanceUpdateRequest) validateServiceID(formats strfmt.Registry) error { + + if err := validate.Required("service_id", "body", m.ServiceID); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this service instance update request based on the context it is used +func (m *ServiceInstanceUpdateRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePreviousValues(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ServiceInstanceUpdateRequest) contextValidatePreviousValues(ctx context.Context, formats strfmt.Registry) error { + + if m.PreviousValues != nil { + if err := m.PreviousValues.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("previous_values") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("previous_values") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ServiceInstanceUpdateRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ServiceInstanceUpdateRequest) UnmarshalBinary(b []byte) error { + var res ServiceInstanceUpdateRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshot.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshot.go new file mode 100644 index 00000000000..c5d2fc31ea5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshot.go @@ -0,0 +1,174 @@ +// 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" +) + +// Snapshot snapshot +// +// swagger:model Snapshot +type Snapshot struct { + + // Action performed on the instance snapshot + Action string `json:"action,omitempty"` + + // Creation Date + // Format: date-time + CreationDate strfmt.DateTime `json:"creationDate,omitempty"` + + // Description of the PVM instance snapshot + Description string `json:"description,omitempty"` + + // Last Update Date + // Format: date-time + LastUpdateDate strfmt.DateTime `json:"lastUpdateDate,omitempty"` + + // Name of the PVM instance snapshot + // Required: true + Name *string `json:"name"` + + // Snapshot completion percentage + PercentComplete int64 `json:"percentComplete,omitempty"` + + // PCloud PVM Instance ID + // Required: true + PvmInstanceID *string `json:"pvmInstanceID"` + + // ID of the PVM instance snapshot + // Required: true + SnapshotID *string `json:"snapshotID"` + + // Status of the PVM instancesnapshot + Status string `json:"status,omitempty"` + + // A map of volume snapshots included in the PVM instance snapshot + // Required: true + VolumeSnapshots map[string]string `json:"volumeSnapshots"` +} + +// Validate validates this snapshot +func (m *Snapshot) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreationDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastUpdateDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePvmInstanceID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSnapshotID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVolumeSnapshots(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Snapshot) validateCreationDate(formats strfmt.Registry) error { + if swag.IsZero(m.CreationDate) { // not required + return nil + } + + if err := validate.FormatOf("creationDate", "body", "date-time", m.CreationDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Snapshot) validateLastUpdateDate(formats strfmt.Registry) error { + if swag.IsZero(m.LastUpdateDate) { // not required + return nil + } + + if err := validate.FormatOf("lastUpdateDate", "body", "date-time", m.LastUpdateDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Snapshot) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *Snapshot) validatePvmInstanceID(formats strfmt.Registry) error { + + if err := validate.Required("pvmInstanceID", "body", m.PvmInstanceID); err != nil { + return err + } + + return nil +} + +func (m *Snapshot) validateSnapshotID(formats strfmt.Registry) error { + + if err := validate.Required("snapshotID", "body", m.SnapshotID); err != nil { + return err + } + + return nil +} + +func (m *Snapshot) validateVolumeSnapshots(formats strfmt.Registry) error { + + if err := validate.Required("volumeSnapshots", "body", m.VolumeSnapshots); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this snapshot based on context it is used +func (m *Snapshot) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Snapshot) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Snapshot) UnmarshalBinary(b []byte) error { + var res Snapshot + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshot_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshot_create.go new file mode 100644 index 00000000000..003771100e4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshot_create.go @@ -0,0 +1,77 @@ +// 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" +) + +// SnapshotCreate snapshot create +// +// swagger:model SnapshotCreate +type SnapshotCreate struct { + + // Description of the PVM instance snapshot + Description string `json:"description,omitempty"` + + // Name of the PVM instance snapshot to create + // Required: true + Name *string `json:"name"` + + // List of volumes to include in the PVM instance snapshot + VolumeIDs []string `json:"volumeIDs"` +} + +// Validate validates this snapshot create +func (m *SnapshotCreate) 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 *SnapshotCreate) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this snapshot create based on context it is used +func (m *SnapshotCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SnapshotCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SnapshotCreate) UnmarshalBinary(b []byte) error { + var res SnapshotCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshot_create_response.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshot_create_response.go new file mode 100644 index 00000000000..61214fb351e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshot_create_response.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" +) + +// SnapshotCreateResponse snapshot create response +// +// swagger:model SnapshotCreateResponse +type SnapshotCreateResponse struct { + + // ID of the PVM instance snapshot + // Required: true + SnapshotID *string `json:"snapshotID"` +} + +// Validate validates this snapshot create response +func (m *SnapshotCreateResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSnapshotID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SnapshotCreateResponse) validateSnapshotID(formats strfmt.Registry) error { + + if err := validate.Required("snapshotID", "body", m.SnapshotID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this snapshot create response based on context it is used +func (m *SnapshotCreateResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SnapshotCreateResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SnapshotCreateResponse) UnmarshalBinary(b []byte) error { + var res SnapshotCreateResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshot_restore.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshot_restore.go new file mode 100644 index 00000000000..b2effe1ffaa --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshot_restore.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" +) + +// SnapshotRestore snapshot restore +// +// swagger:model SnapshotRestore +type SnapshotRestore struct { + + // By default the VM must be shutoff during a snapshot restore, force set to true will relax the VM shutoff pre-condition. + Force *bool `json:"force,omitempty"` +} + +// Validate validates this snapshot restore +func (m *SnapshotRestore) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this snapshot restore based on context it is used +func (m *SnapshotRestore) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SnapshotRestore) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SnapshotRestore) UnmarshalBinary(b []byte) error { + var res SnapshotRestore + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshot_update.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshot_update.go new file mode 100644 index 00000000000..162102e53d9 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshot_update.go @@ -0,0 +1,53 @@ +// 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" +) + +// SnapshotUpdate snapshot update +// +// swagger:model SnapshotUpdate +type SnapshotUpdate struct { + + // Description of the PVM instance snapshot + Description string `json:"description,omitempty"` + + // Name of the PVM instance snapshot + Name string `json:"name,omitempty"` +} + +// Validate validates this snapshot update +func (m *SnapshotUpdate) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this snapshot update based on context it is used +func (m *SnapshotUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SnapshotUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SnapshotUpdate) UnmarshalBinary(b []byte) error { + var res SnapshotUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshots.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshots.go new file mode 100644 index 00000000000..276c6119a8e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/snapshots.go @@ -0,0 +1,119 @@ +// 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" +) + +// Snapshots snapshots +// +// swagger:model Snapshots +type Snapshots struct { + + // List of PVM instance snapshots + // Required: true + Snapshots []*Snapshot `json:"snapshots"` +} + +// Validate validates this snapshots +func (m *Snapshots) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSnapshots(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Snapshots) validateSnapshots(formats strfmt.Registry) error { + + if err := validate.Required("snapshots", "body", m.Snapshots); err != nil { + return err + } + + for i := 0; i < len(m.Snapshots); i++ { + if swag.IsZero(m.Snapshots[i]) { // not required + continue + } + + if m.Snapshots[i] != nil { + if err := m.Snapshots[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("snapshots" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("snapshots" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this snapshots based on the context it is used +func (m *Snapshots) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSnapshots(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Snapshots) contextValidateSnapshots(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Snapshots); i++ { + + if m.Snapshots[i] != nil { + if err := m.Snapshots[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("snapshots" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("snapshots" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Snapshots) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Snapshots) UnmarshalBinary(b []byte) error { + var res Snapshots + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/softlayer_subscription.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/softlayer_subscription.go new file mode 100644 index 00000000000..26941f4fcdb --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/softlayer_subscription.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" +) + +// SoftlayerSubscription Softlayer subscription object +// +// swagger:model SoftlayerSubscription +type SoftlayerSubscription struct { + + // Softlayer ID + // Required: true + ID *string `json:"id"` + + // State of softlayer subscription + // Required: true + State *string `json:"state"` +} + +// Validate validates this softlayer subscription +func (m *SoftlayerSubscription) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SoftlayerSubscription) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *SoftlayerSubscription) validateState(formats strfmt.Registry) error { + + if err := validate.Required("state", "body", m.State); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this softlayer subscription based on context it is used +func (m *SoftlayerSubscription) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SoftlayerSubscription) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SoftlayerSubscription) UnmarshalBinary(b []byte) error { + var res SoftlayerSubscription + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/software_licenses.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/software_licenses.go new file mode 100644 index 00000000000..ae855dccaaf --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/software_licenses.go @@ -0,0 +1,62 @@ +// 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" +) + +// SoftwareLicenses software licenses +// +// swagger:model SoftwareLicenses +type SoftwareLicenses struct { + + // IBMi Cloud Storage Solution + IbmiCSS *bool `json:"ibmiCSS,omitempty"` + + // IBMi Cloud Storage Solution + IbmiDBQ *bool `json:"ibmiDBQ,omitempty"` + + // IBMi Power High Availability + IbmiPHA *bool `json:"ibmiPHA,omitempty"` + + // IBMi Rational Dev Studio + IbmiRDS *bool `json:"ibmiRDS,omitempty"` + + // IBMi Rational Dev Studio Number of User Licenses + IbmiRDSUsers int64 `json:"ibmiRDSUsers,omitempty"` +} + +// Validate validates this software licenses +func (m *SoftwareLicenses) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this software licenses based on context it is used +func (m *SoftwareLicenses) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SoftwareLicenses) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SoftwareLicenses) UnmarshalBinary(b []byte) error { + var res SoftwareLicenses + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/ssh_key.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ssh_key.go new file mode 100644 index 00000000000..5112e6cd084 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ssh_key.go @@ -0,0 +1,108 @@ +// 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" +) + +// SSHKey SSH key +// +// swagger:model SSHKey +type SSHKey struct { + + // Date of sshkey creation + // Format: date-time + CreationDate *strfmt.DateTime `json:"creationDate,omitempty" datastore:"creationDate"` + + // User defined name for the SSH key + // Required: true + Name *string `json:"name" datastore:"name"` + + // SSH RSA key + // Required: true + SSHKey *string `json:"sshKey" datastore:"sshKey"` +} + +// Validate validates this SSH key +func (m *SSHKey) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreationDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSSHKey(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SSHKey) validateCreationDate(formats strfmt.Registry) error { + if swag.IsZero(m.CreationDate) { // not required + return nil + } + + if err := validate.FormatOf("creationDate", "body", "date-time", m.CreationDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *SSHKey) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *SSHKey) validateSSHKey(formats strfmt.Registry) error { + + if err := validate.Required("sshKey", "body", m.SSHKey); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this SSH key based on context it is used +func (m *SSHKey) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SSHKey) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SSHKey) UnmarshalBinary(b []byte) error { + var res SSHKey + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/ssh_keys.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ssh_keys.go new file mode 100644 index 00000000000..ae4e4cd5f66 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/ssh_keys.go @@ -0,0 +1,119 @@ +// 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" +) + +// SSHKeys SSH keys +// +// swagger:model SSHKeys +type SSHKeys struct { + + // SSH Keys + // Required: true + SSHKeys []*SSHKey `json:"sshKeys"` +} + +// Validate validates this SSH keys +func (m *SSHKeys) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSSHKeys(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SSHKeys) validateSSHKeys(formats strfmt.Registry) error { + + if err := validate.Required("sshKeys", "body", m.SSHKeys); err != nil { + return err + } + + for i := 0; i < len(m.SSHKeys); i++ { + if swag.IsZero(m.SSHKeys[i]) { // not required + continue + } + + if m.SSHKeys[i] != nil { + if err := m.SSHKeys[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sshKeys" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sshKeys" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this SSH keys based on the context it is used +func (m *SSHKeys) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateSSHKeys(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SSHKeys) contextValidateSSHKeys(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.SSHKeys); i++ { + + if m.SSHKeys[i] != nil { + if err := m.SSHKeys[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sshKeys" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sshKeys" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SSHKeys) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SSHKeys) UnmarshalBinary(b []byte) error { + var res SSHKeys + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/status.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/status.go new file mode 100644 index 00000000000..b62214580fd --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/status.go @@ -0,0 +1,91 @@ +// 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" +) + +// Status status +// +// swagger:model Status +type Status struct { + + // message detailing current state + Message string `json:"message,omitempty"` + + // progress of a job + // Required: true + Progress *string `json:"progress"` + + // state of a job + // Required: true + State *string `json:"state"` +} + +// Validate validates this status +func (m *Status) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateProgress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Status) validateProgress(formats strfmt.Registry) error { + + if err := validate.Required("progress", "body", m.Progress); err != nil { + return err + } + + return nil +} + +func (m *Status) validateState(formats strfmt.Registry) error { + + if err := validate.Required("state", "body", m.State); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this status based on context it is used +func (m *Status) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Status) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Status) UnmarshalBinary(b []byte) error { + var res Status + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/stock_image.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/stock_image.go new file mode 100644 index 00000000000..5ec533e3177 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/stock_image.go @@ -0,0 +1,56 @@ +// 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" +) + +// StockImage Stock image detail +// +// swagger:model StockImage +type StockImage struct { + + // Image ID + ID string `json:"id,omitempty"` + + // Storage pool for a stock image + StoragePool string `json:"storagePool,omitempty"` + + // Storage type for a stock image + StorageType string `json:"storageType,omitempty"` +} + +// Validate validates this stock image +func (m *StockImage) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this stock image based on context it is used +func (m *StockImage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *StockImage) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StockImage) UnmarshalBinary(b []byte) error { + var res StockImage + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/stock_images.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/stock_images.go new file mode 100644 index 00000000000..8ad0b319847 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/stock_images.go @@ -0,0 +1,73 @@ +// 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" +) + +// StockImages List of stock images +// +// swagger:model StockImages +type StockImages []*StockImage + +// Validate validates this stock images +func (m StockImages) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this stock images based on the context it is used +func (m StockImages) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_affinity.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_affinity.go new file mode 100644 index 00000000000..071b9891ab8 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_affinity.go @@ -0,0 +1,117 @@ +// 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" +) + +// StorageAffinity storage affinity +// +// swagger:model StorageAffinity +type StorageAffinity struct { + + // PVM Instance (ID or Name) to base storage affinity policy against; required if requesting storage affinity and affinityVolume is not provided + AffinityPVMInstance *string `json:"affinityPVMInstance,omitempty"` + + // Affinity policy for storage pool selection; ignored if storagePool provided; for policy 'affinity' requires one of affinityPVMInstance or affinityVolume to be specified; for policy 'anti-affinity' requires one of antiAffinityPVMInstances or antiAffinityVolumes to be specified + // Enum: [affinity anti-affinity] + AffinityPolicy *string `json:"affinityPolicy,omitempty"` + + // Volume (ID or Name) to base storage affinity policy against; required if requesting storage affinity and affinityPVMInstance is not provided + AffinityVolume *string `json:"affinityVolume,omitempty"` + + // List of pvmInstances to base storage anti-affinity policy against; required if requesting storage anti-affinity and antiAffinityVolumes is not provided + AntiAffinityPVMInstances []string `json:"antiAffinityPVMInstances"` + + // List of volumes to base storage anti-affinity policy against; required if requesting storage anti-affinity and antiAffinityPVMInstances is not provided + AntiAffinityVolumes []string `json:"antiAffinityVolumes"` +} + +// Validate validates this storage affinity +func (m *StorageAffinity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAffinityPolicy(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var storageAffinityTypeAffinityPolicyPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["affinity","anti-affinity"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + storageAffinityTypeAffinityPolicyPropEnum = append(storageAffinityTypeAffinityPolicyPropEnum, v) + } +} + +const ( + + // StorageAffinityAffinityPolicyAffinity captures enum value "affinity" + StorageAffinityAffinityPolicyAffinity string = "affinity" + + // StorageAffinityAffinityPolicyAntiDashAffinity captures enum value "anti-affinity" + StorageAffinityAffinityPolicyAntiDashAffinity string = "anti-affinity" +) + +// prop value enum +func (m *StorageAffinity) validateAffinityPolicyEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, storageAffinityTypeAffinityPolicyPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *StorageAffinity) validateAffinityPolicy(formats strfmt.Registry) error { + if swag.IsZero(m.AffinityPolicy) { // not required + return nil + } + + // value enum + if err := m.validateAffinityPolicyEnum("affinityPolicy", "body", *m.AffinityPolicy); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this storage affinity based on context it is used +func (m *StorageAffinity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *StorageAffinity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StorageAffinity) UnmarshalBinary(b []byte) error { + var res StorageAffinity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_entities.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_entities.go new file mode 100644 index 00000000000..5f8c6e8f7cc --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_entities.go @@ -0,0 +1,53 @@ +// 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" +) + +// StorageEntities storage entities +// +// swagger:model StorageEntities +type StorageEntities struct { + + // threshold value to apply to an existing storage entity + ExistingEntity int64 `json:"existingEntity,omitempty"` + + // threshold value to apply to a new storage entity + NewEntity int64 `json:"newEntity,omitempty"` +} + +// Validate validates this storage entities +func (m *StorageEntities) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this storage entities based on context it is used +func (m *StorageEntities) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *StorageEntities) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StorageEntities) UnmarshalBinary(b []byte) error { + var res StorageEntities + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_pool.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_pool.go new file mode 100644 index 00000000000..ab18cac6d00 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_pool.go @@ -0,0 +1,226 @@ +// 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" +) + +// StoragePool storage pool +// +// swagger:model StoragePool +type StoragePool struct { + + // display name of storage pool + // Required: true + DisplayName *string `json:"displayName"` + + // indicates if the storage pool is disaster recovery (dr) enabled + // Required: true + DrEnabled *bool `json:"drEnabled"` + + // name of storage pool + // Required: true + Name *string `json:"name"` + + // threshold override settings of a pool + OverrideThresholds *Thresholds `json:"overrideThresholds,omitempty"` + + // state of storage pool + // Required: true + // Enum: [closed opened] + State *string `json:"state"` + + // type of storage pool + // Required: true + Type *string `json:"type"` +} + +// Validate validates this storage pool +func (m *StoragePool) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDisplayName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDrEnabled(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOverrideThresholds(formats); err != nil { + res = append(res, err) + } + + if err := m.validateState(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 *StoragePool) validateDisplayName(formats strfmt.Registry) error { + + if err := validate.Required("displayName", "body", m.DisplayName); err != nil { + return err + } + + return nil +} + +func (m *StoragePool) validateDrEnabled(formats strfmt.Registry) error { + + if err := validate.Required("drEnabled", "body", m.DrEnabled); err != nil { + return err + } + + return nil +} + +func (m *StoragePool) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *StoragePool) validateOverrideThresholds(formats strfmt.Registry) error { + if swag.IsZero(m.OverrideThresholds) { // not required + return nil + } + + if m.OverrideThresholds != nil { + if err := m.OverrideThresholds.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("overrideThresholds") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("overrideThresholds") + } + return err + } + } + + return nil +} + +var storagePoolTypeStatePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["closed","opened"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + storagePoolTypeStatePropEnum = append(storagePoolTypeStatePropEnum, v) + } +} + +const ( + + // StoragePoolStateClosed captures enum value "closed" + StoragePoolStateClosed string = "closed" + + // StoragePoolStateOpened captures enum value "opened" + StoragePoolStateOpened string = "opened" +) + +// prop value enum +func (m *StoragePool) validateStateEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, storagePoolTypeStatePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *StoragePool) 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 +} + +func (m *StoragePool) validateType(formats strfmt.Registry) error { + + if err := validate.Required("type", "body", m.Type); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this storage pool based on the context it is used +func (m *StoragePool) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOverrideThresholds(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StoragePool) contextValidateOverrideThresholds(ctx context.Context, formats strfmt.Registry) error { + + if m.OverrideThresholds != nil { + if err := m.OverrideThresholds.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("overrideThresholds") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("overrideThresholds") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *StoragePool) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StoragePool) UnmarshalBinary(b []byte) error { + var res StoragePool + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_pool_capacity.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_pool_capacity.go new file mode 100644 index 00000000000..6b233d6baf2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_pool_capacity.go @@ -0,0 +1,80 @@ +// 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" +) + +// StoragePoolCapacity Storage pool capacity +// +// swagger:model StoragePoolCapacity +type StoragePoolCapacity struct { + + // Maximum allocation storage size (GB) + // Required: true + MaxAllocationSize *int64 `json:"maxAllocationSize"` + + // Pool name + PoolName string `json:"poolName,omitempty"` + + // Storage type of the storage pool + StorageType string `json:"storageType,omitempty"` + + // Total pool capacity (GB) + TotalCapacity int64 `json:"totalCapacity,omitempty"` +} + +// Validate validates this storage pool capacity +func (m *StoragePoolCapacity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMaxAllocationSize(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StoragePoolCapacity) validateMaxAllocationSize(formats strfmt.Registry) error { + + if err := validate.Required("maxAllocationSize", "body", m.MaxAllocationSize); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this storage pool capacity based on context it is used +func (m *StoragePoolCapacity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *StoragePoolCapacity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StoragePoolCapacity) UnmarshalBinary(b []byte) error { + var res StoragePoolCapacity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_pools.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_pools.go new file mode 100644 index 00000000000..622e1e19fb5 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_pools.go @@ -0,0 +1,73 @@ +// 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" +) + +// StoragePools list of storage pools for a region-zone +// +// swagger:model StoragePools +type StoragePools []*StoragePool + +// Validate validates this storage pools +func (m StoragePools) Validate(formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + if swag.IsZero(m[i]) { // not required + continue + } + + if m[i] != nil { + if err := m[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this storage pools based on the context it is used +func (m StoragePools) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for i := 0; i < len(m); i++ { + + if m[i] != nil { + if err := m[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(strconv.Itoa(i)) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_pools_capacity.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_pools_capacity.go new file mode 100644 index 00000000000..ad6c04653b1 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_pools_capacity.go @@ -0,0 +1,162 @@ +// 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" +) + +// StoragePoolsCapacity Storage capacity for all storage pools +// +// swagger:model StoragePoolsCapacity +type StoragePoolsCapacity struct { + + // maximum storage allocation + MaximumStorageAllocation *MaximumStorageAllocation `json:"maximumStorageAllocation,omitempty"` + + // storage pools capacity + StoragePoolsCapacity []*StoragePoolCapacity `json:"storagePoolsCapacity"` +} + +// Validate validates this storage pools capacity +func (m *StoragePoolsCapacity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMaximumStorageAllocation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStoragePoolsCapacity(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StoragePoolsCapacity) validateMaximumStorageAllocation(formats strfmt.Registry) error { + if swag.IsZero(m.MaximumStorageAllocation) { // not required + return nil + } + + if m.MaximumStorageAllocation != nil { + if err := m.MaximumStorageAllocation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maximumStorageAllocation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maximumStorageAllocation") + } + return err + } + } + + return nil +} + +func (m *StoragePoolsCapacity) validateStoragePoolsCapacity(formats strfmt.Registry) error { + if swag.IsZero(m.StoragePoolsCapacity) { // not required + return nil + } + + for i := 0; i < len(m.StoragePoolsCapacity); i++ { + if swag.IsZero(m.StoragePoolsCapacity[i]) { // not required + continue + } + + if m.StoragePoolsCapacity[i] != nil { + if err := m.StoragePoolsCapacity[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this storage pools capacity based on the context it is used +func (m *StoragePoolsCapacity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMaximumStorageAllocation(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStoragePoolsCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StoragePoolsCapacity) contextValidateMaximumStorageAllocation(ctx context.Context, formats strfmt.Registry) error { + + if m.MaximumStorageAllocation != nil { + if err := m.MaximumStorageAllocation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maximumStorageAllocation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maximumStorageAllocation") + } + return err + } + } + + return nil +} + +func (m *StoragePoolsCapacity) contextValidateStoragePoolsCapacity(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.StoragePoolsCapacity); i++ { + + if m.StoragePoolsCapacity[i] != nil { + if err := m.StoragePoolsCapacity[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *StoragePoolsCapacity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StoragePoolsCapacity) UnmarshalBinary(b []byte) error { + var res StoragePoolsCapacity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_type.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_type.go new file mode 100644 index 00000000000..4af1f8954aa --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_type.go @@ -0,0 +1,114 @@ +// 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" +) + +// StorageType Storage type detail +// +// swagger:model StorageType +type StorageType struct { + + // Identifies if the storage type is the default for a region + Default bool `json:"default,omitempty"` + + // Description, storage type label + Description string `json:"description,omitempty"` + + // State of the storage type (active or inactive) + // Enum: [active inactive] + State *string `json:"state,omitempty"` + + // Storage type + Type string `json:"type,omitempty"` +} + +// Validate validates this storage type +func (m *StorageType) 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 storageTypeTypeStatePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["active","inactive"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + storageTypeTypeStatePropEnum = append(storageTypeTypeStatePropEnum, v) + } +} + +const ( + + // StorageTypeStateActive captures enum value "active" + StorageTypeStateActive string = "active" + + // StorageTypeStateInactive captures enum value "inactive" + StorageTypeStateInactive string = "inactive" +) + +// prop value enum +func (m *StorageType) validateStateEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, storageTypeTypeStatePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *StorageType) validateState(formats strfmt.Registry) error { + if swag.IsZero(m.State) { // not required + return nil + } + + // value enum + if err := m.validateStateEnum("state", "body", *m.State); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this storage type based on context it is used +func (m *StorageType) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *StorageType) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StorageType) UnmarshalBinary(b []byte) error { + var res StorageType + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_type_capacity.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_type_capacity.go new file mode 100644 index 00000000000..4ac3bf6dee4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_type_capacity.go @@ -0,0 +1,165 @@ +// 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" +) + +// StorageTypeCapacity Storage type capacity +// +// swagger:model StorageTypeCapacity +type StorageTypeCapacity struct { + + // maximum storage allocation + MaximumStorageAllocation *MaximumStorageAllocation `json:"maximumStorageAllocation,omitempty"` + + // List of storage pool capacity for storage type + StoragePoolsCapacity []*StoragePoolCapacity `json:"storagePoolsCapacity"` + + // Storage type + StorageType string `json:"storageType,omitempty"` +} + +// Validate validates this storage type capacity +func (m *StorageTypeCapacity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMaximumStorageAllocation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStoragePoolsCapacity(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StorageTypeCapacity) validateMaximumStorageAllocation(formats strfmt.Registry) error { + if swag.IsZero(m.MaximumStorageAllocation) { // not required + return nil + } + + if m.MaximumStorageAllocation != nil { + if err := m.MaximumStorageAllocation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maximumStorageAllocation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maximumStorageAllocation") + } + return err + } + } + + return nil +} + +func (m *StorageTypeCapacity) validateStoragePoolsCapacity(formats strfmt.Registry) error { + if swag.IsZero(m.StoragePoolsCapacity) { // not required + return nil + } + + for i := 0; i < len(m.StoragePoolsCapacity); i++ { + if swag.IsZero(m.StoragePoolsCapacity[i]) { // not required + continue + } + + if m.StoragePoolsCapacity[i] != nil { + if err := m.StoragePoolsCapacity[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this storage type capacity based on the context it is used +func (m *StorageTypeCapacity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMaximumStorageAllocation(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStoragePoolsCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StorageTypeCapacity) contextValidateMaximumStorageAllocation(ctx context.Context, formats strfmt.Registry) error { + + if m.MaximumStorageAllocation != nil { + if err := m.MaximumStorageAllocation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maximumStorageAllocation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maximumStorageAllocation") + } + return err + } + } + + return nil +} + +func (m *StorageTypeCapacity) contextValidateStoragePoolsCapacity(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.StoragePoolsCapacity); i++ { + + if m.StoragePoolsCapacity[i] != nil { + if err := m.StoragePoolsCapacity[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storagePoolsCapacity" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *StorageTypeCapacity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StorageTypeCapacity) UnmarshalBinary(b []byte) error { + var res StorageTypeCapacity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_types.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_types.go new file mode 100644 index 00000000000..d00c9cd4e4e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_types.go @@ -0,0 +1,69 @@ +// 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/validate" +) + +// StorageTypes A map of an array of storage types supported in a region +// +// swagger:model StorageTypes +type StorageTypes map[string]RegionStorageTypes + +// Validate validates this storage types +func (m StorageTypes) Validate(formats strfmt.Registry) error { + var res []error + + for k := range m { + + if err := validate.Required(k, "body", m[k]); err != nil { + return err + } + + if err := m[k].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(k) + } + return err + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this storage types based on the context it is used +func (m StorageTypes) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for k := range m { + + if err := m[k].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(k) + } + return err + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_types_capacity.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_types_capacity.go new file mode 100644 index 00000000000..de163af979e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/storage_types_capacity.go @@ -0,0 +1,162 @@ +// 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" +) + +// StorageTypesCapacity Storage types capacity +// +// swagger:model StorageTypesCapacity +type StorageTypesCapacity struct { + + // maximum storage allocation + MaximumStorageAllocation *MaximumStorageAllocation `json:"maximumStorageAllocation,omitempty"` + + // storage types capacity + StorageTypesCapacity []*StorageTypeCapacity `json:"storageTypesCapacity"` +} + +// Validate validates this storage types capacity +func (m *StorageTypesCapacity) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMaximumStorageAllocation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStorageTypesCapacity(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StorageTypesCapacity) validateMaximumStorageAllocation(formats strfmt.Registry) error { + if swag.IsZero(m.MaximumStorageAllocation) { // not required + return nil + } + + if m.MaximumStorageAllocation != nil { + if err := m.MaximumStorageAllocation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maximumStorageAllocation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maximumStorageAllocation") + } + return err + } + } + + return nil +} + +func (m *StorageTypesCapacity) validateStorageTypesCapacity(formats strfmt.Registry) error { + if swag.IsZero(m.StorageTypesCapacity) { // not required + return nil + } + + for i := 0; i < len(m.StorageTypesCapacity); i++ { + if swag.IsZero(m.StorageTypesCapacity[i]) { // not required + continue + } + + if m.StorageTypesCapacity[i] != nil { + if err := m.StorageTypesCapacity[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageTypesCapacity" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageTypesCapacity" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this storage types capacity based on the context it is used +func (m *StorageTypesCapacity) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMaximumStorageAllocation(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStorageTypesCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StorageTypesCapacity) contextValidateMaximumStorageAllocation(ctx context.Context, formats strfmt.Registry) error { + + if m.MaximumStorageAllocation != nil { + if err := m.MaximumStorageAllocation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maximumStorageAllocation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maximumStorageAllocation") + } + return err + } + } + + return nil +} + +func (m *StorageTypesCapacity) contextValidateStorageTypesCapacity(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.StorageTypesCapacity); i++ { + + if m.StorageTypesCapacity[i] != nil { + if err := m.StorageTypesCapacity[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("storageTypesCapacity" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("storageTypesCapacity" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *StorageTypesCapacity) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StorageTypesCapacity) UnmarshalBinary(b []byte) error { + var res StorageTypesCapacity + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/system.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/system.go new file mode 100644 index 00000000000..7e09b8ba43f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/system.go @@ -0,0 +1,91 @@ +// 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" +) + +// System system +// +// swagger:model System +type System struct { + + // The host available Processor units + // Required: true + Cores *float64 `json:"cores"` + + // The host identifier + ID int64 `json:"id,omitempty"` + + // The host available RAM memory in GiB + // Required: true + Memory *int64 `json:"memory"` +} + +// Validate validates this system +func (m *System) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCores(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMemory(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *System) validateCores(formats strfmt.Registry) error { + + if err := validate.Required("cores", "body", m.Cores); err != nil { + return err + } + + return nil +} + +func (m *System) validateMemory(formats strfmt.Registry) error { + + if err := validate.Required("memory", "body", m.Memory); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this system based on context it is used +func (m *System) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *System) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *System) UnmarshalBinary(b []byte) error { + var res System + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/system_pool.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/system_pool.go new file mode 100644 index 00000000000..59da690a53e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/system_pool.go @@ -0,0 +1,352 @@ +// 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" +) + +// SystemPool Hardware platform detailing its limits and statistics +// +// swagger:model SystemPool +type SystemPool struct { + + // Advertised capacity cores and memory (GB) + Capacity *System `json:"capacity,omitempty"` + + // Processor to Memory (GB) Ratio + CoreMemoryRatio float64 `json:"coreMemoryRatio,omitempty"` + + // Maximum configurable cores and memory (GB) (aggregated from all hosts) + MaxAvailable *System `json:"maxAvailable,omitempty"` + + // Maximum configurable cores available combined with available memory of that host + MaxCoresAvailable *System `json:"maxCoresAvailable,omitempty"` + + // Maximum configurable memory available combined with available cores of that host + MaxMemoryAvailable *System `json:"maxMemoryAvailable,omitempty"` + + // min-max-default allocation percentage of shared core per vCPU + SharedCoreRatio *MinMaxDefault `json:"sharedCoreRatio,omitempty"` + + // The DataCenter list of servers and their available resources + Systems []*System `json:"systems"` + + // Type of system hardware + Type string `json:"type,omitempty"` +} + +// Validate validates this system pool +func (m *SystemPool) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCapacity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxAvailable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxCoresAvailable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMaxMemoryAvailable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSharedCoreRatio(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSystems(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SystemPool) validateCapacity(formats strfmt.Registry) error { + if swag.IsZero(m.Capacity) { // not required + return nil + } + + if m.Capacity != nil { + if err := m.Capacity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capacity") + } + return err + } + } + + return nil +} + +func (m *SystemPool) validateMaxAvailable(formats strfmt.Registry) error { + if swag.IsZero(m.MaxAvailable) { // not required + return nil + } + + if m.MaxAvailable != nil { + if err := m.MaxAvailable.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxAvailable") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxAvailable") + } + return err + } + } + + return nil +} + +func (m *SystemPool) validateMaxCoresAvailable(formats strfmt.Registry) error { + if swag.IsZero(m.MaxCoresAvailable) { // not required + return nil + } + + if m.MaxCoresAvailable != nil { + if err := m.MaxCoresAvailable.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxCoresAvailable") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxCoresAvailable") + } + return err + } + } + + return nil +} + +func (m *SystemPool) validateMaxMemoryAvailable(formats strfmt.Registry) error { + if swag.IsZero(m.MaxMemoryAvailable) { // not required + return nil + } + + if m.MaxMemoryAvailable != nil { + if err := m.MaxMemoryAvailable.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxMemoryAvailable") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxMemoryAvailable") + } + return err + } + } + + return nil +} + +func (m *SystemPool) validateSharedCoreRatio(formats strfmt.Registry) error { + if swag.IsZero(m.SharedCoreRatio) { // not required + return nil + } + + if m.SharedCoreRatio != nil { + if err := m.SharedCoreRatio.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sharedCoreRatio") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sharedCoreRatio") + } + return err + } + } + + return nil +} + +func (m *SystemPool) validateSystems(formats strfmt.Registry) error { + if swag.IsZero(m.Systems) { // not required + return nil + } + + for i := 0; i < len(m.Systems); i++ { + if swag.IsZero(m.Systems[i]) { // not required + continue + } + + if m.Systems[i] != nil { + if err := m.Systems[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("systems" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("systems" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this system pool based on the context it is used +func (m *SystemPool) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMaxAvailable(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMaxCoresAvailable(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMaxMemoryAvailable(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSharedCoreRatio(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSystems(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SystemPool) contextValidateCapacity(ctx context.Context, formats strfmt.Registry) error { + + if m.Capacity != nil { + if err := m.Capacity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capacity") + } + return err + } + } + + return nil +} + +func (m *SystemPool) contextValidateMaxAvailable(ctx context.Context, formats strfmt.Registry) error { + + if m.MaxAvailable != nil { + if err := m.MaxAvailable.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxAvailable") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxAvailable") + } + return err + } + } + + return nil +} + +func (m *SystemPool) contextValidateMaxCoresAvailable(ctx context.Context, formats strfmt.Registry) error { + + if m.MaxCoresAvailable != nil { + if err := m.MaxCoresAvailable.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxCoresAvailable") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxCoresAvailable") + } + return err + } + } + + return nil +} + +func (m *SystemPool) contextValidateMaxMemoryAvailable(ctx context.Context, formats strfmt.Registry) error { + + if m.MaxMemoryAvailable != nil { + if err := m.MaxMemoryAvailable.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("maxMemoryAvailable") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("maxMemoryAvailable") + } + return err + } + } + + return nil +} + +func (m *SystemPool) contextValidateSharedCoreRatio(ctx context.Context, formats strfmt.Registry) error { + + if m.SharedCoreRatio != nil { + if err := m.SharedCoreRatio.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sharedCoreRatio") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sharedCoreRatio") + } + return err + } + } + + return nil +} + +func (m *SystemPool) contextValidateSystems(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Systems); i++ { + + if m.Systems[i] != nil { + if err := m.Systems[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("systems" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("systems" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SystemPool) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SystemPool) UnmarshalBinary(b []byte) error { + var res SystemPool + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/system_pools.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/system_pools.go new file mode 100644 index 00000000000..afae9a2f15a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/system_pools.go @@ -0,0 +1,67 @@ +// 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/validate" +) + +// SystemPools List of available system pools within a particular DataCenter +// +// swagger:model SystemPools +type SystemPools map[string]SystemPool + +// Validate validates this system pools +func (m SystemPools) Validate(formats strfmt.Registry) error { + var res []error + + for k := range m { + + if err := validate.Required(k, "body", m[k]); err != nil { + return err + } + if val, ok := m[k]; ok { + if err := val.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName(k) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName(k) + } + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validate this system pools based on the context it is used +func (m SystemPools) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + for k := range m { + + if val, ok := m[k]; ok { + if err := val.ContextValidate(ctx, formats); err != nil { + return err + } + } + + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/task.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/task.go new file mode 100644 index 00000000000..ccaf515ab29 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/task.go @@ -0,0 +1,217 @@ +// 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" +) + +// Task task +// +// swagger:model Task +type Task struct { + + // Cloud Instance ID of task owner + // Required: true + CloudInstanceID *string `json:"cloudInstanceID"` + + // the component id of the task + // Required: true + ComponentID *string `json:"componentID"` + + // the component type of the task + // Required: true + ComponentType *string `json:"componentType"` + + // Creation Date + // Required: true + // Format: date-time + CreationDate *strfmt.DateTime `json:"creationDate"` + + // Last Update Date + // Required: true + // Format: date-time + LastUpdateDate *strfmt.DateTime `json:"lastUpdateDate"` + + // Task Operation + // Required: true + Operation *string `json:"operation"` + + // status code of the task + // Required: true + Status *string `json:"status"` + + // status detail of the task + // Required: true + StatusDetail *string `json:"statusDetail"` + + // Pcloud Task ID + // Required: true + TaskID *string `json:"taskID"` +} + +// Validate validates this task +func (m *Task) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCloudInstanceID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateComponentID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateComponentType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCreationDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastUpdateDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOperation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatusDetail(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTaskID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Task) validateCloudInstanceID(formats strfmt.Registry) error { + + if err := validate.Required("cloudInstanceID", "body", m.CloudInstanceID); err != nil { + return err + } + + return nil +} + +func (m *Task) validateComponentID(formats strfmt.Registry) error { + + if err := validate.Required("componentID", "body", m.ComponentID); err != nil { + return err + } + + return nil +} + +func (m *Task) validateComponentType(formats strfmt.Registry) error { + + if err := validate.Required("componentType", "body", m.ComponentType); err != nil { + return err + } + + return nil +} + +func (m *Task) validateCreationDate(formats strfmt.Registry) error { + + if err := validate.Required("creationDate", "body", m.CreationDate); err != nil { + return err + } + + if err := validate.FormatOf("creationDate", "body", "date-time", m.CreationDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Task) validateLastUpdateDate(formats strfmt.Registry) error { + + if err := validate.Required("lastUpdateDate", "body", m.LastUpdateDate); err != nil { + return err + } + + if err := validate.FormatOf("lastUpdateDate", "body", "date-time", m.LastUpdateDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Task) validateOperation(formats strfmt.Registry) error { + + if err := validate.Required("operation", "body", m.Operation); err != nil { + return err + } + + return nil +} + +func (m *Task) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + return nil +} + +func (m *Task) validateStatusDetail(formats strfmt.Registry) error { + + if err := validate.Required("statusDetail", "body", m.StatusDetail); err != nil { + return err + } + + return nil +} + +func (m *Task) validateTaskID(formats strfmt.Registry) error { + + if err := validate.Required("taskID", "body", m.TaskID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this task based on context it is used +func (m *Task) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Task) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Task) UnmarshalBinary(b []byte) error { + var res Task + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/task_reference.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/task_reference.go new file mode 100644 index 00000000000..aca4c6d20d2 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/task_reference.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" +) + +// TaskReference task reference +// +// swagger:model TaskReference +type TaskReference struct { + + // Link to Task resource + // Required: true + Href *string `json:"href"` + + // ID of Task used to get status of long running operation + // Required: true + TaskID *string `json:"taskID"` +} + +// Validate validates this task reference +func (m *TaskReference) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHref(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTaskID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TaskReference) validateHref(formats strfmt.Registry) error { + + if err := validate.Required("href", "body", m.Href); err != nil { + return err + } + + return nil +} + +func (m *TaskReference) validateTaskID(formats strfmt.Registry) error { + + if err := validate.Required("taskID", "body", m.TaskID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this task reference based on context it is used +func (m *TaskReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TaskReference) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TaskReference) UnmarshalBinary(b []byte) error { + var res TaskReference + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/tenant.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/tenant.go new file mode 100644 index 00000000000..60dcec1ba27 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/tenant.go @@ -0,0 +1,292 @@ +// 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" +) + +// Tenant tenant +// +// swagger:model Tenant +type Tenant struct { + + // Cloud Instances owned by the Tenant + // Required: true + CloudInstances []*CloudInstanceReference `json:"cloudInstances"` + + // Date of Tenant creation + // Required: true + // Format: date-time + CreationDate *strfmt.DateTime `json:"creationDate"` + + // Indicates if the tenant is enabled + // Required: true + Enabled *bool `json:"enabled"` + + // IBM Customer Number + Icn string `json:"icn,omitempty"` + + // Peering Network Information (optional) + PeeringNetworks []*PeeringNetwork `json:"peeringNetworks,omitempty"` + + // Tenant SSH Keys + SSHKeys []*SSHKey `json:"sshKeys"` + + // Tenant ID + // Required: true + TenantID *string `json:"tenantID"` +} + +// Validate validates this tenant +func (m *Tenant) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCloudInstances(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCreationDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEnabled(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePeeringNetworks(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSSHKeys(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTenantID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Tenant) validateCloudInstances(formats strfmt.Registry) error { + + if err := validate.Required("cloudInstances", "body", m.CloudInstances); err != nil { + return err + } + + for i := 0; i < len(m.CloudInstances); i++ { + if swag.IsZero(m.CloudInstances[i]) { // not required + continue + } + + if m.CloudInstances[i] != nil { + if err := m.CloudInstances[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cloudInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cloudInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Tenant) validateCreationDate(formats strfmt.Registry) error { + + if err := validate.Required("creationDate", "body", m.CreationDate); err != nil { + return err + } + + if err := validate.FormatOf("creationDate", "body", "date-time", m.CreationDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Tenant) validateEnabled(formats strfmt.Registry) error { + + if err := validate.Required("enabled", "body", m.Enabled); err != nil { + return err + } + + return nil +} + +func (m *Tenant) validatePeeringNetworks(formats strfmt.Registry) error { + if swag.IsZero(m.PeeringNetworks) { // not required + return nil + } + + for i := 0; i < len(m.PeeringNetworks); i++ { + if swag.IsZero(m.PeeringNetworks[i]) { // not required + continue + } + + if m.PeeringNetworks[i] != nil { + if err := m.PeeringNetworks[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Tenant) validateSSHKeys(formats strfmt.Registry) error { + if swag.IsZero(m.SSHKeys) { // not required + return nil + } + + for i := 0; i < len(m.SSHKeys); i++ { + if swag.IsZero(m.SSHKeys[i]) { // not required + continue + } + + if m.SSHKeys[i] != nil { + if err := m.SSHKeys[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sshKeys" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sshKeys" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Tenant) validateTenantID(formats strfmt.Registry) error { + + if err := validate.Required("tenantID", "body", m.TenantID); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this tenant based on the context it is used +func (m *Tenant) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCloudInstances(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePeeringNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSSHKeys(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Tenant) contextValidateCloudInstances(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.CloudInstances); i++ { + + if m.CloudInstances[i] != nil { + if err := m.CloudInstances[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("cloudInstances" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("cloudInstances" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Tenant) contextValidatePeeringNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PeeringNetworks); i++ { + + if m.PeeringNetworks[i] != nil { + if err := m.PeeringNetworks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Tenant) contextValidateSSHKeys(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.SSHKeys); i++ { + + if m.SSHKeys[i] != nil { + if err := m.SSHKeys[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("sshKeys" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("sshKeys" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Tenant) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Tenant) UnmarshalBinary(b []byte) error { + var res Tenant + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/tenant_update.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/tenant_update.go new file mode 100644 index 00000000000..a1a9e439a07 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/tenant_update.go @@ -0,0 +1,119 @@ +// 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" +) + +// TenantUpdate tenant update +// +// swagger:model TenantUpdate +type TenantUpdate struct { + + // IBM Customer Number + Icn *string `json:"icn,omitempty"` + + // Peering Network Information (optional) + PeeringNetworks []*PeeringNetwork `json:"peeringNetworks"` +} + +// Validate validates this tenant update +func (m *TenantUpdate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validatePeeringNetworks(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TenantUpdate) validatePeeringNetworks(formats strfmt.Registry) error { + if swag.IsZero(m.PeeringNetworks) { // not required + return nil + } + + for i := 0; i < len(m.PeeringNetworks); i++ { + if swag.IsZero(m.PeeringNetworks[i]) { // not required + continue + } + + if m.PeeringNetworks[i] != nil { + if err := m.PeeringNetworks[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this tenant update based on the context it is used +func (m *TenantUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePeeringNetworks(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TenantUpdate) contextValidatePeeringNetworks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.PeeringNetworks); i++ { + + if m.PeeringNetworks[i] != nil { + if err := m.PeeringNetworks[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peeringNetworks" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TenantUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TenantUpdate) UnmarshalBinary(b []byte) error { + var res TenantUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/thresholds.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/thresholds.go new file mode 100644 index 00000000000..9d142d57feb --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/thresholds.go @@ -0,0 +1,288 @@ +// 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" +) + +// Thresholds storage threshold settings +// +// swagger:model Thresholds +type Thresholds struct { + + // capacity threshold + Capacity *StorageEntities `json:"capacity,omitempty"` + + // overcommt threshold + Overcommit *StorageEntities `json:"overcommit,omitempty"` + + // physical capacity threshold + PhysicalCapacity *StorageEntities `json:"physicalCapacity,omitempty"` + + // vdisk capacity threshold + VdiskCapacity *StorageEntities `json:"vdiskCapacity,omitempty"` + + // vdisk limit threshold + VdiskLimit *StorageEntities `json:"vdiskLimit,omitempty"` +} + +// Validate validates this thresholds +func (m *Thresholds) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCapacity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOvercommit(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePhysicalCapacity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVdiskCapacity(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVdiskLimit(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Thresholds) validateCapacity(formats strfmt.Registry) error { + if swag.IsZero(m.Capacity) { // not required + return nil + } + + if m.Capacity != nil { + if err := m.Capacity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capacity") + } + return err + } + } + + return nil +} + +func (m *Thresholds) validateOvercommit(formats strfmt.Registry) error { + if swag.IsZero(m.Overcommit) { // not required + return nil + } + + if m.Overcommit != nil { + if err := m.Overcommit.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("overcommit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("overcommit") + } + return err + } + } + + return nil +} + +func (m *Thresholds) validatePhysicalCapacity(formats strfmt.Registry) error { + if swag.IsZero(m.PhysicalCapacity) { // not required + return nil + } + + if m.PhysicalCapacity != nil { + if err := m.PhysicalCapacity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("physicalCapacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("physicalCapacity") + } + return err + } + } + + return nil +} + +func (m *Thresholds) validateVdiskCapacity(formats strfmt.Registry) error { + if swag.IsZero(m.VdiskCapacity) { // not required + return nil + } + + if m.VdiskCapacity != nil { + if err := m.VdiskCapacity.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vdiskCapacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vdiskCapacity") + } + return err + } + } + + return nil +} + +func (m *Thresholds) validateVdiskLimit(formats strfmt.Registry) error { + if swag.IsZero(m.VdiskLimit) { // not required + return nil + } + + if m.VdiskLimit != nil { + if err := m.VdiskLimit.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vdiskLimit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vdiskLimit") + } + return err + } + } + + return nil +} + +// ContextValidate validate this thresholds based on the context it is used +func (m *Thresholds) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOvercommit(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePhysicalCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVdiskCapacity(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateVdiskLimit(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Thresholds) contextValidateCapacity(ctx context.Context, formats strfmt.Registry) error { + + if m.Capacity != nil { + if err := m.Capacity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("capacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("capacity") + } + return err + } + } + + return nil +} + +func (m *Thresholds) contextValidateOvercommit(ctx context.Context, formats strfmt.Registry) error { + + if m.Overcommit != nil { + if err := m.Overcommit.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("overcommit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("overcommit") + } + return err + } + } + + return nil +} + +func (m *Thresholds) contextValidatePhysicalCapacity(ctx context.Context, formats strfmt.Registry) error { + + if m.PhysicalCapacity != nil { + if err := m.PhysicalCapacity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("physicalCapacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("physicalCapacity") + } + return err + } + } + + return nil +} + +func (m *Thresholds) contextValidateVdiskCapacity(ctx context.Context, formats strfmt.Registry) error { + + if m.VdiskCapacity != nil { + if err := m.VdiskCapacity.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vdiskCapacity") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vdiskCapacity") + } + return err + } + } + + return nil +} + +func (m *Thresholds) contextValidateVdiskLimit(ctx context.Context, formats strfmt.Registry) error { + + if m.VdiskLimit != nil { + if err := m.VdiskLimit.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vdiskLimit") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vdiskLimit") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Thresholds) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Thresholds) UnmarshalBinary(b []byte) error { + var res Thresholds + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/token.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/token.go new file mode 100644 index 00000000000..7dcf3634658 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/token.go @@ -0,0 +1,127 @@ +// 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" +) + +// Token token +// +// swagger:model Token +type Token struct { + + // AccessToken + // Required: true + AccessToken *string `json:"accessToken"` + + // Token Expires + // Required: true + // Format: date-time + Expires *strfmt.DateTime `json:"expires"` + + // Refresh Token + // Required: true + RefreshToken *string `json:"refreshToken"` + + // Token Type + // Required: true + Type *string `json:"type"` +} + +// Validate validates this token +func (m *Token) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccessToken(formats); err != nil { + res = append(res, err) + } + + if err := m.validateExpires(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRefreshToken(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 *Token) validateAccessToken(formats strfmt.Registry) error { + + if err := validate.Required("accessToken", "body", m.AccessToken); err != nil { + return err + } + + return nil +} + +func (m *Token) validateExpires(formats strfmt.Registry) error { + + if err := validate.Required("expires", "body", m.Expires); err != nil { + return err + } + + if err := validate.FormatOf("expires", "body", "date-time", m.Expires.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Token) validateRefreshToken(formats strfmt.Registry) error { + + if err := validate.Required("refreshToken", "body", m.RefreshToken); err != nil { + return err + } + + return nil +} + +func (m *Token) validateType(formats strfmt.Registry) error { + + if err := validate.Required("type", "body", m.Type); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this token based on context it is used +func (m *Token) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Token) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Token) UnmarshalBinary(b []byte) error { + var res Token + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/token_extra.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/token_extra.go new file mode 100644 index 00000000000..a37a8bc217e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/token_extra.go @@ -0,0 +1,163 @@ +// 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" +) + +// TokenExtra token extra +// +// swagger:model TokenExtra +type TokenExtra struct { + + // Number of seconds token will expire + // Required: true + ExpiresIn *float64 `json:"expiresIn"` + + // Time on the service broker + // Required: true + // Format: date-time + ServerTime *strfmt.DateTime `json:"serverTime"` + + // OAuth Token + // Required: true + Token *Token `json:"token"` + + // Is this token valid + // Required: true + Valid *bool `json:"valid"` +} + +// Validate validates this token extra +func (m *TokenExtra) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateExpiresIn(formats); err != nil { + res = append(res, err) + } + + if err := m.validateServerTime(formats); err != nil { + res = append(res, err) + } + + if err := m.validateToken(formats); err != nil { + res = append(res, err) + } + + if err := m.validateValid(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TokenExtra) validateExpiresIn(formats strfmt.Registry) error { + + if err := validate.Required("expiresIn", "body", m.ExpiresIn); err != nil { + return err + } + + return nil +} + +func (m *TokenExtra) validateServerTime(formats strfmt.Registry) error { + + if err := validate.Required("serverTime", "body", m.ServerTime); err != nil { + return err + } + + if err := validate.FormatOf("serverTime", "body", "date-time", m.ServerTime.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *TokenExtra) validateToken(formats strfmt.Registry) error { + + if err := validate.Required("token", "body", m.Token); err != nil { + return err + } + + if m.Token != nil { + if err := m.Token.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("token") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("token") + } + return err + } + } + + return nil +} + +func (m *TokenExtra) validateValid(formats strfmt.Registry) error { + + if err := validate.Required("valid", "body", m.Valid); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this token extra based on the context it is used +func (m *TokenExtra) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateToken(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TokenExtra) contextValidateToken(ctx context.Context, formats strfmt.Registry) error { + + if m.Token != nil { + if err := m.Token.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("token") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("token") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *TokenExtra) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TokenExtra) UnmarshalBinary(b []byte) error { + var res TokenExtra + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/token_request.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/token_request.go new file mode 100644 index 00000000000..a136c5cec15 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/token_request.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" +) + +// TokenRequest token request +// +// swagger:model TokenRequest +type TokenRequest struct { + + // The refresh token to request the new Access Token + // Required: true + RefreshToken *string `json:"refreshToken"` + + // Source type of the token request (web or cli) + // Required: true + // Enum: [web cli] + Source *string `json:"source"` +} + +// Validate validates this token request +func (m *TokenRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRefreshToken(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSource(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *TokenRequest) validateRefreshToken(formats strfmt.Registry) error { + + if err := validate.Required("refreshToken", "body", m.RefreshToken); err != nil { + return err + } + + return nil +} + +var tokenRequestTypeSourcePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["web","cli"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + tokenRequestTypeSourcePropEnum = append(tokenRequestTypeSourcePropEnum, v) + } +} + +const ( + + // TokenRequestSourceWeb captures enum value "web" + TokenRequestSourceWeb string = "web" + + // TokenRequestSourceCli captures enum value "cli" + TokenRequestSourceCli string = "cli" +) + +// prop value enum +func (m *TokenRequest) validateSourceEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, tokenRequestTypeSourcePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *TokenRequest) validateSource(formats strfmt.Registry) error { + + if err := validate.Required("source", "body", m.Source); err != nil { + return err + } + + // value enum + if err := m.validateSourceEnum("source", "body", *m.Source); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this token request based on context it is used +func (m *TokenRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TokenRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TokenRequest) UnmarshalBinary(b []byte) error { + var res TokenRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/update_storage_pool.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/update_storage_pool.go new file mode 100644 index 00000000000..b186a57ba94 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/update_storage_pool.go @@ -0,0 +1,162 @@ +// 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" +) + +// UpdateStoragePool update storage pool +// +// swagger:model UpdateStoragePool +type UpdateStoragePool struct { + + // display name of storage pool + DisplayName *string `json:"displayName,omitempty"` + + // indicates if the storage pool is disaster recovery (dr) enabled + DrEnabled *bool `json:"drEnabled,omitempty"` + + // threshold override settings of a pool + OverrideThresholds *Thresholds `json:"overrideThresholds,omitempty"` + + // state of storage pool + // Enum: [closed opened] + State *string `json:"state,omitempty"` +} + +// Validate validates this update storage pool +func (m *UpdateStoragePool) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOverrideThresholds(formats); err != nil { + res = append(res, err) + } + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateStoragePool) validateOverrideThresholds(formats strfmt.Registry) error { + if swag.IsZero(m.OverrideThresholds) { // not required + return nil + } + + if m.OverrideThresholds != nil { + if err := m.OverrideThresholds.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("overrideThresholds") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("overrideThresholds") + } + return err + } + } + + return nil +} + +var updateStoragePoolTypeStatePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["closed","opened"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + updateStoragePoolTypeStatePropEnum = append(updateStoragePoolTypeStatePropEnum, v) + } +} + +const ( + + // UpdateStoragePoolStateClosed captures enum value "closed" + UpdateStoragePoolStateClosed string = "closed" + + // UpdateStoragePoolStateOpened captures enum value "opened" + UpdateStoragePoolStateOpened string = "opened" +) + +// prop value enum +func (m *UpdateStoragePool) validateStateEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, updateStoragePoolTypeStatePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *UpdateStoragePool) validateState(formats strfmt.Registry) error { + if swag.IsZero(m.State) { // not required + return nil + } + + // value enum + if err := m.validateStateEnum("state", "body", *m.State); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this update storage pool based on the context it is used +func (m *UpdateStoragePool) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOverrideThresholds(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *UpdateStoragePool) contextValidateOverrideThresholds(ctx context.Context, formats strfmt.Registry) error { + + if m.OverrideThresholds != nil { + if err := m.OverrideThresholds.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("overrideThresholds") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("overrideThresholds") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *UpdateStoragePool) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UpdateStoragePool) UnmarshalBinary(b []byte) error { + var res UpdateStoragePool + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/update_volume.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/update_volume.go new file mode 100644 index 00000000000..630668b1000 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/update_volume.go @@ -0,0 +1,59 @@ +// 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" +) + +// UpdateVolume update volume +// +// swagger:model UpdateVolume +type UpdateVolume struct { + + // Indicates if the volume is boot capable + Bootable *bool `json:"bootable,omitempty"` + + // Name + Name *string `json:"name,omitempty"` + + // Indicates if the volume is shareable between VMs + Shareable *bool `json:"shareable,omitempty"` + + // New Volume size + Size float64 `json:"size,omitempty"` +} + +// Validate validates this update volume +func (m *UpdateVolume) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this update volume based on context it is used +func (m *UpdateVolume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UpdateVolume) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UpdateVolume) UnmarshalBinary(b []byte) error { + var res UpdateVolume + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/user_info.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/user_info.go new file mode 100644 index 00000000000..95978214893 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/user_info.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" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// UserInfo user info +// +// swagger:model UserInfo +type UserInfo struct { + + // User Email + // Required: true + Email *string `json:"email"` + + // User ID + // Required: true + ID *string `json:"id"` + + // User Image URL + ImageURL string `json:"imageURL,omitempty"` + + // Member of the following tenants + MemberOf []string `json:"memberOf"` + + // User Name + // Required: true + Name *string `json:"name"` +} + +// Validate validates this user info +func (m *UserInfo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmail(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(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 *UserInfo) validateEmail(formats strfmt.Registry) error { + + if err := validate.Required("email", "body", m.Email); err != nil { + return err + } + + return nil +} + +func (m *UserInfo) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *UserInfo) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this user info based on context it is used +func (m *UserInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *UserInfo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *UserInfo) UnmarshalBinary(b []byte) error { + var res UserInfo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_n_connection.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_n_connection.go new file mode 100644 index 00000000000..368b9814dd4 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_n_connection.go @@ -0,0 +1,472 @@ +// 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" +) + +// VPNConnection v p n connection +// +// swagger:model VPNConnection +type VPNConnection struct { + + // dead peer detection + // Required: true + DeadPeerDetection *DeadPeerDetection `json:"deadPeerDetection"` + + // unique identifier for VPN Connection + // Example: 123e4567-e89b-12d3-a456-42661475 + // Required: true + ID *string `json:"id"` + + // ike policy + // Required: true + IkePolicy *IKEPolicyRef `json:"ikePolicy"` + + // ip sec policy + // Required: true + IPSecPolicy *IPSecPolicyRef `json:"ipSecPolicy"` + + // local Gateway address, only in 'route' mode. + // Example: 192.168.1.1 + // Required: true + LocalGatewayAddress *string `json:"localGatewayAddress"` + + // Mode used by this VPNConnection, either policy-based, or route-based, this attribute is set at the creation and cannot be updated later. + // Example: policy + // Required: true + // Enum: [policy route] + Mode *string `json:"mode"` + + // VPN Connection name + // Example: VPN-Connection-1 + // Required: true + Name *string `json:"name"` + + // an array of network IDs + // Required: true + NetworkIDs []string `json:"networkIDs"` + + // peer gateway address + // Required: true + // Format: ipv4 + PeerGatewayAddress *PeerGatewayAddress `json:"peerGatewayAddress"` + + // an array of strings containing CIDR of peer subnets + // Example: ["128.170.1.0/20","128.169.1.0/24","128.168.1.0/27","128.170.1.0/32"] + // Required: true + PeerSubnets []string `json:"peerSubnets"` + + // status of the VPN connection + // Required: true + // Enum: [active warning disabled] + Status *string `json:"status"` + + // public IP address of the VPN Gateway (vSRX) attached to this VPNConnection + // Example: 192.168.204.1 + // Required: true + VpnGatewayAddress *string `json:"vpnGatewayAddress"` +} + +// Validate validates this v p n connection +func (m *VPNConnection) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDeadPeerDetection(formats); err != nil { + res = append(res, err) + } + + if err := m.validateID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIkePolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIPSecPolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLocalGatewayAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetworkIDs(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePeerGatewayAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePeerSubnets(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVpnGatewayAddress(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNConnection) validateDeadPeerDetection(formats strfmt.Registry) error { + + if err := validate.Required("deadPeerDetection", "body", m.DeadPeerDetection); err != nil { + return err + } + + if m.DeadPeerDetection != nil { + if err := m.DeadPeerDetection.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deadPeerDetection") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deadPeerDetection") + } + return err + } + } + + return nil +} + +func (m *VPNConnection) validateID(formats strfmt.Registry) error { + + if err := validate.Required("id", "body", m.ID); err != nil { + return err + } + + return nil +} + +func (m *VPNConnection) validateIkePolicy(formats strfmt.Registry) error { + + if err := validate.Required("ikePolicy", "body", m.IkePolicy); err != nil { + return err + } + + if m.IkePolicy != nil { + if err := m.IkePolicy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ikePolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicy") + } + return err + } + } + + return nil +} + +func (m *VPNConnection) validateIPSecPolicy(formats strfmt.Registry) error { + + if err := validate.Required("ipSecPolicy", "body", m.IPSecPolicy); err != nil { + return err + } + + if m.IPSecPolicy != nil { + if err := m.IPSecPolicy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipSecPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicy") + } + return err + } + } + + return nil +} + +func (m *VPNConnection) validateLocalGatewayAddress(formats strfmt.Registry) error { + + if err := validate.Required("localGatewayAddress", "body", m.LocalGatewayAddress); err != nil { + return err + } + + return nil +} + +var vPNConnectionTypeModePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["policy","route"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + vPNConnectionTypeModePropEnum = append(vPNConnectionTypeModePropEnum, v) + } +} + +const ( + + // VPNConnectionModePolicy captures enum value "policy" + VPNConnectionModePolicy string = "policy" + + // VPNConnectionModeRoute captures enum value "route" + VPNConnectionModeRoute string = "route" +) + +// prop value enum +func (m *VPNConnection) validateModeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, vPNConnectionTypeModePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *VPNConnection) validateMode(formats strfmt.Registry) error { + + if err := validate.Required("mode", "body", m.Mode); err != nil { + return err + } + + // value enum + if err := m.validateModeEnum("mode", "body", *m.Mode); err != nil { + return err + } + + return nil +} + +func (m *VPNConnection) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *VPNConnection) validateNetworkIDs(formats strfmt.Registry) error { + + if err := validate.Required("networkIDs", "body", m.NetworkIDs); err != nil { + return err + } + + return nil +} + +func (m *VPNConnection) validatePeerGatewayAddress(formats strfmt.Registry) error { + + if err := validate.Required("peerGatewayAddress", "body", m.PeerGatewayAddress); err != nil { + return err + } + + if err := validate.Required("peerGatewayAddress", "body", m.PeerGatewayAddress); err != nil { + return err + } + + if m.PeerGatewayAddress != nil { + if err := m.PeerGatewayAddress.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peerGatewayAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peerGatewayAddress") + } + return err + } + } + + return nil +} + +func (m *VPNConnection) validatePeerSubnets(formats strfmt.Registry) error { + + if err := validate.Required("peerSubnets", "body", m.PeerSubnets); err != nil { + return err + } + + return nil +} + +var vPNConnectionTypeStatusPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["active","warning","disabled"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + vPNConnectionTypeStatusPropEnum = append(vPNConnectionTypeStatusPropEnum, v) + } +} + +const ( + + // VPNConnectionStatusActive captures enum value "active" + VPNConnectionStatusActive string = "active" + + // VPNConnectionStatusWarning captures enum value "warning" + VPNConnectionStatusWarning string = "warning" + + // VPNConnectionStatusDisabled captures enum value "disabled" + VPNConnectionStatusDisabled string = "disabled" +) + +// prop value enum +func (m *VPNConnection) validateStatusEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, vPNConnectionTypeStatusPropEnum, true); err != nil { + return err + } + return nil +} + +func (m *VPNConnection) validateStatus(formats strfmt.Registry) error { + + if err := validate.Required("status", "body", m.Status); err != nil { + return err + } + + // value enum + if err := m.validateStatusEnum("status", "body", *m.Status); err != nil { + return err + } + + return nil +} + +func (m *VPNConnection) validateVpnGatewayAddress(formats strfmt.Registry) error { + + if err := validate.Required("vpnGatewayAddress", "body", m.VpnGatewayAddress); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this v p n connection based on the context it is used +func (m *VPNConnection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDeadPeerDetection(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIkePolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIPSecPolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePeerGatewayAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNConnection) contextValidateDeadPeerDetection(ctx context.Context, formats strfmt.Registry) error { + + if m.DeadPeerDetection != nil { + if err := m.DeadPeerDetection.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deadPeerDetection") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deadPeerDetection") + } + return err + } + } + + return nil +} + +func (m *VPNConnection) contextValidateIkePolicy(ctx context.Context, formats strfmt.Registry) error { + + if m.IkePolicy != nil { + if err := m.IkePolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ikePolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicy") + } + return err + } + } + + return nil +} + +func (m *VPNConnection) contextValidateIPSecPolicy(ctx context.Context, formats strfmt.Registry) error { + + if m.IPSecPolicy != nil { + if err := m.IPSecPolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipSecPolicy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicy") + } + return err + } + } + + return nil +} + +func (m *VPNConnection) contextValidatePeerGatewayAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.PeerGatewayAddress != nil { + if err := m.PeerGatewayAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peerGatewayAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peerGatewayAddress") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *VPNConnection) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VPNConnection) UnmarshalBinary(b []byte) error { + var res VPNConnection + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_n_connection_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_n_connection_create.go new file mode 100644 index 00000000000..a98a8db474d --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_n_connection_create.go @@ -0,0 +1,256 @@ +// 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" +) + +// VPNConnectionCreate v p n connection create +// +// swagger:model VPNConnectionCreate +type VPNConnectionCreate struct { + + // unique identifier of IKEPolicy selected for this VPNConnection + // Example: c36723ec-8593-11eb-8dcd-0242ac133853 + // Required: true + IkePolicy *string `json:"ikePolicy"` + + // unique identifier of IPSecPolicy selected for this VPNConnection + // Example: c12345d-8593-11eb-8dcd-0242ac134573 + // Required: true + IPSecPolicy *string `json:"ipSecPolicy"` + + // Mode used by this VPNConnection, either policy-based, or route-based, this attribute is set at the creation and cannot be updated later. + // Example: policy + // Required: true + // Enum: [policy route] + Mode *string `json:"mode"` + + // VPN Connection name + // Example: VPN-Connection-1 + // Required: true + Name *string `json:"name"` + + // an array of network IDs to attach to this VPNConnection + // Example: ["7f950c76-8582-11veb-8dcd-0242ac153","7f950c76-8582-11veb-8dcd-0242ac144","7f950c76-8582-11veb-8dcd-0242ac199"] + // Required: true + Networks []string `json:"networks"` + + // peer gateway address + // Required: true + // Format: ipv4 + PeerGatewayAddress *PeerGatewayAddress `json:"peerGatewayAddress"` + + // an array of strings containing CIDR of peer subnets + // Example: ["128.170.1.0/20","128.169.1.0/24","128.168.1.0/27","128.170.1.0/32"] + // Required: true + PeerSubnets []string `json:"peerSubnets"` +} + +// Validate validates this v p n connection create +func (m *VPNConnectionCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateIkePolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIPSecPolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMode(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNetworks(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePeerGatewayAddress(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePeerSubnets(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNConnectionCreate) validateIkePolicy(formats strfmt.Registry) error { + + if err := validate.Required("ikePolicy", "body", m.IkePolicy); err != nil { + return err + } + + return nil +} + +func (m *VPNConnectionCreate) validateIPSecPolicy(formats strfmt.Registry) error { + + if err := validate.Required("ipSecPolicy", "body", m.IPSecPolicy); err != nil { + return err + } + + return nil +} + +var vPNConnectionCreateTypeModePropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["policy","route"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + vPNConnectionCreateTypeModePropEnum = append(vPNConnectionCreateTypeModePropEnum, v) + } +} + +const ( + + // VPNConnectionCreateModePolicy captures enum value "policy" + VPNConnectionCreateModePolicy string = "policy" + + // VPNConnectionCreateModeRoute captures enum value "route" + VPNConnectionCreateModeRoute string = "route" +) + +// prop value enum +func (m *VPNConnectionCreate) validateModeEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, vPNConnectionCreateTypeModePropEnum, true); err != nil { + return err + } + return nil +} + +func (m *VPNConnectionCreate) validateMode(formats strfmt.Registry) error { + + if err := validate.Required("mode", "body", m.Mode); err != nil { + return err + } + + // value enum + if err := m.validateModeEnum("mode", "body", *m.Mode); err != nil { + return err + } + + return nil +} + +func (m *VPNConnectionCreate) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *VPNConnectionCreate) validateNetworks(formats strfmt.Registry) error { + + if err := validate.Required("networks", "body", m.Networks); err != nil { + return err + } + + return nil +} + +func (m *VPNConnectionCreate) validatePeerGatewayAddress(formats strfmt.Registry) error { + + if err := validate.Required("peerGatewayAddress", "body", m.PeerGatewayAddress); err != nil { + return err + } + + if err := validate.Required("peerGatewayAddress", "body", m.PeerGatewayAddress); err != nil { + return err + } + + if m.PeerGatewayAddress != nil { + if err := m.PeerGatewayAddress.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peerGatewayAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peerGatewayAddress") + } + return err + } + } + + return nil +} + +func (m *VPNConnectionCreate) validatePeerSubnets(formats strfmt.Registry) error { + + if err := validate.Required("peerSubnets", "body", m.PeerSubnets); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this v p n connection create based on the context it is used +func (m *VPNConnectionCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePeerGatewayAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNConnectionCreate) contextValidatePeerGatewayAddress(ctx context.Context, formats strfmt.Registry) error { + + if m.PeerGatewayAddress != nil { + if err := m.PeerGatewayAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peerGatewayAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peerGatewayAddress") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *VPNConnectionCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VPNConnectionCreate) UnmarshalBinary(b []byte) error { + var res VPNConnectionCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_n_connection_create_response.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_n_connection_create_response.go new file mode 100644 index 00000000000..fc9c60ef94e --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_n_connection_create_response.go @@ -0,0 +1,160 @@ +// 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" +) + +// VPNConnectionCreateResponse v p n connection create response +// +// swagger:model VPNConnectionCreateResponse +type VPNConnectionCreateResponse struct { + VPNConnection + + // job ref + JobRef *JobReference `json:"jobRef,omitempty"` +} + +// UnmarshalJSON unmarshals this object from a JSON structure +func (m *VPNConnectionCreateResponse) UnmarshalJSON(raw []byte) error { + // AO0 + var aO0 VPNConnection + if err := swag.ReadJSON(raw, &aO0); err != nil { + return err + } + m.VPNConnection = aO0 + + // now for regular properties + var propsVPNConnectionCreateResponse struct { + JobRef *JobReference `json:"jobRef,omitempty"` + } + if err := swag.ReadJSON(raw, &propsVPNConnectionCreateResponse); err != nil { + return err + } + m.JobRef = propsVPNConnectionCreateResponse.JobRef + + return nil +} + +// MarshalJSON marshals this object to a JSON structure +func (m VPNConnectionCreateResponse) MarshalJSON() ([]byte, error) { + _parts := make([][]byte, 0, 1) + + aO0, err := swag.WriteJSON(m.VPNConnection) + if err != nil { + return nil, err + } + _parts = append(_parts, aO0) + + // now for regular properties + var propsVPNConnectionCreateResponse struct { + JobRef *JobReference `json:"jobRef,omitempty"` + } + propsVPNConnectionCreateResponse.JobRef = m.JobRef + + jsonDataPropsVPNConnectionCreateResponse, errVPNConnectionCreateResponse := swag.WriteJSON(propsVPNConnectionCreateResponse) + if errVPNConnectionCreateResponse != nil { + return nil, errVPNConnectionCreateResponse + } + _parts = append(_parts, jsonDataPropsVPNConnectionCreateResponse) + return swag.ConcatJSON(_parts...), nil +} + +// Validate validates this v p n connection create response +func (m *VPNConnectionCreateResponse) Validate(formats strfmt.Registry) error { + var res []error + + // validation for a type composition with VPNConnection + if err := m.VPNConnection.Validate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateJobRef(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNConnectionCreateResponse) validateJobRef(formats strfmt.Registry) error { + if swag.IsZero(m.JobRef) { // not required + return nil + } + + if m.JobRef != nil { + if err := m.JobRef.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("jobRef") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("jobRef") + } + return err + } + } + + return nil +} + +// ContextValidate validate this v p n connection create response based on the context it is used +func (m *VPNConnectionCreateResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + // validation for a type composition with VPNConnection + if err := m.VPNConnection.ContextValidate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateJobRef(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNConnectionCreateResponse) contextValidateJobRef(ctx context.Context, formats strfmt.Registry) error { + + if m.JobRef != nil { + if err := m.JobRef.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("jobRef") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("jobRef") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *VPNConnectionCreateResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VPNConnectionCreateResponse) UnmarshalBinary(b []byte) error { + var res VPNConnectionCreateResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_n_connection_update.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_n_connection_update.go new file mode 100644 index 00000000000..a771e5c2678 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_n_connection_update.go @@ -0,0 +1,249 @@ +// 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" +) + +// VPNConnectionUpdate VPN Connection object to send during the update +// +// Min Properties: 1 +// +// swagger:model VPNConnectionUpdate +type VPNConnectionUpdate struct { + + // unique identifier of IKEPolicy selected for this VPNConnection + // Example: c36723ec-8593-11eb-8dcd-0242ac133853 + IkePolicy string `json:"ikePolicy,omitempty"` + + // unique identifier of IPSecPolicy selected for this VPNConnection + // Example: c12345d-8593-11eb-8dcd-0242ac134573 + IPSecPolicy string `json:"ipSecPolicy,omitempty"` + + // VPN Connection name + // Example: VPN-Connection-1 + Name string `json:"name,omitempty"` + + // peer gateway address + // Format: ipv4 + PeerGatewayAddress PeerGatewayAddress `json:"peerGatewayAddress,omitempty"` + + // v p n connection update additional properties + VPNConnectionUpdateAdditionalProperties map[string]interface{} `json:"-"` +} + +// UnmarshalJSON unmarshals this object with additional properties from JSON +func (m *VPNConnectionUpdate) UnmarshalJSON(data []byte) error { + // stage 1, bind the properties + var stage1 struct { + + // unique identifier of IKEPolicy selected for this VPNConnection + // Example: c36723ec-8593-11eb-8dcd-0242ac133853 + IkePolicy string `json:"ikePolicy,omitempty"` + + // unique identifier of IPSecPolicy selected for this VPNConnection + // Example: c12345d-8593-11eb-8dcd-0242ac134573 + IPSecPolicy string `json:"ipSecPolicy,omitempty"` + + // VPN Connection name + // Example: VPN-Connection-1 + Name string `json:"name,omitempty"` + + // peer gateway address + // Format: ipv4 + PeerGatewayAddress PeerGatewayAddress `json:"peerGatewayAddress,omitempty"` + } + if err := json.Unmarshal(data, &stage1); err != nil { + return err + } + var rcv VPNConnectionUpdate + + rcv.IkePolicy = stage1.IkePolicy + rcv.IPSecPolicy = stage1.IPSecPolicy + rcv.Name = stage1.Name + rcv.PeerGatewayAddress = stage1.PeerGatewayAddress + *m = rcv + + // stage 2, remove properties and add to map + stage2 := make(map[string]json.RawMessage) + if err := json.Unmarshal(data, &stage2); err != nil { + return err + } + + delete(stage2, "ikePolicy") + delete(stage2, "ipSecPolicy") + delete(stage2, "name") + delete(stage2, "peerGatewayAddress") + // stage 3, add additional properties values + if len(stage2) > 0 { + result := make(map[string]interface{}) + for k, v := range stage2 { + var toadd interface{} + if err := json.Unmarshal(v, &toadd); err != nil { + return err + } + result[k] = toadd + } + m.VPNConnectionUpdateAdditionalProperties = result + } + + return nil +} + +// MarshalJSON marshals this object with additional properties into a JSON object +func (m VPNConnectionUpdate) MarshalJSON() ([]byte, error) { + var stage1 struct { + + // unique identifier of IKEPolicy selected for this VPNConnection + // Example: c36723ec-8593-11eb-8dcd-0242ac133853 + IkePolicy string `json:"ikePolicy,omitempty"` + + // unique identifier of IPSecPolicy selected for this VPNConnection + // Example: c12345d-8593-11eb-8dcd-0242ac134573 + IPSecPolicy string `json:"ipSecPolicy,omitempty"` + + // VPN Connection name + // Example: VPN-Connection-1 + Name string `json:"name,omitempty"` + + // peer gateway address + // Format: ipv4 + PeerGatewayAddress PeerGatewayAddress `json:"peerGatewayAddress,omitempty"` + } + + stage1.IkePolicy = m.IkePolicy + stage1.IPSecPolicy = m.IPSecPolicy + stage1.Name = m.Name + stage1.PeerGatewayAddress = m.PeerGatewayAddress + + // make JSON object for known properties + props, err := json.Marshal(stage1) + if err != nil { + return nil, err + } + + if len(m.VPNConnectionUpdateAdditionalProperties) == 0 { // no additional properties + return props, nil + } + + // make JSON object for the additional properties + additional, err := json.Marshal(m.VPNConnectionUpdateAdditionalProperties) + if err != nil { + return nil, err + } + + if len(props) < 3 { // "{}": only additional properties + return additional, nil + } + + // concatenate the 2 objects + return swag.ConcatJSON(props, additional), nil +} + +// Validate validates this v p n connection update +func (m *VPNConnectionUpdate) Validate(formats strfmt.Registry) error { + var res []error + + // short circuits minProperties > 0 + if m == nil { + return errors.TooFewProperties("", "body", 1) + } + + props := make(map[string]json.RawMessage, 4+10) + j, err := swag.WriteJSON(m) + if err != nil { + return err + } + + if err = swag.ReadJSON(j, &props); err != nil { + return err + } + + nprops := len(props) + + // minProperties: 1 + if nprops < 1 { + return errors.TooFewProperties("", "body", 1) + } + + if err := m.validatePeerGatewayAddress(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNConnectionUpdate) validatePeerGatewayAddress(formats strfmt.Registry) error { + if swag.IsZero(m.PeerGatewayAddress) { // not required + return nil + } + + if err := m.PeerGatewayAddress.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peerGatewayAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peerGatewayAddress") + } + return err + } + + return nil +} + +// ContextValidate validate this v p n connection update based on the context it is used +func (m *VPNConnectionUpdate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidatePeerGatewayAddress(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNConnectionUpdate) contextValidatePeerGatewayAddress(ctx context.Context, formats strfmt.Registry) error { + + if err := m.PeerGatewayAddress.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("peerGatewayAddress") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("peerGatewayAddress") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *VPNConnectionUpdate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VPNConnectionUpdate) UnmarshalBinary(b []byte) error { + var res VPNConnectionUpdate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_n_connections.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_n_connections.go new file mode 100644 index 00000000000..789c36571bd --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_n_connections.go @@ -0,0 +1,117 @@ +// 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" +) + +// VPNConnections v p n connections +// +// swagger:model VPNConnections +type VPNConnections struct { + + // an array of VPN Connections + // Example: [{"deadPeerDetection":{"action":"restart","interval":10,"threshold":5},"id":"123e4567-e89b-12d3-a456-42661475","ikePolicy":{"id":"7654e321-e89b-12d3-a456-4566447","name":"IKE Policy 3"},"ipSecPolicy":{"id":"456f7890-e89b-12d3-a456-4569934","name":"IPSec Policy 2"},"localGatewayAddress":"192.168.1.1","mode":"route","name":"VPN Connection 2","peerGatewayAddress":"192.168.44.1","peerSubnets":["128.169.1.0/24","128.168.1.0/27"],"status":"Active","vpnGatewayAddress":"192.168.24.1"}] + VpnConnections []*VPNConnection `json:"vpnConnections"` +} + +// Validate validates this v p n connections +func (m *VPNConnections) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVpnConnections(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNConnections) validateVpnConnections(formats strfmt.Registry) error { + if swag.IsZero(m.VpnConnections) { // not required + return nil + } + + for i := 0; i < len(m.VpnConnections); i++ { + if swag.IsZero(m.VpnConnections[i]) { // not required + continue + } + + if m.VpnConnections[i] != nil { + if err := m.VpnConnections[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpnConnections" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpnConnections" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this v p n connections based on the context it is used +func (m *VPNConnections) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVpnConnections(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNConnections) contextValidateVpnConnections(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.VpnConnections); i++ { + + if m.VpnConnections[i] != nil { + if err := m.VpnConnections[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vpnConnections" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vpnConnections" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *VPNConnections) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VPNConnections) UnmarshalBinary(b []byte) error { + var res VPNConnections + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_naa_s_options.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_naa_s_options.go new file mode 100644 index 00000000000..ca802f90275 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/v_p_naa_s_options.go @@ -0,0 +1,299 @@ +// 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" +) + +// VPNaaSOptions v p naa s options +// +// swagger:model VPNaaSOptions +type VPNaaSOptions struct { + + // dead peer detection + // Required: true + DeadPeerDetection *DeadPeerDetection `json:"deadPeerDetection"` + + // ike policy options + // Required: true + IkePolicyOptions *IKEPolicyOptions `json:"ikePolicyOptions"` + + // ike policy template + // Required: true + IkePolicyTemplate *IKEPolicyTemplate `json:"ikePolicyTemplate"` + + // ip sec policy options + // Required: true + IPSecPolicyOptions *IPSecPolicyOptions `json:"ipSecPolicyOptions"` + + // ip sec policy template + // Required: true + IPSecPolicyTemplate *IPSecPolicyTemplate `json:"ipSecPolicyTemplate"` +} + +// Validate validates this v p naa s options +func (m *VPNaaSOptions) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDeadPeerDetection(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIkePolicyOptions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIkePolicyTemplate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIPSecPolicyOptions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateIPSecPolicyTemplate(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNaaSOptions) validateDeadPeerDetection(formats strfmt.Registry) error { + + if err := validate.Required("deadPeerDetection", "body", m.DeadPeerDetection); err != nil { + return err + } + + if m.DeadPeerDetection != nil { + if err := m.DeadPeerDetection.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deadPeerDetection") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deadPeerDetection") + } + return err + } + } + + return nil +} + +func (m *VPNaaSOptions) validateIkePolicyOptions(formats strfmt.Registry) error { + + if err := validate.Required("ikePolicyOptions", "body", m.IkePolicyOptions); err != nil { + return err + } + + if m.IkePolicyOptions != nil { + if err := m.IkePolicyOptions.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ikePolicyOptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicyOptions") + } + return err + } + } + + return nil +} + +func (m *VPNaaSOptions) validateIkePolicyTemplate(formats strfmt.Registry) error { + + if err := validate.Required("ikePolicyTemplate", "body", m.IkePolicyTemplate); err != nil { + return err + } + + if m.IkePolicyTemplate != nil { + if err := m.IkePolicyTemplate.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ikePolicyTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicyTemplate") + } + return err + } + } + + return nil +} + +func (m *VPNaaSOptions) validateIPSecPolicyOptions(formats strfmt.Registry) error { + + if err := validate.Required("ipSecPolicyOptions", "body", m.IPSecPolicyOptions); err != nil { + return err + } + + if m.IPSecPolicyOptions != nil { + if err := m.IPSecPolicyOptions.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipSecPolicyOptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicyOptions") + } + return err + } + } + + return nil +} + +func (m *VPNaaSOptions) validateIPSecPolicyTemplate(formats strfmt.Registry) error { + + if err := validate.Required("ipSecPolicyTemplate", "body", m.IPSecPolicyTemplate); err != nil { + return err + } + + if m.IPSecPolicyTemplate != nil { + if err := m.IPSecPolicyTemplate.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipSecPolicyTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicyTemplate") + } + return err + } + } + + return nil +} + +// ContextValidate validate this v p naa s options based on the context it is used +func (m *VPNaaSOptions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDeadPeerDetection(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIkePolicyOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIkePolicyTemplate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIPSecPolicyOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateIPSecPolicyTemplate(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VPNaaSOptions) contextValidateDeadPeerDetection(ctx context.Context, formats strfmt.Registry) error { + + if m.DeadPeerDetection != nil { + if err := m.DeadPeerDetection.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("deadPeerDetection") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("deadPeerDetection") + } + return err + } + } + + return nil +} + +func (m *VPNaaSOptions) contextValidateIkePolicyOptions(ctx context.Context, formats strfmt.Registry) error { + + if m.IkePolicyOptions != nil { + if err := m.IkePolicyOptions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ikePolicyOptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicyOptions") + } + return err + } + } + + return nil +} + +func (m *VPNaaSOptions) contextValidateIkePolicyTemplate(ctx context.Context, formats strfmt.Registry) error { + + if m.IkePolicyTemplate != nil { + if err := m.IkePolicyTemplate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ikePolicyTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ikePolicyTemplate") + } + return err + } + } + + return nil +} + +func (m *VPNaaSOptions) contextValidateIPSecPolicyOptions(ctx context.Context, formats strfmt.Registry) error { + + if m.IPSecPolicyOptions != nil { + if err := m.IPSecPolicyOptions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipSecPolicyOptions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicyOptions") + } + return err + } + } + + return nil +} + +func (m *VPNaaSOptions) contextValidateIPSecPolicyTemplate(ctx context.Context, formats strfmt.Registry) error { + + if m.IPSecPolicyTemplate != nil { + if err := m.IPSecPolicyTemplate.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ipSecPolicyTemplate") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ipSecPolicyTemplate") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *VPNaaSOptions) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VPNaaSOptions) UnmarshalBinary(b []byte) error { + var res VPNaaSOptions + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/version.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/version.go new file mode 100644 index 00000000000..8432df2334f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/version.go @@ -0,0 +1,59 @@ +// 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" +) + +// Version version +// +// swagger:model Version +type Version struct { + + // Returns the build time + BuildDate string `json:"buildDate,omitempty"` + + // Returns the current go runtime version + GoVersion string `json:"goVersion,omitempty"` + + // Hostname of the responding system + Hostname string `json:"hostname,omitempty"` + + // Returns the git versioning information + Version string `json:"version,omitempty"` +} + +// Validate validates this version +func (m *Version) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this version based on context it is used +func (m *Version) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Version) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Version) UnmarshalBinary(b []byte) error { + var res Version + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/virtual_cores.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/virtual_cores.go new file mode 100644 index 00000000000..5d1330783f3 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/virtual_cores.go @@ -0,0 +1,82 @@ +// 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" +) + +// VirtualCores virtual cores +// +// swagger:model VirtualCores +type VirtualCores struct { + + // The active virtual Cores + // Required: true + // Minimum: 1 + Assigned *int64 `json:"assigned"` + + // The maximum DLPAR range for virtual Cores (Display only support) + Max int64 `json:"max,omitempty"` + + // The minimum DLPAR range for virtual Cores (Display only support) + Min int64 `json:"min,omitempty"` +} + +// Validate validates this virtual cores +func (m *VirtualCores) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAssigned(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VirtualCores) validateAssigned(formats strfmt.Registry) error { + + if err := validate.Required("assigned", "body", m.Assigned); err != nil { + return err + } + + if err := validate.MinimumInt("assigned", "body", *m.Assigned, 1, false); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this virtual cores based on context it is used +func (m *VirtualCores) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VirtualCores) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VirtualCores) UnmarshalBinary(b []byte) error { + var res VirtualCores + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volume.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volume.go new file mode 100644 index 00000000000..167869c331a --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volume.go @@ -0,0 +1,191 @@ +// 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" +) + +// Volume volume +// +// swagger:model Volume +type Volume struct { + + // Indicates if the volume is the server's boot volume + BootVolume *bool `json:"bootVolume,omitempty"` + + // Indicates if the volume is boot capable + Bootable *bool `json:"bootable,omitempty"` + + // Consistency Group Name if volume is a part of volume group + ConsistencyGroupName string `json:"consistencyGroupName,omitempty"` + + // Creation Date + // Required: true + // Format: date-time + CreationDate *strfmt.DateTime `json:"creationDate"` + + // Indicates if the volume should be deleted when the server terminates + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + + // Type of Disk + DiskType string `json:"diskType,omitempty"` + + // Volume Group ID + GroupID string `json:"groupID,omitempty"` + + // Last Update Date + // Required: true + // Format: date-time + LastUpdateDate *strfmt.DateTime `json:"lastUpdateDate"` + + // mirroring state for replication enabled volume + MirroringState string `json:"mirroringState,omitempty"` + + // Volume Name + // Required: true + Name *string `json:"name"` + + // List of PCloud PVM Instance attached to the volume + PvmInstanceIDs []string `json:"pvmInstanceIDs"` + + // shows the replication status of a volume + ReplicationStatus string `json:"replicationStatus,omitempty"` + + // Indicates if the volume is shareable between VMs + Shareable *bool `json:"shareable,omitempty"` + + // Volume Size + // Required: true + Size *float64 `json:"size"` + + // Volume State + State string `json:"state,omitempty"` + + // Volume ID + // Required: true + VolumeID *string `json:"volumeID"` + + // Volume pool, name of storage pool where the volume is located + VolumePool string `json:"volumePool,omitempty"` + + // Volume type, name of storage template used to create the volume + VolumeType string `json:"volumeType,omitempty"` + + // Volume world wide name + Wwn string `json:"wwn,omitempty"` +} + +// Validate validates this volume +func (m *Volume) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreationDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastUpdateDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSize(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVolumeID(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Volume) validateCreationDate(formats strfmt.Registry) error { + + if err := validate.Required("creationDate", "body", m.CreationDate); err != nil { + return err + } + + if err := validate.FormatOf("creationDate", "body", "date-time", m.CreationDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Volume) validateLastUpdateDate(formats strfmt.Registry) error { + + if err := validate.Required("lastUpdateDate", "body", m.LastUpdateDate); err != nil { + return err + } + + if err := validate.FormatOf("lastUpdateDate", "body", "date-time", m.LastUpdateDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *Volume) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *Volume) validateSize(formats strfmt.Registry) error { + + if err := validate.Required("size", "body", m.Size); err != nil { + return err + } + + return nil +} + +func (m *Volume) validateVolumeID(formats strfmt.Registry) error { + + if err := validate.Required("volumeID", "body", m.VolumeID); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this volume based on context it is used +func (m *Volume) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Volume) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Volume) UnmarshalBinary(b []byte) error { + var res Volume + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volume_action.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volume_action.go new file mode 100644 index 00000000000..b0c8b5eb443 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volume_action.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" +) + +// VolumeAction volume action +// +// swagger:model VolumeAction +type VolumeAction struct { + + // Indicates if the volume should be replication enabled or not + // Required: true + ReplicationEnabled *bool `json:"replicationEnabled"` +} + +// Validate validates this volume action +func (m *VolumeAction) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateReplicationEnabled(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumeAction) validateReplicationEnabled(formats strfmt.Registry) error { + + if err := validate.Required("replicationEnabled", "body", m.ReplicationEnabled); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this volume action based on context it is used +func (m *VolumeAction) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VolumeAction) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumeAction) UnmarshalBinary(b []byte) error { + var res VolumeAction + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volume_info.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volume_info.go new file mode 100644 index 00000000000..26f5b3f2a67 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volume_info.go @@ -0,0 +1,53 @@ +// 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" +) + +// VolumeInfo volume info +// +// swagger:model VolumeInfo +type VolumeInfo struct { + + // Name of the volume + Name string `json:"name,omitempty"` + + // ID of the volume + VolumeID string `json:"volumeID,omitempty"` +} + +// Validate validates this volume info +func (m *VolumeInfo) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this volume info based on context it is used +func (m *VolumeInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VolumeInfo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumeInfo) UnmarshalBinary(b []byte) error { + var res VolumeInfo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volume_reference.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volume_reference.go new file mode 100644 index 00000000000..95783127e87 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volume_reference.go @@ -0,0 +1,278 @@ +// 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" +) + +// VolumeReference volume reference +// +// swagger:model VolumeReference +type VolumeReference struct { + + // Indicates if the volume is the server's boot volume + BootVolume *bool `json:"bootVolume,omitempty"` + + // Indicates if the volume is boot capable + // Required: true + Bootable *bool `json:"bootable"` + + // Consistency Group Name if volume is a part of volume group + ConsistencyGroupName string `json:"consistencyGroupName,omitempty"` + + // Creation Date + // Required: true + // Format: date-time + CreationDate *strfmt.DateTime `json:"creationDate"` + + // Indicates if the volume should be deleted when the server terminates + DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"` + + // Type of Disk + // Required: true + DiskType *string `json:"diskType"` + + // Volume Group ID + GroupID string `json:"groupID,omitempty"` + + // Link to Volume resource + // Required: true + Href *string `json:"href"` + + // Last Update Date + // Required: true + // Format: date-time + LastUpdateDate *strfmt.DateTime `json:"lastUpdateDate"` + + // mirroring state for replication enabled volume + MirroringState string `json:"mirroringState,omitempty"` + + // Volume Name + // Required: true + Name *string `json:"name"` + + // List of PCloud PVM Instance attached to the volume + PvmInstanceIDs []string `json:"pvmInstanceIDs"` + + // shows the replication status of a volume + ReplicationStatus string `json:"replicationStatus,omitempty"` + + // Indicates if the volume is shareable between VMs + // Required: true + Shareable *bool `json:"shareable"` + + // Volume Size + // Required: true + Size *float64 `json:"size"` + + // Volume State + // Required: true + State *string `json:"state"` + + // Volume ID + // Required: true + VolumeID *string `json:"volumeID"` + + // Volume pool, name of storage pool where the volume is located + VolumePool string `json:"volumePool,omitempty"` + + // Volume type, name of storage template used to create the volume + VolumeType string `json:"volumeType,omitempty"` + + // Volume world wide name + // Required: true + Wwn *string `json:"wwn"` +} + +// Validate validates this volume reference +func (m *VolumeReference) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateBootable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCreationDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDiskType(formats); err != nil { + res = append(res, err) + } + + if err := m.validateHref(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastUpdateDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateShareable(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSize(formats); err != nil { + res = append(res, err) + } + + if err := m.validateState(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVolumeID(formats); err != nil { + res = append(res, err) + } + + if err := m.validateWwn(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumeReference) validateBootable(formats strfmt.Registry) error { + + if err := validate.Required("bootable", "body", m.Bootable); err != nil { + return err + } + + return nil +} + +func (m *VolumeReference) validateCreationDate(formats strfmt.Registry) error { + + if err := validate.Required("creationDate", "body", m.CreationDate); err != nil { + return err + } + + if err := validate.FormatOf("creationDate", "body", "date-time", m.CreationDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *VolumeReference) validateDiskType(formats strfmt.Registry) error { + + if err := validate.Required("diskType", "body", m.DiskType); err != nil { + return err + } + + return nil +} + +func (m *VolumeReference) validateHref(formats strfmt.Registry) error { + + if err := validate.Required("href", "body", m.Href); err != nil { + return err + } + + return nil +} + +func (m *VolumeReference) validateLastUpdateDate(formats strfmt.Registry) error { + + if err := validate.Required("lastUpdateDate", "body", m.LastUpdateDate); err != nil { + return err + } + + if err := validate.FormatOf("lastUpdateDate", "body", "date-time", m.LastUpdateDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *VolumeReference) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *VolumeReference) validateShareable(formats strfmt.Registry) error { + + if err := validate.Required("shareable", "body", m.Shareable); err != nil { + return err + } + + return nil +} + +func (m *VolumeReference) validateSize(formats strfmt.Registry) error { + + if err := validate.Required("size", "body", m.Size); err != nil { + return err + } + + return nil +} + +func (m *VolumeReference) validateState(formats strfmt.Registry) error { + + if err := validate.Required("state", "body", m.State); err != nil { + return err + } + + return nil +} + +func (m *VolumeReference) validateVolumeID(formats strfmt.Registry) error { + + if err := validate.Required("volumeID", "body", m.VolumeID); err != nil { + return err + } + + return nil +} + +func (m *VolumeReference) validateWwn(formats strfmt.Registry) error { + + if err := validate.Required("wwn", "body", m.Wwn); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this volume reference based on context it is used +func (m *VolumeReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VolumeReference) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumeReference) UnmarshalBinary(b []byte) error { + var res VolumeReference + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes.go new file mode 100644 index 00000000000..b701d4837ee --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes.go @@ -0,0 +1,119 @@ +// 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" +) + +// Volumes volumes +// +// swagger:model Volumes +type Volumes struct { + + // Volumes + // Required: true + Volumes []*VolumeReference `json:"volumes"` +} + +// Validate validates this volumes +func (m *Volumes) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVolumes(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Volumes) validateVolumes(formats strfmt.Registry) error { + + if err := validate.Required("volumes", "body", m.Volumes); err != nil { + return err + } + + for i := 0; i < len(m.Volumes); i++ { + if swag.IsZero(m.Volumes[i]) { // not required + continue + } + + if m.Volumes[i] != nil { + if err := m.Volumes[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this volumes based on the context it is used +func (m *Volumes) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVolumes(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Volumes) contextValidateVolumes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Volumes); i++ { + + if m.Volumes[i] != nil { + if err := m.Volumes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Volumes) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Volumes) UnmarshalBinary(b []byte) error { + var res Volumes + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_attach.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_attach.go new file mode 100644 index 00000000000..5e5b69b0891 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_attach.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" +) + +// VolumesAttach volumes attach +// +// swagger:model volumesAttach +type VolumesAttach struct { + + // List of volumes to be attached to a PVM instance + // Required: true + VolumeIDs []string `json:"volumeIDs"` +} + +// Validate validates this volumes attach +func (m *VolumesAttach) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVolumeIDs(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesAttach) validateVolumeIDs(formats strfmt.Registry) error { + + if err := validate.Required("volumeIDs", "body", m.VolumeIDs); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this volumes attach based on context it is used +func (m *VolumesAttach) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VolumesAttach) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumesAttach) UnmarshalBinary(b []byte) error { + var res VolumesAttach + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_attachment_response.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_attachment_response.go new file mode 100644 index 00000000000..a8d453d27ef --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_attachment_response.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" +) + +// VolumesAttachmentResponse volumes attachment response +// +// swagger:model VolumesAttachmentResponse +type VolumesAttachmentResponse struct { + + // status summary for volume attachment to a PVM Instance + // Required: true + Summary *string `json:"summary"` +} + +// Validate validates this volumes attachment response +func (m *VolumesAttachmentResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateSummary(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesAttachmentResponse) validateSummary(formats strfmt.Registry) error { + + if err := validate.Required("summary", "body", m.Summary); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this volumes attachment response based on context it is used +func (m *VolumesAttachmentResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VolumesAttachmentResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumesAttachmentResponse) UnmarshalBinary(b []byte) error { + var res VolumesAttachmentResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone.go new file mode 100644 index 00000000000..38cd8e679db --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone.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" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// VolumesClone volumes clone +// +// swagger:model VolumesClone +type VolumesClone struct { + + // Current action performed for the volumes-clone request + Action string `json:"action,omitempty"` + + // Creation Date + // Format: date-time + CreationDate strfmt.DateTime `json:"creationDate,omitempty"` + + // Failure reason for a failed volumes-clone request + FailureMessage string `json:"failureMessage,omitempty"` + + // Last Update Date + // Format: date-time + LastUpdateDate strfmt.DateTime `json:"lastUpdateDate,omitempty"` + + // Name assigned to a volumes-clone request + Name string `json:"name,omitempty"` + + // The percent completion for the current action + // Required: true + PercentComplete *int64 `json:"percentComplete"` + + // Current status of the volumes-clone request + Status string `json:"status,omitempty"` + + // ID assigned to a volumes-clone request + VolumesCloneID string `json:"volumesCloneID,omitempty"` +} + +// Validate validates this volumes clone +func (m *VolumesClone) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCreationDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastUpdateDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePercentComplete(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesClone) validateCreationDate(formats strfmt.Registry) error { + if swag.IsZero(m.CreationDate) { // not required + return nil + } + + if err := validate.FormatOf("creationDate", "body", "date-time", m.CreationDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *VolumesClone) validateLastUpdateDate(formats strfmt.Registry) error { + if swag.IsZero(m.LastUpdateDate) { // not required + return nil + } + + if err := validate.FormatOf("lastUpdateDate", "body", "date-time", m.LastUpdateDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *VolumesClone) validatePercentComplete(formats strfmt.Registry) error { + + if err := validate.Required("percentComplete", "body", m.PercentComplete); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this volumes clone based on context it is used +func (m *VolumesClone) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VolumesClone) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumesClone) UnmarshalBinary(b []byte) error { + var res VolumesClone + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_async_request.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_async_request.go new file mode 100644 index 00000000000..4ec6f73cd32 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_async_request.go @@ -0,0 +1,95 @@ +// 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" +) + +// VolumesCloneAsyncRequest volumes clone async request +// +// swagger:model VolumesCloneAsyncRequest +type VolumesCloneAsyncRequest struct { + + // Base name of the new cloned volume(s). + // Cloned Volume names will be prefixed with 'clone-' + // and suffixed with '-#####' (where ##### is a 5 digit random number) + // If multiple volumes cloned they will be further suffixed with an incremental number starting with 1. + // Example volume names using name="volume-abcdef" + // single volume clone will be named "clone-volume-abcdef-83081" + // multi volume clone will be named "clone-volume-abcdef-73721-1", "clone-volume-abcdef-73721-2", ... + // + // Required: true + Name *string `json:"name"` + + // List of volumes to be cloned + // Required: true + VolumeIDs []string `json:"volumeIDs"` +} + +// Validate validates this volumes clone async request +func (m *VolumesCloneAsyncRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVolumeIDs(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesCloneAsyncRequest) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *VolumesCloneAsyncRequest) validateVolumeIDs(formats strfmt.Registry) error { + + if err := validate.Required("volumeIDs", "body", m.VolumeIDs); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this volumes clone async request based on context it is used +func (m *VolumesCloneAsyncRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VolumesCloneAsyncRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumesCloneAsyncRequest) UnmarshalBinary(b []byte) error { + var res VolumesCloneAsyncRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_cancel.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_cancel.go new file mode 100644 index 00000000000..44bf4c720c9 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_cancel.go @@ -0,0 +1,52 @@ +// 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" +) + +// VolumesCloneCancel volumes clone cancel +// +// swagger:model VolumesCloneCancel +type VolumesCloneCancel struct { + + // default False, Cancel will only be allowed if the status is 'prepared', or 'available' + // True, Cancel will be allowed when the status is NOT completed, cancelling, cancelled, or failed + // + Force bool `json:"force,omitempty"` +} + +// Validate validates this volumes clone cancel +func (m *VolumesCloneCancel) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this volumes clone cancel based on context it is used +func (m *VolumesCloneCancel) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VolumesCloneCancel) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumesCloneCancel) UnmarshalBinary(b []byte) error { + var res VolumesCloneCancel + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_create.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_create.go new file mode 100644 index 00000000000..77b38ab9b77 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_create.go @@ -0,0 +1,90 @@ +// 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" +) + +// VolumesCloneCreate volumes clone create +// +// swagger:model VolumesCloneCreate +type VolumesCloneCreate struct { + + // Unique name within a cloud instance used to identify a volumes-clone request + // name can be used in replace of a volumesCloneID when used as a URL path parameter + // + // Required: true + Name *string `json:"name"` + + // List of volumes to be cloned + // Required: true + VolumeIDs []string `json:"volumeIDs"` +} + +// Validate validates this volumes clone create +func (m *VolumesCloneCreate) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVolumeIDs(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesCloneCreate) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +func (m *VolumesCloneCreate) validateVolumeIDs(formats strfmt.Registry) error { + + if err := validate.Required("volumeIDs", "body", m.VolumeIDs); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this volumes clone create based on context it is used +func (m *VolumesCloneCreate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VolumesCloneCreate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumesCloneCreate) UnmarshalBinary(b []byte) error { + var res VolumesCloneCreate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_detail.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_detail.go new file mode 100644 index 00000000000..24a51c91d8c --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_detail.go @@ -0,0 +1,189 @@ +// 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" +) + +// VolumesCloneDetail volumes clone detail +// +// swagger:model VolumesCloneDetail +type VolumesCloneDetail struct { + + // Current action performed for the volumes-clone request + Action string `json:"action,omitempty"` + + // List of cloned volumes created from the volumes-clone request + ClonedVolumes []*ClonedVolumeDetail `json:"clonedVolumes"` + + // Creation Date + // Format: date-time + CreationDate strfmt.DateTime `json:"creationDate,omitempty"` + + // Failure reason for a failed volumes-clone request + FailureMessage string `json:"failureMessage,omitempty"` + + // Last Update Date + // Format: date-time + LastUpdateDate strfmt.DateTime `json:"lastUpdateDate,omitempty"` + + // Name assigned to a volumes-clone request + Name string `json:"name,omitempty"` + + // The percent completion for the current action + // Required: true + PercentComplete *int64 `json:"percentComplete"` + + // Current status of the volumes-clone request + Status string `json:"status,omitempty"` + + // ID assigned to a volumes-clone request + VolumesCloneID string `json:"volumesCloneID,omitempty"` +} + +// Validate validates this volumes clone detail +func (m *VolumesCloneDetail) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClonedVolumes(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCreationDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastUpdateDate(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePercentComplete(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesCloneDetail) validateClonedVolumes(formats strfmt.Registry) error { + if swag.IsZero(m.ClonedVolumes) { // not required + return nil + } + + for i := 0; i < len(m.ClonedVolumes); i++ { + if swag.IsZero(m.ClonedVolumes[i]) { // not required + continue + } + + if m.ClonedVolumes[i] != nil { + if err := m.ClonedVolumes[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *VolumesCloneDetail) validateCreationDate(formats strfmt.Registry) error { + if swag.IsZero(m.CreationDate) { // not required + return nil + } + + if err := validate.FormatOf("creationDate", "body", "date-time", m.CreationDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *VolumesCloneDetail) validateLastUpdateDate(formats strfmt.Registry) error { + if swag.IsZero(m.LastUpdateDate) { // not required + return nil + } + + if err := validate.FormatOf("lastUpdateDate", "body", "date-time", m.LastUpdateDate.String(), formats); err != nil { + return err + } + + return nil +} + +func (m *VolumesCloneDetail) validatePercentComplete(formats strfmt.Registry) error { + + if err := validate.Required("percentComplete", "body", m.PercentComplete); err != nil { + return err + } + + return nil +} + +// ContextValidate validate this volumes clone detail based on the context it is used +func (m *VolumesCloneDetail) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClonedVolumes(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesCloneDetail) contextValidateClonedVolumes(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.ClonedVolumes); i++ { + + if m.ClonedVolumes[i] != nil { + if err := m.ClonedVolumes[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clonedVolumes" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *VolumesCloneDetail) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumesCloneDetail) UnmarshalBinary(b []byte) error { + var res VolumesCloneDetail + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_execute.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_execute.go new file mode 100644 index 00000000000..1e10ae5d359 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_execute.go @@ -0,0 +1,83 @@ +// 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" +) + +// VolumesCloneExecute volumes clone execute +// +// swagger:model VolumesCloneExecute +type VolumesCloneExecute struct { + + // Base name of the new cloned volume(s). + // Cloned Volume names will be prefixed with 'clone-' + // and suffixed with '-#####' (where ##### is a 5 digit random number) + // If multiple volumes cloned they will be further suffixed with an incremental number starting with 1. + // Example volume names using name="volume-abcdef" + // single volume clone will be named "clone-volume-abcdef-83081" + // multi volume clone will be named "clone-volume-abcdef-73721-1", "clone-volume-abcdef-73721-2", ... + // + // Required: true + Name *string `json:"name"` + + // default False, Execute failure rolls back clone activity but leaves prepared snapshot + // True, Execute failure rolls back clone activity and removes the prepared snapshot + // + RollbackPrepare bool `json:"rollbackPrepare,omitempty"` +} + +// Validate validates this volumes clone execute +func (m *VolumesCloneExecute) 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 *VolumesCloneExecute) validateName(formats strfmt.Registry) error { + + if err := validate.Required("name", "body", m.Name); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this volumes clone execute based on context it is used +func (m *VolumesCloneExecute) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VolumesCloneExecute) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumesCloneExecute) UnmarshalBinary(b []byte) error { + var res VolumesCloneExecute + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_request.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_request.go new file mode 100644 index 00000000000..7ed5f8c5cd1 --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_request.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" +) + +// VolumesCloneRequest volumes clone request +// +// swagger:model VolumesCloneRequest +type VolumesCloneRequest struct { + + // Display name for the new cloned volumes. + // Cloned Volume names will be prefixed with 'clone-'. + // If multiple volumes cloned they will be suffix with a '-' and an incremental number starting with 1. + // Example volume names using displayName="volume-abcdef" + // single volume clone will be named "clone-volume-abcdef" + // multi volume clone will be named "clone-volume-abcdef-1", "clone-volume-abcdef-2", ... + // + // Required: true + DisplayName *string `json:"displayName"` + + // List of volumes to be cloned + // Required: true + VolumeIDs []string `json:"volumeIDs"` +} + +// Validate validates this volumes clone request +func (m *VolumesCloneRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDisplayName(formats); err != nil { + res = append(res, err) + } + + if err := m.validateVolumeIDs(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesCloneRequest) validateDisplayName(formats strfmt.Registry) error { + + if err := validate.Required("displayName", "body", m.DisplayName); err != nil { + return err + } + + return nil +} + +func (m *VolumesCloneRequest) validateVolumeIDs(formats strfmt.Registry) error { + + if err := validate.Required("volumeIDs", "body", m.VolumeIDs); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this volumes clone request based on context it is used +func (m *VolumesCloneRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VolumesCloneRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumesCloneRequest) UnmarshalBinary(b []byte) error { + var res VolumesCloneRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_response.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_response.go new file mode 100644 index 00000000000..09ecf72c26f --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clone_response.go @@ -0,0 +1,53 @@ +// 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" +) + +// VolumesCloneResponse volumes clone response +// +// swagger:model VolumesCloneResponse +type VolumesCloneResponse struct { + + // ID of the new cloned volume + AdditionalProperties string `json:"additionalProperties,omitempty"` + + // A map of volume IDs to cloned volume IDs + ClonedVolumes interface{} `json:"clonedVolumes,omitempty"` +} + +// Validate validates this volumes clone response +func (m *VolumesCloneResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this volumes clone response based on context it is used +func (m *VolumesCloneResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *VolumesCloneResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumesCloneResponse) UnmarshalBinary(b []byte) error { + var res VolumesCloneResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clones.go b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clones.go new file mode 100644 index 00000000000..33bcab36fbf --- /dev/null +++ b/vendor/github.com/IBM-Cloud/power-go-client/power/models/volumes_clones.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" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// VolumesClones volumes clones +// +// swagger:model VolumesClones +type VolumesClones struct { + + // list of volumes-clone requests + VolumesClone []*VolumesClone `json:"volumesClone"` +} + +// Validate validates this volumes clones +func (m *VolumesClones) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVolumesClone(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesClones) validateVolumesClone(formats strfmt.Registry) error { + if swag.IsZero(m.VolumesClone) { // not required + return nil + } + + for i := 0; i < len(m.VolumesClone); i++ { + if swag.IsZero(m.VolumesClone[i]) { // not required + continue + } + + if m.VolumesClone[i] != nil { + if err := m.VolumesClone[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volumesClone" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumesClone" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this volumes clones based on the context it is used +func (m *VolumesClones) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVolumesClone(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *VolumesClones) contextValidateVolumesClone(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.VolumesClone); i++ { + + if m.VolumesClone[i] != nil { + if err := m.VolumesClone[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("volumesClone" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("volumesClone" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *VolumesClones) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *VolumesClones) UnmarshalBinary(b []byte) error { + var res VolumesClones + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/LICENSE b/vendor/github.com/IBM/go-sdk-core/v5/LICENSE new file mode 100644 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/authenticator.go b/vendor/github.com/IBM/go-sdk-core/v5/core/authenticator.go new file mode 100644 index 00000000000..e580c65061b --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/authenticator.go @@ -0,0 +1,43 @@ +package core + +// (C) Copyright IBM Corp. 2019. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "net/http" +) + +// Authenticator describes the set of methods implemented by each authenticator. +type Authenticator interface { + AuthenticationType() string + Authenticate(*http.Request) error + Validate() error +} + +// AuthenticationError describes the error returned when authentication fails +type AuthenticationError struct { + Response *DetailedResponse + Err error +} + +func (e *AuthenticationError) Error() string { + return e.Err.Error() +} + +func NewAuthenticationError(response *DetailedResponse, err error) *AuthenticationError { + return &AuthenticationError{ + Response: response, + Err: err, + } +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/authenticator_factory.go b/vendor/github.com/IBM/go-sdk-core/v5/core/authenticator_factory.go new file mode 100644 index 00000000000..b02bc1efcc7 --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/authenticator_factory.go @@ -0,0 +1,68 @@ +package core + +// (C) Copyright IBM Corp. 2019, 2021. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "fmt" + "strings" +) + +// GetAuthenticatorFromEnvironment instantiates an Authenticator using service properties +// retrieved from external config sources. +func GetAuthenticatorFromEnvironment(credentialKey string) (authenticator Authenticator, err error) { + properties, err := getServiceProperties(credentialKey) + if len(properties) == 0 { + return + } + + // Determine the authentication type if not specified explicitly. + authType := properties[PROPNAME_AUTH_TYPE] + + // Support alternate "AUTHTYPE" property. + if authType == "" { + authType = properties["AUTHTYPE"] + } + + // Determine a default auth type if one wasn't specified. + if authType == "" { + // If the APIKEY property is specified, then we'll guess IAM... otherwise CR Auth. + if properties[PROPNAME_APIKEY] != "" { + authType = AUTHTYPE_IAM + } else { + authType = AUTHTYPE_CONTAINER + } + } + + // Create the authenticator appropriate for the auth type. + if strings.EqualFold(authType, AUTHTYPE_BASIC) { + authenticator, err = newBasicAuthenticatorFromMap(properties) + } else if strings.EqualFold(authType, AUTHTYPE_BEARER_TOKEN) { + authenticator, err = newBearerTokenAuthenticatorFromMap(properties) + } else if strings.EqualFold(authType, AUTHTYPE_IAM) { + authenticator, err = newIamAuthenticatorFromMap(properties) + } else if strings.EqualFold(authType, AUTHTYPE_CONTAINER) { + authenticator, err = newContainerAuthenticatorFromMap(properties) + } else if strings.EqualFold(authType, AUTHTYPE_VPC) { + authenticator, err = newVpcInstanceAuthenticatorFromMap(properties) + } else if strings.EqualFold(authType, AUTHTYPE_CP4D) { + authenticator, err = newCloudPakForDataAuthenticatorFromMap(properties) + } else if strings.EqualFold(authType, AUTHTYPE_NOAUTH) { + authenticator, err = NewNoAuthAuthenticator() + } else { + err = fmt.Errorf(ERRORMSG_AUTHTYPE_UNKNOWN, authType) + } + + return +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/base_service.go b/vendor/github.com/IBM/go-sdk-core/v5/core/base_service.go new file mode 100644 index 00000000000..264ea70aa50 --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/base_service.go @@ -0,0 +1,781 @@ +package core + +// (C) Copyright IBM Corp. 2019, 2022. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "bytes" + "context" + "crypto/tls" + "crypto/x509" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/http/httputil" + "net/url" + "reflect" + "regexp" + "strconv" + "strings" + "time" + + cleanhttp "github.com/hashicorp/go-cleanhttp" + retryablehttp "github.com/hashicorp/go-retryablehttp" +) + +const ( + headerNameUserAgent = "User-Agent" + sdkName = "ibm-go-sdk-core" +) + +// ServiceOptions is a struct of configuration values for a service. +type ServiceOptions struct { + // This is the base URL associated with the service instance. This value will + // be combined with the paths for each operation to form the request URL + // [required]. + URL string + + // Authenticator holds the authenticator implementation to be used by the + // service instance to authenticate outbound requests, typically by adding the + // HTTP "Authorization" header. + Authenticator Authenticator + + // EnableGzipCompression indicates whether or not request bodies + // should be gzip-compressed. + // This field has no effect on response bodies. + // If enabled, the Body field will be gzip-compressed and + // the "Content-Encoding" header will be added to the request with the + // value "gzip". + EnableGzipCompression bool +} + +// BaseService implements the common functionality shared by generated services +// to manage requests and responses, authenticate outbound requests, etc. +type BaseService struct { + + // Configuration values for a service. + Options *ServiceOptions + + // A set of "default" http headers to be included with each outbound request. + DefaultHeaders http.Header + + // The HTTP Client used to send requests and receive responses. + Client *http.Client + + // The value to be used for the "User-Agent" HTTP header that is added to each + // outbound request. If this value is not set, then a default value will be + // used for the header. + UserAgent string +} + +// NewBaseService constructs a new instance of BaseService. Validation on input +// parameters and service options will be performed before instance creation. +func NewBaseService(options *ServiceOptions) (*BaseService, error) { + if HasBadFirstOrLastChar(options.URL) { + return nil, fmt.Errorf(ERRORMSG_PROP_INVALID, "URL") + } + + if IsNil(options.Authenticator) { + return nil, fmt.Errorf(ERRORMSG_NO_AUTHENTICATOR) + } + + if err := options.Authenticator.Validate(); err != nil { + return nil, err + } + + service := BaseService{ + Options: options, + + Client: DefaultHTTPClient(), + } + + // Set a default value for the User-Agent http header. + service.SetUserAgent(service.buildUserAgent()) + + return &service, nil +} + +// Clone will return a copy of "service" suitable for use by a +// generated service instance to process requests. +func (service *BaseService) Clone() *BaseService { + if IsNil(service) { + return nil + } + + // First, copy the service options struct. + serviceOptions := *service.Options + + // Next, make a copy the service struct, then use the copy of the service options. + // Note, we'll re-use the "Client" instance from the original BaseService instance. + clone := *service + clone.Options = &serviceOptions + + return &clone +} + +// ConfigureService updates the service with external configuration values. +func (service *BaseService) ConfigureService(serviceName string) error { + // Try to load service properties from external config. + serviceProps, err := getServiceProperties(serviceName) + if err != nil { + return err + } + + // If we were able to load any properties for this service, then check to see if the + // service-level properties were present and set them on the service if so. + if serviceProps != nil { + + // URL + if url, ok := serviceProps[PROPNAME_SVC_URL]; ok && url != "" { + err := service.SetURL(url) + if err != nil { + return err + } + } + + // DISABLE_SSL + if disableSSL, ok := serviceProps[PROPNAME_SVC_DISABLE_SSL]; ok && disableSSL != "" { + // Convert the config string to bool. + boolValue, err := strconv.ParseBool(disableSSL) + if err != nil { + boolValue = false + } + + // If requested, disable SSL. + if boolValue { + service.DisableSSLVerification() + } + } + + // ENABLE_GZIP + if enableGzip, ok := serviceProps[PROPNAME_SVC_ENABLE_GZIP]; ok && enableGzip != "" { + // Convert the config string to bool. + boolValue, err := strconv.ParseBool(enableGzip) + if err == nil { + service.SetEnableGzipCompression(boolValue) + } + } + + // ENABLE_RETRIES + // If "ENABLE_RETRIES" is set to true, then we'll also try to retrieve "MAX_RETRIES" and + // "RETRY_INTERVAL". If those are not specified, we'll use 0 to trigger a default value for each. + if enableRetries, ok := serviceProps[PROPNAME_SVC_ENABLE_RETRIES]; ok && enableRetries != "" { + boolValue, err := strconv.ParseBool(enableRetries) + if boolValue && err == nil { + var maxRetries int = 0 + var retryInterval time.Duration = 0 + + var s string + var ok bool + if s, ok = serviceProps[PROPNAME_SVC_MAX_RETRIES]; ok && s != "" { + n, err := strconv.ParseInt(s, 10, 32) + if err == nil { + maxRetries = int(n) + } + } + + if s, ok = serviceProps[PROPNAME_SVC_RETRY_INTERVAL]; ok && s != "" { + n, err := strconv.ParseInt(s, 10, 32) + if err == nil { + retryInterval = time.Duration(n) * time.Second + } + } + + service.EnableRetries(maxRetries, retryInterval) + } + } + } + return nil +} + +// SetURL sets the service URL. +// +// Deprecated: use SetServiceURL instead. +func (service *BaseService) SetURL(url string) error { + return service.SetServiceURL(url) +} + +// SetServiceURL sets the service URL. +func (service *BaseService) SetServiceURL(url string) error { + if HasBadFirstOrLastChar(url) { + return fmt.Errorf(ERRORMSG_PROP_INVALID, "URL") + } + + service.Options.URL = url + return nil +} + +// GetServiceURL returns the service URL. +func (service *BaseService) GetServiceURL() string { + return service.Options.URL +} + +// SetDefaultHeaders sets HTTP headers to be sent in every request. +func (service *BaseService) SetDefaultHeaders(headers http.Header) { + service.DefaultHeaders = headers +} + +// SetHTTPClient updates the client handling the requests. +func (service *BaseService) SetHTTPClient(client *http.Client) { + service.Client = client +} + +// DisableSSLVerification skips SSL verification. +// This function sets a new http.Client instance on the service +// and configures it to bypass verification of server certificates +// and host names, making the client susceptible to "man-in-the-middle" +// attacks. This should be used only for testing. +func (service *BaseService) DisableSSLVerification() { + // Make sure we have a non-nil client hanging off the BaseService. + if service.Client == nil { + service.SetHTTPClient(DefaultHTTPClient()) + } + + // Grab the Transport instance used to invoke requests and set it + // to skip server ssl certificate verification. + tr := getClientTransportForSSL(service.Client) + if tr != nil { + + // If no TLS config, then create a new one. + if tr.TLSClientConfig == nil { + tr.TLSClientConfig = &tls.Config{} // #nosec G402 + } + + // Disable server ssl cert & hostname verification. + tr.TLSClientConfig.InsecureSkipVerify = true // #nosec G402 + } +} + +// IsSSLDisabled returns true if and only if the service's http.Client instance +// is configured to skip verification of server SSL certificates. +func (service *BaseService) IsSSLDisabled() bool { + if service.Client != nil { + tr := getClientTransportForSSL(service.Client) + if tr != nil { + if tr.TLSClientConfig != nil { + return tr.TLSClientConfig.InsecureSkipVerify + } + } + } + return false +} + +// getClientTransportForSSL() will return the http.Transport instance +// that needs to be modified to disable SSL. This is a bit tricky +// because we have to account for the retries-enabled scenario. +func getClientTransportForSSL(client *http.Client) *http.Transport { + // "client" will be passed in as the client instance that is hanging off + // the BaseService. This could be either a "normal" http.Client instance + // to be used when retries are not enabled, or it could be a "shim" http.Client + // instance that's used when retries are enabled. + // We determine which it is by checking the client's Transport field. + // If it is a "shim" client instance then the Transport field will be an + // instance of the retryablehttp.RoundTripper struct, otherwise the Transport + // field will be an instance of http.Transport. + + // if "client" is a shim http.Client instance to support retries, then just + // change "client" to point to the real http.Client instance that is embedded inside + // the retryablehttp.Client instance, since this is the one used to invoke + // individual requests when retries are enabled. + if tr, ok := client.Transport.(*retryablehttp.RoundTripper); tr != nil && ok { + client = tr.Client.HTTPClient + } + + // Next, + if client != nil { + if tr, ok := client.Transport.(*http.Transport); tr != nil && ok { + return tr + } + } + + return nil +} + +// SetEnableGzipCompression sets the service's EnableGzipCompression field +func (service *BaseService) SetEnableGzipCompression(enableGzip bool) { + service.Options.EnableGzipCompression = enableGzip +} + +// GetEnableGzipCompression returns the service's EnableGzipCompression field +func (service *BaseService) GetEnableGzipCompression() bool { + return service.Options.EnableGzipCompression +} + +// buildUserAgent builds the user agent string. +func (service *BaseService) buildUserAgent() string { + return fmt.Sprintf("%s-%s %s", sdkName, __VERSION__, SystemInfo()) +} + +// SetUserAgent sets the user agent value. +func (service *BaseService) SetUserAgent(userAgentString string) { + if userAgentString == "" { + userAgentString = service.buildUserAgent() + } + service.UserAgent = userAgentString +} + +// +// Request invokes the specified HTTP request and returns the response. +// +// Parameters: +// req: the http.Request object that holds the request information +// +// result: a pointer to the operation result. This should be one of: +// - *io.ReadCloser (for a byte-stream type response) +// - *, *[], *map[string] +// - *map[string]json.RawMessage, *[]json.RawMessage +// +// Return values: +// detailedResponse: a DetailedResponse instance containing the status code, headers, etc. +// +// err: a non-nil error object if an error occurred +// +func (service *BaseService) Request(req *http.Request, result interface{}) (detailedResponse *DetailedResponse, err error) { + // Add default headers. + if service.DefaultHeaders != nil { + for k, v := range service.DefaultHeaders { + req.Header.Add(k, strings.Join(v, "")) + } + + // After adding the default headers, make one final check to see if the user + // specified the "Host" header within the default headers. + // This needs to be handled separately because it will be ignored by + // the Request.Write() method. + host := service.DefaultHeaders.Get("Host") + if host != "" { + req.Host = host + } + } + + // Add the default User-Agent header if not already present. + userAgent := req.Header.Get(headerNameUserAgent) + if userAgent == "" { + req.Header.Add(headerNameUserAgent, service.UserAgent) + } + + // Add authentication to the outbound request. + if IsNil(service.Options.Authenticator) { + err = fmt.Errorf(ERRORMSG_NO_AUTHENTICATOR) + return + } + + authError := service.Options.Authenticator.Authenticate(req) + if authError != nil { + err = fmt.Errorf(ERRORMSG_AUTHENTICATE_ERROR, authError.Error()) + castErr, ok := authError.(*AuthenticationError) + if ok { + detailedResponse = castErr.Response + } + return + } + + // If debug is enabled, then dump the request. + if GetLogger().IsLogLevelEnabled(LevelDebug) { + buf, dumpErr := httputil.DumpRequestOut(req, req.Body != nil) + if dumpErr == nil { + GetLogger().Debug("Request:\n%s\n", RedactSecrets(string(buf))) + } else { + GetLogger().Debug("error while attempting to log outbound request: %s", dumpErr.Error()) + } + } + + // Invoke the request, then check for errors during the invocation. + var httpResponse *http.Response + httpResponse, err = service.Client.Do(req) + if err != nil { + if strings.Contains(err.Error(), SSL_CERTIFICATION_ERROR) { + err = fmt.Errorf(ERRORMSG_SSL_VERIFICATION_FAILED + "\n" + err.Error()) + } + return + } + + // If debug is enabled, then dump the response. + if GetLogger().IsLogLevelEnabled(LevelDebug) { + buf, dumpErr := httputil.DumpResponse(httpResponse, httpResponse.Body != nil) + if err == nil { + GetLogger().Debug("Response:\n%s\n", RedactSecrets(string(buf))) + } else { + GetLogger().Debug("error while attempting to log inbound response: %s", dumpErr.Error()) + } + } + + // Start to populate the DetailedResponse. + detailedResponse = &DetailedResponse{ + StatusCode: httpResponse.StatusCode, + Headers: httpResponse.Header, + } + + contentType := httpResponse.Header.Get(CONTENT_TYPE) + + // If the operation was unsuccessful, then set up the DetailedResponse + // and error objects appropriately. + if httpResponse.StatusCode < 200 || httpResponse.StatusCode >= 300 { + + var responseBody []byte + + // First, read the response body into a byte array. + if httpResponse.Body != nil { + var readErr error + + defer httpResponse.Body.Close() + responseBody, readErr = ioutil.ReadAll(httpResponse.Body) + if readErr != nil { + err = fmt.Errorf(ERRORMSG_READ_RESPONSE_BODY, readErr.Error()) + return + } + } + + // If the responseBody is empty, then just return a generic error based on the status code. + if len(responseBody) == 0 { + err = fmt.Errorf(http.StatusText(httpResponse.StatusCode)) + return + } + + // For a JSON-based error response body, decode it into a map (generic JSON object). + if IsJSONMimeType(contentType) { + // Return the error response body as a map, along with an + // error object containing our best guess at an error message. + responseMap, decodeErr := decodeAsMap(responseBody) + if decodeErr == nil { + detailedResponse.Result = responseMap + err = fmt.Errorf(getErrorMessage(responseMap, detailedResponse.StatusCode)) + return + } + } + + // For a non-JSON response or if we tripped while decoding the JSON response, + // just return the response body byte array in the RawResult field along with + // an error object that contains the generic error message for the status code. + detailedResponse.RawResult = responseBody + err = fmt.Errorf(http.StatusText(httpResponse.StatusCode)) + return + } + + // Operation was successful and we are expecting a response, so process the response. + if !IsNil(result) { + resultType := reflect.TypeOf(result).String() + + // If 'result' is a io.ReadCloser, then pass the response body back reflectively via 'result' + // and bypass any further unmarshalling of the response. + if resultType == "*io.ReadCloser" { + rResult := reflect.ValueOf(result).Elem() + rResult.Set(reflect.ValueOf(httpResponse.Body)) + detailedResponse.Result = httpResponse.Body + } else { + + // First, read the response body into a byte array. + defer httpResponse.Body.Close() + responseBody, readErr := ioutil.ReadAll(httpResponse.Body) + if readErr != nil { + err = fmt.Errorf(ERRORMSG_READ_RESPONSE_BODY, readErr.Error()) + return + } + + // If the response body is empty, then skip any attempt to deserialize and just return + if len(responseBody) == 0 { + return + } + + // If the content-type indicates JSON, then unmarshal the response body as JSON. + if IsJSONMimeType(contentType) { + // Decode the byte array as JSON. + decodeErr := json.NewDecoder(bytes.NewReader(responseBody)).Decode(result) + if decodeErr != nil { + // Error decoding the response body. + // Return the response body in RawResult, along with an error. + err = fmt.Errorf(ERRORMSG_UNMARSHAL_RESPONSE_BODY, decodeErr.Error()) + detailedResponse.RawResult = responseBody + return + } + + // Decode step was successful. Return the decoded response object in the Result field. + detailedResponse.Result = reflect.ValueOf(result).Elem().Interface() + return + } + + // Check to see if the caller wanted the response body as a string. + // If the caller passed in 'result' as the address of *string, + // then we'll reflectively set result to point to it. + if resultType == "**string" { + responseString := string(responseBody) + rResult := reflect.ValueOf(result).Elem() + rResult.Set(reflect.ValueOf(&responseString)) + + // And set the string in the Result field. + detailedResponse.Result = &responseString + } else if resultType == "*[]uint8" { // byte is an alias for uint8 + rResult := reflect.ValueOf(result).Elem() + rResult.Set(reflect.ValueOf(responseBody)) + + // And set the byte slice in the Result field. + detailedResponse.Result = responseBody + } else { + // At this point, we don't know how to set the result field, so we have to return an error. + // But make sure we save the bytes we read in the DetailedResponse for debugging purposes + detailedResponse.Result = responseBody + err = fmt.Errorf(ERRORMSG_UNEXPECTED_RESPONSE, contentType, resultType) + return + } + } + } + + return +} + +// Errors is a struct used to hold an array of errors received in an operation +// response. +type Errors struct { + Errors []Error `json:"errors,omitempty"` +} + +// Error is a struct used to represent a single error received in an operation +// response. +type Error struct { + Message string `json:"message,omitempty"` +} + +// decodeAsMap: Decode the specified JSON byte-stream into a map (akin to a generic JSON object). +// Notes: +// 1) This function will return the map (result of decoding the byte-stream) as well as the raw +// byte buffer. We return the byte buffer in addition to the decoded map so that the caller can +// re-use (if necessary) the stream of bytes after we've consumed them via the JSON decode step. +// 2) The primary return value of this function will be: +// a) an instance of map[string]interface{} if the specified byte-stream was successfully +// decoded as JSON. +// b) the string form of the byte-stream if the byte-stream could not be successfully +// decoded as JSON. +// 3) This function will close the io.ReadCloser before returning. +func decodeAsMap(byteBuffer []byte) (result map[string]interface{}, err error) { + err = json.NewDecoder(bytes.NewReader(byteBuffer)).Decode(&result) + return +} + +// getErrorMessage: try to retrieve an error message from the decoded response body (map). +func getErrorMessage(responseMap map[string]interface{}, statusCode int) string { + + // If the response contained the "errors" field, then try to deserialize responseMap + // into an array of Error structs, then return the first entry's "Message" field. + if _, ok := responseMap["errors"]; ok { + var errors Errors + responseBuffer, _ := json.Marshal(responseMap) + if err := json.Unmarshal(responseBuffer, &errors); err == nil { + return errors.Errors[0].Message + } + } + + // Return the "error" field if present and is a string. + if val, ok := responseMap["error"]; ok { + errorMsg, ok := val.(string) + if ok { + return errorMsg + } + } + + // Return the "message" field if present and is a string. + if val, ok := responseMap["message"]; ok { + errorMsg, ok := val.(string) + if ok { + return errorMsg + } + } + + // Finally, return the "errorMessage" field if present and is a string. + if val, ok := responseMap["errorMessage"]; ok { + errorMsg, ok := val.(string) + if ok { + return errorMsg + } + } + + // If we couldn't find an error message above, just return the generic text + // for the status code. + return http.StatusText(statusCode) +} + +// EnableRetries will construct a "retryable" HTTP Client with the specified +// configuration, and then set it on the service instance. +// If maxRetries and/or maxRetryInterval are specified as 0, then default values +// are used instead. +// +// In a scenario where retries ARE NOT enabled: +// - BaseService.Client will be a "normal" http.Client instance used to invoke requests +// - BaseService.Client.Transport will be an instance of the default http.RoundTripper +// - BaseService.Client.Do() calls http.RoundTripper.RoundTrip() to invoke the request +// - Only one http.Client instance needed/used (BaseService.Client) in this scenario +// - Result: "normal" request processing without any automatic retries being performed +// +// In a scenario where retries ARE enabled: +// - BaseService.Client will be a "shim" http.Client instance +// - BaseService.Client.Transport will be an instance of retryablehttp.RoundTripper +// - BaseService.Client.Do() calls retryablehttp.RoundTripper.RoundTrip() (via the shim) +// to invoke the request +// - The retryablehttp.RoundTripper instance is configured with the retryablehttp.Client +// instance which holds the various retry config properties (max retries, max interval, etc.) +// - The retryablehttp.RoundTripper.RoundTrip() method triggers the retry logic in the retryablehttp.Client +// - The retryablehttp.Client instance's HTTPClient field holds a "normal" http.Client instance, +// which is used to invoke individual requests within the retry loop. +// - To summarize, there are three client instances used for request processing in this scenario: +// - The "shim" http.Client instance (BaseService.Client) +// - The retryablehttp.Client instance that implements the retry logic +// - The "normal" http.Client instance embedded in the retryablehttp.Client which is used to invoke +// individual requests within the retry logic +// - Result: Each request is invoked such that the automatic retry logic is employed +func (service *BaseService) EnableRetries(maxRetries int, maxRetryInterval time.Duration) { + // Remember whether or not SSL verification has been disabled. + isSSLDisabled := service.IsSSLDisabled() + + // Create and configure the retryable client, then set it on the service. + client := NewRetryableHTTPClient() + if maxRetries > 0 { + client.RetryMax = maxRetries + } + if maxRetryInterval > 0 { + client.RetryWaitMax = maxRetryInterval + } + service.SetHTTPClient(client.StandardClient()) + + // If SSL verification was previously disabled, then disable it now on the new client. + if isSSLDisabled { + service.DisableSSLVerification() + } +} + +// DisableRetries will disable automatic retries by constructing a new +// default (non-retryable) HTTP Client instance and setting it on the service. +func (service *BaseService) DisableRetries() { + // Remember whether or not SSL verification has been disabled. + isSSLDisabled := service.IsSSLDisabled() + + // Set a new standard client on the service. + service.SetHTTPClient(DefaultHTTPClient()) + + // If SSL verification was previously disabled, then disable it now on the new client. + if isSSLDisabled { + service.DisableSSLVerification() + } +} + +// DefaultHTTPClient returns a non-retryable http client with default configuration. +func DefaultHTTPClient() *http.Client { + return cleanhttp.DefaultPooledClient() +} + +// httpLogger is a shim layer used to allow the Go core's logger to be used with the retryablehttp interfaces. +type httpLogger struct { +} + +func (l *httpLogger) Printf(format string, inserts ...interface{}) { + if GetLogger().IsLogLevelEnabled(LevelDebug) { + msg := fmt.Sprintf(format, inserts...) + GetLogger().Log(LevelDebug, RedactSecrets(msg)) + } +} + +// NewRetryableHTTPClient returns a new instance of go-retryablehttp.Client +// with a default configuration that supports Go SDK usage. +func NewRetryableHTTPClient() *retryablehttp.Client { + client := retryablehttp.NewClient() + client.Logger = &httpLogger{} + client.CheckRetry = IBMCloudSDKRetryPolicy + client.Backoff = IBMCloudSDKBackoffPolicy + client.ErrorHandler = retryablehttp.PassthroughErrorHandler + return client +} + +var ( + // A regular expression to match the error returned by net/http when the + // configured number of redirects is exhausted. This error isn't typed + // specifically so we resort to matching on the error string. + redirectsErrorRe = regexp.MustCompile(`stopped after \d+ redirects\z`) + + // A regular expression to match the error returned by net/http when the + // scheme specified in the URL is invalid. This error isn't typed + // specifically so we resort to matching on the error string. + schemeErrorRe = regexp.MustCompile(`unsupported protocol scheme`) +) + +// IBMCloudSDKRetryPolicy provides a default implementation of the CheckRetry interface +// associated with a retryablehttp.Client. +// This function will return true if the specified request/response should be retried. +func IBMCloudSDKRetryPolicy(ctx context.Context, resp *http.Response, err error) (bool, error) { + // This logic was adapted from go-relyablehttp.ErrorPropagatedRetryPolicy(). + + // Do not retry on a Context-related error (Canceled or DeadlineExceeded). + if ctx.Err() != nil { + return false, ctx.Err() + } + + // Next, check for a few non-retryable errors. + if err != nil { + if v, ok := err.(*url.Error); ok { + // Don't retry if the error was due to too many redirects. + if redirectsErrorRe.MatchString(v.Error()) { + return false, v + } + + // Don't retry if the error was due to an invalid protocol scheme. + if schemeErrorRe.MatchString(v.Error()) { + return false, v + } + + // Don't retry if the error was due to TLS cert verification failure. + if _, ok := v.Err.(x509.UnknownAuthorityError); ok { + return false, v + } + } + + // The error is likely recoverable so retry. + return true, nil + } + + // Now check the status code. + + // A 429 should be retryable. + // All codes in the 500's range except for 501 (Not Implemented) should be retryable. + if resp.StatusCode == 429 || (resp.StatusCode >= 500 && resp.StatusCode <= 599 && resp.StatusCode != 501) { + return true, nil + } + + return false, nil +} + +// IBMCloudSDKBackoffPolicy provides a default implementation of the Backoff interface +// associated with a retryablehttp.Client. +// This function will return the wait time to be associated with the next retry attempt. +func IBMCloudSDKBackoffPolicy(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration { + // Check for a Retry-After header. + if resp != nil { + if s, ok := resp.Header["Retry-After"]; ok { + // First, try to parse the value as an integer (number of seconds to wait) + if sleep, err := strconv.ParseInt(s[0], 10, 64); err == nil { + return time.Second * time.Duration(sleep) + } + + // Otherwise, try to parse the value as an HTTP Time value. + if retryTime, err := http.ParseTime(s[0]); err == nil { + sleep := time.Until(retryTime) + if sleep > max { + sleep = max + } + return sleep + } + + } + } + + // If no header-based wait time can be determined, then ask DefaultBackoff() + // to compute an exponential backoff. + return retryablehttp.DefaultBackoff(min, max, attemptNum, resp) +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/basic_authenticator.go b/vendor/github.com/IBM/go-sdk-core/v5/core/basic_authenticator.go new file mode 100644 index 00000000000..460f3ef9111 --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/basic_authenticator.go @@ -0,0 +1,94 @@ +package core + +// (C) Copyright IBM Corp. 2019. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "fmt" + "net/http" +) + +// BasicAuthenticator takes a user-supplied username and password, and adds +// them to requests via an Authorization header of the form: +// +// Authorization: Basic +// +type BasicAuthenticator struct { + // Username is the user-supplied basic auth username [required]. + Username string + // Password is the user-supplied basic auth password [required]. + Password string +} + +// NewBasicAuthenticator constructs a new BasicAuthenticator instance. +func NewBasicAuthenticator(username string, password string) (*BasicAuthenticator, error) { + obj := &BasicAuthenticator{ + Username: username, + Password: password, + } + if err := obj.Validate(); err != nil { + return nil, err + } + return obj, nil +} + +// newBasicAuthenticatorFromMap constructs a new BasicAuthenticator instance +// from a map. +func newBasicAuthenticatorFromMap(properties map[string]string) (*BasicAuthenticator, error) { + if properties == nil { + return nil, fmt.Errorf(ERRORMSG_PROPS_MAP_NIL) + } + + return NewBasicAuthenticator(properties[PROPNAME_USERNAME], properties[PROPNAME_PASSWORD]) +} + +// AuthenticationType returns the authentication type for this authenticator. +func (BasicAuthenticator) AuthenticationType() string { + return AUTHTYPE_BASIC +} + +// Authenticate adds basic authentication information to a request. +// +// Basic Authorization will be added to the request's headers in the form: +// +// Authorization: Basic +// +func (this *BasicAuthenticator) Authenticate(request *http.Request) error { + request.SetBasicAuth(this.Username, this.Password) + return nil +} + +// Validate the authenticator's configuration. +// +// Ensures the username and password are not Nil. Additionally, ensures +// they do not contain invalid characters. +func (this BasicAuthenticator) Validate() error { + if this.Username == "" { + return fmt.Errorf(ERRORMSG_PROP_MISSING, "Username") + } + + if this.Password == "" { + return fmt.Errorf(ERRORMSG_PROP_MISSING, "Password") + } + + if HasBadFirstOrLastChar(this.Username) { + return fmt.Errorf(ERRORMSG_PROP_INVALID, "Username") + } + + if HasBadFirstOrLastChar(this.Password) { + return fmt.Errorf(ERRORMSG_PROP_INVALID, "Password") + } + + return nil +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/bearer_token_authenticator.go b/vendor/github.com/IBM/go-sdk-core/v5/core/bearer_token_authenticator.go new file mode 100644 index 00000000000..8f2f35fec7a --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/bearer_token_authenticator.go @@ -0,0 +1,77 @@ +package core + +// (C) Copyright IBM Corp. 2019. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "fmt" + "net/http" +) + +// BearerTokenAuthenticator will take a user-supplied bearer token and adds +// it to requests via an Authorization header of the form: +// +// Authorization: Bearer +// +type BearerTokenAuthenticator struct { + + // The bearer token value to be used to authenticate request [required]. + BearerToken string +} + +// NewBearerTokenAuthenticator constructs a new BearerTokenAuthenticator instance. +func NewBearerTokenAuthenticator(bearerToken string) (*BearerTokenAuthenticator, error) { + obj := &BearerTokenAuthenticator{ + BearerToken: bearerToken, + } + if err := obj.Validate(); err != nil { + return nil, err + } + return obj, nil +} + +// newBearerTokenAuthenticator : Constructs a new BearerTokenAuthenticator instance from a map. +func newBearerTokenAuthenticatorFromMap(properties map[string]string) (*BearerTokenAuthenticator, error) { + if properties == nil { + return nil, fmt.Errorf(ERRORMSG_PROPS_MAP_NIL) + } + + return NewBearerTokenAuthenticator(properties[PROPNAME_BEARER_TOKEN]) +} + +// AuthenticationType returns the authentication type for this authenticator. +func (BearerTokenAuthenticator) AuthenticationType() string { + return AUTHTYPE_BEARER_TOKEN +} + +// Authenticate adds bearer authentication information to the request. +// +// The bearer token will be added to the request's headers in the form: +// +// Authorization: Bearer +// +func (this *BearerTokenAuthenticator) Authenticate(request *http.Request) error { + request.Header.Set("Authorization", fmt.Sprintf(`Bearer %s`, this.BearerToken)) + return nil +} + +// Validate the authenticator's configuration. +// +// Ensures the bearer token is not Nil. +func (this BearerTokenAuthenticator) Validate() error { + if this.BearerToken == "" { + return fmt.Errorf(ERRORMSG_PROP_MISSING, "BearerToken") + } + return nil +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/config_utils.go b/vendor/github.com/IBM/go-sdk-core/v5/core/config_utils.go new file mode 100644 index 00000000000..8268cdd3956 --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/config_utils.go @@ -0,0 +1,259 @@ +package core + +// (C) Copyright IBM Corp. 2019. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "bufio" + "encoding/json" + "fmt" + "os" + "path" + "strings" +) + +const ( + // IBM_CREDENTIAL_FILE_ENVVAR is the environment key used to find the path to + // a credentials file. + IBM_CREDENTIAL_FILE_ENVVAR = "IBM_CREDENTIALS_FILE" + + // DEFAULT_CREDENTIAL_FILE_NAME is the default filename for a credentials file. + // It is used when "IBM_CREDENTIALS_FILE" is not specified. The filename will + // be searched for within the program's working directory, and then the OS's + // current user directory. + DEFAULT_CREDENTIAL_FILE_NAME = "ibm-credentials.env" +) + +// +// GetServiceProperties returns a map containing configuration properties for the specified service +// that are retrieved from external configuration sources in the following precedence order: +// 1) credential file +// 2) environment variables +// 3) VCAP_SERVICES +// +// 'serviceName' is used as a filter against the property names. For example, if serviceName is +// passed in as "my_service", then configuration properties whose names begin with "MY_SERVICE_" +// will be returned in the map. +func GetServiceProperties(serviceName string) (serviceProps map[string]string, err error) { + return getServiceProperties(serviceName) +} + +// getServiceProperties: This function will retrieve configuration properties for the specified service +// from external config sources in the following precedence order: +// 1) credential file +// 2) environment variables +// 3) VCAP_SERVICES +func getServiceProperties(serviceName string) (serviceProps map[string]string, err error) { + + if serviceName == "" { + err = fmt.Errorf("serviceName was not specified") + return + } + + // First try to retrieve service properties from a credential file. + serviceProps = getServicePropertiesFromCredentialFile(serviceName) + + // Next, try to retrieve them from environment variables. + if serviceProps == nil { + serviceProps = getServicePropertiesFromEnvironment(serviceName) + } + + // Finally, try to retrieve them from VCAP_SERVICES. + if serviceProps == nil { + serviceProps = getServicePropertiesFromVCAP(serviceName) + } + + return +} + +// getServicePropertiesFromCredentialFile: returns a map containing properties found within a credential file +// that are associated with the specified credentialKey. Returns a nil map if no properties are found. +// Credential file search order: +// 1) ${IBM_CREDENTIALS_FILE} +// 2) /ibm-credentials.env +// 3) /ibm-credentials.env +func getServicePropertiesFromCredentialFile(credentialKey string) map[string]string { + + // Check the search order for the credential file that we'll attempt to load: + var credentialFilePath string + + // 1) ${IBM_CREDENTIALS_FILE} + envPath := os.Getenv(IBM_CREDENTIAL_FILE_ENVVAR) + if _, err := os.Stat(envPath); err == nil { + credentialFilePath = envPath + } + + // 2) /ibm-credentials.env + if credentialFilePath == "" { + dir, _ := os.Getwd() + var filePath = path.Join(dir, DEFAULT_CREDENTIAL_FILE_NAME) + if _, err := os.Stat(filePath); err == nil { + credentialFilePath = filePath + } + } + + // 3) /ibm-credentials.env + if credentialFilePath == "" { + var filePath = path.Join(UserHomeDir(), DEFAULT_CREDENTIAL_FILE_NAME) + if _, err := os.Stat(filePath); err == nil { + credentialFilePath = filePath + } + } + + // If we found a file to load, then load it. + if credentialFilePath != "" { + file, err := os.Open(credentialFilePath) // #nosec G304 + if err != nil { + return nil + } + defer file.Close() // #nosec G307 + + // Collect the contents of the credential file in a string array. + lines := make([]string, 0) + scanner := bufio.NewScanner(file) + for scanner.Scan() { + lines = append(lines, scanner.Text()) + } + + // Parse the file contents into name/value pairs. + return parsePropertyStrings(credentialKey, lines) + } + + return nil +} + +// getServicePropertiesFromEnvironment: returns a map containing properties found within the environment +// that are associated with the specified credentialKey. Returns a nil map if no properties are found. +func getServicePropertiesFromEnvironment(credentialKey string) map[string]string { + return parsePropertyStrings(credentialKey, os.Environ()) +} + +// getServicePropertiesFromVCAP: returns a map containing properties found within the VCAP_SERVICES +// environment variable for the specified credentialKey (service name). Returns a nil map if no properties are found. +func getServicePropertiesFromVCAP(credentialKey string) map[string]string { + credentials := loadFromVCAPServices(credentialKey) + if credentials != nil { + props := make(map[string]string) + if credentials.URL != "" { + props[PROPNAME_SVC_URL] = credentials.URL + } + + if credentials.Username != "" { + props[PROPNAME_USERNAME] = credentials.Username + } + + if credentials.Password != "" { + props[PROPNAME_PASSWORD] = credentials.Password + } + + if credentials.APIKey != "" { + props[PROPNAME_APIKEY] = credentials.APIKey + } + + // If no values were actually found in this credential entry, then bail out now. + if len(props) == 0 { + return nil + } + + // Make a (hopefully good) guess at the auth type. + authType := "" + if props[PROPNAME_APIKEY] != "" { + authType = AUTHTYPE_IAM + } else if props[PROPNAME_USERNAME] != "" || props[PROPNAME_PASSWORD] != "" { + authType = AUTHTYPE_BASIC + } else { + authType = AUTHTYPE_IAM + } + props[PROPNAME_AUTH_TYPE] = authType + + return props + } + + return nil +} + +// parsePropertyStrings: accepts an array of strings of the form "=" and parses/filters them to +// produce a map of properties associated with the specified credentialKey. +func parsePropertyStrings(credentialKey string, propertyStrings []string) map[string]string { + if len(propertyStrings) == 0 { + return nil + } + + props := make(map[string]string) + credentialKey = strings.ToUpper(credentialKey) + credentialKey = strings.Replace(credentialKey, "-", "_", -1) + credentialKey += "_" + for _, propertyString := range propertyStrings { + + // Trim the property string and ignore any blank or comment lines. + propertyString = strings.TrimSpace(propertyString) + if propertyString == "" || strings.HasPrefix(propertyString, "#") { + continue + } + + // Parse the property string into name and value tokens + var tokens = strings.SplitN(propertyString, "=", 2) + if len(tokens) == 2 { + // Does the name start with the credential key? + // If so, then extract the property name by filtering out the credential key, + // then store the name/value pair in the map. + if strings.HasPrefix(tokens[0], credentialKey) && (len(tokens[0]) > len(credentialKey)) { + name := tokens[0][len(credentialKey):] + value := strings.TrimSpace(tokens[1]) + props[name] = value + } + } + } + + if len(props) == 0 { + return nil + } + return props +} + +// Service : The service +type service struct { + Name string `json:"name,omitempty"` + Credentials *credential `json:"credentials,omitempty"` +} + +// Credential : The service credential +type credential struct { + URL string `json:"url,omitempty"` + Username string `json:"username,omitempty"` + Password string `json:"password,omitempty"` + APIKey string `json:"apikey,omitempty"` +} + +// LoadFromVCAPServices : returns the credential of the service +func loadFromVCAPServices(serviceName string) *credential { + vcapServices := os.Getenv("VCAP_SERVICES") + if vcapServices != "" { + var rawServices map[string][]service + if err := json.Unmarshal([]byte(vcapServices), &rawServices); err != nil { + return nil + } + for _, serviceEntries := range rawServices { + for _, service := range serviceEntries { + if service.Name == serviceName { + return service.Credentials + } + } + } + if serviceList, exists := rawServices[serviceName]; exists && len(serviceList) > 0 { + return serviceList[0].Credentials + } + } + return nil +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/constants.go b/vendor/github.com/IBM/go-sdk-core/v5/core/constants.go new file mode 100644 index 00000000000..923d1ebcee2 --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/constants.go @@ -0,0 +1,85 @@ +package core + +// (C) Copyright IBM Corp. 2019, 2022. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const ( + // Supported authentication types. + AUTHTYPE_BASIC = "basic" + AUTHTYPE_BEARER_TOKEN = "bearerToken" + AUTHTYPE_NOAUTH = "noAuth" + AUTHTYPE_IAM = "iam" + AUTHTYPE_CP4D = "cp4d" + AUTHTYPE_CONTAINER = "container" + AUTHTYPE_VPC = "vpc" + + // Names of properties that can be defined as part of an external configuration (credential file, env vars, etc.). + // Example: export MYSERVICE_URL=https://myurl + + // Service client properties. + PROPNAME_SVC_URL = "URL" + PROPNAME_SVC_DISABLE_SSL = "DISABLE_SSL" + PROPNAME_SVC_ENABLE_GZIP = "ENABLE_GZIP" + PROPNAME_SVC_ENABLE_RETRIES = "ENABLE_RETRIES" + PROPNAME_SVC_MAX_RETRIES = "MAX_RETRIES" + PROPNAME_SVC_RETRY_INTERVAL = "RETRY_INTERVAL" + + // Authenticator properties. + PROPNAME_AUTH_TYPE = "AUTH_TYPE" + PROPNAME_USERNAME = "USERNAME" + PROPNAME_PASSWORD = "PASSWORD" + PROPNAME_BEARER_TOKEN = "BEARER_TOKEN" + PROPNAME_AUTH_URL = "AUTH_URL" + PROPNAME_AUTH_DISABLE_SSL = "AUTH_DISABLE_SSL" + PROPNAME_APIKEY = "APIKEY" + PROPNAME_REFRESH_TOKEN = "REFRESH_TOKEN" // #nosec G101 + PROPNAME_CLIENT_ID = "CLIENT_ID" + PROPNAME_CLIENT_SECRET = "CLIENT_SECRET" + PROPNAME_SCOPE = "SCOPE" + PROPNAME_CRTOKEN_FILENAME = "CR_TOKEN_FILENAME" // #nosec G101 + PROPNAME_IAM_PROFILE_CRN = "IAM_PROFILE_CRN" + PROPNAME_IAM_PROFILE_NAME = "IAM_PROFILE_NAME" + PROPNAME_IAM_PROFILE_ID = "IAM_PROFILE_ID" + + // SSL error + SSL_CERTIFICATION_ERROR = "x509: certificate" + + // Common error messages. + ERRORMSG_PROP_MISSING = "The %s property is required but was not specified." + ERRORMSG_PROP_INVALID = "The %s property is invalid. Please remove any surrounding {, }, or \" characters." + ERRORMSG_EXCLUSIVE_PROPS_ERROR = "Exactly one of %s or %s must be specified." + ERRORMSG_ATLEAST_ONE_PROP_ERROR = "At least one of %s or %s must be specified." + ERRORMSG_ATMOST_ONE_PROP_ERROR = "At most one of %s or %s may be specified." + ERRORMSG_NO_AUTHENTICATOR = "Authentication information was not properly configured." + ERRORMSG_AUTHTYPE_UNKNOWN = "Unrecognized authentication type: %s" + ERRORMSG_PROPS_MAP_NIL = "The 'properties' map cannot be nil." + ERRORMSG_SSL_VERIFICATION_FAILED = "The connection failed because the SSL certificate is not valid. To use a " + + "self-signed certificate, disable verification of the server's SSL certificate " + + "by invoking the DisableSSLVerification() function on your service instance " + + "and/or use the DisableSSLVerification option of the authenticator." + ERRORMSG_AUTHENTICATE_ERROR = "An error occurred while performing the 'authenticate' step: %s" + ERRORMSG_READ_RESPONSE_BODY = "An error occurred while reading the response body: %s" + ERRORMSG_UNEXPECTED_RESPONSE = "The response contained unexpected content, Content-Type=%s, operation resultType=%s" + ERRORMSG_UNMARSHAL_RESPONSE_BODY = "An error occurred while unmarshalling the response body: %s" + ERRORMSG_NIL_SLICE = "The 'slice' parameter cannot be nil" + ERRORMSG_PARAM_NOT_SLICE = "The 'slice' parameter must be a slice" + ERRORMSG_MARSHAL_SLICE = "An error occurred while marshalling the slice: %s" + ERRORMSG_CONVERT_SLICE = "An error occurred while converting 'slice' to string slice" + ERRORMSG_UNEXPECTED_STATUS_CODE = "Unexpected HTTP status code %d (%s)" + ERRORMSG_UNMARSHAL_AUTH_RESPONSE = "error unmarshalling authentication response: %s" + ERRORMSG_UNABLE_RETRIEVE_CRTOKEN = "unable to retrieve compute resource token value: %s" // #nosec G101 + ERRORMSG_IAM_GETTOKEN_ERROR = "IAM 'get token' error, status code %d received from '%s': %s" // #nosec G101 + ERRORMSG_UNABLE_RETRIEVE_IITOKEN = "unable to retrieve instance identity token value: %s" // #nosec G101 + ERRORMSG_VPCMDS_OPERATION_ERROR = "VPC metadata service error, status code %d received from '%s': %s" +) diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/container_authenticator.go b/vendor/github.com/IBM/go-sdk-core/v5/core/container_authenticator.go new file mode 100644 index 00000000000..9892da9cc6f --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/container_authenticator.go @@ -0,0 +1,499 @@ +package core + +// (C) Copyright IBM Corp. 2021. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "bytes" + "crypto/tls" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/http/httputil" + "strconv" + "strings" + "sync" + "time" +) + +// ContainerAuthenticator implements an IAM-based authentication schema whereby it +// retrieves a "compute resource token" from the local compute resource (VM) +// and uses that to obtain an IAM access token by invoking the IAM "get token" operation with grant-type=cr-token. +// The resulting IAM access token is then added to outbound requests in an Authorization header +// of the form: +// Authorization: Bearer +// +type ContainerAuthenticator struct { + + // [optional] The name of the file containing the injected CR token value (applies to + // IKS-managed compute resources). + // Default value: "/var/run/secrets/tokens/vault-token" + CRTokenFilename string + + // [optional] The name of the linked trusted IAM profile to be used when obtaining the IAM access token. + // One of IAMProfileName or IAMProfileID must be specified. + // Default value: "" + IAMProfileName string + + // [optional] The id of the linked trusted IAM profile to be used when obtaining the IAM access token. + // One of IAMProfileName or IAMProfileID must be specified. + // Default value: "" + IAMProfileID string + + // [optional] The IAM token server's base endpoint URL. + // Default value: "https://iam.cloud.ibm.com" + URL string + urlInit sync.Once + + // [optional] The ClientID and ClientSecret fields are used to form a "basic auth" + // Authorization header for interactions with the IAM token server. + // If neither field is specified, then no Authorization header will be sent + // with token server requests. + // These fields are both optional, but must be specified together. + // Default value: "" + ClientID string + ClientSecret string + + // [optional] A flag that indicates whether verification of the server's SSL certificate + // should be disabled. + // Default value: false + DisableSSLVerification bool + + // [optional] The "scope" to use when fetching the access token from the IAM token server. + // This can be used to obtain an access token with a specific scope. + // Default value: "" + Scope string + + // [optional] A set of key/value pairs that will be sent as HTTP headers in requests + // made to the IAM token server. + // Default value: nil + Headers map[string]string + + // [optional] The http.Client object used in interacts with the IAM token server. + // If not specified by the user, a suitable default Client will be constructed. + Client *http.Client + + // The cached IAM access token and its expiration time. + tokenData *iamTokenData + + // Mutex to synchronize access to the tokenData field. + tokenDataMutex sync.Mutex +} + +const ( + defaultCRTokenFilename = "/var/run/secrets/tokens/vault-token" // #nosec G101 + iamGrantTypeCRToken = "urn:ibm:params:oauth:grant-type:cr-token" // #nosec G101 +) + +var craRequestTokenMutex sync.Mutex + +// ContainerAuthenticatorBuilder is used to construct an instance of the ContainerAuthenticator +type ContainerAuthenticatorBuilder struct { + ContainerAuthenticator +} + +// NewContainerAuthenticatorBuilder returns a new builder struct that +// can be used to construct a ContainerAuthenticator instance. +func NewContainerAuthenticatorBuilder() *ContainerAuthenticatorBuilder { + return &ContainerAuthenticatorBuilder{} +} + +// SetCRTokenFilename sets the CRTokenFilename field in the builder. +func (builder *ContainerAuthenticatorBuilder) SetCRTokenFilename(s string) *ContainerAuthenticatorBuilder { + builder.ContainerAuthenticator.CRTokenFilename = s + return builder +} + +// SetIAMProfileName sets the IAMProfileName field in the builder. +func (builder *ContainerAuthenticatorBuilder) SetIAMProfileName(s string) *ContainerAuthenticatorBuilder { + builder.ContainerAuthenticator.IAMProfileName = s + return builder +} + +// SetIAMProfileID sets the IAMProfileID field in the builder. +func (builder *ContainerAuthenticatorBuilder) SetIAMProfileID(s string) *ContainerAuthenticatorBuilder { + builder.ContainerAuthenticator.IAMProfileID = s + return builder +} + +// SetURL sets the URL field in the builder. +func (builder *ContainerAuthenticatorBuilder) SetURL(s string) *ContainerAuthenticatorBuilder { + builder.ContainerAuthenticator.URL = s + return builder +} + +// SetClientIDSecret sets the ClientID and ClientSecret fields in the builder. +func (builder *ContainerAuthenticatorBuilder) SetClientIDSecret(clientID, clientSecret string) *ContainerAuthenticatorBuilder { + builder.ContainerAuthenticator.ClientID = clientID + builder.ContainerAuthenticator.ClientSecret = clientSecret + return builder +} + +// SetDisableSSLVerification sets the DisableSSLVerification field in the builder. +func (builder *ContainerAuthenticatorBuilder) SetDisableSSLVerification(b bool) *ContainerAuthenticatorBuilder { + builder.ContainerAuthenticator.DisableSSLVerification = b + return builder +} + +// SetScope sets the Scope field in the builder. +func (builder *ContainerAuthenticatorBuilder) SetScope(s string) *ContainerAuthenticatorBuilder { + builder.ContainerAuthenticator.Scope = s + return builder +} + +// SetHeaders sets the Headers field in the builder. +func (builder *ContainerAuthenticatorBuilder) SetHeaders(headers map[string]string) *ContainerAuthenticatorBuilder { + builder.ContainerAuthenticator.Headers = headers + return builder +} + +// SetClient sets the Client field in the builder. +func (builder *ContainerAuthenticatorBuilder) SetClient(client *http.Client) *ContainerAuthenticatorBuilder { + builder.ContainerAuthenticator.Client = client + return builder +} + +// Build() returns a validated instance of the ContainerAuthenticator with the config that was set in the builder. +func (builder *ContainerAuthenticatorBuilder) Build() (*ContainerAuthenticator, error) { + + // Make sure the config is valid. + err := builder.ContainerAuthenticator.Validate() + if err != nil { + return nil, err + } + + return &builder.ContainerAuthenticator, nil +} + +// newContainerAuthenticatorFromMap constructs a new ContainerAuthenticator instance from a map containing +// configuration properties. +func newContainerAuthenticatorFromMap(properties map[string]string) (authenticator *ContainerAuthenticator, err error) { + if properties == nil { + return nil, fmt.Errorf(ERRORMSG_PROPS_MAP_NIL) + } + + // Grab the AUTH_DISABLE_SSL string property and convert to a boolean value. + disableSSL, err := strconv.ParseBool(properties[PROPNAME_AUTH_DISABLE_SSL]) + if err != nil { + disableSSL = false + } + + authenticator, err = NewContainerAuthenticatorBuilder(). + SetCRTokenFilename(properties[PROPNAME_CRTOKEN_FILENAME]). + SetIAMProfileName(properties[PROPNAME_IAM_PROFILE_NAME]). + SetIAMProfileID(properties[PROPNAME_IAM_PROFILE_ID]). + SetURL(properties[PROPNAME_AUTH_URL]). + SetClientIDSecret(properties[PROPNAME_CLIENT_ID], properties[PROPNAME_CLIENT_SECRET]). + SetDisableSSLVerification(disableSSL). + SetScope(properties[PROPNAME_SCOPE]). + Build() + + return +} + +// AuthenticationType returns the authentication type for this authenticator. +func (*ContainerAuthenticator) AuthenticationType() string { + return AUTHTYPE_CONTAINER +} + +// Authenticate adds IAM authentication information to the request. +// +// The IAM access token will be added to the request's headers in the form: +// +// Authorization: Bearer +// +func (authenticator *ContainerAuthenticator) Authenticate(request *http.Request) error { + token, err := authenticator.GetToken() + if err != nil { + return err + } + + request.Header.Set("Authorization", "Bearer "+token) + return nil +} + +// url returns the authenticator's URL property after potentially initializing it. +func (authenticator *ContainerAuthenticator) url() string { + authenticator.urlInit.Do(func() { + if authenticator.URL == "" { + // If URL was not specified, then use the default IAM endpoint. + authenticator.URL = defaultIamTokenServerEndpoint + } else { + // Canonicalize the URL by removing the operation path if it was specified by the user. + authenticator.URL = strings.TrimSuffix(authenticator.URL, iamAuthOperationPathGetToken) + } + }) + return authenticator.URL +} + +// getTokenData returns the tokenData field from the authenticator with synchronization. +func (authenticator *ContainerAuthenticator) getTokenData() *iamTokenData { + authenticator.tokenDataMutex.Lock() + defer authenticator.tokenDataMutex.Unlock() + + return authenticator.tokenData +} + +// setTokenData sets the 'tokenData' field in the authenticator with synchronization. +func (authenticator *ContainerAuthenticator) setTokenData(tokenData *iamTokenData) { + authenticator.tokenDataMutex.Lock() + defer authenticator.tokenDataMutex.Unlock() + + authenticator.tokenData = tokenData +} + +// Validate the authenticator's configuration. +// +// Ensures that one of IAMProfileName or IAMProfileID are specified, and the ClientId and ClientSecret pair are +// mutually inclusive. +func (authenticator *ContainerAuthenticator) Validate() error { + + // Check to make sure that one of IAMProfileName or IAMProfileID are specified. + if authenticator.IAMProfileName == "" && authenticator.IAMProfileID == "" { + return fmt.Errorf(ERRORMSG_ATLEAST_ONE_PROP_ERROR, "IAMProfileName", "IAMProfileID") + } + + // Validate ClientId and ClientSecret. They must both be specified togther or neither should be specified. + if authenticator.ClientID == "" && authenticator.ClientSecret == "" { + // Do nothing as this is the valid scenario + } else { + // Since it is NOT the case that both properties are empty, make sure BOTH are specified. + if authenticator.ClientID == "" { + return fmt.Errorf(ERRORMSG_PROP_MISSING, "ClientID") + } + + if authenticator.ClientSecret == "" { + return fmt.Errorf(ERRORMSG_PROP_MISSING, "ClientSecret") + } + } + + return nil +} + +// GetToken returns an access token to be used in an Authorization header. +// Whenever a new token is needed (when a token doesn't yet exist or the existing token has expired), +// a new access token is fetched from the token server. +func (authenticator *ContainerAuthenticator) GetToken() (string, error) { + if authenticator.getTokenData() == nil || !authenticator.getTokenData().isTokenValid() { + GetLogger().Debug("Performing synchronous token fetch...") + // synchronously request the token + err := authenticator.synchronizedRequestToken() + if err != nil { + return "", err + } + } else if authenticator.getTokenData().needsRefresh() { + GetLogger().Debug("Performing background asynchronous token fetch...") + // If refresh needed, kick off a go routine in the background to get a new token + //nolint: errcheck + go authenticator.invokeRequestTokenData() + } else { + GetLogger().Debug("Using cached access token...") + } + + // return an error if the access token is not valid or was not fetched + if authenticator.getTokenData() == nil || authenticator.getTokenData().AccessToken == "" { + return "", fmt.Errorf("Error while trying to get access token") + } + + return authenticator.getTokenData().AccessToken, nil +} + +// synchronizedRequestToken will check if the authenticator currently has +// a valid cached access token. +// If yes, then nothing else needs to be done. +// If no, then a blocking request is made to obtain a new IAM access token. +func (authenticator *ContainerAuthenticator) synchronizedRequestToken() error { + craRequestTokenMutex.Lock() + defer craRequestTokenMutex.Unlock() + // if cached token is still valid, then just continue to use it + if authenticator.getTokenData() != nil && authenticator.getTokenData().isTokenValid() { + return nil + } + + return authenticator.invokeRequestTokenData() +} + +// invokeRequestTokenData requests a new token from the IAM token server and +// unmarshals the response to produce the authenticator's 'tokenData' field (cache). +// Returns an error if the token was unable to be fetched, otherwise returns nil. +func (authenticator *ContainerAuthenticator) invokeRequestTokenData() error { + tokenResponse, err := authenticator.RequestToken() + if err != nil { + return err + } + + if tokenData, err := newIamTokenData(tokenResponse); err != nil { + return err + } else { + authenticator.setTokenData(tokenData) + } + + return nil +} + +// RequestToken first retrieves a CR token value from the current compute resource, then uses +// that to obtain a new IAM access token from the IAM token server. +func (authenticator *ContainerAuthenticator) RequestToken() (*IamTokenServerResponse, error) { + var err error + + // First, retrieve the CR token value for this compute resource. + crToken, err := authenticator.retrieveCRToken() + if crToken == "" { + if err == nil { + err = fmt.Errorf(ERRORMSG_UNABLE_RETRIEVE_CRTOKEN, "reason unknown") + } + return nil, NewAuthenticationError(&DetailedResponse{}, err) + } + + // Set up the request for the IAM "get token" invocation. + builder := NewRequestBuilder(POST) + _, err = builder.ResolveRequestURL(authenticator.url(), iamAuthOperationPathGetToken, nil) + if err != nil { + return nil, NewAuthenticationError(&DetailedResponse{}, err) + } + + builder.AddHeader(CONTENT_TYPE, FORM_URL_ENCODED_HEADER) + builder.AddHeader(Accept, APPLICATION_JSON) + builder.AddFormData("grant_type", "", "", iamGrantTypeCRToken) // #nosec G101 + builder.AddFormData("cr_token", "", "", crToken) + + // We previously verified that one of IBMProfileID or IAMProfileName are specified, + // so just process them individually here. + // If both are specified, that's ok too (they must map to the same profile though). + if authenticator.IAMProfileID != "" { + builder.AddFormData("profile_id", "", "", authenticator.IAMProfileID) + } + if authenticator.IAMProfileName != "" { + builder.AddFormData("profile_name", "", "", authenticator.IAMProfileName) + } + + // If the scope was specified, add that form param to the request. + if authenticator.Scope != "" { + builder.AddFormData("scope", "", "", authenticator.Scope) + } + + // Add user-defined headers to request. + for headerName, headerValue := range authenticator.Headers { + builder.AddHeader(headerName, headerValue) + } + + req, err := builder.Build() + if err != nil { + return nil, NewAuthenticationError(&DetailedResponse{}, err) + } + + // If client id and secret were configured by the user, then set them on the request + // as a basic auth header. + if authenticator.ClientID != "" && authenticator.ClientSecret != "" { + req.SetBasicAuth(authenticator.ClientID, authenticator.ClientSecret) + } + + // If the authenticator does not have a Client, create one now. + if authenticator.Client == nil { + authenticator.Client = &http.Client{ + Timeout: time.Second * 30, + } + + // If the user told us to disable SSL verification, then do it now. + if authenticator.DisableSSLVerification { + transport := &http.Transport{ + // #nosec G402 + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } + authenticator.Client.Transport = transport + } + } + + // If debug is enabled, then dump the request. + if GetLogger().IsLogLevelEnabled(LevelDebug) { + buf, dumpErr := httputil.DumpRequestOut(req, req.Body != nil) + if dumpErr == nil { + GetLogger().Debug("Request:\n%s\n", RedactSecrets(string(buf))) + } else { + GetLogger().Debug(fmt.Sprintf("error while attempting to log outbound request: %s", dumpErr.Error())) + } + } + + GetLogger().Debug("Invoking IAM 'get token' operation: %s", builder.URL) + resp, err := authenticator.Client.Do(req) + if err != nil { + return nil, NewAuthenticationError(&DetailedResponse{}, err) + } + GetLogger().Debug("Returned from IAM 'get token' operation, received status code %d", resp.StatusCode) + + // If debug is enabled, then dump the response. + if GetLogger().IsLogLevelEnabled(LevelDebug) { + buf, dumpErr := httputil.DumpResponse(resp, req.Body != nil) + if dumpErr == nil { + GetLogger().Debug("Response:\n%s\n", RedactSecrets(string(buf))) + } else { + GetLogger().Debug(fmt.Sprintf("error while attempting to log inbound response: %s", dumpErr.Error())) + } + } + + // Check for a bad status code and handle an operation error. + if resp.StatusCode < 200 || resp.StatusCode >= 300 { + buff := new(bytes.Buffer) + _, _ = buff.ReadFrom(resp.Body) + resp.Body.Close() // #nosec G104 + + // Create a DetailedResponse to be included in the error below. + detailedResponse := &DetailedResponse{ + StatusCode: resp.StatusCode, + Headers: resp.Header, + RawResult: buff.Bytes(), + } + + iamErrorMsg := string(detailedResponse.RawResult) + if iamErrorMsg == "" { + iamErrorMsg = "IAM error response not available" + } + err = fmt.Errorf(ERRORMSG_IAM_GETTOKEN_ERROR, detailedResponse.StatusCode, builder.URL, iamErrorMsg) + return nil, NewAuthenticationError(detailedResponse, err) + } + + // Good response, so unmarshal the response body into an IamTokenServerResponse instance. + tokenResponse := &IamTokenServerResponse{} + _ = json.NewDecoder(resp.Body).Decode(tokenResponse) + defer resp.Body.Close() + + return tokenResponse, nil +} + +// retrieveCRToken tries to read the CR token value from the local file system. +func (authenticator *ContainerAuthenticator) retrieveCRToken() (crToken string, err error) { + + // Use the default filename if one wasn't supplied by the user. + crTokenFilename := authenticator.CRTokenFilename + if crTokenFilename == "" { + crTokenFilename = defaultCRTokenFilename + } + + GetLogger().Debug("Attempting to read CR token from file: %s\n", crTokenFilename) + + // Read the entire file into a byte slice, then convert to string. + var bytes []byte + bytes, err = ioutil.ReadFile(crTokenFilename) // #nosec G304 + if err != nil { + err = fmt.Errorf(ERRORMSG_UNABLE_RETRIEVE_CRTOKEN, err.Error()) + GetLogger().Debug(err.Error()) + return + } + + crToken = string(bytes) + GetLogger().Debug("Successfully read CR token from file: %s\n", crTokenFilename) + + return +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/cp4d_authenticator.go b/vendor/github.com/IBM/go-sdk-core/v5/core/cp4d_authenticator.go new file mode 100644 index 00000000000..3b0d5aacf71 --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/cp4d_authenticator.go @@ -0,0 +1,424 @@ +package core + +// (C) Copyright IBM Corp. 2019, 2021. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "bytes" + "crypto/tls" + "encoding/json" + "fmt" + "net/http" + "net/http/httputil" + "strconv" + "sync" + "time" +) + +// +// CloudPakForDataAuthenticator uses either a username/password pair or a +// username/apikey pair to obtain a suitable bearer token from the CP4D authentication service, +// and adds the bearer token to requests via an Authorization header of the form: +// +// Authorization: Bearer +// +type CloudPakForDataAuthenticator struct { + // The URL representing the Cloud Pak for Data token service endpoint [required]. + URL string + + // The username used to obtain a bearer token [required]. + Username string + + // The password used to obtain a bearer token [required if APIKey not specified]. + // One of Password or APIKey must be specified. + Password string + + // The apikey used to obtain a bearer token [required if Password not specified]. + // One of Password or APIKey must be specified. + APIKey string + + // A flag that indicates whether verification of the server's SSL certificate + // should be disabled; defaults to false [optional]. + DisableSSLVerification bool + + // Default headers to be sent with every CP4D token request [optional]. + Headers map[string]string + + // The http.Client object used to invoke token server requests [optional]. If + // not specified, a suitable default Client will be constructed. + Client *http.Client + + // The cached token and expiration time. + tokenData *cp4dTokenData + + // Mutex to make the tokenData field thread safe. + tokenDataMutex sync.Mutex +} + +var cp4dRequestTokenMutex sync.Mutex +var cp4dNeedsRefreshMutex sync.Mutex + +// NewCloudPakForDataAuthenticator constructs a new CloudPakForDataAuthenticator +// instance from a username/password pair. +// This is the default way to create an authenticator and is a wrapper around +// the NewCloudPakForDataAuthenticatorUsingPassword() function +func NewCloudPakForDataAuthenticator(url string, username string, password string, + disableSSLVerification bool, headers map[string]string) (*CloudPakForDataAuthenticator, error) { + return NewCloudPakForDataAuthenticatorUsingPassword(url, username, password, disableSSLVerification, headers) +} + +// NewCloudPakForDataAuthenticatorUsingPassword constructs a new CloudPakForDataAuthenticator +// instance from a username/password pair. +func NewCloudPakForDataAuthenticatorUsingPassword(url string, username string, password string, + disableSSLVerification bool, headers map[string]string) (*CloudPakForDataAuthenticator, error) { + return newAuthenticator(url, username, password, "", disableSSLVerification, headers) +} + +// NewCloudPakForDataAuthenticatorUsingAPIKey constructs a new CloudPakForDataAuthenticator +// instance from a username/apikey pair. +func NewCloudPakForDataAuthenticatorUsingAPIKey(url string, username string, apikey string, + disableSSLVerification bool, headers map[string]string) (*CloudPakForDataAuthenticator, error) { + return newAuthenticator(url, username, "", apikey, disableSSLVerification, headers) +} + +func newAuthenticator(url string, username string, password string, apikey string, + disableSSLVerification bool, headers map[string]string) (authenticator *CloudPakForDataAuthenticator, err error) { + + authenticator = &CloudPakForDataAuthenticator{ + Username: username, + Password: password, + APIKey: apikey, + URL: url, + DisableSSLVerification: disableSSLVerification, + Headers: headers, + } + + // Make sure the config is valid. + err = authenticator.Validate() + if err != nil { + return nil, err + } + + return +} + +// newCloudPakForDataAuthenticatorFromMap : Constructs a new CloudPakForDataAuthenticator instance from a map. +func newCloudPakForDataAuthenticatorFromMap(properties map[string]string) (*CloudPakForDataAuthenticator, error) { + if properties == nil { + return nil, fmt.Errorf(ERRORMSG_PROPS_MAP_NIL) + } + + disableSSL, err := strconv.ParseBool(properties[PROPNAME_AUTH_DISABLE_SSL]) + if err != nil { + disableSSL = false + } + + return newAuthenticator(properties[PROPNAME_AUTH_URL], + properties[PROPNAME_USERNAME], properties[PROPNAME_PASSWORD], + properties[PROPNAME_APIKEY], disableSSL, nil) +} + +// AuthenticationType returns the authentication type for this authenticator. +func (*CloudPakForDataAuthenticator) AuthenticationType() string { + return AUTHTYPE_CP4D +} + +// Validate the authenticator's configuration. +// +// Ensures the username, password, and url are not Nil. Additionally, ensures +// they do not contain invalid characters. +func (authenticator *CloudPakForDataAuthenticator) Validate() error { + + if authenticator.Username == "" { + return fmt.Errorf(ERRORMSG_PROP_MISSING, "Username") + } + + // The user should specify exactly one of APIKey or Password. + if (authenticator.APIKey == "" && authenticator.Password == "") || + (authenticator.APIKey != "" && authenticator.Password != "") { + return fmt.Errorf(ERRORMSG_EXCLUSIVE_PROPS_ERROR, "APIKey", "Password") + } + + if authenticator.URL == "" { + return fmt.Errorf(ERRORMSG_PROP_MISSING, "URL") + } + + return nil +} + +// Authenticate adds the bearer token (obtained from the token server) to the +// specified request. +// +// The CP4D bearer token will be added to the request's headers in the form: +// +// Authorization: Bearer +// +func (authenticator *CloudPakForDataAuthenticator) Authenticate(request *http.Request) error { + token, err := authenticator.GetToken() + if err != nil { + return err + } + + request.Header.Set("Authorization", fmt.Sprintf(`Bearer %s`, token)) + return nil +} + +// getTokenData returns the tokenData field from the authenticator. +func (authenticator *CloudPakForDataAuthenticator) getTokenData() *cp4dTokenData { + authenticator.tokenDataMutex.Lock() + defer authenticator.tokenDataMutex.Unlock() + + return authenticator.tokenData +} + +// setTokenData sets the given cp4dTokenData to the tokenData field of the authenticator. +func (authenticator *CloudPakForDataAuthenticator) setTokenData(tokenData *cp4dTokenData) { + authenticator.tokenDataMutex.Lock() + defer authenticator.tokenDataMutex.Unlock() + + authenticator.tokenData = tokenData +} + +// GetToken: returns an access token to be used in an Authorization header. +// Whenever a new token is needed (when a token doesn't yet exist, needs to be refreshed, +// or the existing token has expired), a new access token is fetched from the token server. +func (authenticator *CloudPakForDataAuthenticator) GetToken() (string, error) { + if authenticator.getTokenData() == nil || !authenticator.getTokenData().isTokenValid() { + // synchronously request the token + err := authenticator.synchronizedRequestToken() + if err != nil { + return "", err + } + } else if authenticator.getTokenData().needsRefresh() { + // If refresh needed, kick off a go routine in the background to get a new token + //nolint: errcheck + go authenticator.invokeRequestTokenData() + } + + // return an error if the access token is not valid or was not fetched + if authenticator.getTokenData() == nil || authenticator.getTokenData().AccessToken == "" { + return "", fmt.Errorf("Error while trying to get access token") + } + + return authenticator.getTokenData().AccessToken, nil +} + +// synchronizedRequestToken: synchronously checks if the current token in cache +// is valid. If token is not valid or does not exist, it will fetch a new token +// and set the tokenRefreshTime +func (authenticator *CloudPakForDataAuthenticator) synchronizedRequestToken() error { + cp4dRequestTokenMutex.Lock() + defer cp4dRequestTokenMutex.Unlock() + // if cached token is still valid, then just continue to use it + if authenticator.getTokenData() != nil && authenticator.getTokenData().isTokenValid() { + return nil + } + + return authenticator.invokeRequestTokenData() +} + +// invokeRequestTokenData: requests a new token from the token server and +// unmarshals the token information to the tokenData cache. Returns +// an error if the token was unable to be fetched, otherwise returns nil +func (authenticator *CloudPakForDataAuthenticator) invokeRequestTokenData() error { + tokenResponse, err := authenticator.requestToken() + if err != nil { + authenticator.setTokenData(nil) + return err + } + + if tokenData, err := newCp4dTokenData(tokenResponse); err != nil { + authenticator.setTokenData(nil) + return err + } else { + authenticator.setTokenData(tokenData) + } + + return nil +} + +// cp4dRequestBody is a struct used to model the request body for the "POST /v1/authorize" operation. +// Note: we list both Password and APIKey fields, although exactly one of those will be used for +// a specific invocation of the POST /v1/authorize operation. +type cp4dRequestBody struct { + Username string `json:"username"` + Password string `json:"password,omitempty"` + APIKey string `json:"api_key,omitempty"` +} + +// requestToken: fetches a new access token from the token server. +func (authenticator *CloudPakForDataAuthenticator) requestToken() (tokenResponse *cp4dTokenServerResponse, err error) { + + // Create the request body (only one of APIKey or Password should be set + // on the authenticator so only one of them should end up in the serialized JSON). + body := &cp4dRequestBody{ + Username: authenticator.Username, + Password: authenticator.Password, + APIKey: authenticator.APIKey, + } + + builder := NewRequestBuilder(POST) + _, err = builder.ResolveRequestURL(authenticator.URL, "/v1/authorize", nil) + if err != nil { + return + } + + // Add user-defined headers to request. + for headerName, headerValue := range authenticator.Headers { + builder.AddHeader(headerName, headerValue) + } + + // Add the Content-Type header. + builder.AddHeader("Content-Type", "application/json") + + // Add the request body to request. + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + // Build the request object. + req, err := builder.Build() + if err != nil { + return + } + + // If the authenticator does not have a Client, create one now. + if authenticator.Client == nil { + authenticator.Client = &http.Client{ + Timeout: time.Second * 30, + } + + // If the user told us to disable SSL verification, then do it now. + if authenticator.DisableSSLVerification { + transport := &http.Transport{ + // #nosec G402 + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } + authenticator.Client.Transport = transport + } + } + + // If debug is enabled, then dump the request. + if GetLogger().IsLogLevelEnabled(LevelDebug) { + buf, dumpErr := httputil.DumpRequestOut(req, req.Body != nil) + if dumpErr == nil { + GetLogger().Debug("Request:\n%s\n", RedactSecrets(string(buf))) + } else { + GetLogger().Debug(fmt.Sprintf("error while attempting to log outbound request: %s", dumpErr.Error())) + } + } + + GetLogger().Debug("Invoking CP4D token service operation: %s", builder.URL) + resp, err := authenticator.Client.Do(req) + if err != nil { + return + } + GetLogger().Debug("Returned from CP4D token service operation, received status code %d", resp.StatusCode) + + // If debug is enabled, then dump the response. + if GetLogger().IsLogLevelEnabled(LevelDebug) { + buf, dumpErr := httputil.DumpResponse(resp, req.Body != nil) + if dumpErr == nil { + GetLogger().Debug("Response:\n%s\n", RedactSecrets(string(buf))) + } else { + GetLogger().Debug(fmt.Sprintf("error while attempting to log inbound response: %s", dumpErr.Error())) + } + } + + if resp.StatusCode < 200 || resp.StatusCode >= 300 { + buff := new(bytes.Buffer) + _, _ = buff.ReadFrom(resp.Body) + + // Create a DetailedResponse to be included in the error below. + detailedResponse := &DetailedResponse{ + StatusCode: resp.StatusCode, + Headers: resp.Header, + RawResult: buff.Bytes(), + } + + err = NewAuthenticationError(detailedResponse, fmt.Errorf(buff.String())) + return + } + + tokenResponse = &cp4dTokenServerResponse{} + err = json.NewDecoder(resp.Body).Decode(tokenResponse) + defer resp.Body.Close() + if err != nil { + err = fmt.Errorf(ERRORMSG_UNMARSHAL_AUTH_RESPONSE, err.Error()) + tokenResponse = nil + return + } + + return +} + +// cp4dTokenServerResponse is a struct that models a response received from the token server. +type cp4dTokenServerResponse struct { + Token string `json:"token,omitempty"` + MessageCode string `json:"_messageCode_,omitempty"` + Message string `json:"message,omitempty"` +} + +// cp4dTokenData is a struct that represents the cached information related to a fetched access token. +type cp4dTokenData struct { + AccessToken string + RefreshTime int64 + Expiration int64 +} + +// newCp4dTokenData: constructs a new Cp4dTokenData instance from the specified Cp4dTokenServerResponse instance. +func newCp4dTokenData(tokenResponse *cp4dTokenServerResponse) (*cp4dTokenData, error) { + // Need to crack open the access token (a JWT) to get the expiration and issued-at times. + claims, err := parseJWT(tokenResponse.Token) + if err != nil { + return nil, err + } + + // Compute the adjusted refresh time (expiration time - 20% of timeToLive) + timeToLive := claims.ExpiresAt - claims.IssuedAt + expireTime := claims.ExpiresAt + refreshTime := expireTime - int64(float64(timeToLive)*0.2) + + tokenData := &cp4dTokenData{ + AccessToken: tokenResponse.Token, + Expiration: expireTime, + RefreshTime: refreshTime, + } + + return tokenData, nil +} + +// isTokenValid: returns true iff the Cp4dTokenData instance represents a valid (non-expired) access token. +func (tokenData *cp4dTokenData) isTokenValid() bool { + if tokenData.AccessToken != "" && GetCurrentTime() < tokenData.Expiration { + return true + } + return false +} + +// needsRefresh: synchronously returns true iff the currently stored access token should be refreshed. This method also +// updates the refresh time if it determines the token needs refreshed to prevent other threads from +// making multiple refresh calls. +func (tokenData *cp4dTokenData) needsRefresh() bool { + cp4dNeedsRefreshMutex.Lock() + defer cp4dNeedsRefreshMutex.Unlock() + + // Advance refresh by one minute + if tokenData.RefreshTime >= 0 && GetCurrentTime() > tokenData.RefreshTime { + tokenData.RefreshTime = GetCurrentTime() + 60 + return true + } + return false +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/datetime.go b/vendor/github.com/IBM/go-sdk-core/v5/core/datetime.go new file mode 100644 index 00000000000..0a8bcf839d0 --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/datetime.go @@ -0,0 +1,93 @@ +package core + +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ( + "time" + + "github.com/go-openapi/strfmt" +) + +// Customize the strfmt DateTime parsing and formatting for our use. +func init() { + // Force date-time serialization to use the UTC representation. + strfmt.NormalizeTimeForMarshal = NormalizeDateTimeUTC + + // These formatting layouts (supported by time.Time.Format()) are added to the set of layouts used + // by the strfmt.DateTime unmarshalling function(s). + + // RFC 3339 but with 2-digit tz-offset. + // yyyy-MM-ddThh:mm:ss.SSS, where tz-offset is 'Z', +HH or -HH + rfc3339TZ2Layout := "2006-01-02T15:04:05.000Z07" + + // RFC 3339 but with only seconds precision. + // yyyy-MM-ddThh:mm:ss, where tz-offset is 'Z', +HH:MM or -HH:MM + secsPrecisionLayout := "2006-01-02T15:04:05Z07:00" + // Seconds precision with no colon in tz-offset + secsPrecisionNoColonLayout := "2006-01-02T15:04:05Z0700" + // Seconds precision with 2-digit tz-offset + secsPrecisionTZ2Layout := "2006-01-02T15:04:05Z07" + + // RFC 3339 but with only minutes precision. + // yyyy-MM-ddThh:mm, where tz-offset is 'Z' or +HH:MM or -HH:MM + minPrecisionLayout := "2006-01-02T15:04Z07:00" + // Minutes precision with no colon in tz-offset + minPrecisionNoColonLayout := "2006-01-02T15:04Z0700" + // Minutes precision with 2-digit tz-offset + minPrecisionTZ2Layout := "2006-01-02T15:04Z07" + + // "Dialog" format. + // yyyy-MM-dd hh:mm:ss (no tz-offset) + dialogLayout := "2006-01-02 15:04:05" + + // Register our parsing layouts with the strfmt package. + strfmt.DateTimeFormats = + append(strfmt.DateTimeFormats, + rfc3339TZ2Layout, + secsPrecisionLayout, + secsPrecisionNoColonLayout, + secsPrecisionTZ2Layout, + minPrecisionLayout, + minPrecisionNoColonLayout, + minPrecisionTZ2Layout, + dialogLayout) +} + +// NormalizeDateTimeUTC normalizes t to reflect UTC timezone for marshaling +func NormalizeDateTimeUTC(t time.Time) time.Time { + return t.UTC() +} + +// ParseDate parses the specified RFC3339 full-date string (YYYY-MM-DD) and returns a strfmt.Date instance. +// If the string is empty the return value will be the unix epoch (1970-01-01). +func ParseDate(dateString string) (fmtDate strfmt.Date, err error) { + if dateString == "" { + return strfmt.Date(time.Unix(0, 0).UTC()), nil + } + + formattedTime, err := time.Parse(strfmt.RFC3339FullDate, dateString) + if err == nil { + fmtDate = strfmt.Date(formattedTime) + } + return +} + +// ParseDateTime parses the specified date-time string and returns a strfmt.DateTime instance. +// If the string is empty the return value will be the unix epoch (1970-01-01T00:00:00.000Z). +func ParseDateTime(dateString string) (strfmt.DateTime, error) { + return strfmt.ParseDateTime(dateString) +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/detailed_response.go b/vendor/github.com/IBM/go-sdk-core/v5/core/detailed_response.go new file mode 100644 index 00000000000..4100204945e --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/detailed_response.go @@ -0,0 +1,95 @@ +package core + +// (C) Copyright IBM Corp. 2019. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "encoding/json" + "fmt" + "net/http" +) + +// DetailedResponse holds the response information received from the server. +type DetailedResponse struct { + + // The HTTP status code associated with the response. + StatusCode int + + // The HTTP headers contained in the response. + Headers http.Header + + // Result - this field will contain the result of the operation (obtained from the response body). + // + // If the operation was successful and the response body contains a JSON response, it is un-marshalled + // into an object of the appropriate type (defined by the particular operation), and the Result field will contain + // this response object. If there was an error while un-marshalling the JSON response body, then the RawResult field + // will be set to the byte array containing the response body. + // + // Alternatively, if the generated SDK code passes in a result object which is an io.ReadCloser instance, + // the JSON un-marshalling step is bypassed and the response body is simply returned in the Result field. + // This scenario would occur in a situation where the SDK would like to provide a streaming model for large JSON + // objects. + // + // If the operation was successful and the response body contains a non-JSON response, + // the Result field will be an instance of io.ReadCloser that can be used by generated SDK code + // (or the application) to read the response data. + // + // If the operation was unsuccessful and the response body contains a JSON error response, + // this field will contain an instance of map[string]interface{} which is the result of un-marshalling the + // response body as a "generic" JSON object. + // If the JSON response for an unsuccessful operation could not be properly un-marshalled, then the + // RawResult field will contain the raw response body. + Result interface{} + + // This field will contain the raw response body as a byte array under these conditions: + // 1) there was a problem un-marshalling a JSON response body - + // either for a successful or unsuccessful operation. + // 2) the operation was unsuccessful, and the response body contains a non-JSON response. + RawResult []byte +} + +// GetHeaders returns the headers +func (response *DetailedResponse) GetHeaders() http.Header { + return response.Headers +} + +// GetStatusCode returns the HTTP status code +func (response *DetailedResponse) GetStatusCode() int { + return response.StatusCode +} + +// GetResult returns the result from the service +func (response *DetailedResponse) GetResult() interface{} { + return response.Result +} + +// GetResultAsMap returns the result as a map (generic JSON object), if the +// DetailedResponse.Result field contains an instance of a map. +func (response *DetailedResponse) GetResultAsMap() (map[string]interface{}, bool) { + m, ok := response.Result.(map[string]interface{}) + return m, ok +} + +// GetRawResult returns the raw response body as a byte array. +func (response *DetailedResponse) GetRawResult() []byte { + return response.RawResult +} + +func (response *DetailedResponse) String() string { + output, err := json.MarshalIndent(response, "", " ") + if err == nil { + return fmt.Sprintf("%+v\n", string(output)) + } + return fmt.Sprintf("Error marshalling DetailedResponse instance: %s", err.Error()) +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/doc.go b/vendor/github.com/IBM/go-sdk-core/v5/core/doc.go new file mode 100644 index 00000000000..5c9d60be4ce --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/doc.go @@ -0,0 +1,44 @@ +// (C) Copyright IBM Corp. 2019. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package core contains functionality used by Go SDK's generated by the IBM +OpenAPI 3 SDK Generator (openapi-sdkgen). +Authenticators + +The go-sdk-core project supports the following types of authentication: + + Basic Authentication + Bearer Token + Identity and Access Management (IAM) + Cloud Pak for Data + No Authentication + +The authentication types that are appropriate for a particular service may +vary from service to service. Each authentication type is implemented as an +Authenticator for consumption by a service. To read more about authenticators +and how to use them see here: +https://github.com/IBM/go-sdk-core/blob/main/Authentication.md + +Services + +Services are the API clients generated by the IBM OpenAPI 3 SDK +Generator. These services make use of the code within the core package +BaseService instances to perform service operations. + + + + +*/ +package core diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/file_with_metadata.go b/vendor/github.com/IBM/go-sdk-core/v5/core/file_with_metadata.go new file mode 100644 index 00000000000..578c59bec97 --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/file_with_metadata.go @@ -0,0 +1,76 @@ +package core + +// (C) Copyright IBM Corp. 2021. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "encoding/json" + "io" + "os" + "reflect" +) + +// FileWithMetadata : A file with its associated metadata. +type FileWithMetadata struct { + // The data / content for the file. + Data io.ReadCloser `json:"data" validate:"required"` + + // The filename of the file. + Filename *string `json:"filename,omitempty"` + + // The content type of the file. + ContentType *string `json:"content_type,omitempty"` +} + +// NewFileWithMetadata : Instantiate FileWithMetadata (Generic Model Constructor) +func NewFileWithMetadata(data io.ReadCloser) (model *FileWithMetadata, err error) { + model = &FileWithMetadata{ + Data: data, + } + err = ValidateStruct(model, "required parameters") + return +} + +// UnmarshalFileWithMetadata unmarshals an instance of FileWithMetadata from the specified map of raw messages. +// The "data" field is assumed to be a string, the value of which is assumed to be a path to the file that +// contains the data intended for the FileWithMetadata struct. +func UnmarshalFileWithMetadata(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FileWithMetadata) + + // unmarshal the data field as a filename and read the contents + // then explicitly set the Data field to the contents of the file + var data io.ReadCloser + var pathToData string + err = UnmarshalPrimitive(m, "data", &pathToData) + if err != nil { + return + } + data, err = os.Open(pathToData) // #nosec G304 + if err != nil { + return + } + obj.Data = data + + // unmarshal the other fields as usual + err = UnmarshalPrimitive(m, "filename", &obj.Filename) + if err != nil { + return + } + err = UnmarshalPrimitive(m, "content_type", &obj.ContentType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/gzip.go b/vendor/github.com/IBM/go-sdk-core/v5/core/gzip.go new file mode 100644 index 00000000000..1a834736511 --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/gzip.go @@ -0,0 +1,54 @@ +package core + +// (C) Copyright IBM Corp. 2020. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "compress/gzip" + "io" +) + +// NewGzipCompressionReader will return an io.Reader instance that will deliver +// the gzip-compressed version of the "uncompressedReader" argument. +// This function was inspired by this github gist: +// https://gist.github.com/tomcatzh/cf8040820962e0f8c04700eb3b2f26be +func NewGzipCompressionReader(uncompressedReader io.Reader) (io.Reader, error) { + // Create a pipe whose reader will effectively replace "uncompressedReader" + // to deliver the gzip-compressed byte stream. + pipeReader, pipeWriter := io.Pipe() + go func() { + defer pipeWriter.Close() + + // Wrap the pipe's writer with a gzip writer that will + // write the gzip-compressed bytes to the Pipe. + compressedWriter := gzip.NewWriter(pipeWriter) + defer compressedWriter.Close() + + // To trigger the operation of the pipe, we'll simply start + // to copy bytes from "uncompressedReader" to "compressedWriter". + // This copy operation will block as needed in order to write bytes + // to the pipe only when the pipe reader is called to retrieve more bytes. + _, err := io.Copy(compressedWriter, uncompressedReader) + if err != nil { + _ = pipeWriter.CloseWithError(err) + } + }() + return pipeReader, nil +} + +// NewGzipDecompressionReader will return an io.Reader instance that will deliver +// the gzip-decompressed version of the "compressedReader" argument. +func NewGzipDecompressionReader(compressedReader io.Reader) (io.Reader, error) { + return gzip.NewReader(compressedReader) +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/iam_authenticator.go b/vendor/github.com/IBM/go-sdk-core/v5/core/iam_authenticator.go new file mode 100644 index 00000000000..d6abc820bc6 --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/iam_authenticator.go @@ -0,0 +1,540 @@ +package core + +// (C) Copyright IBM Corp. 2019, 2021. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "bytes" + "crypto/tls" + "encoding/json" + "fmt" + "net/http" + "net/http/httputil" + "strconv" + "strings" + "sync" + "time" +) + +// IamAuthenticator uses an apikey to obtain an IAM access token, +// and adds the access token to requests via an Authorization header +// of the form: +// +// Authorization: Bearer +// +type IamAuthenticator struct { + + // The apikey used to fetch the bearer token from the IAM token server. + // You must specify either ApiKey or RefreshToken. + ApiKey string + + // The refresh token used to fetch the bearer token from the IAM token server. + // You must specify either ApiKey or RefreshToken. + // If this property is specified, then you also must supply appropriate values + // for the ClientId and ClientSecret properties (i.e. they must be the same + // values that were used to obtain the refresh token). + RefreshToken string + + // The URL representing the IAM token server's endpoint; If not specified, + // a suitable default value will be used [optional]. + URL string + urlInit sync.Once + + // The ClientId and ClientSecret fields are used to form a "basic auth" + // Authorization header for interactions with the IAM token server. + + // If neither field is specified, then no Authorization header will be sent + // with token server requests [optional]. These fields are optional, but must + // be specified together. + ClientId string + ClientSecret string + + // A flag that indicates whether verification of the server's SSL certificate + // should be disabled; defaults to false [optional]. + DisableSSLVerification bool + + // [Optional] The "scope" to use when fetching the bearer token from the + // IAM token server. This can be used to obtain an access token + // with a specific scope. + Scope string + + // [Optional] A set of key/value pairs that will be sent as HTTP headers in requests + // made to the token server. + Headers map[string]string + + // [Optional] The http.Client object used to invoke token server requests. + // If not specified by the user, a suitable default Client will be constructed. + Client *http.Client + + // The cached token and expiration time. + tokenData *iamTokenData + + // Mutex to make the tokenData field thread safe. + tokenDataMutex sync.Mutex +} + +var iamRequestTokenMutex sync.Mutex +var iamNeedsRefreshMutex sync.Mutex + +const ( + // The default (prod) IAM token server base endpoint address. + defaultIamTokenServerEndpoint = "https://iam.cloud.ibm.com" // #nosec G101 + iamAuthOperationPathGetToken = "/identity/token" + iamAuthGrantTypeApiKey = "urn:ibm:params:oauth:grant-type:apikey" // #nosec G101 + iamAuthGrantTypeRefreshToken = "refresh_token" // #nosec G101 +) + +// IamAuthenticatorBuilder is used to construct an IamAuthenticator instance. +type IamAuthenticatorBuilder struct { + IamAuthenticator +} + +// NewIamAuthenticatorBuilder returns a new builder struct that +// can be used to construct an IamAuthenticator instance. +func NewIamAuthenticatorBuilder() *IamAuthenticatorBuilder { + return &IamAuthenticatorBuilder{} +} + +// SetApiKey sets the ApiKey field in the builder. +func (builder *IamAuthenticatorBuilder) SetApiKey(s string) *IamAuthenticatorBuilder { + builder.IamAuthenticator.ApiKey = s + return builder +} + +// SetRefreshToken sets the RefreshToken field in the builder. +func (builder *IamAuthenticatorBuilder) SetRefreshToken(s string) *IamAuthenticatorBuilder { + builder.IamAuthenticator.RefreshToken = s + return builder +} + +// SetURL sets the URL field in the builder. +func (builder *IamAuthenticatorBuilder) SetURL(s string) *IamAuthenticatorBuilder { + builder.IamAuthenticator.URL = s + return builder +} + +// SetClientIDSecret sets the ClientId and ClientSecret fields in the builder. +func (builder *IamAuthenticatorBuilder) SetClientIDSecret(clientID, clientSecret string) *IamAuthenticatorBuilder { + builder.IamAuthenticator.ClientId = clientID + builder.IamAuthenticator.ClientSecret = clientSecret + return builder +} + +// SetDisableSSLVerification sets the DisableSSLVerification field in the builder. +func (builder *IamAuthenticatorBuilder) SetDisableSSLVerification(b bool) *IamAuthenticatorBuilder { + builder.IamAuthenticator.DisableSSLVerification = b + return builder +} + +// SetScope sets the Scope field in the builder. +func (builder *IamAuthenticatorBuilder) SetScope(s string) *IamAuthenticatorBuilder { + builder.IamAuthenticator.Scope = s + return builder +} + +// SetHeaders sets the Headers field in the builder. +func (builder *IamAuthenticatorBuilder) SetHeaders(headers map[string]string) *IamAuthenticatorBuilder { + builder.IamAuthenticator.Headers = headers + return builder +} + +// SetClient sets the Client field in the builder. +func (builder *IamAuthenticatorBuilder) SetClient(client *http.Client) *IamAuthenticatorBuilder { + builder.IamAuthenticator.Client = client + return builder +} + +// Build() returns a validated instance of the IamAuthenticator with the config that was set in the builder. +func (builder *IamAuthenticatorBuilder) Build() (*IamAuthenticator, error) { + + // Make sure the config is valid. + err := builder.IamAuthenticator.Validate() + if err != nil { + return nil, err + } + + return &builder.IamAuthenticator, nil +} + +// NewIamAuthenticator constructs a new IamAuthenticator instance. +// Deprecated - use the IamAuthenticatorBuilder instead. +func NewIamAuthenticator(apiKey string, url string, clientId string, clientSecret string, + disableSSLVerification bool, headers map[string]string) (*IamAuthenticator, error) { + + authenticator, err := NewIamAuthenticatorBuilder(). + SetApiKey(apiKey). + SetURL(url). + SetClientIDSecret(clientId, clientSecret). + SetDisableSSLVerification(disableSSLVerification). + SetHeaders(headers). + Build() + + return authenticator, err +} + +// newIamAuthenticatorFromMap constructs a new IamAuthenticator instance from a map. +func newIamAuthenticatorFromMap(properties map[string]string) (authenticator *IamAuthenticator, err error) { + if properties == nil { + return nil, fmt.Errorf(ERRORMSG_PROPS_MAP_NIL) + } + + disableSSL, err := strconv.ParseBool(properties[PROPNAME_AUTH_DISABLE_SSL]) + if err != nil { + disableSSL = false + } + + authenticator, err = NewIamAuthenticatorBuilder(). + SetApiKey(properties[PROPNAME_APIKEY]). + SetRefreshToken(properties[PROPNAME_REFRESH_TOKEN]). + SetURL(properties[PROPNAME_AUTH_URL]). + SetClientIDSecret(properties[PROPNAME_CLIENT_ID], properties[PROPNAME_CLIENT_SECRET]). + SetDisableSSLVerification(disableSSL). + SetScope(properties[PROPNAME_SCOPE]). + Build() + + return +} + +// AuthenticationType returns the authentication type for this authenticator. +func (*IamAuthenticator) AuthenticationType() string { + return AUTHTYPE_IAM +} + +// Authenticate adds IAM authentication information to the request. +// +// The IAM bearer token will be added to the request's headers in the form: +// +// Authorization: Bearer +// +func (authenticator *IamAuthenticator) Authenticate(request *http.Request) error { + token, err := authenticator.GetToken() + if err != nil { + return err + } + + request.Header.Set("Authorization", "Bearer "+token) + return nil +} + +// url returns the authenticator's URL property after potentially initializing it. +func (authenticator *IamAuthenticator) url() string { + authenticator.urlInit.Do(func() { + if authenticator.URL == "" { + // If URL was not specified, then use the default IAM endpoint. + authenticator.URL = defaultIamTokenServerEndpoint + } else { + // Canonicalize the URL by removing the operation path if it was specified by the user. + authenticator.URL = strings.TrimSuffix(authenticator.URL, iamAuthOperationPathGetToken) + } + }) + return authenticator.URL +} + +// getTokenData returns the tokenData field from the authenticator. +func (authenticator *IamAuthenticator) getTokenData() *iamTokenData { + authenticator.tokenDataMutex.Lock() + defer authenticator.tokenDataMutex.Unlock() + + return authenticator.tokenData +} + +// setTokenData sets the given iamTokenData to the tokenData field of the authenticator. +func (authenticator *IamAuthenticator) setTokenData(tokenData *iamTokenData) { + authenticator.tokenDataMutex.Lock() + defer authenticator.tokenDataMutex.Unlock() + + authenticator.tokenData = tokenData + + // Next, we should save the just-returned refresh token back to the main + // authenticator struct. + // This is done so that if we were originally configured with + // a refresh token, then we'll be sure to use a "fresh" + // refresh token next time we invoke the "get token" operation. + // This was recommended by the IAM team to avoid problems in the future + // if the token service is changed to invalidate an existing refresh token + // when a new one is generated and returned in the response. + if tokenData != nil { + authenticator.RefreshToken = tokenData.RefreshToken + } +} + +// Validate the authenticator's configuration. +// +// Ensures that the ApiKey and RefreshToken properties are mutually exclusive, +// and that the ClientId and ClientSecret properties are mutually inclusive. +func (this *IamAuthenticator) Validate() error { + + // The user should specify exactly one of ApiKey or RefreshToken. + if this.ApiKey == "" && this.RefreshToken == "" || + this.ApiKey != "" && this.RefreshToken != "" { + return fmt.Errorf(ERRORMSG_EXCLUSIVE_PROPS_ERROR, "ApiKey", "RefreshToken") + } + + if this.ApiKey != "" && HasBadFirstOrLastChar(this.ApiKey) { + return fmt.Errorf(ERRORMSG_PROP_INVALID, "ApiKey") + } + + // Validate ClientId and ClientSecret. + // If RefreshToken is not specified, then both or neither should be specified. + // If RefreshToken is specified, then both must be specified. + if this.ClientId == "" && this.ClientSecret == "" && this.RefreshToken == "" { + // Do nothing as this is the valid scenario + } else { + // Since it is NOT the case that both properties are empty, make sure BOTH are specified. + if this.ClientId == "" { + return fmt.Errorf(ERRORMSG_PROP_MISSING, "ClientId") + } + + if this.ClientSecret == "" { + return fmt.Errorf(ERRORMSG_PROP_MISSING, "ClientSecret") + } + } + + return nil +} + +// GetToken: returns an access token to be used in an Authorization header. +// Whenever a new token is needed (when a token doesn't yet exist, needs to be refreshed, +// or the existing token has expired), a new access token is fetched from the token server. +func (authenticator *IamAuthenticator) GetToken() (string, error) { + if authenticator.getTokenData() == nil || !authenticator.getTokenData().isTokenValid() { + // synchronously request the token + err := authenticator.synchronizedRequestToken() + if err != nil { + return "", err + } + } else if authenticator.getTokenData().needsRefresh() { + // If refresh needed, kick off a go routine in the background to get a new token + //nolint: errcheck + go authenticator.invokeRequestTokenData() + } + + // return an error if the access token is not valid or was not fetched + if authenticator.getTokenData() == nil || authenticator.getTokenData().AccessToken == "" { + return "", fmt.Errorf("Error while trying to get access token") + } + + return authenticator.getTokenData().AccessToken, nil +} + +// synchronizedRequestToken: synchronously checks if the current token in cache +// is valid. If token is not valid or does not exist, it will fetch a new token +// and set the tokenRefreshTime +func (authenticator *IamAuthenticator) synchronizedRequestToken() error { + iamRequestTokenMutex.Lock() + defer iamRequestTokenMutex.Unlock() + // if cached token is still valid, then just continue to use it + if authenticator.getTokenData() != nil && authenticator.getTokenData().isTokenValid() { + return nil + } + + return authenticator.invokeRequestTokenData() +} + +// invokeRequestTokenData: requests a new token from the access server and +// unmarshals the token information to the tokenData cache. Returns +// an error if the token was unable to be fetched, otherwise returns nil +func (authenticator *IamAuthenticator) invokeRequestTokenData() error { + tokenResponse, err := authenticator.RequestToken() + if err != nil { + return err + } + + if tokenData, err := newIamTokenData(tokenResponse); err != nil { + return err + } else { + authenticator.setTokenData(tokenData) + } + + return nil +} + +// RequestToken fetches a new access token from the token server. +func (authenticator *IamAuthenticator) RequestToken() (*IamTokenServerResponse, error) { + + builder := NewRequestBuilder(POST) + _, err := builder.ResolveRequestURL(authenticator.url(), iamAuthOperationPathGetToken, nil) + if err != nil { + return nil, err + } + + builder.AddHeader(CONTENT_TYPE, "application/x-www-form-urlencoded") + builder.AddHeader(Accept, APPLICATION_JSON) + builder.AddFormData("response_type", "", "", "cloud_iam") + + if authenticator.ApiKey != "" { + // If ApiKey was configured, then use grant_type "apikey" to obtain an access token. + builder.AddFormData("grant_type", "", "", iamAuthGrantTypeApiKey) + builder.AddFormData("apikey", "", "", authenticator.ApiKey) + } else if authenticator.RefreshToken != "" { + // Otherwise, if RefreshToken was configured then use grant_type "refresh_token". + builder.AddFormData("grant_type", "", "", iamAuthGrantTypeRefreshToken) + builder.AddFormData("refresh_token", "", "", authenticator.RefreshToken) + } else { + // We shouldn't ever get here due to prior validations, but just in case, let's log an error. + return nil, fmt.Errorf(ERRORMSG_EXCLUSIVE_PROPS_ERROR, "ApiKey", "RefreshToken") + } + + // Add any optional parameters to the request. + if authenticator.Scope != "" { + builder.AddFormData("scope", "", "", authenticator.Scope) + } + + // Add user-defined headers to request. + for headerName, headerValue := range authenticator.Headers { + builder.AddHeader(headerName, headerValue) + } + + req, err := builder.Build() + if err != nil { + return nil, err + } + + // If client id and secret were configured by the user, then set them on the request + // as a basic auth header. + // Our previous validation step would have made sure that both values are specified + // if the RefreshToken property was specified. + if authenticator.ClientId != "" && authenticator.ClientSecret != "" { + req.SetBasicAuth(authenticator.ClientId, authenticator.ClientSecret) + } + + // If the authenticator does not have a Client, create one now. + if authenticator.Client == nil { + authenticator.Client = &http.Client{ + Timeout: time.Second * 30, + } + + // If the user told us to disable SSL verification, then do it now. + if authenticator.DisableSSLVerification { + transport := &http.Transport{ + // #nosec G402 + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } + authenticator.Client.Transport = transport + } + } + + // If debug is enabled, then dump the request. + if GetLogger().IsLogLevelEnabled(LevelDebug) { + buf, dumpErr := httputil.DumpRequestOut(req, req.Body != nil) + if dumpErr == nil { + GetLogger().Debug("Request:\n%s\n", RedactSecrets(string(buf))) + } else { + GetLogger().Debug(fmt.Sprintf("error while attempting to log outbound request: %s", dumpErr.Error())) + } + } + + GetLogger().Debug("Invoking IAM 'get token' operation: %s", builder.URL) + resp, err := authenticator.Client.Do(req) + if err != nil { + return nil, err + } + GetLogger().Debug("Returned from IAM 'get token' operation, received status code %d", resp.StatusCode) + + // If debug is enabled, then dump the response. + if GetLogger().IsLogLevelEnabled(LevelDebug) { + buf, dumpErr := httputil.DumpResponse(resp, req.Body != nil) + if dumpErr == nil { + GetLogger().Debug("Response:\n%s\n", RedactSecrets(string(buf))) + } else { + GetLogger().Debug(fmt.Sprintf("error while attempting to log inbound response: %s", dumpErr.Error())) + } + } + + if resp.StatusCode < 200 || resp.StatusCode >= 300 { + buff := new(bytes.Buffer) + _, _ = buff.ReadFrom(resp.Body) + + // Create a DetailedResponse to be included in the error below. + detailedResponse := &DetailedResponse{ + StatusCode: resp.StatusCode, + Headers: resp.Header, + RawResult: buff.Bytes(), + } + + iamErrorMsg := string(detailedResponse.RawResult) + if iamErrorMsg == "" { + iamErrorMsg = + fmt.Sprintf("unexpected status code %d received from IAM token server %s", detailedResponse.StatusCode, builder.URL) + } + return nil, NewAuthenticationError(detailedResponse, fmt.Errorf(iamErrorMsg)) + } + + tokenResponse := &IamTokenServerResponse{} + _ = json.NewDecoder(resp.Body).Decode(tokenResponse) + defer resp.Body.Close() + return tokenResponse, nil +} + +// IamTokenServerResponse : This struct models a response received from the token server. +type IamTokenServerResponse struct { + AccessToken string `json:"access_token"` + RefreshToken string `json:"refresh_token"` + TokenType string `json:"token_type"` + ExpiresIn int64 `json:"expires_in"` + Expiration int64 `json:"expiration"` +} + +// iamTokenData : This struct represents the cached information related to a fetched access token. +type iamTokenData struct { + AccessToken string + RefreshToken string + RefreshTime int64 + Expiration int64 +} + +// newIamTokenData: constructs a new IamTokenData instance from the specified IamTokenServerResponse instance. +func newIamTokenData(tokenResponse *IamTokenServerResponse) (*iamTokenData, error) { + + if tokenResponse == nil { + return nil, fmt.Errorf("Error while trying to parse access token!") + } + // Compute the adjusted refresh time (expiration time - 20% of timeToLive) + timeToLive := tokenResponse.ExpiresIn + expireTime := tokenResponse.Expiration + refreshTime := expireTime - int64(float64(timeToLive)*0.2) + + tokenData := &iamTokenData{ + AccessToken: tokenResponse.AccessToken, + RefreshToken: tokenResponse.RefreshToken, + Expiration: expireTime, + RefreshTime: refreshTime, + } + + return tokenData, nil +} + +// isTokenValid: returns true iff the IamTokenData instance represents a valid (non-expired) access token. +func (this *iamTokenData) isTokenValid() bool { + if this.AccessToken != "" && GetCurrentTime() < this.Expiration { + return true + } + return false +} + +// needsRefresh: synchronously returns true iff the currently stored access token should be refreshed. This method also +// updates the refresh time if it determines the token needs refreshed to prevent other threads from +// making multiple refresh calls. +func (this *iamTokenData) needsRefresh() bool { + iamNeedsRefreshMutex.Lock() + defer iamNeedsRefreshMutex.Unlock() + + // Advance refresh by one minute + if this.RefreshTime >= 0 && GetCurrentTime() > this.RefreshTime { + this.RefreshTime = GetCurrentTime() + 60 + return true + } + + return false +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/jwt_utils.go b/vendor/github.com/IBM/go-sdk-core/v5/core/jwt_utils.go new file mode 100644 index 00000000000..117669eb9e0 --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/jwt_utils.go @@ -0,0 +1,66 @@ +package core + +// (C) Copyright IBM Corp. 2021. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "strings" +) + +// coreJWTClaims are the fields within a JWT's "claims" segment that we're interested in. +type coreJWTClaims struct { + ExpiresAt int64 `json:"exp,omitempty"` + IssuedAt int64 `json:"iat,omitempty"` +} + +// parseJWT parses the specified JWT token string and returns an instance of the coreJWTClaims struct. +func parseJWT(tokenString string) (claims *coreJWTClaims, err error) { + // A JWT consists of three .-separated segments + segments := strings.Split(tokenString, ".") + if len(segments) != 3 { + err = fmt.Errorf("token contains an invalid number of segments") + return + } + + // Parse Claims segment. + var claimBytes []byte + claimBytes, err = decodeSegment(segments[1]) + if err != nil { + err = fmt.Errorf("error decoding claims segment: %s", err.Error()) + return + } + + // Now deserialize the claims segment into our coreClaims struct. + claims = &coreJWTClaims{} + err = json.Unmarshal(claimBytes, claims) + if err != nil { + err = fmt.Errorf("error unmarshalling token: %s", err.Error()) + return + } + + return +} + +// Decode JWT specific base64url encoding with padding stripped +// Copied from https://github.com/golang-jwt/jwt/blob/main/token.go +func decodeSegment(seg string) ([]byte, error) { + if l := len(seg) % 4; l > 0 { + seg += strings.Repeat("=", 4-l) + } + + return base64.URLEncoding.DecodeString(seg) +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/log.go b/vendor/github.com/IBM/go-sdk-core/v5/core/log.go new file mode 100644 index 00000000000..0ac5fa0e037 --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/log.go @@ -0,0 +1,179 @@ +package core + +// (C) Copyright IBM Corp. 2020, 2021. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "log" + "os" + "sync" +) + +// LogLevel defines a type for logging levels +type LogLevel int + +// Log level constants +const ( + LevelNone LogLevel = iota + LevelError + LevelWarn + LevelInfo + LevelDebug +) + +// Logger is the logging interface implemented and used by the Go core library. +// Users of the library can supply their own implementation by calling SetLogger(). +type Logger interface { + Log(level LogLevel, format string, inserts ...interface{}) + Error(format string, inserts ...interface{}) + Warn(format string, inserts ...interface{}) + Info(format string, inserts ...interface{}) + Debug(format string, inserts ...interface{}) + + SetLogLevel(level LogLevel) + GetLogLevel() LogLevel + IsLogLevelEnabled(level LogLevel) bool +} + +// SDKLoggerImpl is the Go core's implementation of the Logger interface. +// This logger contains two instances of Go's log.Logger interface which are +// used to perform message logging. +// "infoLogger" is used to log info/warn/debug messages. +// If specified as nil, then a default log.Logger instance that uses stdout will be created +// and used for "infoLogger". +// "errorLogger" is used to log error messages. +// If specified as nil, then a default log.Logger instance that uses stderr will be created +// and used for "errorLogger". +type SDKLoggerImpl struct { + + // The current log level configured in this logger. + // Only messages with a log level that is <= 'logLevel' will be displayed. + logLevel LogLevel + + // The underlying log.Logger instances used to log info/warn/debug messages. + infoLogger *log.Logger + + // The underlying log.Logger instances used to log error messages. + errorLogger *log.Logger + + // These are used to initialize the loggers above. + infoInit sync.Once + errorInit sync.Once +} + +// SetLogLevel sets level to be the current logging level +func (l *SDKLoggerImpl) SetLogLevel(level LogLevel) { + l.logLevel = level +} + +// GetLogLevel sets level to be the current logging level +func (l *SDKLoggerImpl) GetLogLevel() LogLevel { + return l.logLevel +} + +// IsLogLevelEnabled returns true iff the logger's current logging level +// indicates that 'level' is enabled. +func (l *SDKLoggerImpl) IsLogLevelEnabled(level LogLevel) bool { + return l.logLevel >= level +} + +// infoLog returns the underlying log.Logger instance used for info/warn/debug logging. +func (l *SDKLoggerImpl) infoLog() *log.Logger { + l.infoInit.Do(func() { + if l.infoLogger == nil { + l.infoLogger = log.New(os.Stdout, "", log.LstdFlags) + } + }) + + return l.infoLogger +} + +// errorLog returns the underlying log.Logger instance used for error logging. +func (l *SDKLoggerImpl) errorLog() *log.Logger { + l.errorInit.Do(func() { + if l.errorLogger == nil { + l.errorLogger = log.New(os.Stderr, "", log.LstdFlags) + } + }) + + return l.errorLogger +} + +// Log will log the specified message on the appropriate log.Logger instance if "level" is currently enabled. +func (l *SDKLoggerImpl) Log(level LogLevel, format string, inserts ...interface{}) { + if l.IsLogLevelEnabled(level) { + var goLogger *log.Logger + switch level { + case LevelError: + goLogger = l.errorLog() + default: + goLogger = l.infoLog() + } + goLogger.Printf(format, inserts...) + } +} + +// Error logs a message at level "Error" +func (l *SDKLoggerImpl) Error(format string, inserts ...interface{}) { + l.Log(LevelError, "[Error] "+format, inserts...) +} + +// Warn logs a message at level "Warn" +func (l *SDKLoggerImpl) Warn(format string, inserts ...interface{}) { + l.Log(LevelWarn, "[Warn] "+format, inserts...) +} + +// Info logs a message at level "Info" +func (l *SDKLoggerImpl) Info(format string, inserts ...interface{}) { + l.Log(LevelInfo, "[Info] "+format, inserts...) +} + +// Debug logs a message at level "Debug" +func (l *SDKLoggerImpl) Debug(format string, inserts ...interface{}) { + l.Log(LevelDebug, "[Debug] "+format, inserts...) +} + +// NewLogger constructs an SDKLoggerImpl instance with the specified logging level +// enabled. +// The "infoLogger" parameter is the log.Logger instance to be used to log +// info/warn/debug messages. If specified as nil, then a default log.Logger instance +// that writes messages to "stdout" will be used. +// The "errorLogger" parameter is the log.Logger instance to be used to log +// error messages. If specified as nil, then a default log.Logger instance +// that writes messages to "stderr" will be used. +func NewLogger(level LogLevel, infoLogger *log.Logger, errorLogger *log.Logger) *SDKLoggerImpl { + return &SDKLoggerImpl{ + logLevel: level, + infoLogger: infoLogger, + errorLogger: errorLogger, + } +} + +// sdkLogger holds the Logger implementation used by the Go core library. +var sdkLogger Logger = NewLogger(LevelError, nil, nil) + +// SetLogger sets the specified Logger instance as the logger to be used by the Go core library. +func SetLogger(logger Logger) { + sdkLogger = logger +} + +// GetLogger returns the Logger instance currently used by the Go core. +func GetLogger() Logger { + return sdkLogger +} + +// SetLoggingLevel will enable the specified logging level in the Go core library. +func SetLoggingLevel(level LogLevel) { + GetLogger().SetLogLevel(level) +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/noauth_authenticator.go b/vendor/github.com/IBM/go-sdk-core/v5/core/noauth_authenticator.go new file mode 100644 index 00000000000..f77565a6acd --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/noauth_authenticator.go @@ -0,0 +1,41 @@ +package core + +// (C) Copyright IBM Corp. 2019. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "net/http" +) + +// NoAuthAuthenticator is simply a placeholder implementation of the Authenticator interface +// that performs no authentication. This might be useful in testing/debugging situations. +type NoAuthAuthenticator struct { +} + +func NewNoAuthAuthenticator() (*NoAuthAuthenticator, error) { + return &NoAuthAuthenticator{}, nil +} + +func (NoAuthAuthenticator) AuthenticationType() string { + return AUTHTYPE_NOAUTH +} + +func (NoAuthAuthenticator) Validate() error { + return nil +} + +func (this *NoAuthAuthenticator) Authenticate(request *http.Request) error { + // Nothing to do since we're not providing any authentication. + return nil +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/parameterized_url.go b/vendor/github.com/IBM/go-sdk-core/v5/core/parameterized_url.go new file mode 100644 index 00000000000..a2c672b7d6c --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/parameterized_url.go @@ -0,0 +1,74 @@ +package core + +// (C) Copyright IBM Corp. 2021. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "fmt" + "sort" + "strings" +) + +// +// ConstructServiceURL returns a service URL that is constructed by formatting a parameterized URL. +// +// Parameters: +// +// parameterizedUrl: URL that contains variable placeholders, e.g. "{scheme}://ibm.com". +// +// defaultUrlVariables: map from variable names to default values. +// Each variable in the parameterized URL must have a default value specified in this map. +// +// providedUrlVariables: map from variable names to desired values. +// If a variable is not provided in this map, +// the default variable value will be used instead. +// +func ConstructServiceURL( + parameterizedUrl string, + defaultUrlVariables map[string]string, + providedUrlVariables map[string]string, +) (string, error) { + + // Verify the provided variable names. + for providedName := range providedUrlVariables { + if _, ok := defaultUrlVariables[providedName]; !ok { + // Get all accepted variable names (the keys of the default variables map). + var acceptedNames []string + for name := range defaultUrlVariables { + acceptedNames = append(acceptedNames, name) + } + sort.Strings(acceptedNames) + + return "", fmt.Errorf( + "'%s' is an invalid variable name.\nValid variable names: %s.", + providedName, + acceptedNames, + ) + } + } + + // Format the URL with provided or default variable values. + formattedUrl := parameterizedUrl + + for name, defaultValue := range defaultUrlVariables { + providedValue, ok := providedUrlVariables[name] + + // Use the default variable value if none was provided. + if !ok { + providedValue = defaultValue + } + formattedUrl = strings.Replace(formattedUrl, "{"+name+"}", providedValue, 1) + } + return formattedUrl, nil +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/request_builder.go b/vendor/github.com/IBM/go-sdk-core/v5/core/request_builder.go new file mode 100644 index 00000000000..bdd549cdbed --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/request_builder.go @@ -0,0 +1,424 @@ +package core + +// (C) Copyright IBM Corp. 2019. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "mime/multipart" + "net/http" + "net/textproto" + "net/url" + "os" + "path/filepath" + "reflect" + "strings" +) + +// common HTTP methods +const ( + POST = http.MethodPost + GET = http.MethodGet + DELETE = http.MethodDelete + PUT = http.MethodPut + PATCH = http.MethodPatch + HEAD = http.MethodHead +) + +// common headers +const ( + Accept = "Accept" + APPLICATION_JSON = "application/json" + CONTENT_DISPOSITION = "Content-Disposition" + CONTENT_ENCODING = "Content-Encoding" + CONTENT_TYPE = "Content-Type" + FORM_URL_ENCODED_HEADER = "application/x-www-form-urlencoded" + + ERRORMSG_SERVICE_URL_MISSING = "service URL is empty" + ERRORMSG_SERVICE_URL_INVALID = "error parsing service URL: %s" + ERRORMSG_PATH_PARAM_EMPTY = "path parameter '%s' is empty" +) + +// FormData stores information for form data. +type FormData struct { + fileName string + contentType string + contents interface{} +} + +// RequestBuilder is used to build an HTTP Request instance. +type RequestBuilder struct { + Method string + URL *url.URL + Header http.Header + Body io.Reader + Query map[string][]string + Form map[string][]FormData + + // EnableGzipCompression indicates whether or not request bodies + // should be gzip-compressed. + // This field has no effect on response bodies. + // If enabled, the Body field will be gzip-compressed and + // the "Content-Encoding" header will be added to the request with the + // value "gzip". + EnableGzipCompression bool + + // RequestContext is an optional Context instance to be associated with the + // http.Request that is constructed by the Build() method. + ctx context.Context +} + +// NewRequestBuilder initiates a new request. +func NewRequestBuilder(method string) *RequestBuilder { + return &RequestBuilder{ + Method: method, + Header: make(http.Header), + Query: make(map[string][]string), + Form: make(map[string][]FormData), + } +} + +// WithContext sets "ctx" as the Context to be associated with +// the http.Request instance that will be constructed by the Build() method. +func (requestBuilder *RequestBuilder) WithContext(ctx context.Context) *RequestBuilder { + requestBuilder.ctx = ctx + return requestBuilder +} + +// ConstructHTTPURL creates a properly-encoded URL with path parameters. +// This function returns an error if the serviceURL is "" or is an +// invalid URL string (e.g. ":"). +func (requestBuilder *RequestBuilder) ConstructHTTPURL(serviceURL string, pathSegments []string, pathParameters []string) (*RequestBuilder, error) { + if serviceURL == "" { + return requestBuilder, fmt.Errorf(ERRORMSG_SERVICE_URL_MISSING) + } + var URL *url.URL + + URL, err := url.Parse(serviceURL) + if err != nil { + return requestBuilder, fmt.Errorf(ERRORMSG_SERVICE_URL_INVALID, err.Error()) + } + + for i, pathSegment := range pathSegments { + if pathSegment != "" { + URL.Path += "/" + pathSegment + } + + if pathParameters != nil && i < len(pathParameters) { + if pathParameters[i] == "" { + return requestBuilder, fmt.Errorf(ERRORMSG_PATH_PARAM_EMPTY, fmt.Sprintf("[%d]", i)) + } + URL.Path += "/" + pathParameters[i] + } + } + requestBuilder.URL = URL + return requestBuilder, nil +} + +// +// ResolveRequestURL creates a properly-encoded URL with path params. +// This function returns an error if the serviceURL is "" or is an +// invalid URL string (e.g. ":"). +// Parameters: +// serviceURL - the base URL associated with the service endpoint (e.g. "https://myservice.cloud.ibm.com") +// path - the unresolved path string (e.g. "/resource/{resource_id}/type/{type_id}") +// pathParams - a map containing the path params, keyed by the path param base name +// (e.g. {"type_id": "type-1", "resource_id": "res-123-456-789-abc"}) +// The resulting request URL: "https://myservice.cloud.ibm.com/resource/res-123-456-789-abc/type/type-1" +// +func (requestBuilder *RequestBuilder) ResolveRequestURL(serviceURL string, path string, pathParams map[string]string) (*RequestBuilder, error) { + if serviceURL == "" { + return requestBuilder, fmt.Errorf(ERRORMSG_SERVICE_URL_MISSING) + } + + urlString := serviceURL + + // If we have a non-empty "path" input parameter, then process it for possible path param references. + if path != "" { + + // If path parameter values were passed in, then for each one, replace any references to it + // within "path" with the path parameter's encoded value. + if len(pathParams) > 0 { + for k, v := range pathParams { + if v == "" { + return requestBuilder, fmt.Errorf(ERRORMSG_PATH_PARAM_EMPTY, k) + } + encodedValue := url.PathEscape(v) + ref := fmt.Sprintf("{%s}", k) + path = strings.ReplaceAll(path, ref, encodedValue) + } + } + + // Next, we need to append "path" to "urlString". + // We need to pay particular attention to any trailing slash on "urlString" and + // a leading slash on "path". Ultimately, we do not want a double slash. + if strings.HasSuffix(urlString, "/") { + // If urlString has a trailing slash, then make sure path does not have a leading slash. + path = strings.TrimPrefix(path, "/") + } else { + // If urlString does not have a trailing slash and path does not have a + // leading slash, then append a slash to urlString. + if !strings.HasPrefix(path, "/") { + urlString += "/" + } + } + + urlString += path + } + + var URL *url.URL + + URL, err := url.Parse(urlString) + if err != nil { + return requestBuilder, fmt.Errorf(ERRORMSG_SERVICE_URL_INVALID, err.Error()) + } + + requestBuilder.URL = URL + return requestBuilder, nil +} + +// AddQuery adds a query parameter name and value to the request. +func (requestBuilder *RequestBuilder) AddQuery(name string, value string) *RequestBuilder { + requestBuilder.Query[name] = append(requestBuilder.Query[name], value) + return requestBuilder +} + +// AddHeader adds a header name and value to the request. +func (requestBuilder *RequestBuilder) AddHeader(name string, value string) *RequestBuilder { + requestBuilder.Header[name] = []string{value} + return requestBuilder +} + +// AddFormData adds a new mime part (constructed from the input parameters) +// to the request's multi-part form. +func (requestBuilder *RequestBuilder) AddFormData(fieldName string, fileName string, contentType string, + contents interface{}) *RequestBuilder { + if fileName == "" { + if file, ok := contents.(*os.File); ok { + if !((os.File{}) == *file) { // if file is not empty + name := filepath.Base(file.Name()) + fileName = name + } + } + } + requestBuilder.Form[fieldName] = append(requestBuilder.Form[fieldName], FormData{ + fileName: fileName, + contentType: contentType, + contents: contents, + }) + return requestBuilder +} + +// SetBodyContentJSON sets the body content from a JSON structure. +func (requestBuilder *RequestBuilder) SetBodyContentJSON(bodyContent interface{}) (*RequestBuilder, error) { + requestBuilder.Body = new(bytes.Buffer) + err := json.NewEncoder(requestBuilder.Body.(io.Writer)).Encode(bodyContent) + return requestBuilder, err +} + +// SetBodyContentString sets the body content from a string. +func (requestBuilder *RequestBuilder) SetBodyContentString(bodyContent string) (*RequestBuilder, error) { + requestBuilder.Body = strings.NewReader(bodyContent) + return requestBuilder, nil +} + +// SetBodyContentStream sets the body content from an io.Reader instance. +func (requestBuilder *RequestBuilder) SetBodyContentStream(bodyContent io.Reader) (*RequestBuilder, error) { + requestBuilder.Body = bodyContent + return requestBuilder, nil +} + +// CreateMultipartWriter initializes a new multipart writer. +func (requestBuilder *RequestBuilder) createMultipartWriter() *multipart.Writer { + buff := new(bytes.Buffer) + requestBuilder.Body = buff + return multipart.NewWriter(buff) +} + +// CreateFormFile is a convenience wrapper around CreatePart. It creates +// a new form-data header with the provided field name and file name and contentType. +func createFormFile(formWriter *multipart.Writer, fieldname string, filename string, contentType string) (io.Writer, error) { + h := make(textproto.MIMEHeader) + contentDisposition := fmt.Sprintf(`form-data; name="%s"`, fieldname) + if filename != "" { + contentDisposition += fmt.Sprintf(`; filename="%s"`, filename) + } + + h.Set(CONTENT_DISPOSITION, contentDisposition) + if contentType != "" { + h.Set(CONTENT_TYPE, contentType) + } + + return formWriter.CreatePart(h) +} + +// SetBodyContentForMultipart sets the body content for a part in a multi-part form. +func (requestBuilder *RequestBuilder) SetBodyContentForMultipart(contentType string, content interface{}, writer io.Writer) error { + var err error + if stream, ok := content.(io.Reader); ok { + _, err = io.Copy(writer, stream) + } else if stream, ok := content.(*io.ReadCloser); ok { + _, err = io.Copy(writer, *stream) + } else if IsJSONMimeType(contentType) || IsJSONPatchMimeType(contentType) { + err = json.NewEncoder(writer).Encode(content) + } else if str, ok := content.(string); ok { + _, err = writer.Write([]byte(str)) + } else if strPtr, ok := content.(*string); ok { + _, err = writer.Write([]byte(*strPtr)) + } else { + err = fmt.Errorf("Error: unable to determine the type of 'content' provided") + } + return err +} + +// Build builds an HTTP Request object from this RequestBuilder instance. +func (requestBuilder *RequestBuilder) Build() (req *http.Request, err error) { + // Create multipart form data + if len(requestBuilder.Form) > 0 { + // handle both application/x-www-form-urlencoded or multipart/form-data + contentType := requestBuilder.Header.Get(CONTENT_TYPE) + if contentType == FORM_URL_ENCODED_HEADER { + data := url.Values{} + for fieldName, l := range requestBuilder.Form { + for _, v := range l { + data.Add(fieldName, v.contents.(string)) + } + } + _, err = requestBuilder.SetBodyContentString(data.Encode()) + if err != nil { + return + } + } else { + formWriter := requestBuilder.createMultipartWriter() + for fieldName, l := range requestBuilder.Form { + for _, v := range l { + var dataPartWriter io.Writer + dataPartWriter, err = createFormFile(formWriter, fieldName, v.fileName, v.contentType) + if err != nil { + return + } + if err = requestBuilder.SetBodyContentForMultipart(v.contentType, + v.contents, dataPartWriter); err != nil { + return + } + } + } + + requestBuilder.AddHeader("Content-Type", formWriter.FormDataContentType()) + err = formWriter.Close() + if err != nil { + return + } + } + } + + // If we have a request body and gzip is enabled, then wrap the body in a Gzip compression reader + // and add the "Content-Encoding: gzip" request header. + if !IsNil(requestBuilder.Body) && requestBuilder.EnableGzipCompression && + !SliceContains(requestBuilder.Header[CONTENT_ENCODING], "gzip") { + newBody, err := NewGzipCompressionReader(requestBuilder.Body) + if err != nil { + return nil, err + } + requestBuilder.Body = newBody + requestBuilder.Header.Add(CONTENT_ENCODING, "gzip") + } + + // Create the request + req, err = http.NewRequest(requestBuilder.Method, requestBuilder.URL.String(), requestBuilder.Body) + if err != nil { + return + } + + // Headers + req.Header = requestBuilder.Header + + // If "Host" was specified as a header, we need to explicitly copy it + // to the request's Host field since the "Host" header will be ignored by Request.Write(). + host := req.Header.Get("Host") + if host != "" { + req.Host = host + } + + // Query + query := req.URL.Query() + for k, l := range requestBuilder.Query { + for _, v := range l { + query.Add(k, v) + } + } + + // Encode query + req.URL.RawQuery = query.Encode() + + // Finally, if a Context should be associated with the new Request instance, then set it. + if !IsNil(requestBuilder.ctx) { + req = req.WithContext(requestBuilder.ctx) + } + + return +} + +// SetBodyContent sets the body content from one of three different sources. +func (requestBuilder *RequestBuilder) SetBodyContent(contentType string, jsonContent interface{}, jsonPatchContent interface{}, + nonJSONContent interface{}) (builder *RequestBuilder, err error) { + if !IsNil(jsonContent) { + builder, err = requestBuilder.SetBodyContentJSON(jsonContent) + if err != nil { + return + } + } else if !IsNil(jsonPatchContent) { + builder, err = requestBuilder.SetBodyContentJSON(jsonPatchContent) + if err != nil { + return + } + } else if !IsNil(nonJSONContent) { + // Set the non-JSON body content based on the type of value passed in, + // which should be a "string", "*string" or an "io.Reader" + if str, ok := nonJSONContent.(string); ok { + builder, err = requestBuilder.SetBodyContentString(str) + } else if strPtr, ok := nonJSONContent.(*string); ok { + builder, err = requestBuilder.SetBodyContentString(*strPtr) + } else if stream, ok := nonJSONContent.(io.Reader); ok { + builder, err = requestBuilder.SetBodyContentStream(stream) + } else if stream, ok := nonJSONContent.(*io.ReadCloser); ok { + builder, err = requestBuilder.SetBodyContentStream(*stream) + } else { + builder = requestBuilder + err = fmt.Errorf("Invalid type for non-JSON body content: %s", reflect.TypeOf(nonJSONContent).String()) + } + } else { + builder = requestBuilder + err = fmt.Errorf("No body content provided") + } + return +} + +// AddQuerySlice converts the passed in slice 'slice' by calling the ConverSlice method, +// and adds the converted slice to the request's query string. An error is returned when +// conversion fails. +func (requestBuilder *RequestBuilder) AddQuerySlice(param string, slice interface{}) (err error) { + convertedSlice, err := ConvertSlice(slice) + if err != nil { + return + } + + requestBuilder.AddQuery(param, strings.Join(convertedSlice, ",")) + + return +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/unmarshal_v2.go b/vendor/github.com/IBM/go-sdk-core/v5/core/unmarshal_v2.go new file mode 100644 index 00000000000..5055634b6c8 --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/unmarshal_v2.go @@ -0,0 +1,761 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package core + +import ( + "encoding/json" + "fmt" + "reflect" +) + +const ( + errorPropertyInsert = " property '%s' as" + errorPropertyNameMissing = "the 'propertyName' parameter is required" + errorUnmarshalPrimitive = "error unmarshalling property '%s': %s" + errorUnmarshalModel = "error unmarshalling%s %s: %s" + errorIncorrectInputType = "expected 'rawInput' to be a %s but was %s" + errorUnsupportedResultType = "unsupported 'result' type: %s" + errorUnmarshallInputIsNil = "input to unmarshall is nil" +) + +// +// UnmarshalPrimitive retrieves the specified property from 'rawInput', +// then unmarshals the resulting value into 'result'. +// +// This function will typically be invoked from within a model's generated "Unmarshal()" method to unmarshal +// a struct field (model property) involving a primitive type (a scalar value, a slice, a map of the primitive, etc.). +// In this context, "primitive" refers to a type other than a user-defined model type within an OpenAPI definition. +// The 'rawInput' parameter is expected to be a map that contains an instance of a user-defined model type. +// +// Parameters: +// +// rawInput: the unmarshal input source in the form of a map[string]json.RawMessage +// The value 'rawInput[propertyName]' must be a json.RawMessage that contains an instance of the type inferred +// from the value passed in as 'result'. +// +// propertyName: the name of the property (map entry) to retrieve from 'rawInput'. This entry's value will +// be used as the unmarshal input source. +// +// result: a pointer to the unmarshal destination. This could be any of the following: +// - * +// - ** +// - *[] +// - *[][] +// - *map[string] +// - *map[string][] +// - *[]map[string] +// - *[]map[string][] +// +// Where could be any of the following: +// - string, bool, []byte, int64, float32, float64, strfmt.Date, strfmt.DateTime, +// strfmt.UUID, interface{} (any), or map[string]interface{} (any object). +// +// Example: +// type MyStruct struct { +// Field1 *string, +// Field2 map[string]int64 +// } +// myStruct := new(MyStruct) +// jsonString := `{ "field1": "value1", "field2": {"foo": 44, "bar": 74}}` +// var rawMessageMap map[string]json.RawMessage +// var err error +// err = UnmarshalPrimitive(rawMessageMap, "field1", &myStruct.Field1) +// err = UnmarshalPrimitive(rawMessageMap, "field2", &myString.Field2) +// +func UnmarshalPrimitive(rawInput map[string]json.RawMessage, propertyName string, result interface{}) (err error) { + if propertyName == "" { + err = fmt.Errorf(errorPropertyNameMissing) + } + + rawMsg, foundIt := rawInput[propertyName] + if foundIt && rawMsg != nil { + err = json.Unmarshal(rawMsg, result) + if err != nil { + err = fmt.Errorf(errorUnmarshalPrimitive, propertyName, err.Error()) + } + } + return +} + +// +// ModelUnmarshaller defines the interface for a generated Unmarshal() function, which is used +// by the various "UnmarshalModel" functions below to unmarshal an instance of the user-defined model type. +// +// Parameters: +// rawInput: a map[string]json.RawMessage that is assumed to contain an instance of the model type. +// +// result: the unmarshal destination. This should be a ** (i.e. a ptr to a ptr to a model instance). +// A new instance of the model is constructed by the unmarshaller function and is returned through the ptr +// passed in as 'result'. +// +type ModelUnmarshaller func(rawInput map[string]json.RawMessage, result interface{}) error + +// +// UnmarshalModel unmarshals 'rawInput' into 'result' while using 'unmarshaller' to unmarshal model instances. +// This function is the single public interface to the various flavors of model-related unmarshal functions. +// The values passed in for the 'rawInput', 'propertyName' and 'result' fields will determine the function performed. +// +// Parameters: +// rawInput: the unmarshal input source. The various types associated with this parameter are described below in +// "Usage Notes". +// +// propertyName: an optional property name. If specified as "", then 'rawInput' is assumed to directly contain +// the input source to be used for the unmarshal operation. +// If propertyName is specified as a non-empty string, then 'rawInput' is assumed to be a map[string]json.RawMessage, +// and rawInput[propertyName] contains the input source to be unmarshalled. +// +// result: the unmarshal destination. This should be passed in as one of the following types of values: +// - ** (a ptr to a ptr to a instance) +// - *[] (a ptr to a slice) +// - *[][] (a ptr to a slice of slices) +// - *map[string] (a ptr to a map of instances) +// - *map[string][] (a ptr to a map of slices) +// +// unmarshaller: the unmarshaller function to be used to unmarshal each model instance +// +// Usage Notes: +// if 'result' is a: | and propertyName is: | then 'rawInput' should be: +// -------------------+--------------------------+------------------------------------------------------------------ +// **Foo | == "" | a map[string]json.RawMessage which directly +// | | contains an instance of model Foo (i.e. each map entry represents +// | | a property of Foo) +// | | +// **Foo | != "" (e.g. "prop") | a map[string]json.RawMessage and rawInput["prop"] +// | | should contain an instance of Foo (i.e. it can itself be +// | | unmarshalled into a map[string]json.RawMessage whose entries +// | | represent the properties of Foo) +// -------------------+--------------------------+------------------------------------------------------------------ +// *[]Foo | == "" | a []json.RawMessage where each slice element contains +// | | an instance of Foo (i.e. the json.RawMessage can be unmarshalled +// | | into a Foo instance) +// | | +// *[]Foo | != "" (e.g. "prop") | a map[string]json.RawMessage and rawInput["prop"] +// | | contains a []Foo (slice of Foo instances) +// -------------------+--------------------------+------------------------------------------------------------------ +// *[][]Foo | == "" | a []json.RawMessage where each slice element contains +// | | a []Foo (i.e. the json.RawMessage can be unmarshalled +// | | into a []Foo) +// | | +// *[][]Foo | != "" (e.g. "prop") | a map[string]json.RawMessage and rawInput["prop"] +// | | contains a [][]Foo (slice of Foo slices) +// -------------------+--------------------------+------------------------------------------------------------------ +// *map[string]Foo | == "" | a map[string]json.RawMessage which directly contains the +// | | map[string]Foo (i.e. the value within each entry in 'rawInput' +// | | contains an instance of Foo) +// | | +// *map[string]Foo | != "" (e.g. "prop") | a map[string]json.RawMessage and rawInput["prop"] +// | | contains an instance of map[string]Foo +// -------------------+--------------------------+------------------------------------------------------------------ +// *map[string][]Foo | == "" | a map[string]json.RawMessage which directly contains the +// | | map[string][]Foo (i.e. the value within each entry in 'rawInput' +// | | contains a []Foo) +// *map[string][]Foo | != "" (e.g. "prop") | a map[string]json.RawMessage and rawInput["prop"] +// | | contains an instance of map[string][]Foo +// -------------------+--------------------------+------------------------------------------------------------------ +func UnmarshalModel(rawInput interface{}, propertyName string, result interface{}, unmarshaller ModelUnmarshaller) (err error) { + + // Make sure some input is provided. Otherwise return an error. + if IsNil(rawInput) { + err = fmt.Errorf(errorUnmarshallInputIsNil) + return + } + + // Reflect on 'result' to determine the type of unmarshal operation being requested. + rResultType := reflect.TypeOf(result).Elem() + + // Now delegate the work to the appropriate internal unmarshal function. + switch rResultType.Kind() { + case reflect.Ptr, reflect.Interface: + // Unmarshal a single instance of a model. + err = unmarshalModelInstance(rawInput, propertyName, result, unmarshaller) + + case reflect.Slice: + // For a slice, we need to look at the slice element type. + rElementType := rResultType.Elem() + switch rElementType.Kind() { + case reflect.Struct, reflect.Interface: + // A [] + // Slice element type is struct or intf, so must be a slice of model instances. + // Unmarshal a slice of model instances. + err = unmarshalModelSlice(rawInput, propertyName, result, unmarshaller) + + case reflect.Slice: + // If the slice element type is slice (i.e. a slice of slices), + // then we need to make sure that the inner slice's element type is a model (struct or intf). + rInnerElementType := rElementType.Elem() + switch rInnerElementType.Kind() { + case reflect.Struct, reflect.Interface: + // A [][] + err = unmarshalModelSliceSlice(rawInput, propertyName, result, unmarshaller) + + default: + err = fmt.Errorf(errorUnsupportedResultType, rResultType.String()) + } + + default: + err = fmt.Errorf(errorUnsupportedResultType, rResultType.String()) + return + } + + case reflect.Map: + // For a map, we need to look at the map entry type. + // We currently support map[string] and map[string][]. + rEntryType := rResultType.Elem() + switch rEntryType.Kind() { + case reflect.Struct, reflect.Interface: + // A map[string] + err = unmarshalModelMap(rawInput, propertyName, result, unmarshaller) + case reflect.Slice: + // If the map entry type is a slice, make sure it is a slice of model instances. + rElementType := rEntryType.Elem() + switch rElementType.Kind() { + case reflect.Struct, reflect.Interface: + // A map[string][] + err = unmarshalModelSliceMap(rawInput, propertyName, result, unmarshaller) + + default: + err = fmt.Errorf(errorUnsupportedResultType, rResultType.String()) + return + } + default: + err = fmt.Errorf(errorUnsupportedResultType, rResultType.String()) + return + } + + default: + err = fmt.Errorf(errorUnsupportedResultType, rResultType.String()) + return + } + return +} + +// +// unmarshalModelInstance unmarshals 'rawInput' into an instance of a model. +// +// Parameters: +// +// rawInput: the unmarshal input source. +// +// propertyName: the name of the property within 'rawInput' that contains the instance of the model. +// If 'propertyName' is specified as "" then 'rawInput' is assumed to contain the model instance directly. +// +// result: should be a ptr to a ptr to a model instance (e.g. **Foo for model type Foo). +// A new instance of the model will be constructed and returned through the model pointer +// that 'result' points to (i.e. it is legal for 'result' to point to a nil pointer). +// +// 'unmarshaller' is the generated unmarshal function used to unmarshal a single instance of the model. +// +func unmarshalModelInstance(rawInput interface{}, propertyName string, result interface{}, unmarshaller ModelUnmarshaller) (err error) { + var rawMap map[string]json.RawMessage + var foundInput bool + + // Obtain the unmarshal input source from 'rawInput'. + foundInput, rawMap, err = getUnmarshalInputSourceMap(rawInput, propertyName) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), getModelResultType(result), err.Error()) + return + } + + // At this point, 'rawMap' should be the map[string]json.RawMessage which represents model instance: + // i.e. rawMap --> `{ "prop1": "value1", "prop2": "value2", ...}" + + // Initialize our result to nil. + // Note: 'result' is a ptr to a ptr to a model struct. + // We're using 'result' to set the model struct ptr to nil. + rResult := reflect.ValueOf(result).Elem() + rResult.Set(reflect.Zero(rResult.Type())) + + // If there is an unmarshal input source, then unmarshal it. + if foundInput && rawMap != nil { + err = unmarshaller(rawMap, result) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), getModelResultType(result), err.Error()) + return + } + } + return +} + +// +// unmarshalModelSlice unmarshals 'rawInput' into a []. +// +// Parameters: +// +// rawInput: is the unmarshal input source, and should be one of the following: +// 1. a map[string]json.RawMessage - in this case 'propertyName' should specify the name +// of the property to retrieve from the map to obtain the []json.RawMessage containing the slice of model instances +// to be unmarshalled. +// +// 2. a []json.RawMessage - in this case, 'propertyName' should be specified as "" to indicate that +// the []json.RawMessage is available directly via the 'rawInput' parameter. +// +// propertyName: an optional name of a property to be retrieved from 'rawInput'. +// If 'propertyName' is specified as a non-empty string, then 'rawInput' is assumed to be a map[string]RawMessage, +// and the named property is retrieved to obtain the []json.RawMessage to be unmarshalled. +// If 'propertyName' is specified as "", then 'rawInput' is assumed to be a []json.RawMessage and is used directly +// as the unmarshal input source. +// +// result: this should be a pointer to a slice of the model type (e.g. *[]Foo for model type Foo). +// This function will construct a new slice and return it through 'result'. +// +// 'unmarshaller' is the function used to unmarshal a single instance of the model. +// +func unmarshalModelSlice(rawInput interface{}, propertyName string, result interface{}, unmarshaller ModelUnmarshaller) (err error) { + var rawSlice []json.RawMessage + var foundInput bool + + // Obtain the unmarshal input source from 'rawInput'. + foundInput, rawSlice, err = getUnmarshalInputSourceSlice(rawInput, propertyName) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), + reflect.TypeOf(result).Elem().String(), err.Error()) + return + } + + if !foundInput { + return + } + + // At this point, 'rawSlice' should be the []json.RawMessage which represents the slice of model instances: + // i.e. rawSlice --> "[ {...}, {...}, ...]" + + // 'sliceSize' is the number of elements found in 'rawSlice'. + // if 'rawSlice' is nil, 'sliceSize' will be 0, which is what we want. + sliceSize := len(rawSlice) + + // Get a reflective view of the result and initialize it. + rResultSlice := reflect.ValueOf(result).Elem() + rResultSlice.Set(reflect.MakeSlice(reflect.TypeOf(result).Elem(), 0, sliceSize)) + + // If there is anything to unmarshal, then unmarshal it. + if sliceSize > 0 { + // Determine the type of the 'result' parameter that we'll need to pass to + // the model-specific unmarshaller (i.e. a *Foo). + var receiverType reflect.Type + receiverType, err = getUnmarshalResultType(result) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), + reflect.TypeOf(result).Elem().String(), err.Error()) + return + } + + for _, rawMsg := range rawSlice { + // 'rawMsg' should contain an instance of the model - we need to unmarshal it into a map. + rawMap := make(map[string]json.RawMessage) + err = json.Unmarshal(rawMsg, &rawMap) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), + reflect.TypeOf(result).Elem().String(), err.Error()) + return + } + + // Reflectively construct a receiver of the unmarshal step. + rModelReceiver := reflect.New(receiverType) + + // Invoke the model-specific unmarshaller. + err = unmarshaller(rawMap, rModelReceiver.Interface()) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), + reflect.TypeOf(result).Elem().String(), err.Error()) + return + } + + // Add the model instance to the result slice (reflectively, of course :) ). + rResultSlice.Set(reflect.Append(rResultSlice, rModelReceiver.Elem().Elem())) + } + } + return +} + +// +// unmarshalModelSliceSlice unmarshals 'rawInput' into a [][]. +// +// Parameters: +// +// rawInput: is the unmarshal input source, and should be one of the following: +// 1. a map[string]json.RawMessage - in this case 'propertyName' should specify the name +// of the property to retrieve from the map to obtain the []json.RawMessage containing the slice of model slices +// to be unmarshalled. +// +// 2. a []json.RawMessage - in this case, 'propertyName' should be specified as "" to indicate that +// the []json.RawMessage is available directly via the 'rawInput' parameter. +// +// propertyName: an optional name of a property to be retrieved from 'rawInput'. +// If 'propertyName' is specified as a non-empty string, then 'rawInput' is assumed to be a map[string]json.RawMessage, +// and the named property is retrieved to obtain the []json.RawMessage to be unmarshalled. +// If 'propertyName' is specified as "", then 'rawInput' is assumed to be a []json.RawMessage and is used directly +// as the unmarshal input source. +// +// result: this should be a pointer to a slice of model slices (e.g. *[][]Foo for model type Foo). +// This function will construct a new slice of slices and return it through 'result'. +// +// 'unmarshaller' is the function used to unmarshal a single instance of the model. +// +func unmarshalModelSliceSlice(rawInput interface{}, propertyName string, result interface{}, unmarshaller ModelUnmarshaller) (err error) { + var rawSlice []json.RawMessage + var foundInput bool + + // Obtain the unmarshal input source from 'rawInput'. + foundInput, rawSlice, err = getUnmarshalInputSourceSlice(rawInput, propertyName) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), + reflect.TypeOf(result).Elem().String(), err.Error()) + return + } + + if !foundInput { + return + } + + // At this point, 'rawSlice' should be the []json.RawMessage which represents the overall slice whose + // elements should be slices of model instances: + // rawSlice --> "[ [{}, {},...], [{}, {},...], ...]" + + // Get a reflective view of the result and initialize it. + // This will be a slice of slices. + sliceSize := len(rawSlice) + + rResultSlice := reflect.ValueOf(result).Elem() + rResultSlice.Set(reflect.MakeSlice(reflect.TypeOf(result).Elem(), 0, sliceSize)) + + // If there is an unmarshal input source, then unmarshal it. + if sliceSize > 0 { + for _, rawMsg := range rawSlice { + // Make sure our inner slice raw message isn't an explicit JSON null value. + // Each value in 'rawMap' should contain an instance of []. + // We'll first unmarshal each value into a []jsonRawMessage, then unmarshal that + // into a [] using unmarshalModelSlice. + var innerRawSlice []json.RawMessage + err = json.Unmarshal(rawMsg, &innerRawSlice) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), + reflect.TypeOf(result).Elem().String(), err.Error()) + return + } + + // Construct a slice of the correct type (i.e. []Foo) + rSliceValue := reflect.New(reflect.TypeOf(result).Elem().Elem()) + + // Unmarshal 'innerRawSlice' into a slice of models. + err = unmarshalModelSlice(innerRawSlice, "", rSliceValue.Interface(), unmarshaller) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), + reflect.TypeOf(result).Elem().String(), err.Error()) + return + } + + // Now add the unmarshalled model slice to the result slice (reflectively, of course :) ). + rResultSlice.Set(reflect.Append(rResultSlice, rSliceValue.Elem())) + } + } + return +} + +// +// unmarshalModelMap unmarshals 'rawInput' into a map[string]. +// +// Parameters: +// +// rawInput: the unmarshal input source in the form of a map[string]json.RawMessage. +// +// propertyName: an optional name of a property to be retrieved from 'rawInput'. +// If 'propertyName' is specified as a non-empty string, then the specified property value is retrieved +// from 'rawInput', and this value is assumed to contain the map[string] to be unmarshalled. +// If 'propertyName' is specified as "", then 'rawInput' will be used directly as the unmarshal input source. +// +// result: the unmarshal destination. This should be a pointer to map[string] (e.g. *map[string]Foo for model type Foo). +// If 'result' points to a nil map, this function will construct the map prior to adding entries to it. +// +// unmarshaller: the function used to unmarshal a single instance of the model. +// +func unmarshalModelMap(rawInput interface{}, propertyName string, result interface{}, unmarshaller ModelUnmarshaller) (err error) { + var rawMap map[string]json.RawMessage + var foundInput bool + + // Obtain the unmarshal input source from 'rawInput'. + foundInput, rawMap, err = getUnmarshalInputSourceMap(rawInput, propertyName) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), + reflect.TypeOf(result).Elem().String(), err.Error()) + return + } + + if !foundInput { + return + } + + // Get a "reflective" view of the result map and initialize it. + rResultMap := reflect.ValueOf(result).Elem() + rResultMap.Set(reflect.MakeMap(reflect.TypeOf(result).Elem())) + + // If there is an unmarshal input source, then unmarshal it. + if foundInput && rawMap != nil { + // Determine the type of the 'result' parameter that we'll need to pass to + // the model-specific unmarshaller. + var receiverType reflect.Type + receiverType, err = getUnmarshalResultType(result) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), + reflect.TypeOf(result).Elem().String(), err.Error()) + return + } + + for k, v := range rawMap { + // Unmarshal the map entry's value (a json.RawMessage) into a map[string]RawMessage. + // The resulting map should contain an instance of the model. + modelInstanceMap := make(map[string]json.RawMessage) + err = json.Unmarshal(v, &modelInstanceMap) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), + reflect.TypeOf(result).Elem().String(), err.Error()) + return + } + + // Reflectively construct a receiver of the unmarshal step. + rModelReceiver := reflect.New(receiverType) + + // Unmarshal the model instance contained in 'modelInstanceMap'. + err = unmarshaller(modelInstanceMap, rModelReceiver.Interface()) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), + reflect.TypeOf(result).Elem().String(), err.Error()) + return + } + + // Now add the unmarshalled model instance to the result map (reflectively, of course :) ). + rResultMap.SetMapIndex(reflect.ValueOf(k), rModelReceiver.Elem().Elem()) + } + } + return +} + +// +// unmarshalModelSliceMap unmarshals 'rawInput' into a map[string][]. +// +// Parameters: +// +// rawInput: the unmarshal input source in the form of a map[string]json.RawMessage. +// +// propertyName: an optional name of a property to be retrieved from 'rawInput'. +// If 'propertyName' is specified as a non-empty string, then the specified property value is retrieved +// from 'rawInput', and this value is assumed to contain the map[string][] to be unmarshalled. +// If 'propertyName' is specified as "", then 'rawInput' will be used directly as the unmarshal input source. +// +// result: the unmarshal destination. This should be a pointer to a map[string][] +// (e.g. *map[string][]Foo for model type Foo). +// If 'result' points to a nil map, this function will construct the map prior to adding entries to it. +// +// unmarshaller: the function used to unmarshal a single instance of the model. +// +func unmarshalModelSliceMap(rawInput interface{}, propertyName string, result interface{}, unmarshaller ModelUnmarshaller) (err error) { + var rawMap map[string]json.RawMessage + var foundInput bool + + // Obtain the unmarshal input source from 'rawInput'. + foundInput, rawMap, err = getUnmarshalInputSourceMap(rawInput, propertyName) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), + reflect.TypeOf(result).Elem().String(), err.Error()) + return + } + + if !foundInput { + return + } + + // Get a "reflective" view of the result map and initialize it. + rResultMap := reflect.ValueOf(result).Elem() + rResultMap.Set(reflect.MakeMap(reflect.TypeOf(result).Elem())) + + if foundInput && rawMap != nil { + for k, v := range rawMap { + + // Make sure our slice raw message isn't an explicit JSON null value. + if !isJsonNull(v) { + // Each value in 'rawMap' should contain an instance of []. + // We'll first unmarshal each value into a []jsonRawMessage, then unmarshal that + // into a [] using unmarshalModelSlice. + var rawSlice []json.RawMessage + err = json.Unmarshal(v, &rawSlice) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), + reflect.TypeOf(result).Elem().String(), err.Error()) + return + } + + // Construct a slice of the correct type. + rSliceValue := reflect.New(reflect.TypeOf(result).Elem().Elem()) + + // Unmarshal rawSlice into a model slice. + err = unmarshalModelSlice(rawSlice, "", rSliceValue.Interface(), unmarshaller) + if err != nil { + err = fmt.Errorf(errorUnmarshalModel, propInsert(propertyName), + reflect.TypeOf(result).Elem().String(), err.Error()) + return + } + + // Now add the unmarshalled model slice to the result map (reflectively, of course :) ). + rResultMap.SetMapIndex(reflect.ValueOf(k), rSliceValue.Elem()) + } + } + } + return +} + +// +// getUnmarshalInputSourceMap returns the appropriate unmarshal input source from 'rawInput' +// in the form of a map[string]json.RawMessage. +// +// Parameters: +// rawInput: the raw unmarshalled input. This should be in the form of a map[string]json.RawMessage. +// +// propertyName: (optional) the name of the property (map entry) within 'rawInput' that contains the +// unmarshal input source. If specified as "", then 'rawInput' is assumed to contain the entire input source directly. +// +func getUnmarshalInputSourceMap(rawInput interface{}, propertyName string) (foundInput bool, inputSource map[string]json.RawMessage, err error) { + foundInput = true + + // rawInput should be a map[string]json.RawMessage. + rawMap, ok := rawInput.(map[string]json.RawMessage) + if !ok { + foundInput = false + err = fmt.Errorf(errorIncorrectInputType, "map[string]json.RawMessage", reflect.TypeOf(rawInput).String()) + return + } + + // If propertyName was specified, then retrieve that entry from 'rawInput' as our unmarshal input source. + if propertyName != "" { + var rawMsg json.RawMessage + rawMsg, foundInput = rawMap[propertyName] + if !foundInput || isJsonNull(rawMsg) { + foundInput = false + return + } else { + rawMap = make(map[string]json.RawMessage) + err = json.Unmarshal(rawMsg, &rawMap) + if err != nil { + foundInput = false + return + } + } + } + + inputSource = rawMap + return +} + +// +// getUnmarshalInputSourceSlice returns the appropriate unmarshal input source from 'rawInput' +// in the form of a []json.RawMessage. +// +// Parameters: +// rawInput: the raw unmarshalled input. This should be in the form of a map[string]json.RawMessage or []json.RawMessage, +// depending on the value of propertyName. +// +// propertyName: (optional) the name of the property (map entry) within 'rawInput' that contains the +// unmarshal input source. The specified map entry should contain a []json.RawMessage which +// will be used as the unmarshal input source. If 'propertyName' is specified as "", then 'rawInput' +// is assumed to be a []json.RawMessage and contains the entire input source directly. +// +func getUnmarshalInputSourceSlice(rawInput interface{}, propertyName string) (foundInput bool, inputSource []json.RawMessage, err error) { + // If propertyName was specified, then retrieve that entry from 'rawInput' (assumed to be a map[string]json.RawMessage) + // as our unmarshal input source. Otherwise, just use 'rawInput' directly. + if propertyName != "" { + rawMap, ok := rawInput.(map[string]json.RawMessage) + if !ok { + err = fmt.Errorf(errorIncorrectInputType, "map[string]json.RawMessage", reflect.TypeOf(rawInput).String()) + return + } + + var rawMsg json.RawMessage + rawMsg, ok = rawMap[propertyName] + + // If we didn't find the property containing the JSON input, then bail out now. + if !ok || isJsonNull(rawMsg) { + return + } else { + // We found the property in the map, so unmarshal the json.RawMessage into a []json.RawMessage + var rawSlice = make([]json.RawMessage, 0) + err = json.Unmarshal(rawMsg, &rawSlice) + if err != nil { + err = fmt.Errorf(errorIncorrectInputType, "map[string][]json.RawMessage", reflect.TypeOf(rawInput).String()) + return + } + + foundInput = true + inputSource = rawSlice + } + } else { + // 'propertyName' was not specified, so 'rawInput' should be our []json.RawMessage input source. + + rawSlice, ok := rawInput.([]json.RawMessage) + if !ok { + err = fmt.Errorf(errorIncorrectInputType, "[]json.RawMessage", reflect.TypeOf(rawInput).String()) + return + } + + foundInput = true + inputSource = rawSlice + } + + return +} + +// isJsonNull returns true iff 'rawMsg' is exlicitly nil or contains a JSON "null" value. +func isJsonNull(rawMsg json.RawMessage) bool { + var nullLiteral = []byte("null") + if rawMsg == nil || string(rawMsg) == string(nullLiteral) { + return true + } + return false +} + +// propInsert is a utility function used to optionally include the name of a property in an error message. +func propInsert(propertyName string) string { + if propertyName != "" { + return fmt.Sprintf(errorPropertyInsert, propertyName) + } + return "" +} + +// getUnmarshalResultType returns the type associated with an unmarshal result. +// The resulting type can be constructed with the reflect.New() function. +func getUnmarshalResultType(result interface{}) (ptrType reflect.Type, err error) { + rResultType := reflect.TypeOf(result).Elem().Elem() + switch rResultType.Kind() { + case reflect.Struct, reflect.Slice: + ptrType = reflect.PtrTo(rResultType) + + case reflect.Interface: + ptrType = rResultType + + default: + err = fmt.Errorf(errorUnsupportedResultType, rResultType.String()) + } + return +} + +// getModelResultType returns the type of the 'result' parameter as a string. +// This will be something like "mypackagev1.Foo" or "mypackagev1.FooIntf" +func getModelResultType(result interface{}) string { + rResultType := reflect.TypeOf(result).Elem() + if rResultType.Kind() == reflect.Ptr { + rResultType = rResultType.Elem() + } + + return rResultType.String() +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/utils.go b/vendor/github.com/IBM/go-sdk-core/v5/core/utils.go new file mode 100644 index 00000000000..43645ad596e --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/utils.go @@ -0,0 +1,308 @@ +package core + +// (C) Copyright IBM Corp. 2019. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "encoding/json" + "errors" + "fmt" + "net/url" + "os" + "reflect" + "regexp" + "runtime" + "strconv" + "strings" + "time" + + "github.com/go-openapi/strfmt" + validator "gopkg.in/go-playground/validator.v9" +) + +// Validate is a shared validator instance used to perform validation of structs. +var Validate *validator.Validate + +func init() { + Validate = validator.New() +} + +const ( + jsonMimePattern = "(?i)^application\\/((json)|(merge\\-patch\\+json)|(vnd\\..*\\+json))(;.*)?$" + jsonPatchMimePattern = "(?i)^application\\/json\\-patch\\+json(;.*)?$" +) + +// IsNil checks if the specified object is nil or not. +func IsNil(object interface{}) bool { + if object == nil { + return true + } + + switch reflect.TypeOf(object).Kind() { + case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice: + return reflect.ValueOf(object).IsNil() + } + + return false +} + +// ValidateNotNil returns the specified error if 'object' is nil, nil otherwise. +func ValidateNotNil(object interface{}, errorMsg string) error { + if IsNil(object) { + return errors.New(errorMsg) + } + return nil +} + +// ValidateStruct validates 'param' (assumed to be a ptr to a struct) according to the +// annotations attached to its fields. +func ValidateStruct(param interface{}, paramName string) error { + err := ValidateNotNil(param, paramName+" cannot be nil") + if err != nil { + return err + } + + err = Validate.Struct(param) + if err != nil { + // If there were validation errors then return an error containing the field errors + if fieldErrors, ok := err.(validator.ValidationErrors); ok { + return fmt.Errorf("%s failed validation:\n%s", paramName, fieldErrors.Error()) + } + return err + } + + return nil +} + +// StringPtr returns a pointer to string literal. +func StringPtr(literal string) *string { + return &literal +} + +// BoolPtr returns a pointer to boolean literal. +func BoolPtr(literal bool) *bool { + return &literal +} + +// Int64Ptr returns a pointer to int64 literal. +func Int64Ptr(literal int64) *int64 { + return &literal +} + +// Float32Ptr returns a pointer to float32 literal. +func Float32Ptr(literal float32) *float32 { + return &literal +} + +// Float64Ptr returns a pointer to float64 literal. +func Float64Ptr(literal float64) *float64 { + return &literal +} + +// UUIDPtr returns a pointer to strfmt.UUID literal. +func UUIDPtr(literal strfmt.UUID) *strfmt.UUID { + return &literal +} + +// IsJSONMimeType Returns true iff the specified mimeType value represents a +// "JSON" mimetype. +func IsJSONMimeType(mimeType string) bool { + if mimeType == "" { + return false + } + matched, err := regexp.MatchString(jsonMimePattern, mimeType) + if err != nil { + return false + } + return matched +} + +// IsJSONPatchMimeType returns true iff the specified mimeType value represents +// a "JSON Patch" mimetype. +func IsJSONPatchMimeType(mimeType string) bool { + if mimeType == "" { + return false + } + matched, err := regexp.MatchString(jsonPatchMimePattern, mimeType) + if err != nil { + return false + } + return matched +} + +// StringNilMapper de-references the parameter 's' and returns the result, or "" +// if 's' is nil. +func StringNilMapper(s *string) string { + if s == nil { + return "" + } + return *s +} + +// HasBadFirstOrLastChar checks if the string starts with `{` or `"` +// or ends with `}` or `"`. +func HasBadFirstOrLastChar(str string) bool { + return strings.HasPrefix(str, "{") || strings.HasPrefix(str, "\"") || + strings.HasSuffix(str, "}") || strings.HasSuffix(str, "\"") +} + +// UserHomeDir returns the user home directory. +func UserHomeDir() string { + if runtime.GOOS == "windows" { + home := os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH") + if home == "" { + home = os.Getenv("USERPROFILE") + } + return home + } + return os.Getenv("HOME") +} + +// SystemInfo returns the system information. +func SystemInfo() string { + return fmt.Sprintf("(arch=%s; os=%s; go.version=%s)", runtime.GOARCH, runtime.GOOS, runtime.Version()) +} + +// PrettyPrint print pretty. +func PrettyPrint(result interface{}, resultName string) { + output, err := json.MarshalIndent(result, "", " ") + + if err == nil { + fmt.Printf("%v:\n%+v\n\n", resultName, string(output)) + } +} + +// GetCurrentTime returns the current Unix time. +func GetCurrentTime() int64 { + return time.Now().Unix() +} + +// Pre-compiled regular expression used to remove the surrounding +// [] characters from a JSON string containing a slice (e.g. `["str1", "str2", "str3"]`). +var reJsonSlice = regexp.MustCompile(`(?s)\[(\S*)\]`) + +// ConvertSlice marshals 'slice' to a json string, performs +// string manipulation on the resulting string, and converts +// the string to a '[]string'. If 'slice' is nil, not a 'slice' type, +// or an error occurred during conversion, an error will be returned +func ConvertSlice(slice interface{}) (s []string, err error) { + inputIsSlice := false + + if IsNil(slice) { + err = fmt.Errorf(ERRORMSG_NIL_SLICE) + return + } + + // Reflect on 'slice' to validate the input is in fact a slice + rResultType := reflect.TypeOf(slice) + + switch rResultType.Kind() { + case reflect.Slice: + inputIsSlice = true + default: + } + + // If it's not a slice, just return an error + if !inputIsSlice { + err = fmt.Errorf(ERRORMSG_PARAM_NOT_SLICE) + return + } else if reflect.ValueOf(slice).Len() == 0 { + s = []string{} + return + } + + jsonBuffer, err := json.Marshal(slice) + if err != nil { + err = fmt.Errorf(ERRORMSG_MARSHAL_SLICE, err.Error()) + return + } + + jsonString := string(jsonBuffer) + + // Use regex to convert the json string to a string slice + match := reJsonSlice.FindStringSubmatch(jsonString) + if match != nil && match[1] != "" { + newString := match[1] + s = strings.Split(newString, ",") + // For each slice element, attempt to remove any surrounding quotes + // added by marshaling into a json string + for i := range s { + unquotedString, unquoteErr := strconv.Unquote(s[i]) + if unquoteErr == nil && unquotedString != "" { + s[i] = unquotedString + } + } + return + } + + // If we returned a plain string that's not in "slice format", + // then attempt to just convert it to a string slice. + if jsonString != "" { + s = strings.Split(jsonString, ",") + return + } + + return nil, fmt.Errorf(ERRORMSG_CONVERT_SLICE) +} + +// SliceContains returns true iff "contains" is an element of "slice" +func SliceContains(slice []string, contains string) bool { + for _, elem := range slice { + if elem == contains { + return true + } + } + return false +} + +// GetQueryParam() returns a pointer to the value of query parameter `param` from urlStr, +// or nil if not found. +func GetQueryParam(urlStr *string, param string) (*string, error) { + if urlStr == nil || *urlStr == "" { + return nil, nil + } + + u, err := url.Parse(*urlStr) + if err != nil { + return nil, err + } + + q, err := url.ParseQuery(u.RawQuery) + if err != nil { + return nil, err + } + + v := q.Get(param) + if v == "" { + return nil, nil + } + return &v, nil +} + +// Pre-compiled regular expressions used by RedactSecrets(). +var reAuthHeader = regexp.MustCompile(`(?m)^(Authorization|X-Auth\S*): .*`) +var rePassword1 = regexp.MustCompile(`(?i)(password|token|apikey|api_key|passcode)=[^&]*(&|$)`) +var rePassword2 = regexp.MustCompile(`(?i)"([^"]*(password|token|apikey|api_key)[^"_]*)":\s*"[^\,]*"`) + +// RedactSecrets() returns the input string with secrets redacted. +func RedactSecrets(input string) string { + var redacted = "[redacted]" + + redactedString := input + redactedString = reAuthHeader.ReplaceAllString(redactedString, "$1: "+redacted) + redactedString = rePassword1.ReplaceAllString(redactedString, "$1="+redacted+"$2") + redactedString = rePassword2.ReplaceAllString(redactedString, fmt.Sprintf(`"$1":"%s"`, redacted)) + + return redactedString +} diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/version.go b/vendor/github.com/IBM/go-sdk-core/v5/core/version.go new file mode 100644 index 00000000000..bf38e712fdc --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/version.go @@ -0,0 +1,18 @@ +package core + +// (C) Copyright IBM Corp. 2019. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Version of the SDK +const __VERSION__ = "5.9.2" diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/vpc_instance_authenticator.go b/vendor/github.com/IBM/go-sdk-core/v5/core/vpc_instance_authenticator.go new file mode 100644 index 00000000000..11a851b405e --- /dev/null +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/vpc_instance_authenticator.go @@ -0,0 +1,510 @@ +package core + +// (C) Copyright IBM Corp. 2021. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import ( + "bytes" + "encoding/json" + "fmt" + "net/http" + "net/http/httputil" + "sync" + "time" + + "github.com/go-openapi/strfmt" +) + +// VpcInstanceAuthenticator implements an authentication scheme in which it +// retrieves an "instance identity token" and exchanges that for an IAM access token using the +// VPC Instance Metadata Service API which is available on the local compute resource (VM). +// The instance identity token is similar to an IAM apikey, except that it is managed +// automatically by the compute resource provider (VPC). +// The resulting IAM access token is then added to outbound requests in an Authorization header +// of the form: +// Authorization: Bearer +// +type VpcInstanceAuthenticator struct { + + // [optional] The CRN of the linked trusted IAM profile to be used as the identity of the compute resource. + // At most one of IAMProfileCRN or IAMProfileID may be specified. If neither one is specified, then + // the default IAM profile defined for the compute resource will be used. + // Default value: "" + IAMProfileCRN string + + // [optional] The ID of the linked trusted IAM profile to be used when obtaining the IAM access token. + // At most one of IAMProfileCRN or IAMProfileID may be specified. If neither one is specified, then + // the default IAM profile defined for the compute resource will be used. + // Default value: "" + IAMProfileID string + + // [optional] The VPC Instance Metadata Service's base endpoint URL. + // Default value: "http://169.254.169.254" + URL string + urlInit sync.Once + + // [optional] The http.Client object used to interact with the VPC Instance Metadata Service API. + // If not specified by the user, a suitable default Client will be constructed. + Client *http.Client + clientInit sync.Once + + // The cached IAM access token and its expiration time. + tokenData *iamTokenData + + // Mutex to synchronize access to the tokenData field. + tokenDataMutex sync.Mutex +} + +const ( + vpcauthDefaultIMSEndpoint = "http://169.254.169.254" + vpcauthOperationPathCreateAccessToken = "/instance_identity/v1/token" + vpcauthOperationPathCreateIamToken = "/instance_identity/v1/iam_token" + vpcauthMetadataFlavor = "ibm" + vpcauthMetadataServiceVersion = "2021-09-20" + vpcauthInstanceIdentityTokenLifetime = 300 + vpcauthDefaultTimeout = time.Second * 30 +) + +// VpcInstanceAuthenticatorBuilder is used to construct an instance of the VpcInstanceAuthenticator +type VpcInstanceAuthenticatorBuilder struct { + VpcInstanceAuthenticator +} + +// NewVpcInstanceAuthenticatorBuilder returns a new builder struct that +// can be used to construct a VpcInstanceAuthenticator instance. +func NewVpcInstanceAuthenticatorBuilder() *VpcInstanceAuthenticatorBuilder { + return &VpcInstanceAuthenticatorBuilder{} +} + +// SetIAMProfileCRN sets the IAMProfileCRN field in the builder. +func (builder *VpcInstanceAuthenticatorBuilder) SetIAMProfileCRN(s string) *VpcInstanceAuthenticatorBuilder { + builder.VpcInstanceAuthenticator.IAMProfileCRN = s + return builder +} + +// SetIAMProfileID sets the IAMProfileID field in the builder. +func (builder *VpcInstanceAuthenticatorBuilder) SetIAMProfileID(s string) *VpcInstanceAuthenticatorBuilder { + builder.VpcInstanceAuthenticator.IAMProfileID = s + return builder +} + +// SetURL sets the URL field in the builder. +func (builder *VpcInstanceAuthenticatorBuilder) SetURL(s string) *VpcInstanceAuthenticatorBuilder { + builder.VpcInstanceAuthenticator.URL = s + return builder +} + +// SetClient sets the Client field in the builder. +func (builder *VpcInstanceAuthenticatorBuilder) SetClient(client *http.Client) *VpcInstanceAuthenticatorBuilder { + builder.VpcInstanceAuthenticator.Client = client + return builder +} + +// Build() returns a validated instance of the VpcInstanceAuthenticator with the config that was set in the builder. +func (builder *VpcInstanceAuthenticatorBuilder) Build() (*VpcInstanceAuthenticator, error) { + + // Make sure the config is valid. + err := builder.VpcInstanceAuthenticator.Validate() + if err != nil { + return nil, err + } + + return &builder.VpcInstanceAuthenticator, nil +} + +// client returns the authenticator's http client after potentially initializing it. +func (authenticator *VpcInstanceAuthenticator) client() *http.Client { + authenticator.clientInit.Do(func() { + if authenticator.Client == nil { + authenticator.Client = &http.Client{ + Timeout: vpcauthDefaultTimeout, + } + } + }) + return authenticator.Client +} + +// url returns the authenticator's URL property after potentially initializing it. +func (authenticator *VpcInstanceAuthenticator) url() string { + authenticator.urlInit.Do(func() { + if authenticator.URL == "" { + authenticator.URL = vpcauthDefaultIMSEndpoint + } + }) + return authenticator.URL +} + +// newVpcInstanceAuthenticatorFromMap constructs a new VpcInstanceAuthenticator instance from a map containing +// configuration properties. +func newVpcInstanceAuthenticatorFromMap(properties map[string]string) (authenticator *VpcInstanceAuthenticator, err error) { + if properties == nil { + return nil, fmt.Errorf(ERRORMSG_PROPS_MAP_NIL) + } + + authenticator, err = NewVpcInstanceAuthenticatorBuilder(). + SetIAMProfileCRN(properties[PROPNAME_IAM_PROFILE_CRN]). + SetIAMProfileID(properties[PROPNAME_IAM_PROFILE_ID]). + SetURL(properties[PROPNAME_AUTH_URL]). + Build() + + return +} + +// AuthenticationType returns the authentication type for this authenticator. +func (*VpcInstanceAuthenticator) AuthenticationType() string { + return AUTHTYPE_VPC +} + +// Authenticate adds IAM authentication information to the request. +// +// The IAM access token will be added to the request's headers in the form: +// +// Authorization: Bearer +// +func (authenticator *VpcInstanceAuthenticator) Authenticate(request *http.Request) error { + token, err := authenticator.GetToken() + if err != nil { + return err + } + + request.Header.Set("Authorization", "Bearer "+token) + return nil +} + +// getTokenData returns the tokenData field from the authenticator with synchronization. +func (authenticator *VpcInstanceAuthenticator) getTokenData() *iamTokenData { + authenticator.tokenDataMutex.Lock() + defer authenticator.tokenDataMutex.Unlock() + + return authenticator.tokenData +} + +// setTokenData sets the 'tokenData' field in the authenticator with synchronization. +func (authenticator *VpcInstanceAuthenticator) setTokenData(tokenData *iamTokenData) { + authenticator.tokenDataMutex.Lock() + defer authenticator.tokenDataMutex.Unlock() + + authenticator.tokenData = tokenData +} + +// Validate the authenticator's configuration. +// +// Ensures that one of IAMProfileName or IAMProfileID are specified, and the ClientId and ClientSecret pair are +// mutually inclusive. +func (authenticator *VpcInstanceAuthenticator) Validate() error { + + // Check to make sure that at most one of IAMProfileCRN or IAMProfileID are specified. + if authenticator.IAMProfileCRN != "" && authenticator.IAMProfileID != "" { + return fmt.Errorf(ERRORMSG_ATMOST_ONE_PROP_ERROR, "IAMProfileCRN", "IAMProfileID") + } + + return nil +} + +// GetToken returns an IAM access token to be used in an Authorization header. +// Whenever a new IAM access token is needed (when a token doesn't yet exist or the existing token has expired), +// a new IAM access token is fetched from the token server. +func (authenticator *VpcInstanceAuthenticator) GetToken() (string, error) { + if authenticator.getTokenData() == nil || !authenticator.getTokenData().isTokenValid() { + GetLogger().Debug("Performing synchronous token fetch...") + // synchronously request the token + err := authenticator.synchronizedRequestToken() + if err != nil { + return "", err + } + } else if authenticator.getTokenData().needsRefresh() { + GetLogger().Debug("Performing background asynchronous token fetch...") + // If refresh needed, kick off a go routine in the background to get a new token + //nolint: errcheck + go authenticator.invokeRequestTokenData() + } else { + GetLogger().Debug("Using cached access token...") + } + + // return an error if the access token is not valid or was not fetched + if authenticator.getTokenData() == nil || authenticator.getTokenData().AccessToken == "" { + return "", fmt.Errorf("Error while trying to get access token") + } + + return authenticator.getTokenData().AccessToken, nil +} + +// vpcRequestTokenMutex is used to synchronize access to requesting a new IAM access token. +var vpcRequestTokenMutex sync.Mutex + +// synchronizedRequestToken will check if the authenticator currently has +// a valid cached access token. +// If yes, then nothing else needs to be done. +// If no, then a blocking request is made to obtain a new IAM access token. +func (authenticator *VpcInstanceAuthenticator) synchronizedRequestToken() error { + vpcRequestTokenMutex.Lock() + defer vpcRequestTokenMutex.Unlock() + // if cached token is still valid, then just continue to use it + if authenticator.getTokenData() != nil && authenticator.getTokenData().isTokenValid() { + return nil + } + + return authenticator.invokeRequestTokenData() +} + +// invokeRequestTokenData will invoke RequestToken() to obtain a new IAM access token, +// then caches the resulting "tokenData" on the authenticator. +// Returns nil if successful, or non-nil if an error occurred. +func (authenticator *VpcInstanceAuthenticator) invokeRequestTokenData() error { + tokenResponse, err := authenticator.RequestToken() + if err != nil { + return err + } + + if tokenData, err := newIamTokenData(tokenResponse); err != nil { + return err + } else { + authenticator.setTokenData(tokenData) + } + + return nil +} + +// RequestToken will use the VPC Instance Metadata Service to (1) retrieve a fresh instance identity token +// and then (2) exchange that for an IAM access token. +func (authenticator *VpcInstanceAuthenticator) RequestToken() (iamTokenResponse *IamTokenServerResponse, err error) { + + // Retrieve the instance identity token from the VPC Instance Metadata Service. + instanceIdentityToken, err := authenticator.retrieveInstanceIdentityToken() + if err != nil { + return + } + + // Next, exchange the instance identity token for an IAM access token. + iamTokenResponse, err = authenticator.retrieveIamAccessToken(instanceIdentityToken) + if err != nil { + return + } + + return +} + +// vpcTokenResponse describes the response body for both the 'create_access_token' and 'create_iam_token' +// operations (i.e. the response body has the same structure for both operations). +// Note: this struct was generated from the VPC metadata service API definition. +type vpcTokenResponse struct { + // The access token. + AccessToken *string `json:"access_token" validate:"required"` + + // The date and time that the access token was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The date and time that the access token will expire. + ExpiresAt *strfmt.DateTime `json:"expires_at" validate:"required"` + + // Time in seconds before the access token expires. + ExpiresIn *int64 `json:"expires_in" validate:"required"` +} + +// retrieveIamAccessToken will use the VPC "create_iam_token" operation to exchange the +// compute resource's instance identity token for an IAM access token that can be used +// to authenticate outbound REST requests targeting IAM-secured services. +func (authenticator *VpcInstanceAuthenticator) retrieveIamAccessToken( + instanceIdentityToken string) (iamTokenResponse *IamTokenServerResponse, err error) { + + // Set up the request for the VPC "create_iam_token" operation. + builder := NewRequestBuilder(POST) + _, err = builder.ResolveRequestURL(authenticator.url(), vpcauthOperationPathCreateIamToken, nil) + if err != nil { + err = NewAuthenticationError(&DetailedResponse{}, err) + return + } + + // Set the params and request body. + builder.AddQuery("version", vpcauthMetadataServiceVersion) + builder.AddHeader(CONTENT_TYPE, APPLICATION_JSON) + builder.AddHeader(Accept, APPLICATION_JSON) + builder.AddHeader("Authorization", "Bearer "+instanceIdentityToken) + + // Next, construct the optional request body to specify the linked IAM profile. + // We previously verified that at most one of IBMProfileCRN or IAMProfileID was specified by the user, + // so just process them individually here and create the appropriate request body if needed. + // If neither property was specified by the user, then no request body is sent with the request. + var requestBody string + if authenticator.IAMProfileCRN != "" { + requestBody = fmt.Sprintf(`{"trusted_profile": {"crn": "%s"}}`, authenticator.IAMProfileCRN) + } + if authenticator.IAMProfileID != "" { + requestBody = fmt.Sprintf(`{"trusted_profile": {"id": "%s"}}`, authenticator.IAMProfileID) + } + if requestBody != "" { + _, _ = builder.SetBodyContentString(requestBody) + } + + // Build the request. + req, err := builder.Build() + if err != nil { + return nil, NewAuthenticationError(&DetailedResponse{}, err) + } + + // If debug is enabled, then dump the request. + if GetLogger().IsLogLevelEnabled(LevelDebug) { + buf, dumpErr := httputil.DumpRequestOut(req, req.Body != nil) + if dumpErr == nil { + GetLogger().Debug("Request:\n%s\n", string(buf)) + } else { + GetLogger().Debug(fmt.Sprintf("error while attempting to log outbound request: %s", dumpErr.Error())) + } + } + + GetLogger().Debug("Invoking VPC 'create_iam_token' operation: %s", builder.URL) + resp, err := authenticator.client().Do(req) + if err != nil { + return nil, NewAuthenticationError(&DetailedResponse{}, err) + } + GetLogger().Debug("Returned from VPC 'create_iam_token' operation, received status code %d", resp.StatusCode) + + // If debug is enabled, then dump the response. + if GetLogger().IsLogLevelEnabled(LevelDebug) { + buf, dumpErr := httputil.DumpResponse(resp, resp.Body != nil) + if dumpErr == nil { + GetLogger().Debug("Response:\n%s\n", string(buf)) + } else { + GetLogger().Debug(fmt.Sprintf("error while attempting to log inbound response: %s", dumpErr.Error())) + } + } + + // Check for a bad status code and handle an operation error. + if resp.StatusCode < 200 || resp.StatusCode >= 300 { + buff := new(bytes.Buffer) + _, _ = buff.ReadFrom(resp.Body) + resp.Body.Close() // #nosec G104 + + // Create a DetailedResponse to be included in the error below. + detailedResponse := &DetailedResponse{ + StatusCode: resp.StatusCode, + Headers: resp.Header, + RawResult: buff.Bytes(), + } + + vpcErrorMsg := string(detailedResponse.RawResult) + if vpcErrorMsg == "" { + vpcErrorMsg = "Operation 'create_iam_token' error response not available" + } + err = fmt.Errorf(ERRORMSG_VPCMDS_OPERATION_ERROR, detailedResponse.StatusCode, builder.URL, vpcErrorMsg) + return nil, NewAuthenticationError(detailedResponse, err) + } + + // Good response, so unmarshal the response body into a vpcTokenResponse instance. + tokenResponse := &vpcTokenResponse{} + _ = json.NewDecoder(resp.Body).Decode(tokenResponse) + defer resp.Body.Close() + + // Finally, convert the vpcTokenResponse instance into an IamTokenServerResponse to maintain + // consistency with other IAM-based authenticators. + iamTokenResponse = &IamTokenServerResponse{ + AccessToken: *tokenResponse.AccessToken, + ExpiresIn: *tokenResponse.ExpiresIn, + Expiration: time.Time(*tokenResponse.ExpiresAt).Unix(), + } + + return +} + +// retrieveInstanceIdentityToken retrieves the local compute resource's instance identity token using +// the "create_access_token" operation of the local VPC Instance Metadata Service API. +func (authenticator *VpcInstanceAuthenticator) retrieveInstanceIdentityToken() (instanceIdentityToken string, err error) { + + // Set up the request to invoke the "create_access_token" operation. + builder := NewRequestBuilder(PUT) + _, err = builder.ResolveRequestURL(authenticator.url(), vpcauthOperationPathCreateAccessToken, nil) + if err != nil { + err = NewAuthenticationError(&DetailedResponse{}, err) + return + } + + // Set the params and request body. + builder.AddQuery("version", vpcauthMetadataServiceVersion) + builder.AddHeader(CONTENT_TYPE, APPLICATION_JSON) + builder.AddHeader(Accept, APPLICATION_JSON) + builder.AddHeader("Metadata-Flavor", vpcauthMetadataFlavor) + + requestBody := fmt.Sprintf(`{"expires_in": %d}`, vpcauthInstanceIdentityTokenLifetime) + _, _ = builder.SetBodyContentString(requestBody) + + // Build the request. + req, err := builder.Build() + if err != nil { + err = NewAuthenticationError(&DetailedResponse{}, err) + return + } + + // If debug is enabled, then dump the request. + if GetLogger().IsLogLevelEnabled(LevelDebug) { + buf, dumpErr := httputil.DumpRequestOut(req, req.Body != nil) + if dumpErr == nil { + GetLogger().Debug("Request:\n%s\n", string(buf)) + } else { + GetLogger().Debug(fmt.Sprintf("error while attempting to log outbound request: %s", dumpErr.Error())) + } + } + + // Invoke the request. + GetLogger().Debug("Invoking VPC 'create_access_token' operation: %s", builder.URL) + resp, err := authenticator.client().Do(req) + if err != nil { + err = NewAuthenticationError(&DetailedResponse{}, err) + return + } + GetLogger().Debug("Returned from VPC 'create_access_token' operation, received status code %d", resp.StatusCode) + + // If debug is enabled, then dump the response. + if GetLogger().IsLogLevelEnabled(LevelDebug) { + buf, dumpErr := httputil.DumpResponse(resp, resp.Body != nil) + if dumpErr == nil { + GetLogger().Debug("Response:\n%s\n", string(buf)) + } else { + GetLogger().Debug(fmt.Sprintf("error while attempting to log inbound response: %s", dumpErr.Error())) + } + } + + // Check for a bad status code and handle the operation error. + if resp.StatusCode < 200 || resp.StatusCode >= 300 { + buff := new(bytes.Buffer) + _, _ = buff.ReadFrom(resp.Body) + resp.Body.Close() // #nosec G104 + + // Create a DetailedResponse to be included in the error below. + detailedResponse := &DetailedResponse{ + StatusCode: resp.StatusCode, + Headers: resp.Header, + RawResult: buff.Bytes(), + } + + vpcErrorMsg := string(detailedResponse.RawResult) + if vpcErrorMsg == "" { + vpcErrorMsg = "Operation 'create_access_token' error response not available" + } + + err = NewAuthenticationError(detailedResponse, + fmt.Errorf(ERRORMSG_VPCMDS_OPERATION_ERROR, detailedResponse.StatusCode, builder.URL, vpcErrorMsg)) + return + } + + // VPC "create_access_token" operation must have worked, so unmarshal the operation response body + // and retrieve the instance identity token value. + operationResponse := &vpcTokenResponse{} + _ = json.NewDecoder(resp.Body).Decode(operationResponse) + defer resp.Body.Close() + + // The instance identity token is returned in the "access_token" field of the response object. + instanceIdentityToken = *operationResponse.AccessToken + + return +} diff --git a/vendor/github.com/IBM/networking-go-sdk/LICENSE b/vendor/github.com/IBM/networking-go-sdk/LICENSE new file mode 100644 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/vendor/github.com/IBM/networking-go-sdk/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/IBM/networking-go-sdk/common/headers.go b/vendor/github.com/IBM/networking-go-sdk/common/headers.go new file mode 100644 index 00000000000..0ce39a847b9 --- /dev/null +++ b/vendor/github.com/IBM/networking-go-sdk/common/headers.go @@ -0,0 +1,82 @@ +/** + * (C) Copyright IBM Corp. 2019. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package common + +import ( + "fmt" + "runtime" +) + +const ( + sdkName = "networking-go-sdk" + headerNameUserAgent = "User-Agent" +) + +// +// GetSdkHeaders - returns the set of SDK-specific headers to be included in an outgoing request. +// +// This function is invoked by generated service methods (i.e. methods which implement the REST API operations +// defined within the API definition). The purpose of this function is to give the SDK implementor the opportunity +// to provide SDK-specific HTTP headers that will be sent with an outgoing REST API request. +// This function is invoked for each invocation of a generated service method, +// so the set of HTTP headers could be request-specific. +// As an optimization, if your SDK will be returning the same set of HTTP headers for each invocation of this +// function, it is recommended that you initialize the returned map just once (perhaps by using +// lazy initialization) and simply return it each time the function is invoked, instead of building it each time +// as in the example below. +// +// If you plan to gather metrics for your SDK, the User-Agent header value must +// be a string similar to the following: +// my-go-sdk/0.0.1 (lang=go; arch=x86_64; os=Linux; go.version=1.12.9) +// +// In the example above, the analytics tool will parse the user-agent header and +// use the following properties: +// "my-go-sdk" - the name of your sdk +// "0.0.1"- the version of your sdk +// "lang=go" - the language of the current sdk +// "arch=x86_64; os=Linux; go.version=1.12.9" - system information +// +// Note: It is very important that the sdk name ends with the string `-sdk`, +// as the analytics data collector uses this to gather usage data. +// +// Parameters: +// serviceName - the name of the service as defined in the API definition (e.g. "MyService1") +// serviceVersion - the version of the service as defined in the API definition (e.g. "V1") +// operationId - the operationId as defined in the API definition (e.g. getContext) +// +// Returns: +// a Map which contains the set of headers to be included in the REST API request +// +func GetSdkHeaders(serviceName string, serviceVersion string, operationId string) map[string]string { + sdkHeaders := make(map[string]string) + + sdkHeaders[headerNameUserAgent] = GetUserAgentInfo() + + return sdkHeaders +} + +var userAgent string = fmt.Sprintf("%s/%s %s", sdkName, Version, GetSystemInfo()) + +func GetUserAgentInfo() string { + return userAgent +} + +var systemInfo = fmt.Sprintf("(lang=go; arch=%s; os=%s; go.version=%s)", runtime.GOARCH, runtime.GOOS, runtime.Version()) + +func GetSystemInfo() string { + return systemInfo +} diff --git a/vendor/github.com/IBM/networking-go-sdk/common/version.go b/vendor/github.com/IBM/networking-go-sdk/common/version.go new file mode 100644 index 00000000000..032d477de7c --- /dev/null +++ b/vendor/github.com/IBM/networking-go-sdk/common/version.go @@ -0,0 +1,20 @@ +/** + * (C) Copyright IBM Corp. 2019. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package common + +// Version of the SDK +const Version = "0.28.0" diff --git a/vendor/github.com/IBM/networking-go-sdk/zonesv1/zones_v1.go b/vendor/github.com/IBM/networking-go-sdk/zonesv1/zones_v1.go new file mode 100644 index 00000000000..24921d87ab8 --- /dev/null +++ b/vendor/github.com/IBM/networking-go-sdk/zonesv1/zones_v1.go @@ -0,0 +1,1036 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 3.20.0-debb9f29-20201203-202043 + */ + +// Package zonesv1 : Operations and models for the ZonesV1 service +package zonesv1 + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/IBM/go-sdk-core/v5/core" + common "github.com/IBM/networking-go-sdk/common" +) + +// ZonesV1 : CIS Zones +// +// Version: 1.0.1 +type ZonesV1 struct { + Service *core.BaseService + + // Full url-encoded CRN of the service instance. + Crn *string +} + +// DefaultServiceURL is the default URL to make service requests to. +const DefaultServiceURL = "https://api.cis.cloud.ibm.com" + +// DefaultServiceName is the default key used to find external configuration information. +const DefaultServiceName = "zones" + +// ZonesV1Options : Service options +type ZonesV1Options struct { + ServiceName string + URL string + Authenticator core.Authenticator + + // Full url-encoded CRN of the service instance. + Crn *string `validate:"required"` +} + +// NewZonesV1UsingExternalConfig : constructs an instance of ZonesV1 with passed in options and external configuration. +func NewZonesV1UsingExternalConfig(options *ZonesV1Options) (zones *ZonesV1, err error) { + if options.ServiceName == "" { + options.ServiceName = DefaultServiceName + } + + if options.Authenticator == nil { + options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) + if err != nil { + return + } + } + + zones, err = NewZonesV1(options) + if err != nil { + return + } + + err = zones.Service.ConfigureService(options.ServiceName) + if err != nil { + return + } + + if options.URL != "" { + err = zones.Service.SetServiceURL(options.URL) + } + return +} + +// NewZonesV1 : constructs an instance of ZonesV1 with passed in options. +func NewZonesV1(options *ZonesV1Options) (service *ZonesV1, err error) { + serviceOptions := &core.ServiceOptions{ + URL: DefaultServiceURL, + Authenticator: options.Authenticator, + } + + err = core.ValidateStruct(options, "options") + if err != nil { + return + } + + baseService, err := core.NewBaseService(serviceOptions) + if err != nil { + return + } + + if options.URL != "" { + err = baseService.SetServiceURL(options.URL) + if err != nil { + return + } + } + + service = &ZonesV1{ + Service: baseService, + Crn: options.Crn, + } + + return +} + +// GetServiceURLForRegion returns the service URL to be used for the specified region +func GetServiceURLForRegion(region string) (string, error) { + return "", fmt.Errorf("service does not support regional URLs") +} + +// Clone makes a copy of "zones" suitable for processing requests. +func (zones *ZonesV1) Clone() *ZonesV1 { + if core.IsNil(zones) { + return nil + } + clone := *zones + clone.Service = zones.Service.Clone() + return &clone +} + +// SetServiceURL sets the service URL +func (zones *ZonesV1) SetServiceURL(url string) error { + return zones.Service.SetServiceURL(url) +} + +// GetServiceURL returns the service URL +func (zones *ZonesV1) GetServiceURL() string { + return zones.Service.GetServiceURL() +} + +// SetDefaultHeaders sets HTTP headers to be sent in every request +func (zones *ZonesV1) SetDefaultHeaders(headers http.Header) { + zones.Service.SetDefaultHeaders(headers) +} + +// SetEnableGzipCompression sets the service's EnableGzipCompression field +func (zones *ZonesV1) SetEnableGzipCompression(enableGzip bool) { + zones.Service.SetEnableGzipCompression(enableGzip) +} + +// GetEnableGzipCompression returns the service's EnableGzipCompression field +func (zones *ZonesV1) GetEnableGzipCompression() bool { + return zones.Service.GetEnableGzipCompression() +} + +// EnableRetries enables automatic retries for requests invoked for this service instance. +// If either parameter is specified as 0, then a default value is used instead. +func (zones *ZonesV1) EnableRetries(maxRetries int, maxRetryInterval time.Duration) { + zones.Service.EnableRetries(maxRetries, maxRetryInterval) +} + +// DisableRetries disables automatic retries for requests invoked for this service instance. +func (zones *ZonesV1) DisableRetries() { + zones.Service.DisableRetries() +} + +// ListZones : List all zones +// List all zones for a service instance. +func (zones *ZonesV1) ListZones(listZonesOptions *ListZonesOptions) (result *ListZonesResp, response *core.DetailedResponse, err error) { + return zones.ListZonesWithContext(context.Background(), listZonesOptions) +} + +// ListZonesWithContext is an alternate form of the ListZones method which supports a Context parameter +func (zones *ZonesV1) ListZonesWithContext(ctx context.Context, listZonesOptions *ListZonesOptions) (result *ListZonesResp, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listZonesOptions, "listZonesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "crn": *zones.Crn, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = zones.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(zones.Service.Options.URL, `/v1/{crn}/zones`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listZonesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("zones", "V1", "ListZones") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listZonesOptions.Page != nil { + builder.AddQuery("page", fmt.Sprint(*listZonesOptions.Page)) + } + if listZonesOptions.PerPage != nil { + builder.AddQuery("per_page", fmt.Sprint(*listZonesOptions.PerPage)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = zones.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalListZonesResp) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateZone : Create zone +// Add a new zone for a given service instance. +func (zones *ZonesV1) CreateZone(createZoneOptions *CreateZoneOptions) (result *ZoneResp, response *core.DetailedResponse, err error) { + return zones.CreateZoneWithContext(context.Background(), createZoneOptions) +} + +// CreateZoneWithContext is an alternate form of the CreateZone method which supports a Context parameter +func (zones *ZonesV1) CreateZoneWithContext(ctx context.Context, createZoneOptions *CreateZoneOptions) (result *ZoneResp, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(createZoneOptions, "createZoneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "crn": *zones.Crn, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = zones.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(zones.Service.Options.URL, `/v1/{crn}/zones`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createZoneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("zones", "V1", "CreateZone") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if createZoneOptions.Name != nil { + body["name"] = createZoneOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = zones.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneResp) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteZone : Delete zone +// Delete a zone given its id. +func (zones *ZonesV1) DeleteZone(deleteZoneOptions *DeleteZoneOptions) (result *DeleteZoneResp, response *core.DetailedResponse, err error) { + return zones.DeleteZoneWithContext(context.Background(), deleteZoneOptions) +} + +// DeleteZoneWithContext is an alternate form of the DeleteZone method which supports a Context parameter +func (zones *ZonesV1) DeleteZoneWithContext(ctx context.Context, deleteZoneOptions *DeleteZoneOptions) (result *DeleteZoneResp, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteZoneOptions, "deleteZoneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteZoneOptions, "deleteZoneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "crn": *zones.Crn, + "zone_identifier": *deleteZoneOptions.ZoneIdentifier, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = zones.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(zones.Service.Options.URL, `/v1/{crn}/zones/{zone_identifier}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteZoneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("zones", "V1", "DeleteZone") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = zones.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDeleteZoneResp) + if err != nil { + return + } + response.Result = result + + return +} + +// GetZone : Get zone +// Get the details of a zone for a given service instance and given zone id. +func (zones *ZonesV1) GetZone(getZoneOptions *GetZoneOptions) (result *ZoneResp, response *core.DetailedResponse, err error) { + return zones.GetZoneWithContext(context.Background(), getZoneOptions) +} + +// GetZoneWithContext is an alternate form of the GetZone method which supports a Context parameter +func (zones *ZonesV1) GetZoneWithContext(ctx context.Context, getZoneOptions *GetZoneOptions) (result *ZoneResp, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getZoneOptions, "getZoneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getZoneOptions, "getZoneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "crn": *zones.Crn, + "zone_identifier": *getZoneOptions.ZoneIdentifier, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = zones.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(zones.Service.Options.URL, `/v1/{crn}/zones/{zone_identifier}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getZoneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("zones", "V1", "GetZone") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = zones.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneResp) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateZone : Update zone +// Update the paused field of the zone. +func (zones *ZonesV1) UpdateZone(updateZoneOptions *UpdateZoneOptions) (result *ZoneResp, response *core.DetailedResponse, err error) { + return zones.UpdateZoneWithContext(context.Background(), updateZoneOptions) +} + +// UpdateZoneWithContext is an alternate form of the UpdateZone method which supports a Context parameter +func (zones *ZonesV1) UpdateZoneWithContext(ctx context.Context, updateZoneOptions *UpdateZoneOptions) (result *ZoneResp, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateZoneOptions, "updateZoneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateZoneOptions, "updateZoneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "crn": *zones.Crn, + "zone_identifier": *updateZoneOptions.ZoneIdentifier, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = zones.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(zones.Service.Options.URL, `/v1/{crn}/zones/{zone_identifier}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateZoneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("zones", "V1", "UpdateZone") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if updateZoneOptions.Paused != nil { + body["paused"] = updateZoneOptions.Paused + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = zones.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneResp) + if err != nil { + return + } + response.Result = result + + return +} + +// ZoneActivationCheck : Check zone +// Perform activation check on zone for status. +func (zones *ZonesV1) ZoneActivationCheck(zoneActivationCheckOptions *ZoneActivationCheckOptions) (result *ZoneActivationcheckResp, response *core.DetailedResponse, err error) { + return zones.ZoneActivationCheckWithContext(context.Background(), zoneActivationCheckOptions) +} + +// ZoneActivationCheckWithContext is an alternate form of the ZoneActivationCheck method which supports a Context parameter +func (zones *ZonesV1) ZoneActivationCheckWithContext(ctx context.Context, zoneActivationCheckOptions *ZoneActivationCheckOptions) (result *ZoneActivationcheckResp, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(zoneActivationCheckOptions, "zoneActivationCheckOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(zoneActivationCheckOptions, "zoneActivationCheckOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "crn": *zones.Crn, + "zone_identifier": *zoneActivationCheckOptions.ZoneIdentifier, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = zones.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(zones.Service.Options.URL, `/v1/{crn}/zones/{zone_identifier}/activation_check`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range zoneActivationCheckOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("zones", "V1", "ZoneActivationCheck") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = zones.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneActivationcheckResp) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateZoneOptions : The CreateZone options. +type CreateZoneOptions struct { + // name. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateZoneOptions : Instantiate CreateZoneOptions +func (*ZonesV1) NewCreateZoneOptions() *CreateZoneOptions { + return &CreateZoneOptions{} +} + +// SetName : Allow user to set Name +func (options *CreateZoneOptions) SetName(name string) *CreateZoneOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateZoneOptions) SetHeaders(param map[string]string) *CreateZoneOptions { + options.Headers = param + return options +} + +// DeleteZoneOptions : The DeleteZone options. +type DeleteZoneOptions struct { + // Identifier of zone. + ZoneIdentifier *string `json:"zone_identifier" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteZoneOptions : Instantiate DeleteZoneOptions +func (*ZonesV1) NewDeleteZoneOptions(zoneIdentifier string) *DeleteZoneOptions { + return &DeleteZoneOptions{ + ZoneIdentifier: core.StringPtr(zoneIdentifier), + } +} + +// SetZoneIdentifier : Allow user to set ZoneIdentifier +func (options *DeleteZoneOptions) SetZoneIdentifier(zoneIdentifier string) *DeleteZoneOptions { + options.ZoneIdentifier = core.StringPtr(zoneIdentifier) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteZoneOptions) SetHeaders(param map[string]string) *DeleteZoneOptions { + options.Headers = param + return options +} + +// DeleteZoneRespResult : result. +type DeleteZoneRespResult struct { + // id. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalDeleteZoneRespResult unmarshals an instance of DeleteZoneRespResult from the specified map of raw messages. +func UnmarshalDeleteZoneRespResult(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DeleteZoneRespResult) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// GetZoneOptions : The GetZone options. +type GetZoneOptions struct { + // Zone identifier. + ZoneIdentifier *string `json:"zone_identifier" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetZoneOptions : Instantiate GetZoneOptions +func (*ZonesV1) NewGetZoneOptions(zoneIdentifier string) *GetZoneOptions { + return &GetZoneOptions{ + ZoneIdentifier: core.StringPtr(zoneIdentifier), + } +} + +// SetZoneIdentifier : Allow user to set ZoneIdentifier +func (options *GetZoneOptions) SetZoneIdentifier(zoneIdentifier string) *GetZoneOptions { + options.ZoneIdentifier = core.StringPtr(zoneIdentifier) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetZoneOptions) SetHeaders(param map[string]string) *GetZoneOptions { + options.Headers = param + return options +} + +// ListZonesOptions : The ListZones options. +type ListZonesOptions struct { + // Page number of paginated results. + Page *int64 `json:"page,omitempty"` + + // Maximum number of zones per page. + PerPage *int64 `json:"per_page,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListZonesOptions : Instantiate ListZonesOptions +func (*ZonesV1) NewListZonesOptions() *ListZonesOptions { + return &ListZonesOptions{} +} + +// SetPage : Allow user to set Page +func (options *ListZonesOptions) SetPage(page int64) *ListZonesOptions { + options.Page = core.Int64Ptr(page) + return options +} + +// SetPerPage : Allow user to set PerPage +func (options *ListZonesOptions) SetPerPage(perPage int64) *ListZonesOptions { + options.PerPage = core.Int64Ptr(perPage) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListZonesOptions) SetHeaders(param map[string]string) *ListZonesOptions { + options.Headers = param + return options +} + +// UpdateZoneOptions : The UpdateZone options. +type UpdateZoneOptions struct { + // Zone identifier. + ZoneIdentifier *string `json:"zone_identifier" validate:"required,ne="` + + // paused. + Paused *bool `json:"paused,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateZoneOptions : Instantiate UpdateZoneOptions +func (*ZonesV1) NewUpdateZoneOptions(zoneIdentifier string) *UpdateZoneOptions { + return &UpdateZoneOptions{ + ZoneIdentifier: core.StringPtr(zoneIdentifier), + } +} + +// SetZoneIdentifier : Allow user to set ZoneIdentifier +func (options *UpdateZoneOptions) SetZoneIdentifier(zoneIdentifier string) *UpdateZoneOptions { + options.ZoneIdentifier = core.StringPtr(zoneIdentifier) + return options +} + +// SetPaused : Allow user to set Paused +func (options *UpdateZoneOptions) SetPaused(paused bool) *UpdateZoneOptions { + options.Paused = core.BoolPtr(paused) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateZoneOptions) SetHeaders(param map[string]string) *UpdateZoneOptions { + options.Headers = param + return options +} + +// ZoneActivationCheckOptions : The ZoneActivationCheck options. +type ZoneActivationCheckOptions struct { + // Identifier of zone. + ZoneIdentifier *string `json:"zone_identifier" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewZoneActivationCheckOptions : Instantiate ZoneActivationCheckOptions +func (*ZonesV1) NewZoneActivationCheckOptions(zoneIdentifier string) *ZoneActivationCheckOptions { + return &ZoneActivationCheckOptions{ + ZoneIdentifier: core.StringPtr(zoneIdentifier), + } +} + +// SetZoneIdentifier : Allow user to set ZoneIdentifier +func (options *ZoneActivationCheckOptions) SetZoneIdentifier(zoneIdentifier string) *ZoneActivationCheckOptions { + options.ZoneIdentifier = core.StringPtr(zoneIdentifier) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ZoneActivationCheckOptions) SetHeaders(param map[string]string) *ZoneActivationCheckOptions { + options.Headers = param + return options +} + +// ZoneActivationcheckRespResult : result. +type ZoneActivationcheckRespResult struct { + // id. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalZoneActivationcheckRespResult unmarshals an instance of ZoneActivationcheckRespResult from the specified map of raw messages. +func UnmarshalZoneActivationcheckRespResult(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneActivationcheckRespResult) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DeleteZoneResp : delete zone response. +type DeleteZoneResp struct { + // success. + Success *bool `json:"success" validate:"required"` + + // errors. + Errors [][]string `json:"errors" validate:"required"` + + // messages. + Messages [][]string `json:"messages" validate:"required"` + + // result. + Result *DeleteZoneRespResult `json:"result" validate:"required"` +} + +// UnmarshalDeleteZoneResp unmarshals an instance of DeleteZoneResp from the specified map of raw messages. +func UnmarshalDeleteZoneResp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DeleteZoneResp) + err = core.UnmarshalPrimitive(m, "success", &obj.Success) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "errors", &obj.Errors) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "messages", &obj.Messages) + if err != nil { + return + } + err = core.UnmarshalModel(m, "result", &obj.Result, UnmarshalDeleteZoneRespResult) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ListZonesResp : list zones response. +type ListZonesResp struct { + // success. + Success *bool `json:"success" validate:"required"` + + // errors. + Errors [][]string `json:"errors" validate:"required"` + + // messages. + Messages [][]string `json:"messages" validate:"required"` + + // zone list. + Result []ZoneDetails `json:"result" validate:"required"` + + // result information. + ResultInfo *ResultInfo `json:"result_info" validate:"required"` +} + +// UnmarshalListZonesResp unmarshals an instance of ListZonesResp from the specified map of raw messages. +func UnmarshalListZonesResp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ListZonesResp) + err = core.UnmarshalPrimitive(m, "success", &obj.Success) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "errors", &obj.Errors) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "messages", &obj.Messages) + if err != nil { + return + } + err = core.UnmarshalModel(m, "result", &obj.Result, UnmarshalZoneDetails) + if err != nil { + return + } + err = core.UnmarshalModel(m, "result_info", &obj.ResultInfo, UnmarshalResultInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResultInfo : result information. +type ResultInfo struct { + // page. + Page *int64 `json:"page" validate:"required"` + + // per page. + PerPage *int64 `json:"per_page" validate:"required"` + + // count. + Count *int64 `json:"count" validate:"required"` + + // total count. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalResultInfo unmarshals an instance of ResultInfo from the specified map of raw messages. +func UnmarshalResultInfo(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResultInfo) + err = core.UnmarshalPrimitive(m, "page", &obj.Page) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "per_page", &obj.PerPage) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneActivationcheckResp : zone activation check response. +type ZoneActivationcheckResp struct { + // success. + Success *bool `json:"success" validate:"required"` + + // errors. + Errors [][]string `json:"errors" validate:"required"` + + // messages. + Messages [][]string `json:"messages" validate:"required"` + + // result. + Result *ZoneActivationcheckRespResult `json:"result" validate:"required"` +} + +// UnmarshalZoneActivationcheckResp unmarshals an instance of ZoneActivationcheckResp from the specified map of raw messages. +func UnmarshalZoneActivationcheckResp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneActivationcheckResp) + err = core.UnmarshalPrimitive(m, "success", &obj.Success) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "errors", &obj.Errors) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "messages", &obj.Messages) + if err != nil { + return + } + err = core.UnmarshalModel(m, "result", &obj.Result, UnmarshalZoneActivationcheckRespResult) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneDetails : zone details. +type ZoneDetails struct { + // id. + ID *string `json:"id,omitempty"` + + // created date. + CreatedOn *string `json:"created_on,omitempty"` + + // modified date. + ModifiedOn *string `json:"modified_on,omitempty"` + + // name. + Name *string `json:"name,omitempty"` + + // original registrar. + OriginalRegistrar *string `json:"original_registrar,omitempty"` + + // orginal dns host. + OriginalDnshost *string `json:"original_dnshost,omitempty"` + + // status. + Status *string `json:"status,omitempty"` + + // paused. + Paused *bool `json:"paused,omitempty"` + + // orginal name servers. + OriginalNameServers []string `json:"original_name_servers,omitempty"` + + // name servers. + NameServers []string `json:"name_servers,omitempty"` +} + +// UnmarshalZoneDetails unmarshals an instance of ZoneDetails from the specified map of raw messages. +func UnmarshalZoneDetails(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneDetails) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_on", &obj.CreatedOn) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "modified_on", &obj.ModifiedOn) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "original_registrar", &obj.OriginalRegistrar) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "original_dnshost", &obj.OriginalDnshost) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "paused", &obj.Paused) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "original_name_servers", &obj.OriginalNameServers) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name_servers", &obj.NameServers) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneResp : zone response. +type ZoneResp struct { + // success. + Success *bool `json:"success" validate:"required"` + + // errors. + Errors [][]string `json:"errors" validate:"required"` + + // messages. + Messages [][]string `json:"messages" validate:"required"` + + // zone details. + Result *ZoneDetails `json:"result" validate:"required"` +} + +// UnmarshalZoneResp unmarshals an instance of ZoneResp from the specified map of raw messages. +func UnmarshalZoneResp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneResp) + err = core.UnmarshalPrimitive(m, "success", &obj.Success) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "errors", &obj.Errors) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "messages", &obj.Messages) + if err != nil { + return + } + err = core.UnmarshalModel(m, "result", &obj.Result, UnmarshalZoneDetails) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} diff --git a/vendor/github.com/IBM/platform-services-go-sdk/LICENSE b/vendor/github.com/IBM/platform-services-go-sdk/LICENSE new file mode 100644 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/vendor/github.com/IBM/platform-services-go-sdk/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/IBM/platform-services-go-sdk/common/headers.go b/vendor/github.com/IBM/platform-services-go-sdk/common/headers.go new file mode 100644 index 00000000000..44afd10cad8 --- /dev/null +++ b/vendor/github.com/IBM/platform-services-go-sdk/common/headers.go @@ -0,0 +1,66 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package common + +import ( + "fmt" + "runtime" +) + +const ( + sdkName = "platform-services-go-sdk" + headerNameUserAgent = "User-Agent" +) + +// +// GetSdkHeaders - returns the set of SDK-specific headers to be included in an outgoing request. +// +// This function is invoked by generated service methods (i.e. methods which implement the REST API operations +// defined within the API definition). The purpose of this function is to give the SDK implementor the opportunity +// to provide SDK-specific HTTP headers that will be sent with an outgoing REST API request. +// This function is invoked for each invocation of a generated service method, +// so the set of HTTP headers could be request-specific. +// As an optimization, if your SDK will be returning the same set of HTTP headers for each invocation of this +// function, it is recommended that you initialize the returned map just once (perhaps by using +// lazy initialization) and simply return it each time the function is invoked, instead of building it each time +// as in the example below. +// +// Parameters: +// serviceName - the name of the service as defined in the API definition (e.g. "MyService1") +// serviceVersion - the version of the service as defined in the API definition (e.g. "V1") +// operationId - the operationId as defined in the API definition (e.g. getContext) +// +// Returns: +// a Map which contains the set of headers to be included in the REST API request +// +func GetSdkHeaders(serviceName string, serviceVersion string, operationId string) map[string]string { + sdkHeaders := make(map[string]string) + sdkHeaders[headerNameUserAgent] = GetUserAgentInfo() + return sdkHeaders +} + +var userAgent string = fmt.Sprintf("%s/%s %s", sdkName, Version, GetSystemInfo()) + +func GetUserAgentInfo() string { + return userAgent +} + +var systemInfo = fmt.Sprintf("(lang=go; arch=%s; os=%s; go.version=%s)", runtime.GOARCH, runtime.GOOS, runtime.Version()) + +func GetSystemInfo() string { + return systemInfo +} diff --git a/vendor/github.com/IBM/platform-services-go-sdk/common/utils.go b/vendor/github.com/IBM/platform-services-go-sdk/common/utils.go new file mode 100644 index 00000000000..14178eae142 --- /dev/null +++ b/vendor/github.com/IBM/platform-services-go-sdk/common/utils.go @@ -0,0 +1,30 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package common + +import ( + "encoding/json" +) + +// ToJSON marshals the specified object and returns the resulting JSON string +func ToJSON(obj interface{}) string { + b, err := json.MarshalIndent(obj, "", " ") + if err != nil { + panic(err) + } + return string(b) +} diff --git a/vendor/github.com/IBM/platform-services-go-sdk/common/version.go b/vendor/github.com/IBM/platform-services-go-sdk/common/version.go new file mode 100644 index 00000000000..cdf0859a01c --- /dev/null +++ b/vendor/github.com/IBM/platform-services-go-sdk/common/version.go @@ -0,0 +1,20 @@ +/** + * (C) Copyright IBM Corp. 2020. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package common + +// Version of the SDK +const Version = "0.22.8" diff --git a/vendor/github.com/IBM/platform-services-go-sdk/globalcatalogv1/global_catalog_v1.go b/vendor/github.com/IBM/platform-services-go-sdk/globalcatalogv1/global_catalog_v1.go new file mode 100644 index 00000000000..6220124f48f --- /dev/null +++ b/vendor/github.com/IBM/platform-services-go-sdk/globalcatalogv1/global_catalog_v1.go @@ -0,0 +1,4612 @@ +/** + * (C) Copyright IBM Corp. 2021. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-4c92c221-20210211-060810 + */ + +// Package globalcatalogv1 : Operations and models for the GlobalCatalogV1 service +package globalcatalogv1 + +import ( + "context" + "encoding/json" + "fmt" + "github.com/IBM/go-sdk-core/v5/core" + common "github.com/IBM/platform-services-go-sdk/common" + "github.com/go-openapi/strfmt" + "io" + "net/http" + "reflect" + "time" +) + +// GlobalCatalogV1 : The catalog service manages offerings across geographies as the system of record. The catalog +// supports a RESTful API where users can retrieve information about existing offerings and create, manage, and delete +// their offerings. Start with the base URL and use the endpoints to retrieve metadata about services in the catalog and +// manage service visbility. Depending on the kind of object, the metadata can include information about pricing, +// provisioning, regions, and more. For more information, see the [catalog +// documentation](https://cloud.ibm.com/docs/overview/catalog.html#global-catalog-overview). +// +// Version: 1.0.3 +type GlobalCatalogV1 struct { + Service *core.BaseService +} + +// DefaultServiceURL is the default URL to make service requests to. +const DefaultServiceURL = "https://globalcatalog.cloud.ibm.com/api/v1" + +// DefaultServiceName is the default key used to find external configuration information. +const DefaultServiceName = "global_catalog" + +// GlobalCatalogV1Options : Service options +type GlobalCatalogV1Options struct { + ServiceName string + URL string + Authenticator core.Authenticator +} + +// NewGlobalCatalogV1UsingExternalConfig : constructs an instance of GlobalCatalogV1 with passed in options and external configuration. +func NewGlobalCatalogV1UsingExternalConfig(options *GlobalCatalogV1Options) (globalCatalog *GlobalCatalogV1, err error) { + if options.ServiceName == "" { + options.ServiceName = DefaultServiceName + } + + if options.Authenticator == nil { + options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) + if err != nil { + return + } + } + + globalCatalog, err = NewGlobalCatalogV1(options) + if err != nil { + return + } + + err = globalCatalog.Service.ConfigureService(options.ServiceName) + if err != nil { + return + } + + if options.URL != "" { + err = globalCatalog.Service.SetServiceURL(options.URL) + } + return +} + +// NewGlobalCatalogV1 : constructs an instance of GlobalCatalogV1 with passed in options. +func NewGlobalCatalogV1(options *GlobalCatalogV1Options) (service *GlobalCatalogV1, err error) { + serviceOptions := &core.ServiceOptions{ + URL: DefaultServiceURL, + Authenticator: options.Authenticator, + } + + baseService, err := core.NewBaseService(serviceOptions) + if err != nil { + return + } + + if options.URL != "" { + err = baseService.SetServiceURL(options.URL) + if err != nil { + return + } + } + + service = &GlobalCatalogV1{ + Service: baseService, + } + + return +} + +// GetServiceURLForRegion returns the service URL to be used for the specified region +func GetServiceURLForRegion(region string) (string, error) { + return "", fmt.Errorf("service does not support regional URLs") +} + +// Clone makes a copy of "globalCatalog" suitable for processing requests. +func (globalCatalog *GlobalCatalogV1) Clone() *GlobalCatalogV1 { + if core.IsNil(globalCatalog) { + return nil + } + clone := *globalCatalog + clone.Service = globalCatalog.Service.Clone() + return &clone +} + +// SetServiceURL sets the service URL +func (globalCatalog *GlobalCatalogV1) SetServiceURL(url string) error { + return globalCatalog.Service.SetServiceURL(url) +} + +// GetServiceURL returns the service URL +func (globalCatalog *GlobalCatalogV1) GetServiceURL() string { + return globalCatalog.Service.GetServiceURL() +} + +// SetDefaultHeaders sets HTTP headers to be sent in every request +func (globalCatalog *GlobalCatalogV1) SetDefaultHeaders(headers http.Header) { + globalCatalog.Service.SetDefaultHeaders(headers) +} + +// SetEnableGzipCompression sets the service's EnableGzipCompression field +func (globalCatalog *GlobalCatalogV1) SetEnableGzipCompression(enableGzip bool) { + globalCatalog.Service.SetEnableGzipCompression(enableGzip) +} + +// GetEnableGzipCompression returns the service's EnableGzipCompression field +func (globalCatalog *GlobalCatalogV1) GetEnableGzipCompression() bool { + return globalCatalog.Service.GetEnableGzipCompression() +} + +// EnableRetries enables automatic retries for requests invoked for this service instance. +// If either parameter is specified as 0, then a default value is used instead. +func (globalCatalog *GlobalCatalogV1) EnableRetries(maxRetries int, maxRetryInterval time.Duration) { + globalCatalog.Service.EnableRetries(maxRetries, maxRetryInterval) +} + +// DisableRetries disables automatic retries for requests invoked for this service instance. +func (globalCatalog *GlobalCatalogV1) DisableRetries() { + globalCatalog.Service.DisableRetries() +} + +// ListCatalogEntries : Returns parent catalog entries +// Includes key information, such as ID, name, kind, CRN, tags, and provider. This endpoint is ETag enabled. +func (globalCatalog *GlobalCatalogV1) ListCatalogEntries(listCatalogEntriesOptions *ListCatalogEntriesOptions) (result *EntrySearchResult, response *core.DetailedResponse, err error) { + return globalCatalog.ListCatalogEntriesWithContext(context.Background(), listCatalogEntriesOptions) +} + +// ListCatalogEntriesWithContext is an alternate form of the ListCatalogEntries method which supports a Context parameter +func (globalCatalog *GlobalCatalogV1) ListCatalogEntriesWithContext(ctx context.Context, listCatalogEntriesOptions *ListCatalogEntriesOptions) (result *EntrySearchResult, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listCatalogEntriesOptions, "listCatalogEntriesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = globalCatalog.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(globalCatalog.Service.Options.URL, `/`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listCatalogEntriesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "ListCatalogEntries") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listCatalogEntriesOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*listCatalogEntriesOptions.Account)) + } + if listCatalogEntriesOptions.Include != nil { + builder.AddQuery("include", fmt.Sprint(*listCatalogEntriesOptions.Include)) + } + if listCatalogEntriesOptions.Q != nil { + builder.AddQuery("q", fmt.Sprint(*listCatalogEntriesOptions.Q)) + } + if listCatalogEntriesOptions.SortBy != nil { + builder.AddQuery("sort-by", fmt.Sprint(*listCatalogEntriesOptions.SortBy)) + } + if listCatalogEntriesOptions.Descending != nil { + builder.AddQuery("descending", fmt.Sprint(*listCatalogEntriesOptions.Descending)) + } + if listCatalogEntriesOptions.Languages != nil { + builder.AddQuery("languages", fmt.Sprint(*listCatalogEntriesOptions.Languages)) + } + if listCatalogEntriesOptions.Catalog != nil { + builder.AddQuery("catalog", fmt.Sprint(*listCatalogEntriesOptions.Catalog)) + } + if listCatalogEntriesOptions.Complete != nil { + builder.AddQuery("complete", fmt.Sprint(*listCatalogEntriesOptions.Complete)) + } + if listCatalogEntriesOptions.Offset != nil { + builder.AddQuery("_offset", fmt.Sprint(*listCatalogEntriesOptions.Offset)) + } + if listCatalogEntriesOptions.Limit != nil { + builder.AddQuery("_limit", fmt.Sprint(*listCatalogEntriesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEntrySearchResult) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateCatalogEntry : Create a catalog entry +// The created catalog entry is restricted by default. You must have an administrator or editor role in the scope of the +// provided token. This API will return an ETag that can be used for standard ETag processing, except when depth query +// is used. +func (globalCatalog *GlobalCatalogV1) CreateCatalogEntry(createCatalogEntryOptions *CreateCatalogEntryOptions) (result *CatalogEntry, response *core.DetailedResponse, err error) { + return globalCatalog.CreateCatalogEntryWithContext(context.Background(), createCatalogEntryOptions) +} + +// CreateCatalogEntryWithContext is an alternate form of the CreateCatalogEntry method which supports a Context parameter +func (globalCatalog *GlobalCatalogV1) CreateCatalogEntryWithContext(ctx context.Context, createCatalogEntryOptions *CreateCatalogEntryOptions) (result *CatalogEntry, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createCatalogEntryOptions, "createCatalogEntryOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createCatalogEntryOptions, "createCatalogEntryOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = globalCatalog.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(globalCatalog.Service.Options.URL, `/`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createCatalogEntryOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "CreateCatalogEntry") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + if createCatalogEntryOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*createCatalogEntryOptions.Account)) + } + + body := make(map[string]interface{}) + if createCatalogEntryOptions.Name != nil { + body["name"] = createCatalogEntryOptions.Name + } + if createCatalogEntryOptions.Kind != nil { + body["kind"] = createCatalogEntryOptions.Kind + } + if createCatalogEntryOptions.OverviewUI != nil { + body["overview_ui"] = createCatalogEntryOptions.OverviewUI + } + if createCatalogEntryOptions.Images != nil { + body["images"] = createCatalogEntryOptions.Images + } + if createCatalogEntryOptions.Disabled != nil { + body["disabled"] = createCatalogEntryOptions.Disabled + } + if createCatalogEntryOptions.Tags != nil { + body["tags"] = createCatalogEntryOptions.Tags + } + if createCatalogEntryOptions.Provider != nil { + body["provider"] = createCatalogEntryOptions.Provider + } + if createCatalogEntryOptions.ID != nil { + body["id"] = createCatalogEntryOptions.ID + } + if createCatalogEntryOptions.ParentID != nil { + body["parent_id"] = createCatalogEntryOptions.ParentID + } + if createCatalogEntryOptions.Group != nil { + body["group"] = createCatalogEntryOptions.Group + } + if createCatalogEntryOptions.Active != nil { + body["active"] = createCatalogEntryOptions.Active + } + if createCatalogEntryOptions.Metadata != nil { + body["metadata"] = createCatalogEntryOptions.Metadata + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogEntry) + if err != nil { + return + } + response.Result = result + + return +} + +// GetCatalogEntry : Get a specific catalog object +// This endpoint returns a specific catalog entry using the object's unique identifier, for example +// `/_*service_name*?complete=true`. This endpoint is ETag enabled. This can be used by an unauthenticated user for +// publicly available services. +func (globalCatalog *GlobalCatalogV1) GetCatalogEntry(getCatalogEntryOptions *GetCatalogEntryOptions) (result *CatalogEntry, response *core.DetailedResponse, err error) { + return globalCatalog.GetCatalogEntryWithContext(context.Background(), getCatalogEntryOptions) +} + +// GetCatalogEntryWithContext is an alternate form of the GetCatalogEntry method which supports a Context parameter +func (globalCatalog *GlobalCatalogV1) GetCatalogEntryWithContext(ctx context.Context, getCatalogEntryOptions *GetCatalogEntryOptions) (result *CatalogEntry, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getCatalogEntryOptions, "getCatalogEntryOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getCatalogEntryOptions, "getCatalogEntryOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getCatalogEntryOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = globalCatalog.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(globalCatalog.Service.Options.URL, `/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getCatalogEntryOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "GetCatalogEntry") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getCatalogEntryOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*getCatalogEntryOptions.Account)) + } + if getCatalogEntryOptions.Include != nil { + builder.AddQuery("include", fmt.Sprint(*getCatalogEntryOptions.Include)) + } + if getCatalogEntryOptions.Languages != nil { + builder.AddQuery("languages", fmt.Sprint(*getCatalogEntryOptions.Languages)) + } + if getCatalogEntryOptions.Complete != nil { + builder.AddQuery("complete", fmt.Sprint(*getCatalogEntryOptions.Complete)) + } + if getCatalogEntryOptions.Depth != nil { + builder.AddQuery("depth", fmt.Sprint(*getCatalogEntryOptions.Depth)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogEntry) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateCatalogEntry : Update a catalog entry +// Update a catalog entry. The visibility of the catalog entry cannot be modified with this endpoint. You must be an +// administrator or editor in the scope of the provided token. This endpoint is ETag enabled. +func (globalCatalog *GlobalCatalogV1) UpdateCatalogEntry(updateCatalogEntryOptions *UpdateCatalogEntryOptions) (result *CatalogEntry, response *core.DetailedResponse, err error) { + return globalCatalog.UpdateCatalogEntryWithContext(context.Background(), updateCatalogEntryOptions) +} + +// UpdateCatalogEntryWithContext is an alternate form of the UpdateCatalogEntry method which supports a Context parameter +func (globalCatalog *GlobalCatalogV1) UpdateCatalogEntryWithContext(ctx context.Context, updateCatalogEntryOptions *UpdateCatalogEntryOptions) (result *CatalogEntry, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateCatalogEntryOptions, "updateCatalogEntryOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateCatalogEntryOptions, "updateCatalogEntryOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateCatalogEntryOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = globalCatalog.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(globalCatalog.Service.Options.URL, `/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateCatalogEntryOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "UpdateCatalogEntry") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + if updateCatalogEntryOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*updateCatalogEntryOptions.Account)) + } + if updateCatalogEntryOptions.Move != nil { + builder.AddQuery("move", fmt.Sprint(*updateCatalogEntryOptions.Move)) + } + + body := make(map[string]interface{}) + if updateCatalogEntryOptions.Name != nil { + body["name"] = updateCatalogEntryOptions.Name + } + if updateCatalogEntryOptions.Kind != nil { + body["kind"] = updateCatalogEntryOptions.Kind + } + if updateCatalogEntryOptions.OverviewUI != nil { + body["overview_ui"] = updateCatalogEntryOptions.OverviewUI + } + if updateCatalogEntryOptions.Images != nil { + body["images"] = updateCatalogEntryOptions.Images + } + if updateCatalogEntryOptions.Disabled != nil { + body["disabled"] = updateCatalogEntryOptions.Disabled + } + if updateCatalogEntryOptions.Tags != nil { + body["tags"] = updateCatalogEntryOptions.Tags + } + if updateCatalogEntryOptions.Provider != nil { + body["provider"] = updateCatalogEntryOptions.Provider + } + if updateCatalogEntryOptions.ParentID != nil { + body["parent_id"] = updateCatalogEntryOptions.ParentID + } + if updateCatalogEntryOptions.Group != nil { + body["group"] = updateCatalogEntryOptions.Group + } + if updateCatalogEntryOptions.Active != nil { + body["active"] = updateCatalogEntryOptions.Active + } + if updateCatalogEntryOptions.Metadata != nil { + body["metadata"] = updateCatalogEntryOptions.Metadata + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalCatalogEntry) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteCatalogEntry : Delete a catalog entry +// Delete a catalog entry. This will archive the catalog entry for a minimum of two weeks. While archived, it can be +// restored using the PUT restore API. After two weeks, it will be deleted and cannot be restored. You must have +// administrator role in the scope of the provided token to modify it. This endpoint is ETag enabled. +func (globalCatalog *GlobalCatalogV1) DeleteCatalogEntry(deleteCatalogEntryOptions *DeleteCatalogEntryOptions) (response *core.DetailedResponse, err error) { + return globalCatalog.DeleteCatalogEntryWithContext(context.Background(), deleteCatalogEntryOptions) +} + +// DeleteCatalogEntryWithContext is an alternate form of the DeleteCatalogEntry method which supports a Context parameter +func (globalCatalog *GlobalCatalogV1) DeleteCatalogEntryWithContext(ctx context.Context, deleteCatalogEntryOptions *DeleteCatalogEntryOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteCatalogEntryOptions, "deleteCatalogEntryOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteCatalogEntryOptions, "deleteCatalogEntryOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteCatalogEntryOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = globalCatalog.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(globalCatalog.Service.Options.URL, `/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteCatalogEntryOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "DeleteCatalogEntry") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + if deleteCatalogEntryOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*deleteCatalogEntryOptions.Account)) + } + if deleteCatalogEntryOptions.Force != nil { + builder.AddQuery("force", fmt.Sprint(*deleteCatalogEntryOptions.Force)) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = globalCatalog.Service.Request(request, nil) + + return +} + +// GetChildObjects : Get child catalog entries of a specific kind +// Fetch child catalog entries for a catalog entry with a specific id. This endpoint is ETag enabled. This can be used +// by an unauthenticated user for publicly available services. +func (globalCatalog *GlobalCatalogV1) GetChildObjects(getChildObjectsOptions *GetChildObjectsOptions) (result *EntrySearchResult, response *core.DetailedResponse, err error) { + return globalCatalog.GetChildObjectsWithContext(context.Background(), getChildObjectsOptions) +} + +// GetChildObjectsWithContext is an alternate form of the GetChildObjects method which supports a Context parameter +func (globalCatalog *GlobalCatalogV1) GetChildObjectsWithContext(ctx context.Context, getChildObjectsOptions *GetChildObjectsOptions) (result *EntrySearchResult, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getChildObjectsOptions, "getChildObjectsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getChildObjectsOptions, "getChildObjectsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getChildObjectsOptions.ID, + "kind": *getChildObjectsOptions.Kind, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = globalCatalog.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(globalCatalog.Service.Options.URL, `/{id}/{kind}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getChildObjectsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "GetChildObjects") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getChildObjectsOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*getChildObjectsOptions.Account)) + } + if getChildObjectsOptions.Include != nil { + builder.AddQuery("include", fmt.Sprint(*getChildObjectsOptions.Include)) + } + if getChildObjectsOptions.Q != nil { + builder.AddQuery("q", fmt.Sprint(*getChildObjectsOptions.Q)) + } + if getChildObjectsOptions.SortBy != nil { + builder.AddQuery("sort-by", fmt.Sprint(*getChildObjectsOptions.SortBy)) + } + if getChildObjectsOptions.Descending != nil { + builder.AddQuery("descending", fmt.Sprint(*getChildObjectsOptions.Descending)) + } + if getChildObjectsOptions.Languages != nil { + builder.AddQuery("languages", fmt.Sprint(*getChildObjectsOptions.Languages)) + } + if getChildObjectsOptions.Complete != nil { + builder.AddQuery("complete", fmt.Sprint(*getChildObjectsOptions.Complete)) + } + if getChildObjectsOptions.Offset != nil { + builder.AddQuery("_offset", fmt.Sprint(*getChildObjectsOptions.Offset)) + } + if getChildObjectsOptions.Limit != nil { + builder.AddQuery("_limit", fmt.Sprint(*getChildObjectsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEntrySearchResult) + if err != nil { + return + } + response.Result = result + + return +} + +// RestoreCatalogEntry : Restore archived catalog entry +// Restore an archived catalog entry. You must have an administrator role in the scope of the provided token. +func (globalCatalog *GlobalCatalogV1) RestoreCatalogEntry(restoreCatalogEntryOptions *RestoreCatalogEntryOptions) (response *core.DetailedResponse, err error) { + return globalCatalog.RestoreCatalogEntryWithContext(context.Background(), restoreCatalogEntryOptions) +} + +// RestoreCatalogEntryWithContext is an alternate form of the RestoreCatalogEntry method which supports a Context parameter +func (globalCatalog *GlobalCatalogV1) RestoreCatalogEntryWithContext(ctx context.Context, restoreCatalogEntryOptions *RestoreCatalogEntryOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(restoreCatalogEntryOptions, "restoreCatalogEntryOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(restoreCatalogEntryOptions, "restoreCatalogEntryOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *restoreCatalogEntryOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = globalCatalog.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(globalCatalog.Service.Options.URL, `/{id}/restore`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range restoreCatalogEntryOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "RestoreCatalogEntry") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + if restoreCatalogEntryOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*restoreCatalogEntryOptions.Account)) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = globalCatalog.Service.Request(request, nil) + + return +} + +// GetVisibility : Get the visibility constraints for an object +// This endpoint returns the visibility rules for this object. Overall visibility is determined by the parent objects +// and any further restrictions on this object. You must have an administrator role in the scope of the provided token. +// This endpoint is ETag enabled. +func (globalCatalog *GlobalCatalogV1) GetVisibility(getVisibilityOptions *GetVisibilityOptions) (result *Visibility, response *core.DetailedResponse, err error) { + return globalCatalog.GetVisibilityWithContext(context.Background(), getVisibilityOptions) +} + +// GetVisibilityWithContext is an alternate form of the GetVisibility method which supports a Context parameter +func (globalCatalog *GlobalCatalogV1) GetVisibilityWithContext(ctx context.Context, getVisibilityOptions *GetVisibilityOptions) (result *Visibility, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVisibilityOptions, "getVisibilityOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVisibilityOptions, "getVisibilityOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVisibilityOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = globalCatalog.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(globalCatalog.Service.Options.URL, `/{id}/visibility`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVisibilityOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "GetVisibility") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getVisibilityOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*getVisibilityOptions.Account)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVisibility) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateVisibility : Update visibility +// Update an Object's Visibility. You must have an administrator role in the scope of the provided token. This endpoint +// is ETag enabled. +func (globalCatalog *GlobalCatalogV1) UpdateVisibility(updateVisibilityOptions *UpdateVisibilityOptions) (response *core.DetailedResponse, err error) { + return globalCatalog.UpdateVisibilityWithContext(context.Background(), updateVisibilityOptions) +} + +// UpdateVisibilityWithContext is an alternate form of the UpdateVisibility method which supports a Context parameter +func (globalCatalog *GlobalCatalogV1) UpdateVisibilityWithContext(ctx context.Context, updateVisibilityOptions *UpdateVisibilityOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVisibilityOptions, "updateVisibilityOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVisibilityOptions, "updateVisibilityOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVisibilityOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = globalCatalog.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(globalCatalog.Service.Options.URL, `/{id}/visibility`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVisibilityOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "UpdateVisibility") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Content-Type", "application/json") + + if updateVisibilityOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*updateVisibilityOptions.Account)) + } + + body := make(map[string]interface{}) + if updateVisibilityOptions.Extendable != nil { + body["extendable"] = updateVisibilityOptions.Extendable + } + if updateVisibilityOptions.Include != nil { + body["include"] = updateVisibilityOptions.Include + } + if updateVisibilityOptions.Exclude != nil { + body["exclude"] = updateVisibilityOptions.Exclude + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = globalCatalog.Service.Request(request, nil) + + return +} + +// GetPricing : Get the pricing for an object +// This endpoint returns the pricing for an object. Static pricing is defined in the catalog. Dynamic pricing is stored +// in IBM Cloud Pricing Catalog. This can be used by an unauthenticated user for publicly available services. +func (globalCatalog *GlobalCatalogV1) GetPricing(getPricingOptions *GetPricingOptions) (result *PricingGet, response *core.DetailedResponse, err error) { + return globalCatalog.GetPricingWithContext(context.Background(), getPricingOptions) +} + +// GetPricingWithContext is an alternate form of the GetPricing method which supports a Context parameter +func (globalCatalog *GlobalCatalogV1) GetPricingWithContext(ctx context.Context, getPricingOptions *GetPricingOptions) (result *PricingGet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPricingOptions, "getPricingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getPricingOptions, "getPricingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getPricingOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = globalCatalog.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(globalCatalog.Service.Options.URL, `/{id}/pricing`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getPricingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "GetPricing") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getPricingOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*getPricingOptions.Account)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPricingGet) + if err != nil { + return + } + response.Result = result + + return +} + +// GetAuditLogs : Get the audit logs for an object +// This endpoint returns the audit logs for an object. Only administrators and editors can get logs. +func (globalCatalog *GlobalCatalogV1) GetAuditLogs(getAuditLogsOptions *GetAuditLogsOptions) (result *AuditSearchResult, response *core.DetailedResponse, err error) { + return globalCatalog.GetAuditLogsWithContext(context.Background(), getAuditLogsOptions) +} + +// GetAuditLogsWithContext is an alternate form of the GetAuditLogs method which supports a Context parameter +func (globalCatalog *GlobalCatalogV1) GetAuditLogsWithContext(ctx context.Context, getAuditLogsOptions *GetAuditLogsOptions) (result *AuditSearchResult, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getAuditLogsOptions, "getAuditLogsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getAuditLogsOptions, "getAuditLogsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getAuditLogsOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = globalCatalog.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(globalCatalog.Service.Options.URL, `/{id}/logs`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getAuditLogsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "GetAuditLogs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getAuditLogsOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*getAuditLogsOptions.Account)) + } + if getAuditLogsOptions.Ascending != nil { + builder.AddQuery("ascending", fmt.Sprint(*getAuditLogsOptions.Ascending)) + } + if getAuditLogsOptions.Startat != nil { + builder.AddQuery("startat", fmt.Sprint(*getAuditLogsOptions.Startat)) + } + if getAuditLogsOptions.Offset != nil { + builder.AddQuery("_offset", fmt.Sprint(*getAuditLogsOptions.Offset)) + } + if getAuditLogsOptions.Limit != nil { + builder.AddQuery("_limit", fmt.Sprint(*getAuditLogsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAuditSearchResult) + if err != nil { + return + } + response.Result = result + + return +} + +// ListArtifacts : Get artifacts +// This endpoint returns a list of artifacts for an object. +func (globalCatalog *GlobalCatalogV1) ListArtifacts(listArtifactsOptions *ListArtifactsOptions) (result *Artifacts, response *core.DetailedResponse, err error) { + return globalCatalog.ListArtifactsWithContext(context.Background(), listArtifactsOptions) +} + +// ListArtifactsWithContext is an alternate form of the ListArtifacts method which supports a Context parameter +func (globalCatalog *GlobalCatalogV1) ListArtifactsWithContext(ctx context.Context, listArtifactsOptions *ListArtifactsOptions) (result *Artifacts, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listArtifactsOptions, "listArtifactsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listArtifactsOptions, "listArtifactsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "object_id": *listArtifactsOptions.ObjectID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = globalCatalog.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(globalCatalog.Service.Options.URL, `/{object_id}/artifacts`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listArtifactsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "ListArtifacts") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listArtifactsOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*listArtifactsOptions.Account)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = globalCatalog.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalArtifacts) + if err != nil { + return + } + response.Result = result + + return +} + +// GetArtifact : Get artifact +// This endpoint returns the binary of an artifact. +func (globalCatalog *GlobalCatalogV1) GetArtifact(getArtifactOptions *GetArtifactOptions) (result io.ReadCloser, response *core.DetailedResponse, err error) { + return globalCatalog.GetArtifactWithContext(context.Background(), getArtifactOptions) +} + +// GetArtifactWithContext is an alternate form of the GetArtifact method which supports a Context parameter +func (globalCatalog *GlobalCatalogV1) GetArtifactWithContext(ctx context.Context, getArtifactOptions *GetArtifactOptions) (result io.ReadCloser, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getArtifactOptions, "getArtifactOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getArtifactOptions, "getArtifactOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "object_id": *getArtifactOptions.ObjectID, + "artifact_id": *getArtifactOptions.ArtifactID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = globalCatalog.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(globalCatalog.Service.Options.URL, `/{object_id}/artifacts/{artifact_id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getArtifactOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "GetArtifact") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "*/*") + if getArtifactOptions.Accept != nil { + builder.AddHeader("Accept", fmt.Sprint(*getArtifactOptions.Accept)) + } + + if getArtifactOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*getArtifactOptions.Account)) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = globalCatalog.Service.Request(request, &result) + + return +} + +// UploadArtifact : Upload artifact +// This endpoint uploads the binary for an artifact. Only administrators and editors can upload artifacts. +func (globalCatalog *GlobalCatalogV1) UploadArtifact(uploadArtifactOptions *UploadArtifactOptions) (response *core.DetailedResponse, err error) { + return globalCatalog.UploadArtifactWithContext(context.Background(), uploadArtifactOptions) +} + +// UploadArtifactWithContext is an alternate form of the UploadArtifact method which supports a Context parameter +func (globalCatalog *GlobalCatalogV1) UploadArtifactWithContext(ctx context.Context, uploadArtifactOptions *UploadArtifactOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(uploadArtifactOptions, "uploadArtifactOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(uploadArtifactOptions, "uploadArtifactOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "object_id": *uploadArtifactOptions.ObjectID, + "artifact_id": *uploadArtifactOptions.ArtifactID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = globalCatalog.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(globalCatalog.Service.Options.URL, `/{object_id}/artifacts/{artifact_id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range uploadArtifactOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "UploadArtifact") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + if uploadArtifactOptions.ContentType != nil { + builder.AddHeader("Content-Type", fmt.Sprint(*uploadArtifactOptions.ContentType)) + } + + if uploadArtifactOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*uploadArtifactOptions.Account)) + } + + _, err = builder.SetBodyContent(core.StringNilMapper(uploadArtifactOptions.ContentType), nil, nil, uploadArtifactOptions.Artifact) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = globalCatalog.Service.Request(request, nil) + + return +} + +// DeleteArtifact : Delete artifact +// This endpoint deletes an artifact. Only administrators and editors can delete artifacts. +func (globalCatalog *GlobalCatalogV1) DeleteArtifact(deleteArtifactOptions *DeleteArtifactOptions) (response *core.DetailedResponse, err error) { + return globalCatalog.DeleteArtifactWithContext(context.Background(), deleteArtifactOptions) +} + +// DeleteArtifactWithContext is an alternate form of the DeleteArtifact method which supports a Context parameter +func (globalCatalog *GlobalCatalogV1) DeleteArtifactWithContext(ctx context.Context, deleteArtifactOptions *DeleteArtifactOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteArtifactOptions, "deleteArtifactOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteArtifactOptions, "deleteArtifactOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "object_id": *deleteArtifactOptions.ObjectID, + "artifact_id": *deleteArtifactOptions.ArtifactID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = globalCatalog.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(globalCatalog.Service.Options.URL, `/{object_id}/artifacts/{artifact_id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteArtifactOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("global_catalog", "V1", "DeleteArtifact") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + if deleteArtifactOptions.Account != nil { + builder.AddQuery("account", fmt.Sprint(*deleteArtifactOptions.Account)) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = globalCatalog.Service.Request(request, nil) + + return +} + +// AliasMetaData : Alias-related metadata. +type AliasMetaData struct { + // Type of alias. + Type *string `json:"type,omitempty"` + + // Points to the plan that this object is an alias for. + PlanID *string `json:"plan_id,omitempty"` +} + +// UnmarshalAliasMetaData unmarshals an instance of AliasMetaData from the specified map of raw messages. +func UnmarshalAliasMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AliasMetaData) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "plan_id", &obj.PlanID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Amount : Country-specific pricing information. +type Amount struct { + // Country. + Country *string `json:"country,omitempty"` + + // Currency. + Currency *string `json:"currency,omitempty"` + + // See Price for nested fields. + Prices []Price `json:"prices,omitempty"` +} + +// UnmarshalAmount unmarshals an instance of Amount from the specified map of raw messages. +func UnmarshalAmount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Amount) + err = core.UnmarshalPrimitive(m, "country", &obj.Country) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "currency", &obj.Currency) + if err != nil { + return + } + err = core.UnmarshalModel(m, "prices", &obj.Prices, UnmarshalPrice) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Artifact : Artifact Details. +type Artifact struct { + // The name of the artifact. + Name *string `json:"name,omitempty"` + + // The timestamp of the last update to the artifact. + Updated *strfmt.DateTime `json:"updated,omitempty"` + + // The url for the artifact. + URL *string `json:"url,omitempty"` + + // The etag of the artifact. + Etag *string `json:"etag,omitempty"` + + // The content length of the artifact. + Size *int64 `json:"size,omitempty"` +} + +// UnmarshalArtifact unmarshals an instance of Artifact from the specified map of raw messages. +func UnmarshalArtifact(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Artifact) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "etag", &obj.Etag) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Artifacts : Artifacts List. +type Artifacts struct { + // The total number of artifacts. + Count *int64 `json:"count,omitempty"` + + // The list of artifacts. + Resources []Artifact `json:"resources,omitempty"` +} + +// UnmarshalArtifacts unmarshals an instance of Artifacts from the specified map of raw messages. +func UnmarshalArtifacts(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Artifacts) + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalArtifact) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AuditSearchResult : A paginated search result containing audit logs. +type AuditSearchResult struct { + // The offset (origin 0) of the first resource in this page of search results. + Offset *int64 `json:"offset,omitempty"` + + // The maximum number of resources returned in each page of search results. + Limit *int64 `json:"limit,omitempty"` + + // The overall total number of resources in the search result set. + Count *int64 `json:"count,omitempty"` + + // The number of resources returned in this page of search results. + ResourceCount *int64 `json:"resource_count,omitempty"` + + // A URL for retrieving the first page of search results. + First *string `json:"first,omitempty"` + + // A URL for retrieving the last page of search results. + Last *string `json:"last,omitempty"` + + // A URL for retrieving the previous page of search results. + Prev *string `json:"prev,omitempty"` + + // A URL for retrieving the next page of search results. + Next *string `json:"next,omitempty"` + + // The resources (audit messages) contained in this page of search results. + Resources []Message `json:"resources,omitempty"` +} + +// UnmarshalAuditSearchResult unmarshals an instance of AuditSearchResult from the specified map of raw messages. +func UnmarshalAuditSearchResult(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AuditSearchResult) + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_count", &obj.ResourceCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "first", &obj.First) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last", &obj.Last) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "prev", &obj.Prev) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next", &obj.Next) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalMessage) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Broker : The broker associated with a catalog entry. +type Broker struct { + // Broker name. + Name *string `json:"name,omitempty"` + + // Broker guid. + GUID *string `json:"guid,omitempty"` +} + +// UnmarshalBroker unmarshals an instance of Broker from the specified map of raw messages. +func UnmarshalBroker(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Broker) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "guid", &obj.GUID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Bullets : Information related to list delimiters. +type Bullets struct { + // The bullet title. + Title *string `json:"title,omitempty"` + + // The bullet description. + Description *string `json:"description,omitempty"` + + // The icon to use for rendering the bullet. + Icon *string `json:"icon,omitempty"` + + // The bullet quantity. + Quantity *int64 `json:"quantity,omitempty"` +} + +// UnmarshalBullets unmarshals an instance of Bullets from the specified map of raw messages. +func UnmarshalBullets(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Bullets) + err = core.UnmarshalPrimitive(m, "title", &obj.Title) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "icon", &obj.Icon) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "quantity", &obj.Quantity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CfMetaData : Service-related metadata. +type CfMetaData struct { + // Type of service. + Type *string `json:"type,omitempty"` + + // Boolean value that describes whether the service is compatible with Identity and Access Management. + IamCompatible *bool `json:"iam_compatible,omitempty"` + + // Boolean value that describes whether the service has a unique API key. + UniqueAPIKey *bool `json:"unique_api_key,omitempty"` + + // Boolean value that describes whether the service is provisionable or not. You may need sales or support to create + // this service. + Provisionable *bool `json:"provisionable,omitempty"` + + // Boolean value that describes whether you can create bindings for this service. + Bindable *bool `json:"bindable,omitempty"` + + // Boolean value that describes whether the service supports asynchronous provisioning. + AsyncProvisioningSupported *bool `json:"async_provisioning_supported,omitempty"` + + // Boolean value that describes whether the service supports asynchronous unprovisioning. + AsyncUnprovisioningSupported *bool `json:"async_unprovisioning_supported,omitempty"` + + // Service dependencies. + Requires []string `json:"requires,omitempty"` + + // Boolean value that describes whether the service supports upgrade or downgrade for some plans. + PlanUpdateable *bool `json:"plan_updateable,omitempty"` + + // String that describes whether the service is active or inactive. + State *string `json:"state,omitempty"` + + // Boolean value that describes whether the service check is enabled. + ServiceCheckEnabled *bool `json:"service_check_enabled,omitempty"` + + // Test check interval. + TestCheckInterval *int64 `json:"test_check_interval,omitempty"` + + // Boolean value that describes whether the service supports service keys. + ServiceKeySupported *bool `json:"service_key_supported,omitempty"` + + // If the field is imported from Cloud Foundry, the Cloud Foundry region's GUID. This is a required field. For example, + // `us-south=123`. + CfGUID map[string]string `json:"cf_guid,omitempty"` +} + +// UnmarshalCfMetaData unmarshals an instance of CfMetaData from the specified map of raw messages. +func UnmarshalCfMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CfMetaData) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iam_compatible", &obj.IamCompatible) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "unique_api_key", &obj.UniqueAPIKey) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "bindable", &obj.Bindable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "async_provisioning_supported", &obj.AsyncProvisioningSupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "async_unprovisioning_supported", &obj.AsyncUnprovisioningSupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "requires", &obj.Requires) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "plan_updateable", &obj.PlanUpdateable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_check_enabled", &obj.ServiceCheckEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "test_check_interval", &obj.TestCheckInterval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_key_supported", &obj.ServiceKeySupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cf_guid", &obj.CfGUID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Callbacks : Callback-related information associated with a catalog entry. +type Callbacks struct { + // The URL of the deployment controller. + ControllerURL *string `json:"controller_url,omitempty"` + + // The URL of the deployment broker. + BrokerURL *string `json:"broker_url,omitempty"` + + // The URL of the deployment broker SC proxy. + BrokerProxyURL *string `json:"broker_proxy_url,omitempty"` + + // The URL of dashboard callback. + DashboardURL *string `json:"dashboard_url,omitempty"` + + // The URL of dashboard data. + DashboardDataURL *string `json:"dashboard_data_url,omitempty"` + + // The URL of the dashboard detail tab. + DashboardDetailTabURL *string `json:"dashboard_detail_tab_url,omitempty"` + + // The URL of the dashboard detail tab extension. + DashboardDetailTabExtURL *string `json:"dashboard_detail_tab_ext_url,omitempty"` + + // Service monitor API URL. + ServiceMonitorAPI *string `json:"service_monitor_api,omitempty"` + + // Service monitor app URL. + ServiceMonitorApp *string `json:"service_monitor_app,omitempty"` + + // API endpoint. + APIEndpoint map[string]string `json:"api_endpoint,omitempty"` +} + +// UnmarshalCallbacks unmarshals an instance of Callbacks from the specified map of raw messages. +func UnmarshalCallbacks(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Callbacks) + err = core.UnmarshalPrimitive(m, "controller_url", &obj.ControllerURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "broker_url", &obj.BrokerURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "broker_proxy_url", &obj.BrokerProxyURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dashboard_url", &obj.DashboardURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dashboard_data_url", &obj.DashboardDataURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dashboard_detail_tab_url", &obj.DashboardDetailTabURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dashboard_detail_tab_ext_url", &obj.DashboardDetailTabExtURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_monitor_api", &obj.ServiceMonitorAPI) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_monitor_app", &obj.ServiceMonitorApp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "api_endpoint", &obj.APIEndpoint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogEntry : An entry in the global catalog. +type CatalogEntry struct { + // Programmatic name for this catalog entry, which must be formatted like a CRN segment. See the display name in + // OverviewUI for a user-readable name. + Name *string `json:"name" validate:"required"` + + // The type of catalog entry, **service**, **template**, **dashboard**, which determines the type and shape of the + // object. + Kind *string `json:"kind" validate:"required"` + + // Overview is nested in the top level. The key value pair is `[_language_]overview_ui`. + OverviewUI map[string]Overview `json:"overview_ui" validate:"required"` + + // Image annotation for this catalog entry. The image is a URL. + Images *Image `json:"images" validate:"required"` + + // The ID of the parent catalog entry if it exists. + ParentID *string `json:"parent_id,omitempty"` + + // Boolean value that determines the global visibility for the catalog entry, and its children. If it is not enabled, + // all plans are disabled. + Disabled *bool `json:"disabled" validate:"required"` + + // A list of tags. For example, IBM, 3rd Party, Beta, GA, and Single Tenant. + Tags []string `json:"tags" validate:"required"` + + // Boolean value that determines whether the catalog entry is a group. + Group *bool `json:"group,omitempty"` + + // Information related to the provider associated with a catalog entry. + Provider *Provider `json:"provider" validate:"required"` + + // Boolean value that describes whether the service is active. + Active *bool `json:"active,omitempty"` + + // Model used to describe metadata object returned. + Metadata *CatalogEntryMetadata `json:"metadata,omitempty"` + + // Catalog entry's unique ID. It's the same across all catalog instances. + ID *string `json:"id,omitempty"` + + // The CRN associated with the catalog entry. + CatalogCRN *string `json:"catalog_crn,omitempty"` + + // URL to get details about this object. + URL *string `json:"url,omitempty"` + + // URL to get details about children of this object. + ChildrenURL *string `json:"children_url,omitempty"` + + // tags to indicate the locations this service is deployable to. + GeoTags []string `json:"geo_tags,omitempty"` + + // tags to indicate the type of pricing plans this service supports. + PricingTags []string `json:"pricing_tags,omitempty"` + + // Date created. + Created *strfmt.DateTime `json:"created,omitempty"` + + // Date last updated. + Updated *strfmt.DateTime `json:"updated,omitempty"` +} + +// Constants associated with the CatalogEntry.Kind property. +// The type of catalog entry, **service**, **template**, **dashboard**, which determines the type and shape of the +// object. +const ( + CatalogEntryKindDashboardConst = "dashboard" + CatalogEntryKindServiceConst = "service" + CatalogEntryKindTemplateConst = "template" +) + +// UnmarshalCatalogEntry unmarshals an instance of CatalogEntry from the specified map of raw messages. +func UnmarshalCatalogEntry(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogEntry) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "kind", &obj.Kind) + if err != nil { + return + } + err = core.UnmarshalModel(m, "overview_ui", &obj.OverviewUI, UnmarshalOverview) + if err != nil { + return + } + err = core.UnmarshalModel(m, "images", &obj.Images, UnmarshalImage) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "parent_id", &obj.ParentID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "disabled", &obj.Disabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tags", &obj.Tags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "group", &obj.Group) + if err != nil { + return + } + err = core.UnmarshalModel(m, "provider", &obj.Provider, UnmarshalProvider) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metadata", &obj.Metadata, UnmarshalCatalogEntryMetadata) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "catalog_crn", &obj.CatalogCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "children_url", &obj.ChildrenURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "geo_tags", &obj.GeoTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "pricing_tags", &obj.PricingTags) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created", &obj.Created) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated", &obj.Updated) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogEntryMetadata : Model used to describe metadata object returned. +type CatalogEntryMetadata struct { + // Boolean value that describes whether the service is compatible with the Resource Controller. + RcCompatible *bool `json:"rc_compatible,omitempty"` + + // Service-related metadata. + Service *CfMetaData `json:"service,omitempty"` + + // Plan-related metadata. + Plan *PlanMetaData `json:"plan,omitempty"` + + // Alias-related metadata. + Alias *AliasMetaData `json:"alias,omitempty"` + + // Template-related metadata. + Template *TemplateMetaData `json:"template,omitempty"` + + // Information related to the UI presentation associated with a catalog entry. + UI *UIMetaData `json:"ui,omitempty"` + + // Compliance information for HIPAA and PCI. + Compliance []string `json:"compliance,omitempty"` + + // Service Level Agreement related metadata. + SLA *SLAMetaData `json:"sla,omitempty"` + + // Callback-related information associated with a catalog entry. + Callbacks *Callbacks `json:"callbacks,omitempty"` + + // The original name of the object. + OriginalName *string `json:"original_name,omitempty"` + + // Optional version of the object. + Version *string `json:"version,omitempty"` + + // Additional information. + Other map[string]interface{} `json:"other,omitempty"` + + // Pricing-related information. + Pricing *CatalogEntryMetadataPricing `json:"pricing,omitempty"` + + // Deployment-related metadata. + Deployment *CatalogEntryMetadataDeployment `json:"deployment,omitempty"` +} + +// UnmarshalCatalogEntryMetadata unmarshals an instance of CatalogEntryMetadata from the specified map of raw messages. +func UnmarshalCatalogEntryMetadata(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogEntryMetadata) + err = core.UnmarshalPrimitive(m, "rc_compatible", &obj.RcCompatible) + if err != nil { + return + } + err = core.UnmarshalModel(m, "service", &obj.Service, UnmarshalCfMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plan", &obj.Plan, UnmarshalPlanMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "alias", &obj.Alias, UnmarshalAliasMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "template", &obj.Template, UnmarshalTemplateMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ui", &obj.UI, UnmarshalUIMetaData) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "compliance", &obj.Compliance) + if err != nil { + return + } + err = core.UnmarshalModel(m, "sla", &obj.SLA, UnmarshalSLAMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "callbacks", &obj.Callbacks, UnmarshalCallbacks) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "original_name", &obj.OriginalName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "other", &obj.Other) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pricing", &obj.Pricing, UnmarshalCatalogEntryMetadataPricing) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deployment", &obj.Deployment, UnmarshalCatalogEntryMetadataDeployment) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogEntryMetadataDeployment : Deployment-related metadata. +type CatalogEntryMetadataDeployment struct { + // Describes the region where the service is located. + Location *string `json:"location,omitempty"` + + // Pointer to the location resource in the catalog. + LocationURL *string `json:"location_url,omitempty"` + + // Original service location. + OriginalLocation *string `json:"original_location,omitempty"` + + // A CRN that describes the deployment. crn:v1:[cname]:[ctype]:[location]:[scope]::[resource-type]:[resource]. + TargetCRN *string `json:"target_crn,omitempty"` + + // CRN for the service. + ServiceCRN *string `json:"service_crn,omitempty"` + + // ID for MCCP. + MccpID *string `json:"mccp_id,omitempty"` + + // The broker associated with a catalog entry. + Broker *Broker `json:"broker,omitempty"` + + // This deployment not only supports RC but is ready to migrate and support the RC broker for a location. + SupportsRcMigration *bool `json:"supports_rc_migration,omitempty"` + + // network to use during deployment. + TargetNetwork *string `json:"target_network,omitempty"` +} + +// UnmarshalCatalogEntryMetadataDeployment unmarshals an instance of CatalogEntryMetadataDeployment from the specified map of raw messages. +func UnmarshalCatalogEntryMetadataDeployment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogEntryMetadataDeployment) + err = core.UnmarshalPrimitive(m, "location", &obj.Location) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "location_url", &obj.LocationURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "original_location", &obj.OriginalLocation) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_crn", &obj.TargetCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_crn", &obj.ServiceCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mccp_id", &obj.MccpID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "broker", &obj.Broker, UnmarshalBroker) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "supports_rc_migration", &obj.SupportsRcMigration) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_network", &obj.TargetNetwork) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CatalogEntryMetadataPricing : Pricing-related information. +type CatalogEntryMetadataPricing struct { + // Type of plan. Valid values are `free`, `trial`, `paygo`, `bluemix-subscription`, and `ibm-subscription`. + Type *string `json:"type,omitempty"` + + // Defines where the pricing originates. + Origin *string `json:"origin,omitempty"` + + // Plan-specific starting price information. + StartingPrice *StartingPrice `json:"starting_price,omitempty"` + + // Plan-specific cost metric structure. + Metrics []Metrics `json:"metrics,omitempty"` +} + +// UnmarshalCatalogEntryMetadataPricing unmarshals an instance of CatalogEntryMetadataPricing from the specified map of raw messages. +func UnmarshalCatalogEntryMetadataPricing(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CatalogEntryMetadataPricing) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } + err = core.UnmarshalModel(m, "starting_price", &obj.StartingPrice, UnmarshalStartingPrice) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metrics", &obj.Metrics, UnmarshalMetrics) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CreateCatalogEntryOptions : The CreateCatalogEntry options. +type CreateCatalogEntryOptions struct { + // Programmatic name for this catalog entry, which must be formatted like a CRN segment. See the display name in + // OverviewUI for a user-readable name. + Name *string `validate:"required"` + + // The type of catalog entry, **service**, **template**, **dashboard**, which determines the type and shape of the + // object. + Kind *string `validate:"required"` + + // Overview is nested in the top level. The key value pair is `[_language_]overview_ui`. + OverviewUI map[string]Overview `validate:"required"` + + // Image annotation for this catalog entry. The image is a URL. + Images *Image `validate:"required"` + + // Boolean value that determines the global visibility for the catalog entry, and its children. If it is not enabled, + // all plans are disabled. + Disabled *bool `validate:"required"` + + // A list of tags. For example, IBM, 3rd Party, Beta, GA, and Single Tenant. + Tags []string `validate:"required"` + + // Information related to the provider associated with a catalog entry. + Provider *Provider `validate:"required"` + + // Catalog entry's unique ID. It's the same across all catalog instances. + ID *string `validate:"required"` + + // The ID of the parent catalog entry if it exists. + ParentID *string + + // Boolean value that determines whether the catalog entry is a group. + Group *bool + + // Boolean value that describes whether the service is active. + Active *bool + + // Model used to describe metadata object that can be set. + Metadata *ObjectMetadataSet + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateCatalogEntryOptions.Kind property. +// The type of catalog entry, **service**, **template**, **dashboard**, which determines the type and shape of the +// object. +const ( + CreateCatalogEntryOptionsKindDashboardConst = "dashboard" + CreateCatalogEntryOptionsKindServiceConst = "service" + CreateCatalogEntryOptionsKindTemplateConst = "template" +) + +// NewCreateCatalogEntryOptions : Instantiate CreateCatalogEntryOptions +func (*GlobalCatalogV1) NewCreateCatalogEntryOptions(name string, kind string, overviewUI map[string]Overview, images *Image, disabled bool, tags []string, provider *Provider, id string) *CreateCatalogEntryOptions { + return &CreateCatalogEntryOptions{ + Name: core.StringPtr(name), + Kind: core.StringPtr(kind), + OverviewUI: overviewUI, + Images: images, + Disabled: core.BoolPtr(disabled), + Tags: tags, + Provider: provider, + ID: core.StringPtr(id), + } +} + +// SetName : Allow user to set Name +func (options *CreateCatalogEntryOptions) SetName(name string) *CreateCatalogEntryOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetKind : Allow user to set Kind +func (options *CreateCatalogEntryOptions) SetKind(kind string) *CreateCatalogEntryOptions { + options.Kind = core.StringPtr(kind) + return options +} + +// SetOverviewUI : Allow user to set OverviewUI +func (options *CreateCatalogEntryOptions) SetOverviewUI(overviewUI map[string]Overview) *CreateCatalogEntryOptions { + options.OverviewUI = overviewUI + return options +} + +// SetImages : Allow user to set Images +func (options *CreateCatalogEntryOptions) SetImages(images *Image) *CreateCatalogEntryOptions { + options.Images = images + return options +} + +// SetDisabled : Allow user to set Disabled +func (options *CreateCatalogEntryOptions) SetDisabled(disabled bool) *CreateCatalogEntryOptions { + options.Disabled = core.BoolPtr(disabled) + return options +} + +// SetTags : Allow user to set Tags +func (options *CreateCatalogEntryOptions) SetTags(tags []string) *CreateCatalogEntryOptions { + options.Tags = tags + return options +} + +// SetProvider : Allow user to set Provider +func (options *CreateCatalogEntryOptions) SetProvider(provider *Provider) *CreateCatalogEntryOptions { + options.Provider = provider + return options +} + +// SetID : Allow user to set ID +func (options *CreateCatalogEntryOptions) SetID(id string) *CreateCatalogEntryOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetParentID : Allow user to set ParentID +func (options *CreateCatalogEntryOptions) SetParentID(parentID string) *CreateCatalogEntryOptions { + options.ParentID = core.StringPtr(parentID) + return options +} + +// SetGroup : Allow user to set Group +func (options *CreateCatalogEntryOptions) SetGroup(group bool) *CreateCatalogEntryOptions { + options.Group = core.BoolPtr(group) + return options +} + +// SetActive : Allow user to set Active +func (options *CreateCatalogEntryOptions) SetActive(active bool) *CreateCatalogEntryOptions { + options.Active = core.BoolPtr(active) + return options +} + +// SetMetadata : Allow user to set Metadata +func (options *CreateCatalogEntryOptions) SetMetadata(metadata *ObjectMetadataSet) *CreateCatalogEntryOptions { + options.Metadata = metadata + return options +} + +// SetAccount : Allow user to set Account +func (options *CreateCatalogEntryOptions) SetAccount(account string) *CreateCatalogEntryOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateCatalogEntryOptions) SetHeaders(param map[string]string) *CreateCatalogEntryOptions { + options.Headers = param + return options +} + +// DrMetaData : SLA Disaster Recovery-related metadata. +type DrMetaData struct { + // Required boolean value that describes whether disaster recovery is on. + Dr *bool `json:"dr,omitempty"` + + // Description of the disaster recovery implementation. + Description *string `json:"description,omitempty"` +} + +// UnmarshalDrMetaData unmarshals an instance of DrMetaData from the specified map of raw messages. +func UnmarshalDrMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DrMetaData) + err = core.UnmarshalPrimitive(m, "dr", &obj.Dr) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DeleteArtifactOptions : The DeleteArtifact options. +type DeleteArtifactOptions struct { + // The object's unique ID. + ObjectID *string `validate:"required,ne="` + + // The artifact's ID. + ArtifactID *string `validate:"required,ne="` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteArtifactOptions : Instantiate DeleteArtifactOptions +func (*GlobalCatalogV1) NewDeleteArtifactOptions(objectID string, artifactID string) *DeleteArtifactOptions { + return &DeleteArtifactOptions{ + ObjectID: core.StringPtr(objectID), + ArtifactID: core.StringPtr(artifactID), + } +} + +// SetObjectID : Allow user to set ObjectID +func (options *DeleteArtifactOptions) SetObjectID(objectID string) *DeleteArtifactOptions { + options.ObjectID = core.StringPtr(objectID) + return options +} + +// SetArtifactID : Allow user to set ArtifactID +func (options *DeleteArtifactOptions) SetArtifactID(artifactID string) *DeleteArtifactOptions { + options.ArtifactID = core.StringPtr(artifactID) + return options +} + +// SetAccount : Allow user to set Account +func (options *DeleteArtifactOptions) SetAccount(account string) *DeleteArtifactOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteArtifactOptions) SetHeaders(param map[string]string) *DeleteArtifactOptions { + options.Headers = param + return options +} + +// DeleteCatalogEntryOptions : The DeleteCatalogEntry options. +type DeleteCatalogEntryOptions struct { + // The object's unique ID. + ID *string `validate:"required,ne="` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string + + // This will cause entry to be deleted fully. By default it is archived for two weeks, so that it can be restored if + // necessary. + Force *bool + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteCatalogEntryOptions : Instantiate DeleteCatalogEntryOptions +func (*GlobalCatalogV1) NewDeleteCatalogEntryOptions(id string) *DeleteCatalogEntryOptions { + return &DeleteCatalogEntryOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteCatalogEntryOptions) SetID(id string) *DeleteCatalogEntryOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetAccount : Allow user to set Account +func (options *DeleteCatalogEntryOptions) SetAccount(account string) *DeleteCatalogEntryOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetForce : Allow user to set Force +func (options *DeleteCatalogEntryOptions) SetForce(force bool) *DeleteCatalogEntryOptions { + options.Force = core.BoolPtr(force) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteCatalogEntryOptions) SetHeaders(param map[string]string) *DeleteCatalogEntryOptions { + options.Headers = param + return options +} + +// DeploymentBase : Deployment-related metadata. +type DeploymentBase struct { + // Describes the region where the service is located. + Location *string `json:"location,omitempty"` + + // URL of deployment. + LocationURL *string `json:"location_url,omitempty"` + + // Original service location. + OriginalLocation *string `json:"original_location,omitempty"` + + // A CRN that describes the deployment. crn:v1:[cname]:[ctype]:[location]:[scope]::[resource-type]:[resource]. + TargetCRN *string `json:"target_crn,omitempty"` + + // CRN for the service. + ServiceCRN *string `json:"service_crn,omitempty"` + + // ID for MCCP. + MccpID *string `json:"mccp_id,omitempty"` + + // The broker associated with a catalog entry. + Broker *Broker `json:"broker,omitempty"` + + // This deployment not only supports RC but is ready to migrate and support the RC broker for a location. + SupportsRcMigration *bool `json:"supports_rc_migration,omitempty"` + + // network to use during deployment. + TargetNetwork *string `json:"target_network,omitempty"` +} + +// UnmarshalDeploymentBase unmarshals an instance of DeploymentBase from the specified map of raw messages. +func UnmarshalDeploymentBase(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DeploymentBase) + err = core.UnmarshalPrimitive(m, "location", &obj.Location) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "location_url", &obj.LocationURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "original_location", &obj.OriginalLocation) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_crn", &obj.TargetCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_crn", &obj.ServiceCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mccp_id", &obj.MccpID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "broker", &obj.Broker, UnmarshalBroker) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "supports_rc_migration", &obj.SupportsRcMigration) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_network", &obj.TargetNetwork) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EntrySearchResult : A paginated search result containing catalog entries. +type EntrySearchResult struct { + // The offset (origin 0) of the first resource in this page of search results. + Offset *int64 `json:"offset,omitempty"` + + // The maximum number of resources returned in each page of search results. + Limit *int64 `json:"limit,omitempty"` + + // The overall total number of resources in the search result set. + Count *int64 `json:"count,omitempty"` + + // The number of resources returned in this page of search results. + ResourceCount *int64 `json:"resource_count,omitempty"` + + // A URL for retrieving the first page of search results. + First *string `json:"first,omitempty"` + + // A URL for retrieving the last page of search results. + Last *string `json:"last,omitempty"` + + // A URL for retrieving the previous page of search results. + Prev *string `json:"prev,omitempty"` + + // A URL for retrieving the next page of search results. + Next *string `json:"next,omitempty"` + + // The resources (catalog entries) contained in this page of search results. + Resources []CatalogEntry `json:"resources,omitempty"` +} + +// UnmarshalEntrySearchResult unmarshals an instance of EntrySearchResult from the specified map of raw messages. +func UnmarshalEntrySearchResult(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EntrySearchResult) + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_count", &obj.ResourceCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "first", &obj.First) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last", &obj.Last) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "prev", &obj.Prev) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next", &obj.Next) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalCatalogEntry) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// GetArtifactOptions : The GetArtifact options. +type GetArtifactOptions struct { + // The object's unique ID. + ObjectID *string `validate:"required,ne="` + + // The artifact's ID. + ArtifactID *string `validate:"required,ne="` + + // The type of the response: or *_/_*. + Accept *string + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetArtifactOptions : Instantiate GetArtifactOptions +func (*GlobalCatalogV1) NewGetArtifactOptions(objectID string, artifactID string) *GetArtifactOptions { + return &GetArtifactOptions{ + ObjectID: core.StringPtr(objectID), + ArtifactID: core.StringPtr(artifactID), + } +} + +// SetObjectID : Allow user to set ObjectID +func (options *GetArtifactOptions) SetObjectID(objectID string) *GetArtifactOptions { + options.ObjectID = core.StringPtr(objectID) + return options +} + +// SetArtifactID : Allow user to set ArtifactID +func (options *GetArtifactOptions) SetArtifactID(artifactID string) *GetArtifactOptions { + options.ArtifactID = core.StringPtr(artifactID) + return options +} + +// SetAccept : Allow user to set Accept +func (options *GetArtifactOptions) SetAccept(accept string) *GetArtifactOptions { + options.Accept = core.StringPtr(accept) + return options +} + +// SetAccount : Allow user to set Account +func (options *GetArtifactOptions) SetAccount(account string) *GetArtifactOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetArtifactOptions) SetHeaders(param map[string]string) *GetArtifactOptions { + options.Headers = param + return options +} + +// GetAuditLogsOptions : The GetAuditLogs options. +type GetAuditLogsOptions struct { + // The object's unique ID. + ID *string `validate:"required,ne="` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string + + // Sets the sort order. False is descending. + Ascending *string + + // Starting time for the logs. If it's descending then the entries will be equal or earlier. The default is latest. For + // ascending it will entries equal or later. The default is earliest. It can be either a number or a string. If a + // number then it is in the format of Unix timestamps. If it is a string then it is a date in the format + // YYYY-MM-DDTHH:MM:SSZ and the time is UTC. The T and the Z are required. For example: 2017-12-24T12:00:00Z for Noon + // UTC on Dec 24, 2017. + Startat *string + + // Count of number of log entries to skip before returning logs. The default is zero. + Offset *int64 + + // Count of number of entries to return. The default is fifty. The maximum value is two hundred. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetAuditLogsOptions : Instantiate GetAuditLogsOptions +func (*GlobalCatalogV1) NewGetAuditLogsOptions(id string) *GetAuditLogsOptions { + return &GetAuditLogsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetAuditLogsOptions) SetID(id string) *GetAuditLogsOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetAccount : Allow user to set Account +func (options *GetAuditLogsOptions) SetAccount(account string) *GetAuditLogsOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetAscending : Allow user to set Ascending +func (options *GetAuditLogsOptions) SetAscending(ascending string) *GetAuditLogsOptions { + options.Ascending = core.StringPtr(ascending) + return options +} + +// SetStartat : Allow user to set Startat +func (options *GetAuditLogsOptions) SetStartat(startat string) *GetAuditLogsOptions { + options.Startat = core.StringPtr(startat) + return options +} + +// SetOffset : Allow user to set Offset +func (options *GetAuditLogsOptions) SetOffset(offset int64) *GetAuditLogsOptions { + options.Offset = core.Int64Ptr(offset) + return options +} + +// SetLimit : Allow user to set Limit +func (options *GetAuditLogsOptions) SetLimit(limit int64) *GetAuditLogsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetAuditLogsOptions) SetHeaders(param map[string]string) *GetAuditLogsOptions { + options.Headers = param + return options +} + +// GetCatalogEntryOptions : The GetCatalogEntry options. +type GetCatalogEntryOptions struct { + // The catalog entry's unqiue ID. + ID *string `validate:"required,ne="` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string + + // A GET call by default returns a basic set of properties. To include other properties, you must add this parameter. A + // wildcard (`*`) includes all properties for an object, for example `GET /id?include=*`. To include specific metadata + // fields, separate each field with a colon (:), for example `GET /id?include=metadata.ui:metadata.pricing`. + Include *string + + // Return the data strings in the specified langauge. By default the strings returned are of the language preferred by + // your browser through the Accept-Langauge header, which allows an override of the header. Languages are specified in + // standard form, such as `en-us`. To include all languages use a wildcard (*). + Languages *string + + // Returns all available fields for all languages. Use the value `?complete=true` as shortcut for + // ?include=*&languages=*. + Complete *bool + + // Return the children down to the requested depth. Use * to include the entire children tree. If there are more + // children than the maximum permitted an error will be returned. Be judicious with this as it can cause a large number + // of database accesses and can result in a large amount of data returned. + Depth *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetCatalogEntryOptions : Instantiate GetCatalogEntryOptions +func (*GlobalCatalogV1) NewGetCatalogEntryOptions(id string) *GetCatalogEntryOptions { + return &GetCatalogEntryOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetCatalogEntryOptions) SetID(id string) *GetCatalogEntryOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetAccount : Allow user to set Account +func (options *GetCatalogEntryOptions) SetAccount(account string) *GetCatalogEntryOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetInclude : Allow user to set Include +func (options *GetCatalogEntryOptions) SetInclude(include string) *GetCatalogEntryOptions { + options.Include = core.StringPtr(include) + return options +} + +// SetLanguages : Allow user to set Languages +func (options *GetCatalogEntryOptions) SetLanguages(languages string) *GetCatalogEntryOptions { + options.Languages = core.StringPtr(languages) + return options +} + +// SetComplete : Allow user to set Complete +func (options *GetCatalogEntryOptions) SetComplete(complete bool) *GetCatalogEntryOptions { + options.Complete = core.BoolPtr(complete) + return options +} + +// SetDepth : Allow user to set Depth +func (options *GetCatalogEntryOptions) SetDepth(depth int64) *GetCatalogEntryOptions { + options.Depth = core.Int64Ptr(depth) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetCatalogEntryOptions) SetHeaders(param map[string]string) *GetCatalogEntryOptions { + options.Headers = param + return options +} + +// GetChildObjectsOptions : The GetChildObjects options. +type GetChildObjectsOptions struct { + // The parent catalog entry's ID. + ID *string `validate:"required,ne="` + + // The **kind** of child catalog entries to search for. A wildcard (*) includes all child catalog entries for all + // kinds, for example `GET /service_name/_*`. + Kind *string `validate:"required,ne="` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string + + // A colon (:) separated list of properties to include. A GET call by defaults return a limited set of properties. To + // include other properties, you must add the include parameter. A wildcard (*) includes all properties. + Include *string + + // A query filter, for example, `q=kind:iaas IBM` will filter on entries of **kind** iaas that has `IBM` in their + // name, display name, or description. + Q *string + + // The field on which to sort the output. By default by name. Available fields are **name**, **kind**, and + // **provider**. + SortBy *string + + // The sort order. The default is false, which is ascending. + Descending *string + + // Return the data strings in the specified langauge. By default the strings returned are of the language preferred by + // your browser through the Accept-Langauge header. This allows an override of the header. Languages are specified in + // standard form, such as `en-us`. To include all languages use the wildcard (*). + Languages *string + + // Use the value `?complete=true` as shortcut for ?include=*&languages=*. + Complete *bool + + // Useful for pagination, specifies index (origin 0) of first item to return in response. + Offset *int64 + + // Useful for pagination, specifies the maximum number of items to return in the response. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetChildObjectsOptions : Instantiate GetChildObjectsOptions +func (*GlobalCatalogV1) NewGetChildObjectsOptions(id string, kind string) *GetChildObjectsOptions { + return &GetChildObjectsOptions{ + ID: core.StringPtr(id), + Kind: core.StringPtr(kind), + } +} + +// SetID : Allow user to set ID +func (options *GetChildObjectsOptions) SetID(id string) *GetChildObjectsOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetKind : Allow user to set Kind +func (options *GetChildObjectsOptions) SetKind(kind string) *GetChildObjectsOptions { + options.Kind = core.StringPtr(kind) + return options +} + +// SetAccount : Allow user to set Account +func (options *GetChildObjectsOptions) SetAccount(account string) *GetChildObjectsOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetInclude : Allow user to set Include +func (options *GetChildObjectsOptions) SetInclude(include string) *GetChildObjectsOptions { + options.Include = core.StringPtr(include) + return options +} + +// SetQ : Allow user to set Q +func (options *GetChildObjectsOptions) SetQ(q string) *GetChildObjectsOptions { + options.Q = core.StringPtr(q) + return options +} + +// SetSortBy : Allow user to set SortBy +func (options *GetChildObjectsOptions) SetSortBy(sortBy string) *GetChildObjectsOptions { + options.SortBy = core.StringPtr(sortBy) + return options +} + +// SetDescending : Allow user to set Descending +func (options *GetChildObjectsOptions) SetDescending(descending string) *GetChildObjectsOptions { + options.Descending = core.StringPtr(descending) + return options +} + +// SetLanguages : Allow user to set Languages +func (options *GetChildObjectsOptions) SetLanguages(languages string) *GetChildObjectsOptions { + options.Languages = core.StringPtr(languages) + return options +} + +// SetComplete : Allow user to set Complete +func (options *GetChildObjectsOptions) SetComplete(complete bool) *GetChildObjectsOptions { + options.Complete = core.BoolPtr(complete) + return options +} + +// SetOffset : Allow user to set Offset +func (options *GetChildObjectsOptions) SetOffset(offset int64) *GetChildObjectsOptions { + options.Offset = core.Int64Ptr(offset) + return options +} + +// SetLimit : Allow user to set Limit +func (options *GetChildObjectsOptions) SetLimit(limit int64) *GetChildObjectsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetChildObjectsOptions) SetHeaders(param map[string]string) *GetChildObjectsOptions { + options.Headers = param + return options +} + +// GetPricingOptions : The GetPricing options. +type GetPricingOptions struct { + // The object's unique ID. + ID *string `validate:"required,ne="` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetPricingOptions : Instantiate GetPricingOptions +func (*GlobalCatalogV1) NewGetPricingOptions(id string) *GetPricingOptions { + return &GetPricingOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetPricingOptions) SetID(id string) *GetPricingOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetAccount : Allow user to set Account +func (options *GetPricingOptions) SetAccount(account string) *GetPricingOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetPricingOptions) SetHeaders(param map[string]string) *GetPricingOptions { + options.Headers = param + return options +} + +// GetVisibilityOptions : The GetVisibility options. +type GetVisibilityOptions struct { + // The object's unique ID. + ID *string `validate:"required,ne="` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVisibilityOptions : Instantiate GetVisibilityOptions +func (*GlobalCatalogV1) NewGetVisibilityOptions(id string) *GetVisibilityOptions { + return &GetVisibilityOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetVisibilityOptions) SetID(id string) *GetVisibilityOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetAccount : Allow user to set Account +func (options *GetVisibilityOptions) SetAccount(account string) *GetVisibilityOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVisibilityOptions) SetHeaders(param map[string]string) *GetVisibilityOptions { + options.Headers = param + return options +} + +// Image : Image annotation for this catalog entry. The image is a URL. +type Image struct { + // URL for the large, default image. + Image *string `json:"image" validate:"required"` + + // URL for a small image. + SmallImage *string `json:"small_image,omitempty"` + + // URL for a medium image. + MediumImage *string `json:"medium_image,omitempty"` + + // URL for a featured image. + FeatureImage *string `json:"feature_image,omitempty"` +} + +// NewImage : Instantiate Image (Generic Model Constructor) +func (*GlobalCatalogV1) NewImage(image string) (model *Image, err error) { + model = &Image{ + Image: core.StringPtr(image), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalImage unmarshals an instance of Image from the specified map of raw messages. +func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Image) + err = core.UnmarshalPrimitive(m, "image", &obj.Image) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "small_image", &obj.SmallImage) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "medium_image", &obj.MediumImage) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "feature_image", &obj.FeatureImage) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ListArtifactsOptions : The ListArtifacts options. +type ListArtifactsOptions struct { + // The object's unique ID. + ObjectID *string `validate:"required,ne="` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListArtifactsOptions : Instantiate ListArtifactsOptions +func (*GlobalCatalogV1) NewListArtifactsOptions(objectID string) *ListArtifactsOptions { + return &ListArtifactsOptions{ + ObjectID: core.StringPtr(objectID), + } +} + +// SetObjectID : Allow user to set ObjectID +func (options *ListArtifactsOptions) SetObjectID(objectID string) *ListArtifactsOptions { + options.ObjectID = core.StringPtr(objectID) + return options +} + +// SetAccount : Allow user to set Account +func (options *ListArtifactsOptions) SetAccount(account string) *ListArtifactsOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListArtifactsOptions) SetHeaders(param map[string]string) *ListArtifactsOptions { + options.Headers = param + return options +} + +// ListCatalogEntriesOptions : The ListCatalogEntries options. +type ListCatalogEntriesOptions struct { + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string + + // A GET call by default returns a basic set of properties. To include other properties, you must add this parameter. A + // wildcard (`*`) includes all properties for an object, for example `GET /?include=*`. To include specific metadata + // fields, separate each field with a colon (:), for example `GET /?include=metadata.ui:metadata.pricing`. + Include *string + + // Searches the catalog entries for keywords. Add filters to refine your search. A query filter, for example, + // `q=kind:iaas service_name rc:true`, filters entries of kind iaas with metadata.service.rc_compatible set to true and + // have a service name is in their name, display name, or description. Valid tags are **kind**:, + // **tag**:, **rc**:[true|false], **iam**:[true|false], **active**:[true|false], **geo**:, and + // **price**:. + Q *string + + // The field on which the output is sorted. Sorts by default by **name** property. Available fields are **name**, + // **displayname** (overview_ui.display_name), **kind**, **provider** (provider.name), **sbsindex** + // (metadata.ui.side_by_side_index), and the time **created**, and **updated**. + SortBy *string + + // Sets the sort order. The default is false, which is ascending. + Descending *string + + // Return the data strings in a specified langauge. By default, the strings returned are of the language preferred by + // your browser through the Accept-Langauge header, which allows an override of the header. Languages are specified in + // standard form, such as `en-us`. To include all languages use a wildcard (*). + Languages *string + + // Checks to see if a catalog's object is visible, or if it's filtered by service, plan, deployment, or region. Use the + // value `?catalog=true`. If a `200` code is returned, the object is visible. If a `403` code is returned, the object + // is not visible for the user. + Catalog *bool + + // Returns all available fields for all languages. Use the value `?complete=true` as shortcut for + // ?include=*&languages=*. + Complete *bool + + // Useful for pagination, specifies index (origin 0) of first item to return in response. + Offset *int64 + + // Useful for pagination, specifies the maximum number of items to return in the response. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListCatalogEntriesOptions : Instantiate ListCatalogEntriesOptions +func (*GlobalCatalogV1) NewListCatalogEntriesOptions() *ListCatalogEntriesOptions { + return &ListCatalogEntriesOptions{} +} + +// SetAccount : Allow user to set Account +func (options *ListCatalogEntriesOptions) SetAccount(account string) *ListCatalogEntriesOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetInclude : Allow user to set Include +func (options *ListCatalogEntriesOptions) SetInclude(include string) *ListCatalogEntriesOptions { + options.Include = core.StringPtr(include) + return options +} + +// SetQ : Allow user to set Q +func (options *ListCatalogEntriesOptions) SetQ(q string) *ListCatalogEntriesOptions { + options.Q = core.StringPtr(q) + return options +} + +// SetSortBy : Allow user to set SortBy +func (options *ListCatalogEntriesOptions) SetSortBy(sortBy string) *ListCatalogEntriesOptions { + options.SortBy = core.StringPtr(sortBy) + return options +} + +// SetDescending : Allow user to set Descending +func (options *ListCatalogEntriesOptions) SetDescending(descending string) *ListCatalogEntriesOptions { + options.Descending = core.StringPtr(descending) + return options +} + +// SetLanguages : Allow user to set Languages +func (options *ListCatalogEntriesOptions) SetLanguages(languages string) *ListCatalogEntriesOptions { + options.Languages = core.StringPtr(languages) + return options +} + +// SetCatalog : Allow user to set Catalog +func (options *ListCatalogEntriesOptions) SetCatalog(catalog bool) *ListCatalogEntriesOptions { + options.Catalog = core.BoolPtr(catalog) + return options +} + +// SetComplete : Allow user to set Complete +func (options *ListCatalogEntriesOptions) SetComplete(complete bool) *ListCatalogEntriesOptions { + options.Complete = core.BoolPtr(complete) + return options +} + +// SetOffset : Allow user to set Offset +func (options *ListCatalogEntriesOptions) SetOffset(offset int64) *ListCatalogEntriesOptions { + options.Offset = core.Int64Ptr(offset) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListCatalogEntriesOptions) SetLimit(limit int64) *ListCatalogEntriesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListCatalogEntriesOptions) SetHeaders(param map[string]string) *ListCatalogEntriesOptions { + options.Headers = param + return options +} + +// Message : log object describing who did what. +type Message struct { + // id of catalog entry. + ID *string `json:"id,omitempty"` + + // Information related to the visibility of a catalog entry. + Effective *Visibility `json:"effective,omitempty"` + + // time of action. + Time *strfmt.DateTime `json:"time,omitempty"` + + // user ID of person who did action. + WhoID *string `json:"who_id,omitempty"` + + // name of person who did action. + WhoName *string `json:"who_name,omitempty"` + + // user email of person who did action. + WhoEmail *string `json:"who_email,omitempty"` + + // Global catalog instance where this occured. + Instance *string `json:"instance,omitempty"` + + // transaction id associatd with action. + Gid *string `json:"gid,omitempty"` + + // type of action taken. + Type *string `json:"type,omitempty"` + + // message describing action. + Message *string `json:"message,omitempty"` + + // An object containing details on changes made to object data. + Data map[string]interface{} `json:"data,omitempty"` +} + +// UnmarshalMessage unmarshals an instance of Message from the specified map of raw messages. +func UnmarshalMessage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Message) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "effective", &obj.Effective, UnmarshalVisibility) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "time", &obj.Time) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "who_id", &obj.WhoID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "who_name", &obj.WhoName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "who_email", &obj.WhoEmail) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instance", &obj.Instance) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "gid", &obj.Gid) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "data", &obj.Data) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Metrics : Plan-specific cost metrics information. +type Metrics struct { + // The part reference. + PartRef *string `json:"part_ref,omitempty"` + + // The metric ID or part number. + MetricID *string `json:"metric_id,omitempty"` + + // The tier model. + TierModel *string `json:"tier_model,omitempty"` + + // The unit to charge. + ChargeUnit *string `json:"charge_unit,omitempty"` + + // The charge unit name. + ChargeUnitName *string `json:"charge_unit_name,omitempty"` + + // The charge unit quantity. + ChargeUnitQuantity *string `json:"charge_unit_quantity,omitempty"` + + // Display name of the resource. + ResourceDisplayName *string `json:"resource_display_name,omitempty"` + + // Display name of the charge unit. + ChargeUnitDisplayName *string `json:"charge_unit_display_name,omitempty"` + + // Usage limit for the metric. + UsageCapQty *int64 `json:"usage_cap_qty,omitempty"` + + // Display capacity. + DisplayCap *int64 `json:"display_cap,omitempty"` + + // Effective from time. + EffectiveFrom *strfmt.DateTime `json:"effective_from,omitempty"` + + // Effective until time. + EffectiveUntil *strfmt.DateTime `json:"effective_until,omitempty"` + + // The pricing per metric by country and currency. + Amounts []Amount `json:"amounts,omitempty"` +} + +// UnmarshalMetrics unmarshals an instance of Metrics from the specified map of raw messages. +func UnmarshalMetrics(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Metrics) + err = core.UnmarshalPrimitive(m, "part_ref", &obj.PartRef) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_id", &obj.MetricID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tier_model", &obj.TierModel) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "charge_unit", &obj.ChargeUnit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "charge_unit_name", &obj.ChargeUnitName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "charge_unit_quantity", &obj.ChargeUnitQuantity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_display_name", &obj.ResourceDisplayName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "charge_unit_display_name", &obj.ChargeUnitDisplayName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "usage_cap_qty", &obj.UsageCapQty) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "display_cap", &obj.DisplayCap) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "effective_from", &obj.EffectiveFrom) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "effective_until", &obj.EffectiveUntil) + if err != nil { + return + } + err = core.UnmarshalModel(m, "amounts", &obj.Amounts, UnmarshalAmount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ObjectMetadataSet : Model used to describe metadata object that can be set. +type ObjectMetadataSet struct { + // Boolean value that describes whether the service is compatible with the Resource Controller. + RcCompatible *bool `json:"rc_compatible,omitempty"` + + // Service-related metadata. + Service *CfMetaData `json:"service,omitempty"` + + // Plan-related metadata. + Plan *PlanMetaData `json:"plan,omitempty"` + + // Alias-related metadata. + Alias *AliasMetaData `json:"alias,omitempty"` + + // Template-related metadata. + Template *TemplateMetaData `json:"template,omitempty"` + + // Information related to the UI presentation associated with a catalog entry. + UI *UIMetaData `json:"ui,omitempty"` + + // Compliance information for HIPAA and PCI. + Compliance []string `json:"compliance,omitempty"` + + // Service Level Agreement related metadata. + SLA *SLAMetaData `json:"sla,omitempty"` + + // Callback-related information associated with a catalog entry. + Callbacks *Callbacks `json:"callbacks,omitempty"` + + // The original name of the object. + OriginalName *string `json:"original_name,omitempty"` + + // Optional version of the object. + Version *string `json:"version,omitempty"` + + // Additional information. + Other map[string]interface{} `json:"other,omitempty"` + + // Pricing-related information. + Pricing *PricingSet `json:"pricing,omitempty"` + + // Deployment-related metadata. + Deployment *DeploymentBase `json:"deployment,omitempty"` +} + +// UnmarshalObjectMetadataSet unmarshals an instance of ObjectMetadataSet from the specified map of raw messages. +func UnmarshalObjectMetadataSet(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ObjectMetadataSet) + err = core.UnmarshalPrimitive(m, "rc_compatible", &obj.RcCompatible) + if err != nil { + return + } + err = core.UnmarshalModel(m, "service", &obj.Service, UnmarshalCfMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plan", &obj.Plan, UnmarshalPlanMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "alias", &obj.Alias, UnmarshalAliasMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "template", &obj.Template, UnmarshalTemplateMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ui", &obj.UI, UnmarshalUIMetaData) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "compliance", &obj.Compliance) + if err != nil { + return + } + err = core.UnmarshalModel(m, "sla", &obj.SLA, UnmarshalSLAMetaData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "callbacks", &obj.Callbacks, UnmarshalCallbacks) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "original_name", &obj.OriginalName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "other", &obj.Other) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pricing", &obj.Pricing, UnmarshalPricingSet) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deployment", &obj.Deployment, UnmarshalDeploymentBase) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Overview : Overview is nested in the top level. The key value pair is `[_language_]overview_ui`. +type Overview struct { + // The translated display name. + DisplayName *string `json:"display_name" validate:"required"` + + // The translated long description. + LongDescription *string `json:"long_description" validate:"required"` + + // The translated description. + Description *string `json:"description" validate:"required"` + + // The translated description that will be featured. + FeaturedDescription *string `json:"featured_description,omitempty"` +} + +// NewOverview : Instantiate Overview (Generic Model Constructor) +func (*GlobalCatalogV1) NewOverview(displayName string, longDescription string, description string) (model *Overview, err error) { + model = &Overview{ + DisplayName: core.StringPtr(displayName), + LongDescription: core.StringPtr(longDescription), + Description: core.StringPtr(description), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalOverview unmarshals an instance of Overview from the specified map of raw messages. +func UnmarshalOverview(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Overview) + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "long_description", &obj.LongDescription) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "featured_description", &obj.FeaturedDescription) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PlanMetaData : Plan-related metadata. +type PlanMetaData struct { + // Boolean value that describes whether the service can be bound to an application. + Bindable *bool `json:"bindable,omitempty"` + + // Boolean value that describes whether the service can be reserved. + Reservable *bool `json:"reservable,omitempty"` + + // Boolean value that describes whether the service can be used internally. + AllowInternalUsers *bool `json:"allow_internal_users,omitempty"` + + // Boolean value that describes whether the service can be provisioned asynchronously. + AsyncProvisioningSupported *bool `json:"async_provisioning_supported,omitempty"` + + // Boolean value that describes whether the service can be unprovisioned asynchronously. + AsyncUnprovisioningSupported *bool `json:"async_unprovisioning_supported,omitempty"` + + // Test check interval. + TestCheckInterval *int64 `json:"test_check_interval,omitempty"` + + // Single scope instance. + SingleScopeInstance *string `json:"single_scope_instance,omitempty"` + + // Boolean value that describes whether the service check is enabled. + ServiceCheckEnabled *bool `json:"service_check_enabled,omitempty"` + + // If the field is imported from Cloud Foundry, the Cloud Foundry region's GUID. This is a required field. For example, + // `us-south=123`. + CfGUID map[string]string `json:"cf_guid,omitempty"` +} + +// UnmarshalPlanMetaData unmarshals an instance of PlanMetaData from the specified map of raw messages. +func UnmarshalPlanMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlanMetaData) + err = core.UnmarshalPrimitive(m, "bindable", &obj.Bindable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "reservable", &obj.Reservable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_internal_users", &obj.AllowInternalUsers) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "async_provisioning_supported", &obj.AsyncProvisioningSupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "async_unprovisioning_supported", &obj.AsyncUnprovisioningSupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "test_check_interval", &obj.TestCheckInterval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "single_scope_instance", &obj.SingleScopeInstance) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_check_enabled", &obj.ServiceCheckEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cf_guid", &obj.CfGUID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Price : Pricing-related information. +type Price struct { + // Pricing tier. + QuantityTier *int64 `json:"quantity_tier,omitempty"` + + // Price in the selected currency. + Price *float64 `json:"Price,omitempty"` +} + +// UnmarshalPrice unmarshals an instance of Price from the specified map of raw messages. +func UnmarshalPrice(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Price) + err = core.UnmarshalPrimitive(m, "quantity_tier", &obj.QuantityTier) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "Price", &obj.Price) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PricingGet : Pricing-related information. +type PricingGet struct { + // Type of plan. Valid values are `free`, `trial`, `paygo`, `bluemix-subscription`, and `ibm-subscription`. + Type *string `json:"type,omitempty"` + + // Defines where the pricing originates. + Origin *string `json:"origin,omitempty"` + + // Plan-specific starting price information. + StartingPrice *StartingPrice `json:"starting_price,omitempty"` + + // Plan-specific cost metric structure. + Metrics []Metrics `json:"metrics,omitempty"` +} + +// UnmarshalPricingGet unmarshals an instance of PricingGet from the specified map of raw messages. +func UnmarshalPricingGet(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PricingGet) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } + err = core.UnmarshalModel(m, "starting_price", &obj.StartingPrice, UnmarshalStartingPrice) + if err != nil { + return + } + err = core.UnmarshalModel(m, "metrics", &obj.Metrics, UnmarshalMetrics) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PricingSet : Pricing-related information. +type PricingSet struct { + // Type of plan. Valid values are `free`, `trial`, `paygo`, `bluemix-subscription`, and `ibm-subscription`. + Type *string `json:"type,omitempty"` + + // Defines where the pricing originates. + Origin *string `json:"origin,omitempty"` + + // Plan-specific starting price information. + StartingPrice *StartingPrice `json:"starting_price,omitempty"` +} + +// UnmarshalPricingSet unmarshals an instance of PricingSet from the specified map of raw messages. +func UnmarshalPricingSet(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PricingSet) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "origin", &obj.Origin) + if err != nil { + return + } + err = core.UnmarshalModel(m, "starting_price", &obj.StartingPrice, UnmarshalStartingPrice) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Provider : Information related to the provider associated with a catalog entry. +type Provider struct { + // Provider's email address for this catalog entry. + Email *string `json:"email" validate:"required"` + + // Provider's name, for example, IBM. + Name *string `json:"name" validate:"required"` + + // Provider's contact name. + Contact *string `json:"contact,omitempty"` + + // Provider's support email. + SupportEmail *string `json:"support_email,omitempty"` + + // Provider's contact phone. + Phone *string `json:"phone,omitempty"` +} + +// NewProvider : Instantiate Provider (Generic Model Constructor) +func (*GlobalCatalogV1) NewProvider(email string, name string) (model *Provider, err error) { + model = &Provider{ + Email: core.StringPtr(email), + Name: core.StringPtr(name), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalProvider unmarshals an instance of Provider from the specified map of raw messages. +func UnmarshalProvider(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Provider) + err = core.UnmarshalPrimitive(m, "email", &obj.Email) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "contact", &obj.Contact) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "support_email", &obj.SupportEmail) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "phone", &obj.Phone) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RestoreCatalogEntryOptions : The RestoreCatalogEntry options. +type RestoreCatalogEntryOptions struct { + // The catalog entry's unique ID. + ID *string `validate:"required,ne="` + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewRestoreCatalogEntryOptions : Instantiate RestoreCatalogEntryOptions +func (*GlobalCatalogV1) NewRestoreCatalogEntryOptions(id string) *RestoreCatalogEntryOptions { + return &RestoreCatalogEntryOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *RestoreCatalogEntryOptions) SetID(id string) *RestoreCatalogEntryOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetAccount : Allow user to set Account +func (options *RestoreCatalogEntryOptions) SetAccount(account string) *RestoreCatalogEntryOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *RestoreCatalogEntryOptions) SetHeaders(param map[string]string) *RestoreCatalogEntryOptions { + options.Headers = param + return options +} + +// SLAMetaData : Service Level Agreement related metadata. +type SLAMetaData struct { + // Required Service License Agreement Terms of Use. + Terms *string `json:"terms,omitempty"` + + // Required deployment type. Valid values are dedicated, local, or public. It can be Single or Multi tennancy, more + // specifically on a Server, VM, Physical, or Pod. + Tenancy *string `json:"tenancy,omitempty"` + + // Provisioning reliability, for example, 99.95. + Provisioning *string `json:"provisioning,omitempty"` + + // Uptime reliability of the service, for example, 99.95. + Responsiveness *string `json:"responsiveness,omitempty"` + + // SLA Disaster Recovery-related metadata. + Dr *DrMetaData `json:"dr,omitempty"` +} + +// UnmarshalSLAMetaData unmarshals an instance of SLAMetaData from the specified map of raw messages. +func UnmarshalSLAMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SLAMetaData) + err = core.UnmarshalPrimitive(m, "terms", &obj.Terms) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "tenancy", &obj.Tenancy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning", &obj.Provisioning) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "responsiveness", &obj.Responsiveness) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dr", &obj.Dr, UnmarshalDrMetaData) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SourceMetaData : Location of your applications source files. +type SourceMetaData struct { + // Path to your application. + Path *string `json:"path,omitempty"` + + // Type of source, for example, git. + Type *string `json:"type,omitempty"` + + // URL to source. + URL *string `json:"url,omitempty"` +} + +// UnmarshalSourceMetaData unmarshals an instance of SourceMetaData from the specified map of raw messages. +func UnmarshalSourceMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SourceMetaData) + err = core.UnmarshalPrimitive(m, "path", &obj.Path) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// StartingPrice : Plan-specific starting price information. +type StartingPrice struct { + // ID of the plan the starting price is calculated. + PlanID *string `json:"plan_id,omitempty"` + + // ID of the deployment the starting price is calculated. + DeploymentID *string `json:"deployment_id,omitempty"` + + // Pricing unit. + Unit *string `json:"unit,omitempty"` + + // The pricing per metric by country and currency. + Amount []Amount `json:"amount,omitempty"` +} + +// UnmarshalStartingPrice unmarshals an instance of StartingPrice from the specified map of raw messages. +func UnmarshalStartingPrice(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(StartingPrice) + err = core.UnmarshalPrimitive(m, "plan_id", &obj.PlanID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deployment_id", &obj.DeploymentID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "unit", &obj.Unit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "amount", &obj.Amount, UnmarshalAmount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Strings : Information related to a translated text message. +type Strings struct { + // Presentation information related to list delimiters. + Bullets []Bullets `json:"bullets,omitempty"` + + // Media-related metadata. + Media []UIMetaMedia `json:"media,omitempty"` + + // Warning that a message is not creatable. + NotCreatableMsg *string `json:"not_creatable_msg,omitempty"` + + // Warning that a robot message is not creatable. + NotCreatableRobotMsg *string `json:"not_creatable__robot_msg,omitempty"` + + // Warning for deprecation. + DeprecationWarning *string `json:"deprecation_warning,omitempty"` + + // Popup warning message. + PopupWarningMessage *string `json:"popup_warning_message,omitempty"` + + // Instructions for UI strings. + Instruction *string `json:"instruction,omitempty"` +} + +// UnmarshalStrings unmarshals an instance of Strings from the specified map of raw messages. +func UnmarshalStrings(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Strings) + err = core.UnmarshalModel(m, "bullets", &obj.Bullets, UnmarshalBullets) + if err != nil { + return + } + err = core.UnmarshalModel(m, "media", &obj.Media, UnmarshalUIMetaMedia) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "not_creatable_msg", &obj.NotCreatableMsg) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "not_creatable__robot_msg", &obj.NotCreatableRobotMsg) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deprecation_warning", &obj.DeprecationWarning) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "popup_warning_message", &obj.PopupWarningMessage) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instruction", &obj.Instruction) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TemplateMetaData : Template-related metadata. +type TemplateMetaData struct { + // List of required offering or plan IDs. + Services []string `json:"services,omitempty"` + + // Cloud Foundry instance memory value. + DefaultMemory *int64 `json:"default_memory,omitempty"` + + // Start Command. + StartCmd *string `json:"start_cmd,omitempty"` + + // Location of your applications source files. + Source *SourceMetaData `json:"source,omitempty"` + + // ID of the runtime. + RuntimeCatalogID *string `json:"runtime_catalog_id,omitempty"` + + // ID of the Cloud Foundry runtime. + CfRuntimeID *string `json:"cf_runtime_id,omitempty"` + + // ID of the boilerplate or template. + TemplateID *string `json:"template_id,omitempty"` + + // File path to the executable file for the template. + ExecutableFile *string `json:"executable_file,omitempty"` + + // ID of the buildpack used by the template. + Buildpack *string `json:"buildpack,omitempty"` + + // Environment variables (key/value pairs) for the template. + EnvironmentVariables map[string]string `json:"environment_variables,omitempty"` +} + +// UnmarshalTemplateMetaData unmarshals an instance of TemplateMetaData from the specified map of raw messages. +func UnmarshalTemplateMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TemplateMetaData) + err = core.UnmarshalPrimitive(m, "services", &obj.Services) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default_memory", &obj.DefaultMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "start_cmd", &obj.StartCmd) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalSourceMetaData) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "runtime_catalog_id", &obj.RuntimeCatalogID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cf_runtime_id", &obj.CfRuntimeID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "template_id", &obj.TemplateID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "executable_file", &obj.ExecutableFile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "buildpack", &obj.Buildpack) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "environment_variables", &obj.EnvironmentVariables) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// UIMetaData : Information related to the UI presentation associated with a catalog entry. +type UIMetaData struct { + // Language specific translation of translation properties, like label and description. + Strings map[string]Strings `json:"strings,omitempty"` + + // UI based URLs. + Urls *Urls `json:"urls,omitempty"` + + // Describes how the embeddable dashboard is rendered. + EmbeddableDashboard *string `json:"embeddable_dashboard,omitempty"` + + // Describes whether the embeddable dashboard is rendered at the full width. + EmbeddableDashboardFullWidth *bool `json:"embeddable_dashboard_full_width,omitempty"` + + // Defines the order of information presented. + NavigationOrder []string `json:"navigation_order,omitempty"` + + // Describes whether this entry is able to be created from the UI element or CLI. + NotCreatable *bool `json:"not_creatable,omitempty"` + + // ID of the primary offering for a group. + PrimaryOfferingID *string `json:"primary_offering_id,omitempty"` + + // Alert to ACE to allow instance UI to be accessible while the provisioning state of instance is in progress. + AccessibleDuringProvision *bool `json:"accessible_during_provision,omitempty"` + + // Specifies a side by side ordering weight to the UI. + SideBySideIndex *int64 `json:"side_by_side_index,omitempty"` + + // Date and time the service will no longer be available. + EndOfServiceTime *strfmt.DateTime `json:"end_of_service_time,omitempty"` + + // Denotes visibility. + Hidden *bool `json:"hidden,omitempty"` + + // Denotes lite metering visibility. + HideLiteMetering *bool `json:"hide_lite_metering,omitempty"` + + // Denotes whether an upgrade should occurr. + NoUpgradeNextStep *bool `json:"no_upgrade_next_step,omitempty"` +} + +// UnmarshalUIMetaData unmarshals an instance of UIMetaData from the specified map of raw messages. +func UnmarshalUIMetaData(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(UIMetaData) + err = core.UnmarshalModel(m, "strings", &obj.Strings, UnmarshalStrings) + if err != nil { + return + } + err = core.UnmarshalModel(m, "urls", &obj.Urls, UnmarshalUrls) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "embeddable_dashboard", &obj.EmbeddableDashboard) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "embeddable_dashboard_full_width", &obj.EmbeddableDashboardFullWidth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "navigation_order", &obj.NavigationOrder) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "not_creatable", &obj.NotCreatable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "primary_offering_id", &obj.PrimaryOfferingID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "accessible_during_provision", &obj.AccessibleDuringProvision) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "side_by_side_index", &obj.SideBySideIndex) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "end_of_service_time", &obj.EndOfServiceTime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hidden", &obj.Hidden) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hide_lite_metering", &obj.HideLiteMetering) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "no_upgrade_next_step", &obj.NoUpgradeNextStep) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// UIMetaMedia : Media-related metadata. +type UIMetaMedia struct { + // Caption for an image. + Caption *string `json:"caption,omitempty"` + + // URL for thumbnail image. + ThumbnailURL *string `json:"thumbnail_url,omitempty"` + + // Type of media. + Type *string `json:"type,omitempty"` + + // URL for media. + URL *string `json:"URL,omitempty"` + + // Information related to list delimiters. + Source *Bullets `json:"source,omitempty"` +} + +// UnmarshalUIMetaMedia unmarshals an instance of UIMetaMedia from the specified map of raw messages. +func UnmarshalUIMetaMedia(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(UIMetaMedia) + err = core.UnmarshalPrimitive(m, "caption", &obj.Caption) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "thumbnail_url", &obj.ThumbnailURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "URL", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source", &obj.Source, UnmarshalBullets) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Urls : UI based URLs. +type Urls struct { + // URL for documentation. + DocURL *string `json:"doc_url,omitempty"` + + // URL for usage instructions. + InstructionsURL *string `json:"instructions_url,omitempty"` + + // API URL. + APIURL *string `json:"api_url,omitempty"` + + // URL Creation UI / API. + CreateURL *string `json:"create_url,omitempty"` + + // URL to downlaod an SDK. + SdkDownloadURL *string `json:"sdk_download_url,omitempty"` + + // URL to the terms of use for your service. + TermsURL *string `json:"terms_url,omitempty"` + + // URL to the custom create page for your serivce. + CustomCreatePageURL *string `json:"custom_create_page_url,omitempty"` + + // URL to the catalog details page for your serivce. + CatalogDetailsURL *string `json:"catalog_details_url,omitempty"` + + // URL for deprecation documentation. + DeprecationDocURL *string `json:"deprecation_doc_url,omitempty"` + + // URL for dashboard. + DashboardURL *string `json:"dashboard_url,omitempty"` + + // URL for registration. + RegistrationURL *string `json:"registration_url,omitempty"` + + // URL for API documentation. + Apidocsurl *string `json:"apidocsurl,omitempty"` +} + +// UnmarshalUrls unmarshals an instance of Urls from the specified map of raw messages. +func UnmarshalUrls(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Urls) + err = core.UnmarshalPrimitive(m, "doc_url", &obj.DocURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instructions_url", &obj.InstructionsURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "api_url", &obj.APIURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "create_url", &obj.CreateURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "sdk_download_url", &obj.SdkDownloadURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "terms_url", &obj.TermsURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "custom_create_page_url", &obj.CustomCreatePageURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "catalog_details_url", &obj.CatalogDetailsURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deprecation_doc_url", &obj.DeprecationDocURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dashboard_url", &obj.DashboardURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "registration_url", &obj.RegistrationURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "apidocsurl", &obj.Apidocsurl) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// UpdateCatalogEntryOptions : The UpdateCatalogEntry options. +type UpdateCatalogEntryOptions struct { + // The object's unique ID. + ID *string `validate:"required,ne="` + + // Programmatic name for this catalog entry, which must be formatted like a CRN segment. See the display name in + // OverviewUI for a user-readable name. + Name *string `validate:"required"` + + // The type of catalog entry, **service**, **template**, **dashboard**, which determines the type and shape of the + // object. + Kind *string `validate:"required"` + + // Overview is nested in the top level. The key value pair is `[_language_]overview_ui`. + OverviewUI map[string]Overview `validate:"required"` + + // Image annotation for this catalog entry. The image is a URL. + Images *Image `validate:"required"` + + // Boolean value that determines the global visibility for the catalog entry, and its children. If it is not enabled, + // all plans are disabled. + Disabled *bool `validate:"required"` + + // A list of tags. For example, IBM, 3rd Party, Beta, GA, and Single Tenant. + Tags []string `validate:"required"` + + // Information related to the provider associated with a catalog entry. + Provider *Provider `validate:"required"` + + // The ID of the parent catalog entry if it exists. + ParentID *string + + // Boolean value that determines whether the catalog entry is a group. + Group *bool + + // Boolean value that describes whether the service is active. + Active *bool + + // Model used to describe metadata object that can be set. + Metadata *ObjectMetadataSet + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string + + // Reparenting object. In the body set the parent_id to a different parent. Or remove the parent_id field to reparent + // to the root of the catalog. If this is not set to 'true' then changing the parent_id in the body of the request will + // not be permitted. If this is 'true' and no change to parent_id then this is also error. This is to prevent + // accidental changing of parent. + Move *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the UpdateCatalogEntryOptions.Kind property. +// The type of catalog entry, **service**, **template**, **dashboard**, which determines the type and shape of the +// object. +const ( + UpdateCatalogEntryOptionsKindDashboardConst = "dashboard" + UpdateCatalogEntryOptionsKindServiceConst = "service" + UpdateCatalogEntryOptionsKindTemplateConst = "template" +) + +// NewUpdateCatalogEntryOptions : Instantiate UpdateCatalogEntryOptions +func (*GlobalCatalogV1) NewUpdateCatalogEntryOptions(id string, name string, kind string, overviewUI map[string]Overview, images *Image, disabled bool, tags []string, provider *Provider) *UpdateCatalogEntryOptions { + return &UpdateCatalogEntryOptions{ + ID: core.StringPtr(id), + Name: core.StringPtr(name), + Kind: core.StringPtr(kind), + OverviewUI: overviewUI, + Images: images, + Disabled: core.BoolPtr(disabled), + Tags: tags, + Provider: provider, + } +} + +// SetID : Allow user to set ID +func (options *UpdateCatalogEntryOptions) SetID(id string) *UpdateCatalogEntryOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetName : Allow user to set Name +func (options *UpdateCatalogEntryOptions) SetName(name string) *UpdateCatalogEntryOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetKind : Allow user to set Kind +func (options *UpdateCatalogEntryOptions) SetKind(kind string) *UpdateCatalogEntryOptions { + options.Kind = core.StringPtr(kind) + return options +} + +// SetOverviewUI : Allow user to set OverviewUI +func (options *UpdateCatalogEntryOptions) SetOverviewUI(overviewUI map[string]Overview) *UpdateCatalogEntryOptions { + options.OverviewUI = overviewUI + return options +} + +// SetImages : Allow user to set Images +func (options *UpdateCatalogEntryOptions) SetImages(images *Image) *UpdateCatalogEntryOptions { + options.Images = images + return options +} + +// SetDisabled : Allow user to set Disabled +func (options *UpdateCatalogEntryOptions) SetDisabled(disabled bool) *UpdateCatalogEntryOptions { + options.Disabled = core.BoolPtr(disabled) + return options +} + +// SetTags : Allow user to set Tags +func (options *UpdateCatalogEntryOptions) SetTags(tags []string) *UpdateCatalogEntryOptions { + options.Tags = tags + return options +} + +// SetProvider : Allow user to set Provider +func (options *UpdateCatalogEntryOptions) SetProvider(provider *Provider) *UpdateCatalogEntryOptions { + options.Provider = provider + return options +} + +// SetParentID : Allow user to set ParentID +func (options *UpdateCatalogEntryOptions) SetParentID(parentID string) *UpdateCatalogEntryOptions { + options.ParentID = core.StringPtr(parentID) + return options +} + +// SetGroup : Allow user to set Group +func (options *UpdateCatalogEntryOptions) SetGroup(group bool) *UpdateCatalogEntryOptions { + options.Group = core.BoolPtr(group) + return options +} + +// SetActive : Allow user to set Active +func (options *UpdateCatalogEntryOptions) SetActive(active bool) *UpdateCatalogEntryOptions { + options.Active = core.BoolPtr(active) + return options +} + +// SetMetadata : Allow user to set Metadata +func (options *UpdateCatalogEntryOptions) SetMetadata(metadata *ObjectMetadataSet) *UpdateCatalogEntryOptions { + options.Metadata = metadata + return options +} + +// SetAccount : Allow user to set Account +func (options *UpdateCatalogEntryOptions) SetAccount(account string) *UpdateCatalogEntryOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetMove : Allow user to set Move +func (options *UpdateCatalogEntryOptions) SetMove(move string) *UpdateCatalogEntryOptions { + options.Move = core.StringPtr(move) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateCatalogEntryOptions) SetHeaders(param map[string]string) *UpdateCatalogEntryOptions { + options.Headers = param + return options +} + +// UpdateVisibilityOptions : The UpdateVisibility options. +type UpdateVisibilityOptions struct { + // The object's unique ID. + ID *string `validate:"required,ne="` + + // Allows the visibility to be extenable. + Extendable *bool + + // Visibility details related to a catalog entry. + Include *VisibilityDetail + + // Visibility details related to a catalog entry. + Exclude *VisibilityDetail + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVisibilityOptions : Instantiate UpdateVisibilityOptions +func (*GlobalCatalogV1) NewUpdateVisibilityOptions(id string) *UpdateVisibilityOptions { + return &UpdateVisibilityOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *UpdateVisibilityOptions) SetID(id string) *UpdateVisibilityOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetExtendable : Allow user to set Extendable +func (options *UpdateVisibilityOptions) SetExtendable(extendable bool) *UpdateVisibilityOptions { + options.Extendable = core.BoolPtr(extendable) + return options +} + +// SetInclude : Allow user to set Include +func (options *UpdateVisibilityOptions) SetInclude(include *VisibilityDetail) *UpdateVisibilityOptions { + options.Include = include + return options +} + +// SetExclude : Allow user to set Exclude +func (options *UpdateVisibilityOptions) SetExclude(exclude *VisibilityDetail) *UpdateVisibilityOptions { + options.Exclude = exclude + return options +} + +// SetAccount : Allow user to set Account +func (options *UpdateVisibilityOptions) SetAccount(account string) *UpdateVisibilityOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVisibilityOptions) SetHeaders(param map[string]string) *UpdateVisibilityOptions { + options.Headers = param + return options +} + +// UploadArtifactOptions : The UploadArtifact options. +type UploadArtifactOptions struct { + // The object's unique ID. + ObjectID *string `validate:"required,ne="` + + // The artifact's ID. + ArtifactID *string `validate:"required,ne="` + + Artifact io.ReadCloser + + // The type of the input. + ContentType *string + + // This changes the scope of the request regardless of the authorization header. Example scopes are `account` and + // `global`. `account=global` is reqired if operating with a service ID that has a global admin policy, for example + // `GET /?account=global`. + Account *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUploadArtifactOptions : Instantiate UploadArtifactOptions +func (*GlobalCatalogV1) NewUploadArtifactOptions(objectID string, artifactID string) *UploadArtifactOptions { + return &UploadArtifactOptions{ + ObjectID: core.StringPtr(objectID), + ArtifactID: core.StringPtr(artifactID), + } +} + +// SetObjectID : Allow user to set ObjectID +func (options *UploadArtifactOptions) SetObjectID(objectID string) *UploadArtifactOptions { + options.ObjectID = core.StringPtr(objectID) + return options +} + +// SetArtifactID : Allow user to set ArtifactID +func (options *UploadArtifactOptions) SetArtifactID(artifactID string) *UploadArtifactOptions { + options.ArtifactID = core.StringPtr(artifactID) + return options +} + +// SetArtifact : Allow user to set Artifact +func (options *UploadArtifactOptions) SetArtifact(artifact io.ReadCloser) *UploadArtifactOptions { + options.Artifact = artifact + return options +} + +// SetContentType : Allow user to set ContentType +func (options *UploadArtifactOptions) SetContentType(contentType string) *UploadArtifactOptions { + options.ContentType = core.StringPtr(contentType) + return options +} + +// SetAccount : Allow user to set Account +func (options *UploadArtifactOptions) SetAccount(account string) *UploadArtifactOptions { + options.Account = core.StringPtr(account) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UploadArtifactOptions) SetHeaders(param map[string]string) *UploadArtifactOptions { + options.Headers = param + return options +} + +// Visibility : Information related to the visibility of a catalog entry. +type Visibility struct { + // This controls the overall visibility. It is an enum of *public*, *ibm_only*, and *private*. public means it is + // visible to all. ibm_only means it is visible to all IBM unless their account is explicitly excluded. private means + // it is visible only to the included accounts. + Restrictions *string `json:"restrictions,omitempty"` + + // IAM Scope-related information associated with a catalog entry. + Owner *string `json:"owner,omitempty"` + + // Allows the visibility to be extenable. + Extendable *bool `json:"extendable,omitempty"` + + // Visibility details related to a catalog entry. + Include *VisibilityDetail `json:"include,omitempty"` + + // Visibility details related to a catalog entry. + Exclude *VisibilityDetail `json:"exclude,omitempty"` + + // Determines whether the owning account has full control over the visibility of the entry such as adding non-IBM + // accounts to the whitelist and making entries `private`, `ibm_only` or `public`. + Approved *bool `json:"approved,omitempty"` +} + +// UnmarshalVisibility unmarshals an instance of Visibility from the specified map of raw messages. +func UnmarshalVisibility(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Visibility) + err = core.UnmarshalPrimitive(m, "restrictions", &obj.Restrictions) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "owner", &obj.Owner) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "extendable", &obj.Extendable) + if err != nil { + return + } + err = core.UnmarshalModel(m, "include", &obj.Include, UnmarshalVisibilityDetail) + if err != nil { + return + } + err = core.UnmarshalModel(m, "exclude", &obj.Exclude, UnmarshalVisibilityDetail) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "approved", &obj.Approved) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VisibilityDetail : Visibility details related to a catalog entry. +type VisibilityDetail struct { + // Information related to the accounts for which a catalog entry is visible. + Accounts *VisibilityDetailAccounts `json:"accounts" validate:"required"` +} + +// NewVisibilityDetail : Instantiate VisibilityDetail (Generic Model Constructor) +func (*GlobalCatalogV1) NewVisibilityDetail(accounts *VisibilityDetailAccounts) (model *VisibilityDetail, err error) { + model = &VisibilityDetail{ + Accounts: accounts, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalVisibilityDetail unmarshals an instance of VisibilityDetail from the specified map of raw messages. +func UnmarshalVisibilityDetail(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VisibilityDetail) + err = core.UnmarshalModel(m, "accounts", &obj.Accounts, UnmarshalVisibilityDetailAccounts) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VisibilityDetailAccounts : Information related to the accounts for which a catalog entry is visible. +type VisibilityDetailAccounts struct { + // (_accountid_) is the GUID of the account and the value is the scope of who set it. For setting visibility use "" as + // the value. It is replaced with the owner scope when saved. + Accountid *string `json:"_accountid_,omitempty"` +} + +// UnmarshalVisibilityDetailAccounts unmarshals an instance of VisibilityDetailAccounts from the specified map of raw messages. +func UnmarshalVisibilityDetailAccounts(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VisibilityDetailAccounts) + err = core.UnmarshalPrimitive(m, "_accountid_", &obj.Accountid) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} diff --git a/vendor/github.com/IBM/platform-services-go-sdk/iamidentityv1/iam_identity_v1.go b/vendor/github.com/IBM/platform-services-go-sdk/iamidentityv1/iam_identity_v1.go new file mode 100644 index 00000000000..d353f71810e --- /dev/null +++ b/vendor/github.com/IBM/platform-services-go-sdk/iamidentityv1/iam_identity_v1.go @@ -0,0 +1,5091 @@ +/** + * (C) Copyright IBM Corp. 2021. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 3.37.0-a85661cd-20210802-190136 + */ + +// Package iamidentityv1 : Operations and models for the IamIdentityV1 service +package iamidentityv1 + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/IBM/go-sdk-core/v5/core" + common "github.com/IBM/platform-services-go-sdk/common" + "github.com/go-openapi/strfmt" +) + +// IamIdentityV1 : The IAM Identity Service API allows for the management of Account Settings and Identities (Service +// IDs, ApiKeys). +// +// Version: 1.0.0 +type IamIdentityV1 struct { + Service *core.BaseService +} + +// DefaultServiceURL is the default URL to make service requests to. +const DefaultServiceURL = "https://iam.cloud.ibm.com" + +// DefaultServiceName is the default key used to find external configuration information. +const DefaultServiceName = "iam_identity" + +// IamIdentityV1Options : Service options +type IamIdentityV1Options struct { + ServiceName string + URL string + Authenticator core.Authenticator +} + +// NewIamIdentityV1UsingExternalConfig : constructs an instance of IamIdentityV1 with passed in options and external configuration. +func NewIamIdentityV1UsingExternalConfig(options *IamIdentityV1Options) (iamIdentity *IamIdentityV1, err error) { + if options.ServiceName == "" { + options.ServiceName = DefaultServiceName + } + + if options.Authenticator == nil { + options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) + if err != nil { + return + } + } + + iamIdentity, err = NewIamIdentityV1(options) + if err != nil { + return + } + + err = iamIdentity.Service.ConfigureService(options.ServiceName) + if err != nil { + return + } + + if options.URL != "" { + err = iamIdentity.Service.SetServiceURL(options.URL) + } + return +} + +// NewIamIdentityV1 : constructs an instance of IamIdentityV1 with passed in options. +func NewIamIdentityV1(options *IamIdentityV1Options) (service *IamIdentityV1, err error) { + serviceOptions := &core.ServiceOptions{ + URL: DefaultServiceURL, + Authenticator: options.Authenticator, + } + + baseService, err := core.NewBaseService(serviceOptions) + if err != nil { + return + } + + if options.URL != "" { + err = baseService.SetServiceURL(options.URL) + if err != nil { + return + } + } + + service = &IamIdentityV1{ + Service: baseService, + } + + return +} + +// GetServiceURLForRegion returns the service URL to be used for the specified region +func GetServiceURLForRegion(region string) (string, error) { + return "", fmt.Errorf("service does not support regional URLs") +} + +// Clone makes a copy of "iamIdentity" suitable for processing requests. +func (iamIdentity *IamIdentityV1) Clone() *IamIdentityV1 { + if core.IsNil(iamIdentity) { + return nil + } + clone := *iamIdentity + clone.Service = iamIdentity.Service.Clone() + return &clone +} + +// SetServiceURL sets the service URL +func (iamIdentity *IamIdentityV1) SetServiceURL(url string) error { + return iamIdentity.Service.SetServiceURL(url) +} + +// GetServiceURL returns the service URL +func (iamIdentity *IamIdentityV1) GetServiceURL() string { + return iamIdentity.Service.GetServiceURL() +} + +// SetDefaultHeaders sets HTTP headers to be sent in every request +func (iamIdentity *IamIdentityV1) SetDefaultHeaders(headers http.Header) { + iamIdentity.Service.SetDefaultHeaders(headers) +} + +// SetEnableGzipCompression sets the service's EnableGzipCompression field +func (iamIdentity *IamIdentityV1) SetEnableGzipCompression(enableGzip bool) { + iamIdentity.Service.SetEnableGzipCompression(enableGzip) +} + +// GetEnableGzipCompression returns the service's EnableGzipCompression field +func (iamIdentity *IamIdentityV1) GetEnableGzipCompression() bool { + return iamIdentity.Service.GetEnableGzipCompression() +} + +// EnableRetries enables automatic retries for requests invoked for this service instance. +// If either parameter is specified as 0, then a default value is used instead. +func (iamIdentity *IamIdentityV1) EnableRetries(maxRetries int, maxRetryInterval time.Duration) { + iamIdentity.Service.EnableRetries(maxRetries, maxRetryInterval) +} + +// DisableRetries disables automatic retries for requests invoked for this service instance. +func (iamIdentity *IamIdentityV1) DisableRetries() { + iamIdentity.Service.DisableRetries() +} + +// ListAPIKeys : Get API keys for a given service or user IAM ID and account ID +// Returns the list of API key details for a given service or user IAM ID and account ID. Users can manage user API keys +// for themself, or service ID API keys for service IDs that are bound to an entity they have access to. In case of +// service IDs and their API keys, a user must be either an account owner, a IBM Cloud org manager or IBM Cloud space +// developer in order to manage service IDs of the entity. +func (iamIdentity *IamIdentityV1) ListAPIKeys(listAPIKeysOptions *ListAPIKeysOptions) (result *APIKeyList, response *core.DetailedResponse, err error) { + return iamIdentity.ListAPIKeysWithContext(context.Background(), listAPIKeysOptions) +} + +// ListAPIKeysWithContext is an alternate form of the ListAPIKeys method which supports a Context parameter +func (iamIdentity *IamIdentityV1) ListAPIKeysWithContext(ctx context.Context, listAPIKeysOptions *ListAPIKeysOptions) (result *APIKeyList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listAPIKeysOptions, "listAPIKeysOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listAPIKeysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "ListAPIKeys") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listAPIKeysOptions.AccountID != nil { + builder.AddQuery("account_id", fmt.Sprint(*listAPIKeysOptions.AccountID)) + } + if listAPIKeysOptions.IamID != nil { + builder.AddQuery("iam_id", fmt.Sprint(*listAPIKeysOptions.IamID)) + } + if listAPIKeysOptions.Pagesize != nil { + builder.AddQuery("pagesize", fmt.Sprint(*listAPIKeysOptions.Pagesize)) + } + if listAPIKeysOptions.Pagetoken != nil { + builder.AddQuery("pagetoken", fmt.Sprint(*listAPIKeysOptions.Pagetoken)) + } + if listAPIKeysOptions.Scope != nil { + builder.AddQuery("scope", fmt.Sprint(*listAPIKeysOptions.Scope)) + } + if listAPIKeysOptions.Type != nil { + builder.AddQuery("type", fmt.Sprint(*listAPIKeysOptions.Type)) + } + if listAPIKeysOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listAPIKeysOptions.Sort)) + } + if listAPIKeysOptions.Order != nil { + builder.AddQuery("order", fmt.Sprint(*listAPIKeysOptions.Order)) + } + if listAPIKeysOptions.IncludeHistory != nil { + builder.AddQuery("include_history", fmt.Sprint(*listAPIKeysOptions.IncludeHistory)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAPIKeyList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateAPIKey : Create an API key +// Creates an API key for a UserID or service ID. Users can manage user API keys for themself, or service ID API keys +// for service IDs that are bound to an entity they have access to. +func (iamIdentity *IamIdentityV1) CreateAPIKey(createAPIKeyOptions *CreateAPIKeyOptions) (result *APIKey, response *core.DetailedResponse, err error) { + return iamIdentity.CreateAPIKeyWithContext(context.Background(), createAPIKeyOptions) +} + +// CreateAPIKeyWithContext is an alternate form of the CreateAPIKey method which supports a Context parameter +func (iamIdentity *IamIdentityV1) CreateAPIKeyWithContext(ctx context.Context, createAPIKeyOptions *CreateAPIKeyOptions) (result *APIKey, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createAPIKeyOptions, "createAPIKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createAPIKeyOptions, "createAPIKeyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createAPIKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "CreateAPIKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if createAPIKeyOptions.EntityLock != nil { + builder.AddHeader("Entity-Lock", fmt.Sprint(*createAPIKeyOptions.EntityLock)) + } + + body := make(map[string]interface{}) + if createAPIKeyOptions.Name != nil { + body["name"] = createAPIKeyOptions.Name + } + if createAPIKeyOptions.IamID != nil { + body["iam_id"] = createAPIKeyOptions.IamID + } + if createAPIKeyOptions.Description != nil { + body["description"] = createAPIKeyOptions.Description + } + if createAPIKeyOptions.AccountID != nil { + body["account_id"] = createAPIKeyOptions.AccountID + } + if createAPIKeyOptions.Apikey != nil { + body["apikey"] = createAPIKeyOptions.Apikey + } + if createAPIKeyOptions.StoreValue != nil { + body["store_value"] = createAPIKeyOptions.StoreValue + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAPIKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetAPIKeysDetails : Get details of an API key by its value +// Returns the details of an API key by its value. Users can manage user API keys for themself, or service ID API keys +// for service IDs that are bound to an entity they have access to. +func (iamIdentity *IamIdentityV1) GetAPIKeysDetails(getAPIKeysDetailsOptions *GetAPIKeysDetailsOptions) (result *APIKey, response *core.DetailedResponse, err error) { + return iamIdentity.GetAPIKeysDetailsWithContext(context.Background(), getAPIKeysDetailsOptions) +} + +// GetAPIKeysDetailsWithContext is an alternate form of the GetAPIKeysDetails method which supports a Context parameter +func (iamIdentity *IamIdentityV1) GetAPIKeysDetailsWithContext(ctx context.Context, getAPIKeysDetailsOptions *GetAPIKeysDetailsOptions) (result *APIKey, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(getAPIKeysDetailsOptions, "getAPIKeysDetailsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys/details`, nil) + if err != nil { + return + } + + for headerName, headerValue := range getAPIKeysDetailsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "GetAPIKeysDetails") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + if getAPIKeysDetailsOptions.IamAPIKey != nil { + builder.AddHeader("IAM-ApiKey", fmt.Sprint(*getAPIKeysDetailsOptions.IamAPIKey)) + } + + if getAPIKeysDetailsOptions.IncludeHistory != nil { + builder.AddQuery("include_history", fmt.Sprint(*getAPIKeysDetailsOptions.IncludeHistory)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAPIKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetAPIKey : Get details of an API key +// Returns the details of an API key. Users can manage user API keys for themself, or service ID API keys for service +// IDs that are bound to an entity they have access to. In case of service IDs and their API keys, a user must be +// either an account owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the +// entity. +func (iamIdentity *IamIdentityV1) GetAPIKey(getAPIKeyOptions *GetAPIKeyOptions) (result *APIKey, response *core.DetailedResponse, err error) { + return iamIdentity.GetAPIKeyWithContext(context.Background(), getAPIKeyOptions) +} + +// GetAPIKeyWithContext is an alternate form of the GetAPIKey method which supports a Context parameter +func (iamIdentity *IamIdentityV1) GetAPIKeyWithContext(ctx context.Context, getAPIKeyOptions *GetAPIKeyOptions) (result *APIKey, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getAPIKeyOptions, "getAPIKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getAPIKeyOptions, "getAPIKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getAPIKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getAPIKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "GetAPIKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getAPIKeyOptions.IncludeHistory != nil { + builder.AddQuery("include_history", fmt.Sprint(*getAPIKeyOptions.IncludeHistory)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAPIKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateAPIKey : Updates an API key +// Updates properties of an API key. This does NOT affect existing access tokens. Their token content will stay +// unchanged until the access token is refreshed. To update an API key, pass the property to be modified. To delete one +// property's value, pass the property with an empty value "".Users can manage user API keys for themself, or service ID +// API keys for service IDs that are bound to an entity they have access to. +func (iamIdentity *IamIdentityV1) UpdateAPIKey(updateAPIKeyOptions *UpdateAPIKeyOptions) (result *APIKey, response *core.DetailedResponse, err error) { + return iamIdentity.UpdateAPIKeyWithContext(context.Background(), updateAPIKeyOptions) +} + +// UpdateAPIKeyWithContext is an alternate form of the UpdateAPIKey method which supports a Context parameter +func (iamIdentity *IamIdentityV1) UpdateAPIKeyWithContext(ctx context.Context, updateAPIKeyOptions *UpdateAPIKeyOptions) (result *APIKey, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateAPIKeyOptions, "updateAPIKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateAPIKeyOptions, "updateAPIKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateAPIKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateAPIKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "UpdateAPIKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if updateAPIKeyOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateAPIKeyOptions.IfMatch)) + } + + body := make(map[string]interface{}) + if updateAPIKeyOptions.Name != nil { + body["name"] = updateAPIKeyOptions.Name + } + if updateAPIKeyOptions.Description != nil { + body["description"] = updateAPIKeyOptions.Description + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAPIKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteAPIKey : Deletes an API key +// Deletes an API key. Existing tokens will remain valid until expired. Users can manage user API keys for themself, or +// service ID API keys for service IDs that are bound to an entity they have access to. +func (iamIdentity *IamIdentityV1) DeleteAPIKey(deleteAPIKeyOptions *DeleteAPIKeyOptions) (response *core.DetailedResponse, err error) { + return iamIdentity.DeleteAPIKeyWithContext(context.Background(), deleteAPIKeyOptions) +} + +// DeleteAPIKeyWithContext is an alternate form of the DeleteAPIKey method which supports a Context parameter +func (iamIdentity *IamIdentityV1) DeleteAPIKeyWithContext(ctx context.Context, deleteAPIKeyOptions *DeleteAPIKeyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteAPIKeyOptions, "deleteAPIKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteAPIKeyOptions, "deleteAPIKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteAPIKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteAPIKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "DeleteAPIKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = iamIdentity.Service.Request(request, nil) + + return +} + +// LockAPIKey : Lock the API key +// Locks an API key by ID. Users can manage user API keys for themself, or service ID API keys for service IDs that are +// bound to an entity they have access to. In case of service IDs and their API keys, a user must be either an account +// owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the entity. +func (iamIdentity *IamIdentityV1) LockAPIKey(lockAPIKeyOptions *LockAPIKeyOptions) (response *core.DetailedResponse, err error) { + return iamIdentity.LockAPIKeyWithContext(context.Background(), lockAPIKeyOptions) +} + +// LockAPIKeyWithContext is an alternate form of the LockAPIKey method which supports a Context parameter +func (iamIdentity *IamIdentityV1) LockAPIKeyWithContext(ctx context.Context, lockAPIKeyOptions *LockAPIKeyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(lockAPIKeyOptions, "lockAPIKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(lockAPIKeyOptions, "lockAPIKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *lockAPIKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys/{id}/lock`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range lockAPIKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "LockAPIKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = iamIdentity.Service.Request(request, nil) + + return +} + +// UnlockAPIKey : Unlock the API key +// Unlocks an API key by ID. Users can manage user API keys for themself, or service ID API keys for service IDs that +// are bound to an entity they have access to. In case of service IDs and their API keys, a user must be either an +// account owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the entity. +func (iamIdentity *IamIdentityV1) UnlockAPIKey(unlockAPIKeyOptions *UnlockAPIKeyOptions) (response *core.DetailedResponse, err error) { + return iamIdentity.UnlockAPIKeyWithContext(context.Background(), unlockAPIKeyOptions) +} + +// UnlockAPIKeyWithContext is an alternate form of the UnlockAPIKey method which supports a Context parameter +func (iamIdentity *IamIdentityV1) UnlockAPIKeyWithContext(ctx context.Context, unlockAPIKeyOptions *UnlockAPIKeyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(unlockAPIKeyOptions, "unlockAPIKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(unlockAPIKeyOptions, "unlockAPIKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *unlockAPIKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/apikeys/{id}/lock`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range unlockAPIKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "UnlockAPIKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = iamIdentity.Service.Request(request, nil) + + return +} + +// ListServiceIds : List service IDs +// Returns a list of service IDs. Users can manage user API keys for themself, or service ID API keys for service IDs +// that are bound to an entity they have access to. Note: apikey details are only included in the response when +// creating a Service ID with an apikey. +func (iamIdentity *IamIdentityV1) ListServiceIds(listServiceIdsOptions *ListServiceIdsOptions) (result *ServiceIDList, response *core.DetailedResponse, err error) { + return iamIdentity.ListServiceIdsWithContext(context.Background(), listServiceIdsOptions) +} + +// ListServiceIdsWithContext is an alternate form of the ListServiceIds method which supports a Context parameter +func (iamIdentity *IamIdentityV1) ListServiceIdsWithContext(ctx context.Context, listServiceIdsOptions *ListServiceIdsOptions) (result *ServiceIDList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listServiceIdsOptions, "listServiceIdsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/serviceids/`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listServiceIdsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "ListServiceIds") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listServiceIdsOptions.AccountID != nil { + builder.AddQuery("account_id", fmt.Sprint(*listServiceIdsOptions.AccountID)) + } + if listServiceIdsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listServiceIdsOptions.Name)) + } + if listServiceIdsOptions.Pagesize != nil { + builder.AddQuery("pagesize", fmt.Sprint(*listServiceIdsOptions.Pagesize)) + } + if listServiceIdsOptions.Pagetoken != nil { + builder.AddQuery("pagetoken", fmt.Sprint(*listServiceIdsOptions.Pagetoken)) + } + if listServiceIdsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listServiceIdsOptions.Sort)) + } + if listServiceIdsOptions.Order != nil { + builder.AddQuery("order", fmt.Sprint(*listServiceIdsOptions.Order)) + } + if listServiceIdsOptions.IncludeHistory != nil { + builder.AddQuery("include_history", fmt.Sprint(*listServiceIdsOptions.IncludeHistory)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalServiceIDList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateServiceID : Create a service ID +// Creates a service ID for an IBM Cloud account. Users can manage user API keys for themself, or service ID API keys +// for service IDs that are bound to an entity they have access to. +func (iamIdentity *IamIdentityV1) CreateServiceID(createServiceIDOptions *CreateServiceIDOptions) (result *ServiceID, response *core.DetailedResponse, err error) { + return iamIdentity.CreateServiceIDWithContext(context.Background(), createServiceIDOptions) +} + +// CreateServiceIDWithContext is an alternate form of the CreateServiceID method which supports a Context parameter +func (iamIdentity *IamIdentityV1) CreateServiceIDWithContext(ctx context.Context, createServiceIDOptions *CreateServiceIDOptions) (result *ServiceID, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createServiceIDOptions, "createServiceIDOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createServiceIDOptions, "createServiceIDOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/serviceids/`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createServiceIDOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "CreateServiceID") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if createServiceIDOptions.EntityLock != nil { + builder.AddHeader("Entity-Lock", fmt.Sprint(*createServiceIDOptions.EntityLock)) + } + + body := make(map[string]interface{}) + if createServiceIDOptions.AccountID != nil { + body["account_id"] = createServiceIDOptions.AccountID + } + if createServiceIDOptions.Name != nil { + body["name"] = createServiceIDOptions.Name + } + if createServiceIDOptions.Description != nil { + body["description"] = createServiceIDOptions.Description + } + if createServiceIDOptions.UniqueInstanceCrns != nil { + body["unique_instance_crns"] = createServiceIDOptions.UniqueInstanceCrns + } + if createServiceIDOptions.Apikey != nil { + body["apikey"] = createServiceIDOptions.Apikey + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalServiceID) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetServiceID : Get details of a service ID +// Returns the details of a service ID. Users can manage user API keys for themself, or service ID API keys for service +// IDs that are bound to an entity they have access to. Note: apikey details are only included in the response when +// creating a Service ID with an apikey. +func (iamIdentity *IamIdentityV1) GetServiceID(getServiceIDOptions *GetServiceIDOptions) (result *ServiceID, response *core.DetailedResponse, err error) { + return iamIdentity.GetServiceIDWithContext(context.Background(), getServiceIDOptions) +} + +// GetServiceIDWithContext is an alternate form of the GetServiceID method which supports a Context parameter +func (iamIdentity *IamIdentityV1) GetServiceIDWithContext(ctx context.Context, getServiceIDOptions *GetServiceIDOptions) (result *ServiceID, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getServiceIDOptions, "getServiceIDOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getServiceIDOptions, "getServiceIDOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getServiceIDOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/serviceids/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getServiceIDOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "GetServiceID") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getServiceIDOptions.IncludeHistory != nil { + builder.AddQuery("include_history", fmt.Sprint(*getServiceIDOptions.IncludeHistory)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalServiceID) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateServiceID : Update service ID +// Updates properties of a service ID. This does NOT affect existing access tokens. Their token content will stay +// unchanged until the access token is refreshed. To update a service ID, pass the property to be modified. To delete +// one property's value, pass the property with an empty value "".Users can manage user API keys for themself, or +// service ID API keys for service IDs that are bound to an entity they have access to. Note: apikey details are only +// included in the response when creating a Service ID with an apikey. +func (iamIdentity *IamIdentityV1) UpdateServiceID(updateServiceIDOptions *UpdateServiceIDOptions) (result *ServiceID, response *core.DetailedResponse, err error) { + return iamIdentity.UpdateServiceIDWithContext(context.Background(), updateServiceIDOptions) +} + +// UpdateServiceIDWithContext is an alternate form of the UpdateServiceID method which supports a Context parameter +func (iamIdentity *IamIdentityV1) UpdateServiceIDWithContext(ctx context.Context, updateServiceIDOptions *UpdateServiceIDOptions) (result *ServiceID, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateServiceIDOptions, "updateServiceIDOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateServiceIDOptions, "updateServiceIDOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateServiceIDOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/serviceids/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateServiceIDOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "UpdateServiceID") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if updateServiceIDOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateServiceIDOptions.IfMatch)) + } + + body := make(map[string]interface{}) + if updateServiceIDOptions.Name != nil { + body["name"] = updateServiceIDOptions.Name + } + if updateServiceIDOptions.Description != nil { + body["description"] = updateServiceIDOptions.Description + } + if updateServiceIDOptions.UniqueInstanceCrns != nil { + body["unique_instance_crns"] = updateServiceIDOptions.UniqueInstanceCrns + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalServiceID) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteServiceID : Deletes a service ID and associated API keys +// Deletes a service ID and all API keys associated to it. Before deleting the service ID, all associated API keys are +// deleted. In case a Delete Conflict (status code 409) a retry of the request may help as the service ID is only +// deleted if the associated API keys were successfully deleted before. Users can manage user API keys for themself, or +// service ID API keys for service IDs that are bound to an entity they have access to. +func (iamIdentity *IamIdentityV1) DeleteServiceID(deleteServiceIDOptions *DeleteServiceIDOptions) (response *core.DetailedResponse, err error) { + return iamIdentity.DeleteServiceIDWithContext(context.Background(), deleteServiceIDOptions) +} + +// DeleteServiceIDWithContext is an alternate form of the DeleteServiceID method which supports a Context parameter +func (iamIdentity *IamIdentityV1) DeleteServiceIDWithContext(ctx context.Context, deleteServiceIDOptions *DeleteServiceIDOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteServiceIDOptions, "deleteServiceIDOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteServiceIDOptions, "deleteServiceIDOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteServiceIDOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/serviceids/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteServiceIDOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "DeleteServiceID") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = iamIdentity.Service.Request(request, nil) + + return +} + +// LockServiceID : Lock the service ID +// Locks a service ID by ID. Users can manage user API keys for themself, or service ID API keys for service IDs that +// are bound to an entity they have access to. In case of service IDs and their API keys, a user must be either an +// account owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the entity. +func (iamIdentity *IamIdentityV1) LockServiceID(lockServiceIDOptions *LockServiceIDOptions) (response *core.DetailedResponse, err error) { + return iamIdentity.LockServiceIDWithContext(context.Background(), lockServiceIDOptions) +} + +// LockServiceIDWithContext is an alternate form of the LockServiceID method which supports a Context parameter +func (iamIdentity *IamIdentityV1) LockServiceIDWithContext(ctx context.Context, lockServiceIDOptions *LockServiceIDOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(lockServiceIDOptions, "lockServiceIDOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(lockServiceIDOptions, "lockServiceIDOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *lockServiceIDOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/serviceids/{id}/lock`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range lockServiceIDOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "LockServiceID") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = iamIdentity.Service.Request(request, nil) + + return +} + +// UnlockServiceID : Unlock the service ID +// Unlocks a service ID by ID. Users can manage user API keys for themself, or service ID API keys for service IDs that +// are bound to an entity they have access to. In case of service IDs and their API keys, a user must be either an +// account owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs of the entity. +func (iamIdentity *IamIdentityV1) UnlockServiceID(unlockServiceIDOptions *UnlockServiceIDOptions) (response *core.DetailedResponse, err error) { + return iamIdentity.UnlockServiceIDWithContext(context.Background(), unlockServiceIDOptions) +} + +// UnlockServiceIDWithContext is an alternate form of the UnlockServiceID method which supports a Context parameter +func (iamIdentity *IamIdentityV1) UnlockServiceIDWithContext(ctx context.Context, unlockServiceIDOptions *UnlockServiceIDOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(unlockServiceIDOptions, "unlockServiceIDOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(unlockServiceIDOptions, "unlockServiceIDOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *unlockServiceIDOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/serviceids/{id}/lock`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range unlockServiceIDOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "UnlockServiceID") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = iamIdentity.Service.Request(request, nil) + + return +} + +// CreateProfile : Create a trusted profile +// Create a trusted profile for a given account ID. +func (iamIdentity *IamIdentityV1) CreateProfile(createProfileOptions *CreateProfileOptions) (result *TrustedProfile, response *core.DetailedResponse, err error) { + return iamIdentity.CreateProfileWithContext(context.Background(), createProfileOptions) +} + +// CreateProfileWithContext is an alternate form of the CreateProfile method which supports a Context parameter +func (iamIdentity *IamIdentityV1) CreateProfileWithContext(ctx context.Context, createProfileOptions *CreateProfileOptions) (result *TrustedProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createProfileOptions, "createProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createProfileOptions, "createProfileOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "CreateProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if createProfileOptions.Name != nil { + body["name"] = createProfileOptions.Name + } + if createProfileOptions.AccountID != nil { + body["account_id"] = createProfileOptions.AccountID + } + if createProfileOptions.Description != nil { + body["description"] = createProfileOptions.Description + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTrustedProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListProfiles : List trusted profiles +// List the trusted profiles in an account. The `account_id` query parameter determines the account from which to +// retrieve the list of trusted profiles. +func (iamIdentity *IamIdentityV1) ListProfiles(listProfilesOptions *ListProfilesOptions) (result *TrustedProfilesList, response *core.DetailedResponse, err error) { + return iamIdentity.ListProfilesWithContext(context.Background(), listProfilesOptions) +} + +// ListProfilesWithContext is an alternate form of the ListProfiles method which supports a Context parameter +func (iamIdentity *IamIdentityV1) ListProfilesWithContext(ctx context.Context, listProfilesOptions *ListProfilesOptions) (result *TrustedProfilesList, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listProfilesOptions, "listProfilesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listProfilesOptions, "listProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "ListProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("account_id", fmt.Sprint(*listProfilesOptions.AccountID)) + if listProfilesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listProfilesOptions.Name)) + } + if listProfilesOptions.Pagesize != nil { + builder.AddQuery("pagesize", fmt.Sprint(*listProfilesOptions.Pagesize)) + } + if listProfilesOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listProfilesOptions.Sort)) + } + if listProfilesOptions.Order != nil { + builder.AddQuery("order", fmt.Sprint(*listProfilesOptions.Order)) + } + if listProfilesOptions.IncludeHistory != nil { + builder.AddQuery("include_history", fmt.Sprint(*listProfilesOptions.IncludeHistory)) + } + if listProfilesOptions.Pagetoken != nil { + builder.AddQuery("pagetoken", fmt.Sprint(*listProfilesOptions.Pagetoken)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTrustedProfilesList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetProfile : Get a trusted profile +// Retrieve a trusted profile by its `profile-id`. Only the trusted profile's data is returned (`name`, `description`, +// `iam_id`, etc.), not the federated users or compute resources that qualify to apply the trusted profile. +func (iamIdentity *IamIdentityV1) GetProfile(getProfileOptions *GetProfileOptions) (result *TrustedProfile, response *core.DetailedResponse, err error) { + return iamIdentity.GetProfileWithContext(context.Background(), getProfileOptions) +} + +// GetProfileWithContext is an alternate form of the GetProfile method which supports a Context parameter +func (iamIdentity *IamIdentityV1) GetProfileWithContext(ctx context.Context, getProfileOptions *GetProfileOptions) (result *TrustedProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getProfileOptions, "getProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getProfileOptions, "getProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "profile-id": *getProfileOptions.ProfileID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "GetProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTrustedProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateProfile : Update a trusted profile +// Update the name or description of an existing trusted profile. +func (iamIdentity *IamIdentityV1) UpdateProfile(updateProfileOptions *UpdateProfileOptions) (result *TrustedProfile, response *core.DetailedResponse, err error) { + return iamIdentity.UpdateProfileWithContext(context.Background(), updateProfileOptions) +} + +// UpdateProfileWithContext is an alternate form of the UpdateProfile method which supports a Context parameter +func (iamIdentity *IamIdentityV1) UpdateProfileWithContext(ctx context.Context, updateProfileOptions *UpdateProfileOptions) (result *TrustedProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateProfileOptions, "updateProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateProfileOptions, "updateProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "profile-id": *updateProfileOptions.ProfileID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "UpdateProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if updateProfileOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateProfileOptions.IfMatch)) + } + + body := make(map[string]interface{}) + if updateProfileOptions.Name != nil { + body["name"] = updateProfileOptions.Name + } + if updateProfileOptions.Description != nil { + body["description"] = updateProfileOptions.Description + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalTrustedProfile) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteProfile : Delete a trusted profile +// Delete a trusted profile. When you delete trusted profile, compute resources and federated users are unlinked from +// the profile and can no longer apply the trusted profile identity. +func (iamIdentity *IamIdentityV1) DeleteProfile(deleteProfileOptions *DeleteProfileOptions) (response *core.DetailedResponse, err error) { + return iamIdentity.DeleteProfileWithContext(context.Background(), deleteProfileOptions) +} + +// DeleteProfileWithContext is an alternate form of the DeleteProfile method which supports a Context parameter +func (iamIdentity *IamIdentityV1) DeleteProfileWithContext(ctx context.Context, deleteProfileOptions *DeleteProfileOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteProfileOptions, "deleteProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteProfileOptions, "deleteProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "profile-id": *deleteProfileOptions.ProfileID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "DeleteProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = iamIdentity.Service.Request(request, nil) + + return +} + +// CreateClaimRule : Create claim rule for a trusted profile +// Create a claim rule for a trusted profile. There is a limit of 20 rules per trusted profile. +func (iamIdentity *IamIdentityV1) CreateClaimRule(createClaimRuleOptions *CreateClaimRuleOptions) (result *ProfileClaimRule, response *core.DetailedResponse, err error) { + return iamIdentity.CreateClaimRuleWithContext(context.Background(), createClaimRuleOptions) +} + +// CreateClaimRuleWithContext is an alternate form of the CreateClaimRule method which supports a Context parameter +func (iamIdentity *IamIdentityV1) CreateClaimRuleWithContext(ctx context.Context, createClaimRuleOptions *CreateClaimRuleOptions) (result *ProfileClaimRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createClaimRuleOptions, "createClaimRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createClaimRuleOptions, "createClaimRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "profile-id": *createClaimRuleOptions.ProfileID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createClaimRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "CreateClaimRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if createClaimRuleOptions.Type != nil { + body["type"] = createClaimRuleOptions.Type + } + if createClaimRuleOptions.Conditions != nil { + body["conditions"] = createClaimRuleOptions.Conditions + } + if createClaimRuleOptions.Context != nil { + body["context"] = createClaimRuleOptions.Context + } + if createClaimRuleOptions.Name != nil { + body["name"] = createClaimRuleOptions.Name + } + if createClaimRuleOptions.RealmName != nil { + body["realm_name"] = createClaimRuleOptions.RealmName + } + if createClaimRuleOptions.CrType != nil { + body["cr_type"] = createClaimRuleOptions.CrType + } + if createClaimRuleOptions.Expiration != nil { + body["expiration"] = createClaimRuleOptions.Expiration + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileClaimRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListClaimRules : List claim rules for a trusted profile +// Get a list of all claim rules for a trusted profile. The `profile-id` query parameter determines the profile from +// which to retrieve the list of claim rules. +func (iamIdentity *IamIdentityV1) ListClaimRules(listClaimRulesOptions *ListClaimRulesOptions) (result *ProfileClaimRuleList, response *core.DetailedResponse, err error) { + return iamIdentity.ListClaimRulesWithContext(context.Background(), listClaimRulesOptions) +} + +// ListClaimRulesWithContext is an alternate form of the ListClaimRules method which supports a Context parameter +func (iamIdentity *IamIdentityV1) ListClaimRulesWithContext(ctx context.Context, listClaimRulesOptions *ListClaimRulesOptions) (result *ProfileClaimRuleList, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listClaimRulesOptions, "listClaimRulesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listClaimRulesOptions, "listClaimRulesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "profile-id": *listClaimRulesOptions.ProfileID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listClaimRulesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "ListClaimRules") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileClaimRuleList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetClaimRule : Get a claim rule for a trusted profile +// A specific claim rule can be fetched for a given trusted profile ID and rule ID. +func (iamIdentity *IamIdentityV1) GetClaimRule(getClaimRuleOptions *GetClaimRuleOptions) (result *ProfileClaimRule, response *core.DetailedResponse, err error) { + return iamIdentity.GetClaimRuleWithContext(context.Background(), getClaimRuleOptions) +} + +// GetClaimRuleWithContext is an alternate form of the GetClaimRule method which supports a Context parameter +func (iamIdentity *IamIdentityV1) GetClaimRuleWithContext(ctx context.Context, getClaimRuleOptions *GetClaimRuleOptions) (result *ProfileClaimRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getClaimRuleOptions, "getClaimRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getClaimRuleOptions, "getClaimRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "profile-id": *getClaimRuleOptions.ProfileID, + "rule-id": *getClaimRuleOptions.RuleID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/rules/{rule-id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getClaimRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "GetClaimRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileClaimRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateClaimRule : Update claim rule for a trusted profile +// Update a specific claim rule for a given trusted profile ID and rule ID. +func (iamIdentity *IamIdentityV1) UpdateClaimRule(updateClaimRuleOptions *UpdateClaimRuleOptions) (result *ProfileClaimRule, response *core.DetailedResponse, err error) { + return iamIdentity.UpdateClaimRuleWithContext(context.Background(), updateClaimRuleOptions) +} + +// UpdateClaimRuleWithContext is an alternate form of the UpdateClaimRule method which supports a Context parameter +func (iamIdentity *IamIdentityV1) UpdateClaimRuleWithContext(ctx context.Context, updateClaimRuleOptions *UpdateClaimRuleOptions) (result *ProfileClaimRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateClaimRuleOptions, "updateClaimRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateClaimRuleOptions, "updateClaimRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "profile-id": *updateClaimRuleOptions.ProfileID, + "rule-id": *updateClaimRuleOptions.RuleID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/rules/{rule-id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateClaimRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "UpdateClaimRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if updateClaimRuleOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateClaimRuleOptions.IfMatch)) + } + + body := make(map[string]interface{}) + if updateClaimRuleOptions.Type != nil { + body["type"] = updateClaimRuleOptions.Type + } + if updateClaimRuleOptions.Conditions != nil { + body["conditions"] = updateClaimRuleOptions.Conditions + } + if updateClaimRuleOptions.Context != nil { + body["context"] = updateClaimRuleOptions.Context + } + if updateClaimRuleOptions.Name != nil { + body["name"] = updateClaimRuleOptions.Name + } + if updateClaimRuleOptions.RealmName != nil { + body["realm_name"] = updateClaimRuleOptions.RealmName + } + if updateClaimRuleOptions.CrType != nil { + body["cr_type"] = updateClaimRuleOptions.CrType + } + if updateClaimRuleOptions.Expiration != nil { + body["expiration"] = updateClaimRuleOptions.Expiration + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileClaimRule) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteClaimRule : Delete a claim rule +// Delete a claim rule. When you delete a claim rule, federated user or compute resources are no longer required to meet +// the conditions of the claim rule in order to apply the trusted profile. +func (iamIdentity *IamIdentityV1) DeleteClaimRule(deleteClaimRuleOptions *DeleteClaimRuleOptions) (response *core.DetailedResponse, err error) { + return iamIdentity.DeleteClaimRuleWithContext(context.Background(), deleteClaimRuleOptions) +} + +// DeleteClaimRuleWithContext is an alternate form of the DeleteClaimRule method which supports a Context parameter +func (iamIdentity *IamIdentityV1) DeleteClaimRuleWithContext(ctx context.Context, deleteClaimRuleOptions *DeleteClaimRuleOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteClaimRuleOptions, "deleteClaimRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteClaimRuleOptions, "deleteClaimRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "profile-id": *deleteClaimRuleOptions.ProfileID, + "rule-id": *deleteClaimRuleOptions.RuleID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/rules/{rule-id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteClaimRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "DeleteClaimRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = iamIdentity.Service.Request(request, nil) + + return +} + +// CreateLink : Create link to a trusted profile +// Create a direct link between a specific compute resource and a trusted profile, rather than creating conditions that +// a compute resource must fulfill to apply a trusted profile. +func (iamIdentity *IamIdentityV1) CreateLink(createLinkOptions *CreateLinkOptions) (result *ProfileLink, response *core.DetailedResponse, err error) { + return iamIdentity.CreateLinkWithContext(context.Background(), createLinkOptions) +} + +// CreateLinkWithContext is an alternate form of the CreateLink method which supports a Context parameter +func (iamIdentity *IamIdentityV1) CreateLinkWithContext(ctx context.Context, createLinkOptions *CreateLinkOptions) (result *ProfileLink, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLinkOptions, "createLinkOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createLinkOptions, "createLinkOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "profile-id": *createLinkOptions.ProfileID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/links`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLinkOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "CreateLink") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if createLinkOptions.CrType != nil { + body["cr_type"] = createLinkOptions.CrType + } + if createLinkOptions.Link != nil { + body["link"] = createLinkOptions.Link + } + if createLinkOptions.Name != nil { + body["name"] = createLinkOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileLink) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListLinks : List links to a trusted profile +// Get a list of links to a trusted profile. +func (iamIdentity *IamIdentityV1) ListLinks(listLinksOptions *ListLinksOptions) (result *ProfileLinkList, response *core.DetailedResponse, err error) { + return iamIdentity.ListLinksWithContext(context.Background(), listLinksOptions) +} + +// ListLinksWithContext is an alternate form of the ListLinks method which supports a Context parameter +func (iamIdentity *IamIdentityV1) ListLinksWithContext(ctx context.Context, listLinksOptions *ListLinksOptions) (result *ProfileLinkList, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLinksOptions, "listLinksOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listLinksOptions, "listLinksOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "profile-id": *listLinksOptions.ProfileID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/links`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLinksOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "ListLinks") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileLinkList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetLink : Get link to a trusted profile +// Get a specific link to a trusted profile by `link_id`. +func (iamIdentity *IamIdentityV1) GetLink(getLinkOptions *GetLinkOptions) (result *ProfileLink, response *core.DetailedResponse, err error) { + return iamIdentity.GetLinkWithContext(context.Background(), getLinkOptions) +} + +// GetLinkWithContext is an alternate form of the GetLink method which supports a Context parameter +func (iamIdentity *IamIdentityV1) GetLinkWithContext(ctx context.Context, getLinkOptions *GetLinkOptions) (result *ProfileLink, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLinkOptions, "getLinkOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLinkOptions, "getLinkOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "profile-id": *getLinkOptions.ProfileID, + "link-id": *getLinkOptions.LinkID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/links/{link-id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLinkOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "GetLink") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalProfileLink) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteLink : Delete link to a trusted profile +// Delete a link between a compute resource and a trusted profile. +func (iamIdentity *IamIdentityV1) DeleteLink(deleteLinkOptions *DeleteLinkOptions) (response *core.DetailedResponse, err error) { + return iamIdentity.DeleteLinkWithContext(context.Background(), deleteLinkOptions) +} + +// DeleteLinkWithContext is an alternate form of the DeleteLink method which supports a Context parameter +func (iamIdentity *IamIdentityV1) DeleteLinkWithContext(ctx context.Context, deleteLinkOptions *DeleteLinkOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLinkOptions, "deleteLinkOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteLinkOptions, "deleteLinkOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "profile-id": *deleteLinkOptions.ProfileID, + "link-id": *deleteLinkOptions.LinkID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/profiles/{profile-id}/links/{link-id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLinkOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "DeleteLink") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = iamIdentity.Service.Request(request, nil) + + return +} + +// GetAccountSettings : Get account configurations +// Returns the details of an account's configuration. +func (iamIdentity *IamIdentityV1) GetAccountSettings(getAccountSettingsOptions *GetAccountSettingsOptions) (result *AccountSettingsResponse, response *core.DetailedResponse, err error) { + return iamIdentity.GetAccountSettingsWithContext(context.Background(), getAccountSettingsOptions) +} + +// GetAccountSettingsWithContext is an alternate form of the GetAccountSettings method which supports a Context parameter +func (iamIdentity *IamIdentityV1) GetAccountSettingsWithContext(ctx context.Context, getAccountSettingsOptions *GetAccountSettingsOptions) (result *AccountSettingsResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getAccountSettingsOptions, "getAccountSettingsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getAccountSettingsOptions, "getAccountSettingsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "account_id": *getAccountSettingsOptions.AccountID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/accounts/{account_id}/settings/identity`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getAccountSettingsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "GetAccountSettings") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if getAccountSettingsOptions.IncludeHistory != nil { + builder.AddQuery("include_history", fmt.Sprint(*getAccountSettingsOptions.IncludeHistory)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccountSettingsResponse) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateAccountSettings : Update account configurations +// Allows a user to configure settings on their account with regards to MFA, session lifetimes, access control for +// creating new identities, and enforcing IP restrictions on token creation. +func (iamIdentity *IamIdentityV1) UpdateAccountSettings(updateAccountSettingsOptions *UpdateAccountSettingsOptions) (result *AccountSettingsResponse, response *core.DetailedResponse, err error) { + return iamIdentity.UpdateAccountSettingsWithContext(context.Background(), updateAccountSettingsOptions) +} + +// UpdateAccountSettingsWithContext is an alternate form of the UpdateAccountSettings method which supports a Context parameter +func (iamIdentity *IamIdentityV1) UpdateAccountSettingsWithContext(ctx context.Context, updateAccountSettingsOptions *UpdateAccountSettingsOptions) (result *AccountSettingsResponse, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateAccountSettingsOptions, "updateAccountSettingsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateAccountSettingsOptions, "updateAccountSettingsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "account_id": *updateAccountSettingsOptions.AccountID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = iamIdentity.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(iamIdentity.Service.Options.URL, `/v1/accounts/{account_id}/settings/identity`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateAccountSettingsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("iam_identity", "V1", "UpdateAccountSettings") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if updateAccountSettingsOptions.IfMatch != nil { + builder.AddHeader("If-Match", fmt.Sprint(*updateAccountSettingsOptions.IfMatch)) + } + + body := make(map[string]interface{}) + if updateAccountSettingsOptions.RestrictCreateServiceID != nil { + body["restrict_create_service_id"] = updateAccountSettingsOptions.RestrictCreateServiceID + } + if updateAccountSettingsOptions.RestrictCreatePlatformApikey != nil { + body["restrict_create_platform_apikey"] = updateAccountSettingsOptions.RestrictCreatePlatformApikey + } + if updateAccountSettingsOptions.AllowedIPAddresses != nil { + body["allowed_ip_addresses"] = updateAccountSettingsOptions.AllowedIPAddresses + } + if updateAccountSettingsOptions.Mfa != nil { + body["mfa"] = updateAccountSettingsOptions.Mfa + } + if updateAccountSettingsOptions.SessionExpirationInSeconds != nil { + body["session_expiration_in_seconds"] = updateAccountSettingsOptions.SessionExpirationInSeconds + } + if updateAccountSettingsOptions.SessionInvalidationInSeconds != nil { + body["session_invalidation_in_seconds"] = updateAccountSettingsOptions.SessionInvalidationInSeconds + } + if updateAccountSettingsOptions.MaxSessionsPerIdentity != nil { + body["max_sessions_per_identity"] = updateAccountSettingsOptions.MaxSessionsPerIdentity + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = iamIdentity.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAccountSettingsResponse) + if err != nil { + return + } + response.Result = result + } + + return +} + +// AccountSettingsResponse : Response body format for Account Settings REST requests. +type AccountSettingsResponse struct { + // Context with key properties for problem determination. + Context *ResponseContext `json:"context,omitempty"` + + // Unique ID of the account. + AccountID *string `json:"account_id" validate:"required"` + + // Defines whether or not creating a Service Id is access controlled. Valid values: + // * RESTRICTED - to apply access control + // * NOT_RESTRICTED - to remove access control + // * NOT_SET - to 'unset' a previous set value. + RestrictCreateServiceID *string `json:"restrict_create_service_id" validate:"required"` + + // Defines whether or not creating platform API keys is access controlled. Valid values: + // * RESTRICTED - to apply access control + // * NOT_RESTRICTED - to remove access control + // * NOT_SET - to 'unset' a previous set value. + RestrictCreatePlatformApikey *string `json:"restrict_create_platform_apikey" validate:"required"` + + // Defines the IP addresses and subnets from which IAM tokens can be created for the account. + AllowedIPAddresses *string `json:"allowed_ip_addresses" validate:"required"` + + // Version of the account settings. + EntityTag *string `json:"entity_tag" validate:"required"` + + // Defines the MFA trait for the account. Valid values: + // * NONE - No MFA trait set + // * TOTP - For all non-federated IBMId users + // * TOTP4ALL - For all users + // * LEVEL1 - Email-based MFA for all users + // * LEVEL2 - TOTP-based MFA for all users + // * LEVEL3 - U2F MFA for all users. + Mfa *string `json:"mfa" validate:"required"` + + // History of the Account Settings. + History []EnityHistoryRecord `json:"history,omitempty"` + + // Defines the session expiration in seconds for the account. Valid values: + // * Any whole number between between '900' and '86400' + // * NOT_SET - To unset account setting and use service default. + SessionExpirationInSeconds *string `json:"session_expiration_in_seconds" validate:"required"` + + // Defines the period of time in seconds in which a session will be invalidated due to inactivity. Valid values: + // * Any whole number between '900' and '7200' + // * NOT_SET - To unset account setting and use service default. + SessionInvalidationInSeconds *string `json:"session_invalidation_in_seconds" validate:"required"` + + // Defines the max allowed sessions per identity required by the account. Valid values: + // * Any whole number greater than 0 + // * NOT_SET - To unset account setting and use service default. + MaxSessionsPerIdentity *string `json:"max_sessions_per_identity" validate:"required"` +} + +// Constants associated with the AccountSettingsResponse.RestrictCreateServiceID property. +// Defines whether or not creating a Service Id is access controlled. Valid values: +// * RESTRICTED - to apply access control +// * NOT_RESTRICTED - to remove access control +// * NOT_SET - to 'unset' a previous set value. +const ( + AccountSettingsResponseRestrictCreateServiceIDNotRestrictedConst = "NOT_RESTRICTED" + AccountSettingsResponseRestrictCreateServiceIDNotSetConst = "NOT_SET" + AccountSettingsResponseRestrictCreateServiceIDRestrictedConst = "RESTRICTED" +) + +// Constants associated with the AccountSettingsResponse.RestrictCreatePlatformApikey property. +// Defines whether or not creating platform API keys is access controlled. Valid values: +// * RESTRICTED - to apply access control +// * NOT_RESTRICTED - to remove access control +// * NOT_SET - to 'unset' a previous set value. +const ( + AccountSettingsResponseRestrictCreatePlatformApikeyNotRestrictedConst = "NOT_RESTRICTED" + AccountSettingsResponseRestrictCreatePlatformApikeyNotSetConst = "NOT_SET" + AccountSettingsResponseRestrictCreatePlatformApikeyRestrictedConst = "RESTRICTED" +) + +// Constants associated with the AccountSettingsResponse.Mfa property. +// Defines the MFA trait for the account. Valid values: +// * NONE - No MFA trait set +// * TOTP - For all non-federated IBMId users +// * TOTP4ALL - For all users +// * LEVEL1 - Email-based MFA for all users +// * LEVEL2 - TOTP-based MFA for all users +// * LEVEL3 - U2F MFA for all users. +const ( + AccountSettingsResponseMfaLevel1Const = "LEVEL1" + AccountSettingsResponseMfaLevel2Const = "LEVEL2" + AccountSettingsResponseMfaLevel3Const = "LEVEL3" + AccountSettingsResponseMfaNoneConst = "NONE" + AccountSettingsResponseMfaTotpConst = "TOTP" + AccountSettingsResponseMfaTotp4allConst = "TOTP4ALL" +) + +// UnmarshalAccountSettingsResponse unmarshals an instance of AccountSettingsResponse from the specified map of raw messages. +func UnmarshalAccountSettingsResponse(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AccountSettingsResponse) + err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "restrict_create_service_id", &obj.RestrictCreateServiceID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "restrict_create_platform_apikey", &obj.RestrictCreatePlatformApikey) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allowed_ip_addresses", &obj.AllowedIPAddresses) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mfa", &obj.Mfa) + if err != nil { + return + } + err = core.UnmarshalModel(m, "history", &obj.History, UnmarshalEnityHistoryRecord) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "session_expiration_in_seconds", &obj.SessionExpirationInSeconds) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "session_invalidation_in_seconds", &obj.SessionInvalidationInSeconds) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_sessions_per_identity", &obj.MaxSessionsPerIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// APIKey : Response body format for API key V1 REST requests. +type APIKey struct { + // Context with key properties for problem determination. + Context *ResponseContext `json:"context,omitempty"` + + // Unique identifier of this API Key. + ID *string `json:"id" validate:"required"` + + // Version of the API Key details object. You need to specify this value when updating the API key to avoid stale + // updates. + EntityTag *string `json:"entity_tag,omitempty"` + + // Cloud Resource Name of the item. Example Cloud Resource Name: + // 'crn:v1:bluemix:public:iam-identity:us-south:a/myaccount::apikey:1234-9012-5678'. + CRN *string `json:"crn" validate:"required"` + + // The API key cannot be changed if set to true. + Locked *bool `json:"locked" validate:"required"` + + // If set contains a date time string of the creation date in ISO format. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // IAM ID of the user or service which created the API key. + CreatedBy *string `json:"created_by" validate:"required"` + + // If set contains a date time string of the last modification date in ISO format. + ModifiedAt *strfmt.DateTime `json:"modified_at,omitempty"` + + // Name of the API key. The name is not checked for uniqueness. Therefore multiple names with the same value can exist. + // Access is done via the UUID of the API key. + Name *string `json:"name" validate:"required"` + + // The optional description of the API key. The 'description' property is only available if a description was provided + // during a create of an API key. + Description *string `json:"description,omitempty"` + + // The iam_id that this API key authenticates. + IamID *string `json:"iam_id" validate:"required"` + + // ID of the account that this API key authenticates for. + AccountID *string `json:"account_id" validate:"required"` + + // The API key value. This property only contains the API key value for the following cases: create an API key, update + // a service ID API key that stores the API key value as retrievable, or get a service ID API key that stores the API + // key value as retrievable. All other operations don't return the API key value, for example all user API key related + // operations, except for create, don't contain the API key value. + Apikey *string `json:"apikey" validate:"required"` + + // History of the API key. + History []EnityHistoryRecord `json:"history,omitempty"` +} + +// UnmarshalAPIKey unmarshals an instance of APIKey from the specified map of raw messages. +func UnmarshalAPIKey(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(APIKey) + err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "locked", &obj.Locked) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "modified_at", &obj.ModifiedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iam_id", &obj.IamID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "apikey", &obj.Apikey) + if err != nil { + return + } + err = core.UnmarshalModel(m, "history", &obj.History, UnmarshalEnityHistoryRecord) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// APIKeyInsideCreateServiceIDRequest : Parameters for the API key in the Create service Id V1 REST request. +type APIKeyInsideCreateServiceIDRequest struct { + // Name of the API key. The name is not checked for uniqueness. Therefore multiple names with the same value can exist. + // Access is done via the UUID of the API key. + Name *string `json:"name" validate:"required"` + + // The optional description of the API key. The 'description' property is only available if a description was provided + // during a create of an API key. + Description *string `json:"description,omitempty"` + + // You can optionally passthrough the API key value for this API key. If passed, NO validation of that apiKey value is + // done, i.e. the value can be non-URL safe. If omitted, the API key management will create an URL safe opaque API key + // value. The value of the API key is checked for uniqueness. Please ensure enough variations when passing in this + // value. + Apikey *string `json:"apikey,omitempty"` + + // Send true or false to set whether the API key value is retrievable in the future by using the Get details of an API + // key request. If you create an API key for a user, you must specify `false` or omit the value. We don't allow storing + // of API keys for users. + StoreValue *bool `json:"store_value,omitempty"` +} + +// NewAPIKeyInsideCreateServiceIDRequest : Instantiate APIKeyInsideCreateServiceIDRequest (Generic Model Constructor) +func (*IamIdentityV1) NewAPIKeyInsideCreateServiceIDRequest(name string) (_model *APIKeyInsideCreateServiceIDRequest, err error) { + _model = &APIKeyInsideCreateServiceIDRequest{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalAPIKeyInsideCreateServiceIDRequest unmarshals an instance of APIKeyInsideCreateServiceIDRequest from the specified map of raw messages. +func UnmarshalAPIKeyInsideCreateServiceIDRequest(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(APIKeyInsideCreateServiceIDRequest) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "apikey", &obj.Apikey) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "store_value", &obj.StoreValue) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// APIKeyList : Response body format for the List API keys V1 REST request. +type APIKeyList struct { + // Context with key properties for problem determination. + Context *ResponseContext `json:"context,omitempty"` + + // The offset of the current page. + Offset *int64 `json:"offset,omitempty"` + + // Optional size of a single page. Default is 20 items per page. Valid range is 1 to 100. + Limit *int64 `json:"limit,omitempty"` + + // Link to the first page. + First *string `json:"first,omitempty"` + + // Link to the previous available page. If 'previous' property is not part of the response no previous page is + // available. + Previous *string `json:"previous,omitempty"` + + // Link to the next available page. If 'next' property is not part of the response no next page is available. + Next *string `json:"next,omitempty"` + + // List of API keys based on the query paramters and the page size. The apikeys array is always part of the response + // but might be empty depending on the query parameters values provided. + Apikeys []APIKey `json:"apikeys" validate:"required"` +} + +// UnmarshalAPIKeyList unmarshals an instance of APIKeyList from the specified map of raw messages. +func UnmarshalAPIKeyList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(APIKeyList) + err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "first", &obj.First) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "previous", &obj.Previous) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next", &obj.Next) + if err != nil { + return + } + err = core.UnmarshalModel(m, "apikeys", &obj.Apikeys, UnmarshalAPIKey) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CreateAPIKeyOptions : The CreateAPIKey options. +type CreateAPIKeyOptions struct { + // Name of the API key. The name is not checked for uniqueness. Therefore multiple names with the same value can exist. + // Access is done via the UUID of the API key. + Name *string `json:"name" validate:"required"` + + // The iam_id that this API key authenticates. + IamID *string `json:"iam_id" validate:"required"` + + // The optional description of the API key. The 'description' property is only available if a description was provided + // during a create of an API key. + Description *string `json:"description,omitempty"` + + // The account ID of the API key. + AccountID *string `json:"account_id,omitempty"` + + // You can optionally passthrough the API key value for this API key. If passed, NO validation of that apiKey value is + // done, i.e. the value can be non-URL safe. If omitted, the API key management will create an URL safe opaque API key + // value. The value of the API key is checked for uniqueness. Please ensure enough variations when passing in this + // value. + Apikey *string `json:"apikey,omitempty"` + + // Send true or false to set whether the API key value is retrievable in the future by using the Get details of an API + // key request. If you create an API key for a user, you must specify `false` or omit the value. We don't allow storing + // of API keys for users. + StoreValue *bool `json:"store_value,omitempty"` + + // Indicates if the API key is locked for further write operations. False by default. + EntityLock *string `json:"-"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateAPIKeyOptions : Instantiate CreateAPIKeyOptions +func (*IamIdentityV1) NewCreateAPIKeyOptions(name string, iamID string) *CreateAPIKeyOptions { + return &CreateAPIKeyOptions{ + Name: core.StringPtr(name), + IamID: core.StringPtr(iamID), + } +} + +// SetName : Allow user to set Name +func (_options *CreateAPIKeyOptions) SetName(name string) *CreateAPIKeyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetIamID : Allow user to set IamID +func (_options *CreateAPIKeyOptions) SetIamID(iamID string) *CreateAPIKeyOptions { + _options.IamID = core.StringPtr(iamID) + return _options +} + +// SetDescription : Allow user to set Description +func (_options *CreateAPIKeyOptions) SetDescription(description string) *CreateAPIKeyOptions { + _options.Description = core.StringPtr(description) + return _options +} + +// SetAccountID : Allow user to set AccountID +func (_options *CreateAPIKeyOptions) SetAccountID(accountID string) *CreateAPIKeyOptions { + _options.AccountID = core.StringPtr(accountID) + return _options +} + +// SetApikey : Allow user to set Apikey +func (_options *CreateAPIKeyOptions) SetApikey(apikey string) *CreateAPIKeyOptions { + _options.Apikey = core.StringPtr(apikey) + return _options +} + +// SetStoreValue : Allow user to set StoreValue +func (_options *CreateAPIKeyOptions) SetStoreValue(storeValue bool) *CreateAPIKeyOptions { + _options.StoreValue = core.BoolPtr(storeValue) + return _options +} + +// SetEntityLock : Allow user to set EntityLock +func (_options *CreateAPIKeyOptions) SetEntityLock(entityLock string) *CreateAPIKeyOptions { + _options.EntityLock = core.StringPtr(entityLock) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateAPIKeyOptions) SetHeaders(param map[string]string) *CreateAPIKeyOptions { + options.Headers = param + return options +} + +// CreateClaimRuleOptions : The CreateClaimRule options. +type CreateClaimRuleOptions struct { + // ID of the trusted profile to create a claim rule. + ProfileID *string `json:"-" validate:"required,ne="` + + // Type of the calim rule, either 'Profile-SAML' or 'Profile-CR'. + Type *string `json:"type" validate:"required"` + + // Conditions of this claim rule. + Conditions []ProfileClaimRuleConditions `json:"conditions" validate:"required"` + + // Context with key properties for problem determination. + Context *ResponseContext `json:"context,omitempty"` + + // Name of the claim rule to be created or updated. + Name *string `json:"name,omitempty"` + + // The realm name of the Idp this claim rule applies to. This field is required only if the type is specified as + // 'Profile-SAML'. + RealmName *string `json:"realm_name,omitempty"` + + // The compute resource type the rule applies to, required only if type is specified as 'Profile-CR'. Valid values are + // VSI, IKS_SA, ROKS_SA. + CrType *string `json:"cr_type,omitempty"` + + // Session expiration in seconds, only required if type is 'Profile-SAML'. + Expiration *int64 `json:"expiration,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateClaimRuleOptions : Instantiate CreateClaimRuleOptions +func (*IamIdentityV1) NewCreateClaimRuleOptions(profileID string, typeVar string, conditions []ProfileClaimRuleConditions) *CreateClaimRuleOptions { + return &CreateClaimRuleOptions{ + ProfileID: core.StringPtr(profileID), + Type: core.StringPtr(typeVar), + Conditions: conditions, + } +} + +// SetProfileID : Allow user to set ProfileID +func (_options *CreateClaimRuleOptions) SetProfileID(profileID string) *CreateClaimRuleOptions { + _options.ProfileID = core.StringPtr(profileID) + return _options +} + +// SetType : Allow user to set Type +func (_options *CreateClaimRuleOptions) SetType(typeVar string) *CreateClaimRuleOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetConditions : Allow user to set Conditions +func (_options *CreateClaimRuleOptions) SetConditions(conditions []ProfileClaimRuleConditions) *CreateClaimRuleOptions { + _options.Conditions = conditions + return _options +} + +// SetContext : Allow user to set Context +func (_options *CreateClaimRuleOptions) SetContext(context *ResponseContext) *CreateClaimRuleOptions { + _options.Context = context + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateClaimRuleOptions) SetName(name string) *CreateClaimRuleOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetRealmName : Allow user to set RealmName +func (_options *CreateClaimRuleOptions) SetRealmName(realmName string) *CreateClaimRuleOptions { + _options.RealmName = core.StringPtr(realmName) + return _options +} + +// SetCrType : Allow user to set CrType +func (_options *CreateClaimRuleOptions) SetCrType(crType string) *CreateClaimRuleOptions { + _options.CrType = core.StringPtr(crType) + return _options +} + +// SetExpiration : Allow user to set Expiration +func (_options *CreateClaimRuleOptions) SetExpiration(expiration int64) *CreateClaimRuleOptions { + _options.Expiration = core.Int64Ptr(expiration) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateClaimRuleOptions) SetHeaders(param map[string]string) *CreateClaimRuleOptions { + options.Headers = param + return options +} + +// CreateLinkOptions : The CreateLink options. +type CreateLinkOptions struct { + // ID of the trusted profile. + ProfileID *string `json:"-" validate:"required,ne="` + + // The compute resource type. Valid values are VSI, IKS_SA, ROKS_SA. + CrType *string `json:"cr_type" validate:"required"` + + // Link details. + Link *CreateProfileLinkRequestLink `json:"link" validate:"required"` + + // Optional name of the Link. + Name *string `json:"name,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateLinkOptions : Instantiate CreateLinkOptions +func (*IamIdentityV1) NewCreateLinkOptions(profileID string, crType string, link *CreateProfileLinkRequestLink) *CreateLinkOptions { + return &CreateLinkOptions{ + ProfileID: core.StringPtr(profileID), + CrType: core.StringPtr(crType), + Link: link, + } +} + +// SetProfileID : Allow user to set ProfileID +func (_options *CreateLinkOptions) SetProfileID(profileID string) *CreateLinkOptions { + _options.ProfileID = core.StringPtr(profileID) + return _options +} + +// SetCrType : Allow user to set CrType +func (_options *CreateLinkOptions) SetCrType(crType string) *CreateLinkOptions { + _options.CrType = core.StringPtr(crType) + return _options +} + +// SetLink : Allow user to set Link +func (_options *CreateLinkOptions) SetLink(link *CreateProfileLinkRequestLink) *CreateLinkOptions { + _options.Link = link + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateLinkOptions) SetName(name string) *CreateLinkOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLinkOptions) SetHeaders(param map[string]string) *CreateLinkOptions { + options.Headers = param + return options +} + +// CreateProfileLinkRequestLink : Link details. +type CreateProfileLinkRequestLink struct { + // The CRN of the compute resource. + CRN *string `json:"crn" validate:"required"` + + // The compute resource namespace, only required if cr_type is IKS_SA or ROKS_SA. + Namespace *string `json:"namespace" validate:"required"` + + // Name of the compute resource, only required if cr_type is IKS_SA or ROKS_SA. + Name *string `json:"name,omitempty"` +} + +// NewCreateProfileLinkRequestLink : Instantiate CreateProfileLinkRequestLink (Generic Model Constructor) +func (*IamIdentityV1) NewCreateProfileLinkRequestLink(crn string, namespace string) (_model *CreateProfileLinkRequestLink, err error) { + _model = &CreateProfileLinkRequestLink{ + CRN: core.StringPtr(crn), + Namespace: core.StringPtr(namespace), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalCreateProfileLinkRequestLink unmarshals an instance of CreateProfileLinkRequestLink from the specified map of raw messages. +func UnmarshalCreateProfileLinkRequestLink(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CreateProfileLinkRequestLink) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "namespace", &obj.Namespace) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CreateProfileOptions : The CreateProfile options. +type CreateProfileOptions struct { + // Name of the trusted profile. The name is checked for uniqueness. Therefore trusted profiles with the same names can + // not exist in the same account. + Name *string `json:"name" validate:"required"` + + // The account ID of the trusted profile. + AccountID *string `json:"account_id" validate:"required"` + + // The optional description of the trusted profile. The 'description' property is only available if a description was + // provided during creation of trusted profile. + Description *string `json:"description,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateProfileOptions : Instantiate CreateProfileOptions +func (*IamIdentityV1) NewCreateProfileOptions(name string, accountID string) *CreateProfileOptions { + return &CreateProfileOptions{ + Name: core.StringPtr(name), + AccountID: core.StringPtr(accountID), + } +} + +// SetName : Allow user to set Name +func (_options *CreateProfileOptions) SetName(name string) *CreateProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetAccountID : Allow user to set AccountID +func (_options *CreateProfileOptions) SetAccountID(accountID string) *CreateProfileOptions { + _options.AccountID = core.StringPtr(accountID) + return _options +} + +// SetDescription : Allow user to set Description +func (_options *CreateProfileOptions) SetDescription(description string) *CreateProfileOptions { + _options.Description = core.StringPtr(description) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateProfileOptions) SetHeaders(param map[string]string) *CreateProfileOptions { + options.Headers = param + return options +} + +// CreateServiceIDOptions : The CreateServiceID options. +type CreateServiceIDOptions struct { + // ID of the account the service ID belongs to. + AccountID *string `json:"account_id" validate:"required"` + + // Name of the Service Id. The name is not checked for uniqueness. Therefore multiple names with the same value can + // exist. Access is done via the UUID of the Service Id. + Name *string `json:"name" validate:"required"` + + // The optional description of the Service Id. The 'description' property is only available if a description was + // provided during a create of a Service Id. + Description *string `json:"description,omitempty"` + + // Optional list of CRNs (string array) which point to the services connected to the service ID. + UniqueInstanceCrns []string `json:"unique_instance_crns,omitempty"` + + // Parameters for the API key in the Create service Id V1 REST request. + Apikey *APIKeyInsideCreateServiceIDRequest `json:"apikey,omitempty"` + + // Indicates if the service ID is locked for further write operations. False by default. + EntityLock *string `json:"-"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateServiceIDOptions : Instantiate CreateServiceIDOptions +func (*IamIdentityV1) NewCreateServiceIDOptions(accountID string, name string) *CreateServiceIDOptions { + return &CreateServiceIDOptions{ + AccountID: core.StringPtr(accountID), + Name: core.StringPtr(name), + } +} + +// SetAccountID : Allow user to set AccountID +func (_options *CreateServiceIDOptions) SetAccountID(accountID string) *CreateServiceIDOptions { + _options.AccountID = core.StringPtr(accountID) + return _options +} + +// SetName : Allow user to set Name +func (_options *CreateServiceIDOptions) SetName(name string) *CreateServiceIDOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetDescription : Allow user to set Description +func (_options *CreateServiceIDOptions) SetDescription(description string) *CreateServiceIDOptions { + _options.Description = core.StringPtr(description) + return _options +} + +// SetUniqueInstanceCrns : Allow user to set UniqueInstanceCrns +func (_options *CreateServiceIDOptions) SetUniqueInstanceCrns(uniqueInstanceCrns []string) *CreateServiceIDOptions { + _options.UniqueInstanceCrns = uniqueInstanceCrns + return _options +} + +// SetApikey : Allow user to set Apikey +func (_options *CreateServiceIDOptions) SetApikey(apikey *APIKeyInsideCreateServiceIDRequest) *CreateServiceIDOptions { + _options.Apikey = apikey + return _options +} + +// SetEntityLock : Allow user to set EntityLock +func (_options *CreateServiceIDOptions) SetEntityLock(entityLock string) *CreateServiceIDOptions { + _options.EntityLock = core.StringPtr(entityLock) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateServiceIDOptions) SetHeaders(param map[string]string) *CreateServiceIDOptions { + options.Headers = param + return options +} + +// DeleteAPIKeyOptions : The DeleteAPIKey options. +type DeleteAPIKeyOptions struct { + // Unique ID of the API key. + ID *string `json:"-" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteAPIKeyOptions : Instantiate DeleteAPIKeyOptions +func (*IamIdentityV1) NewDeleteAPIKeyOptions(id string) *DeleteAPIKeyOptions { + return &DeleteAPIKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteAPIKeyOptions) SetID(id string) *DeleteAPIKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteAPIKeyOptions) SetHeaders(param map[string]string) *DeleteAPIKeyOptions { + options.Headers = param + return options +} + +// DeleteClaimRuleOptions : The DeleteClaimRule options. +type DeleteClaimRuleOptions struct { + // ID of the trusted profile. + ProfileID *string `json:"-" validate:"required,ne="` + + // ID of the claim rule to delete. + RuleID *string `json:"-" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteClaimRuleOptions : Instantiate DeleteClaimRuleOptions +func (*IamIdentityV1) NewDeleteClaimRuleOptions(profileID string, ruleID string) *DeleteClaimRuleOptions { + return &DeleteClaimRuleOptions{ + ProfileID: core.StringPtr(profileID), + RuleID: core.StringPtr(ruleID), + } +} + +// SetProfileID : Allow user to set ProfileID +func (_options *DeleteClaimRuleOptions) SetProfileID(profileID string) *DeleteClaimRuleOptions { + _options.ProfileID = core.StringPtr(profileID) + return _options +} + +// SetRuleID : Allow user to set RuleID +func (_options *DeleteClaimRuleOptions) SetRuleID(ruleID string) *DeleteClaimRuleOptions { + _options.RuleID = core.StringPtr(ruleID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteClaimRuleOptions) SetHeaders(param map[string]string) *DeleteClaimRuleOptions { + options.Headers = param + return options +} + +// DeleteLinkOptions : The DeleteLink options. +type DeleteLinkOptions struct { + // ID of the trusted profile. + ProfileID *string `json:"-" validate:"required,ne="` + + // ID of the link. + LinkID *string `json:"-" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLinkOptions : Instantiate DeleteLinkOptions +func (*IamIdentityV1) NewDeleteLinkOptions(profileID string, linkID string) *DeleteLinkOptions { + return &DeleteLinkOptions{ + ProfileID: core.StringPtr(profileID), + LinkID: core.StringPtr(linkID), + } +} + +// SetProfileID : Allow user to set ProfileID +func (_options *DeleteLinkOptions) SetProfileID(profileID string) *DeleteLinkOptions { + _options.ProfileID = core.StringPtr(profileID) + return _options +} + +// SetLinkID : Allow user to set LinkID +func (_options *DeleteLinkOptions) SetLinkID(linkID string) *DeleteLinkOptions { + _options.LinkID = core.StringPtr(linkID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLinkOptions) SetHeaders(param map[string]string) *DeleteLinkOptions { + options.Headers = param + return options +} + +// DeleteProfileOptions : The DeleteProfile options. +type DeleteProfileOptions struct { + // ID of the trusted profile. + ProfileID *string `json:"-" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteProfileOptions : Instantiate DeleteProfileOptions +func (*IamIdentityV1) NewDeleteProfileOptions(profileID string) *DeleteProfileOptions { + return &DeleteProfileOptions{ + ProfileID: core.StringPtr(profileID), + } +} + +// SetProfileID : Allow user to set ProfileID +func (_options *DeleteProfileOptions) SetProfileID(profileID string) *DeleteProfileOptions { + _options.ProfileID = core.StringPtr(profileID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteProfileOptions) SetHeaders(param map[string]string) *DeleteProfileOptions { + options.Headers = param + return options +} + +// DeleteServiceIDOptions : The DeleteServiceID options. +type DeleteServiceIDOptions struct { + // Unique ID of the service ID. + ID *string `json:"-" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteServiceIDOptions : Instantiate DeleteServiceIDOptions +func (*IamIdentityV1) NewDeleteServiceIDOptions(id string) *DeleteServiceIDOptions { + return &DeleteServiceIDOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteServiceIDOptions) SetID(id string) *DeleteServiceIDOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteServiceIDOptions) SetHeaders(param map[string]string) *DeleteServiceIDOptions { + options.Headers = param + return options +} + +// EnityHistoryRecord : Response body format for an entity history record. +type EnityHistoryRecord struct { + // Timestamp when the action was triggered. + Timestamp *string `json:"timestamp" validate:"required"` + + // IAM ID of the identity which triggered the action. + IamID *string `json:"iam_id" validate:"required"` + + // Account of the identity which triggered the action. + IamIDAccount *string `json:"iam_id_account" validate:"required"` + + // Action of the history entry. + Action *string `json:"action" validate:"required"` + + // Params of the history entry. + Params []string `json:"params" validate:"required"` + + // Message which summarizes the executed action. + Message *string `json:"message" validate:"required"` +} + +// UnmarshalEnityHistoryRecord unmarshals an instance of EnityHistoryRecord from the specified map of raw messages. +func UnmarshalEnityHistoryRecord(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EnityHistoryRecord) + err = core.UnmarshalPrimitive(m, "timestamp", &obj.Timestamp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iam_id", &obj.IamID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iam_id_account", &obj.IamIDAccount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "params", &obj.Params) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// GetAccountSettingsOptions : The GetAccountSettings options. +type GetAccountSettingsOptions struct { + // Unique ID of the account. + AccountID *string `json:"-" validate:"required,ne="` + + // Defines if the entity history is included in the response. + IncludeHistory *bool `json:"-"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetAccountSettingsOptions : Instantiate GetAccountSettingsOptions +func (*IamIdentityV1) NewGetAccountSettingsOptions(accountID string) *GetAccountSettingsOptions { + return &GetAccountSettingsOptions{ + AccountID: core.StringPtr(accountID), + } +} + +// SetAccountID : Allow user to set AccountID +func (_options *GetAccountSettingsOptions) SetAccountID(accountID string) *GetAccountSettingsOptions { + _options.AccountID = core.StringPtr(accountID) + return _options +} + +// SetIncludeHistory : Allow user to set IncludeHistory +func (_options *GetAccountSettingsOptions) SetIncludeHistory(includeHistory bool) *GetAccountSettingsOptions { + _options.IncludeHistory = core.BoolPtr(includeHistory) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetAccountSettingsOptions) SetHeaders(param map[string]string) *GetAccountSettingsOptions { + options.Headers = param + return options +} + +// GetAPIKeyOptions : The GetAPIKey options. +type GetAPIKeyOptions struct { + // Unique ID of the API key. + ID *string `json:"-" validate:"required,ne="` + + // Defines if the entity history is included in the response. + IncludeHistory *bool `json:"-"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetAPIKeyOptions : Instantiate GetAPIKeyOptions +func (*IamIdentityV1) NewGetAPIKeyOptions(id string) *GetAPIKeyOptions { + return &GetAPIKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetAPIKeyOptions) SetID(id string) *GetAPIKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIncludeHistory : Allow user to set IncludeHistory +func (_options *GetAPIKeyOptions) SetIncludeHistory(includeHistory bool) *GetAPIKeyOptions { + _options.IncludeHistory = core.BoolPtr(includeHistory) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetAPIKeyOptions) SetHeaders(param map[string]string) *GetAPIKeyOptions { + options.Headers = param + return options +} + +// GetAPIKeysDetailsOptions : The GetAPIKeysDetails options. +type GetAPIKeysDetailsOptions struct { + // API key value. + IamAPIKey *string `json:"-"` + + // Defines if the entity history is included in the response. + IncludeHistory *bool `json:"-"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetAPIKeysDetailsOptions : Instantiate GetAPIKeysDetailsOptions +func (*IamIdentityV1) NewGetAPIKeysDetailsOptions() *GetAPIKeysDetailsOptions { + return &GetAPIKeysDetailsOptions{} +} + +// SetIamAPIKey : Allow user to set IamAPIKey +func (_options *GetAPIKeysDetailsOptions) SetIamAPIKey(iamAPIKey string) *GetAPIKeysDetailsOptions { + _options.IamAPIKey = core.StringPtr(iamAPIKey) + return _options +} + +// SetIncludeHistory : Allow user to set IncludeHistory +func (_options *GetAPIKeysDetailsOptions) SetIncludeHistory(includeHistory bool) *GetAPIKeysDetailsOptions { + _options.IncludeHistory = core.BoolPtr(includeHistory) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetAPIKeysDetailsOptions) SetHeaders(param map[string]string) *GetAPIKeysDetailsOptions { + options.Headers = param + return options +} + +// GetClaimRuleOptions : The GetClaimRule options. +type GetClaimRuleOptions struct { + // ID of the trusted profile. + ProfileID *string `json:"-" validate:"required,ne="` + + // ID of the claim rule to get. + RuleID *string `json:"-" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetClaimRuleOptions : Instantiate GetClaimRuleOptions +func (*IamIdentityV1) NewGetClaimRuleOptions(profileID string, ruleID string) *GetClaimRuleOptions { + return &GetClaimRuleOptions{ + ProfileID: core.StringPtr(profileID), + RuleID: core.StringPtr(ruleID), + } +} + +// SetProfileID : Allow user to set ProfileID +func (_options *GetClaimRuleOptions) SetProfileID(profileID string) *GetClaimRuleOptions { + _options.ProfileID = core.StringPtr(profileID) + return _options +} + +// SetRuleID : Allow user to set RuleID +func (_options *GetClaimRuleOptions) SetRuleID(ruleID string) *GetClaimRuleOptions { + _options.RuleID = core.StringPtr(ruleID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetClaimRuleOptions) SetHeaders(param map[string]string) *GetClaimRuleOptions { + options.Headers = param + return options +} + +// GetLinkOptions : The GetLink options. +type GetLinkOptions struct { + // ID of the trusted profile. + ProfileID *string `json:"-" validate:"required,ne="` + + // ID of the link. + LinkID *string `json:"-" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLinkOptions : Instantiate GetLinkOptions +func (*IamIdentityV1) NewGetLinkOptions(profileID string, linkID string) *GetLinkOptions { + return &GetLinkOptions{ + ProfileID: core.StringPtr(profileID), + LinkID: core.StringPtr(linkID), + } +} + +// SetProfileID : Allow user to set ProfileID +func (_options *GetLinkOptions) SetProfileID(profileID string) *GetLinkOptions { + _options.ProfileID = core.StringPtr(profileID) + return _options +} + +// SetLinkID : Allow user to set LinkID +func (_options *GetLinkOptions) SetLinkID(linkID string) *GetLinkOptions { + _options.LinkID = core.StringPtr(linkID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLinkOptions) SetHeaders(param map[string]string) *GetLinkOptions { + options.Headers = param + return options +} + +// GetProfileOptions : The GetProfile options. +type GetProfileOptions struct { + // ID of the trusted profile to get. + ProfileID *string `json:"-" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetProfileOptions : Instantiate GetProfileOptions +func (*IamIdentityV1) NewGetProfileOptions(profileID string) *GetProfileOptions { + return &GetProfileOptions{ + ProfileID: core.StringPtr(profileID), + } +} + +// SetProfileID : Allow user to set ProfileID +func (_options *GetProfileOptions) SetProfileID(profileID string) *GetProfileOptions { + _options.ProfileID = core.StringPtr(profileID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetProfileOptions) SetHeaders(param map[string]string) *GetProfileOptions { + options.Headers = param + return options +} + +// GetServiceIDOptions : The GetServiceID options. +type GetServiceIDOptions struct { + // Unique ID of the service ID. + ID *string `json:"-" validate:"required,ne="` + + // Defines if the entity history is included in the response. + IncludeHistory *bool `json:"-"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetServiceIDOptions : Instantiate GetServiceIDOptions +func (*IamIdentityV1) NewGetServiceIDOptions(id string) *GetServiceIDOptions { + return &GetServiceIDOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetServiceIDOptions) SetID(id string) *GetServiceIDOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIncludeHistory : Allow user to set IncludeHistory +func (_options *GetServiceIDOptions) SetIncludeHistory(includeHistory bool) *GetServiceIDOptions { + _options.IncludeHistory = core.BoolPtr(includeHistory) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetServiceIDOptions) SetHeaders(param map[string]string) *GetServiceIDOptions { + options.Headers = param + return options +} + +// ListAPIKeysOptions : The ListAPIKeys options. +type ListAPIKeysOptions struct { + // Account ID of the API keys(s) to query. If a service IAM ID is specified in iam_id then account_id must match the + // account of the IAM ID. If a user IAM ID is specified in iam_id then then account_id must match the account of the + // Authorization token. + AccountID *string `json:"-"` + + // IAM ID of the API key(s) to be queried. The IAM ID may be that of a user or a service. For a user IAM ID iam_id must + // match the Authorization token. + IamID *string `json:"-"` + + // Optional size of a single page. Default is 20 items per page. Valid range is 1 to 100. + Pagesize *int64 `json:"-"` + + // Optional Prev or Next page token returned from a previous query execution. Default is start with first page. + Pagetoken *string `json:"-"` + + // Optional parameter to define the scope of the queried API Keys. Can be 'entity' (default) or 'account'. + Scope *string `json:"-"` + + // Optional parameter to filter the type of the queried API Keys. Can be 'user' or 'serviceid'. + Type *string `json:"-"` + + // Optional sort property, valid values are name, description, created_at and created_by. If specified, the items are + // sorted by the value of this property. + Sort *string `json:"-"` + + // Optional sort order, valid values are asc and desc. Default: asc. + Order *string `json:"-"` + + // Defines if the entity history is included in the response. + IncludeHistory *bool `json:"-"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListAPIKeysOptions.Scope property. +// Optional parameter to define the scope of the queried API Keys. Can be 'entity' (default) or 'account'. +const ( + ListAPIKeysOptionsScopeAccountConst = "account" + ListAPIKeysOptionsScopeEntityConst = "entity" +) + +// Constants associated with the ListAPIKeysOptions.Type property. +// Optional parameter to filter the type of the queried API Keys. Can be 'user' or 'serviceid'. +const ( + ListAPIKeysOptionsTypeServiceidConst = "serviceid" + ListAPIKeysOptionsTypeUserConst = "user" +) + +// Constants associated with the ListAPIKeysOptions.Order property. +// Optional sort order, valid values are asc and desc. Default: asc. +const ( + ListAPIKeysOptionsOrderAscConst = "asc" + ListAPIKeysOptionsOrderDescConst = "desc" +) + +// NewListAPIKeysOptions : Instantiate ListAPIKeysOptions +func (*IamIdentityV1) NewListAPIKeysOptions() *ListAPIKeysOptions { + return &ListAPIKeysOptions{} +} + +// SetAccountID : Allow user to set AccountID +func (_options *ListAPIKeysOptions) SetAccountID(accountID string) *ListAPIKeysOptions { + _options.AccountID = core.StringPtr(accountID) + return _options +} + +// SetIamID : Allow user to set IamID +func (_options *ListAPIKeysOptions) SetIamID(iamID string) *ListAPIKeysOptions { + _options.IamID = core.StringPtr(iamID) + return _options +} + +// SetPagesize : Allow user to set Pagesize +func (_options *ListAPIKeysOptions) SetPagesize(pagesize int64) *ListAPIKeysOptions { + _options.Pagesize = core.Int64Ptr(pagesize) + return _options +} + +// SetPagetoken : Allow user to set Pagetoken +func (_options *ListAPIKeysOptions) SetPagetoken(pagetoken string) *ListAPIKeysOptions { + _options.Pagetoken = core.StringPtr(pagetoken) + return _options +} + +// SetScope : Allow user to set Scope +func (_options *ListAPIKeysOptions) SetScope(scope string) *ListAPIKeysOptions { + _options.Scope = core.StringPtr(scope) + return _options +} + +// SetType : Allow user to set Type +func (_options *ListAPIKeysOptions) SetType(typeVar string) *ListAPIKeysOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListAPIKeysOptions) SetSort(sort string) *ListAPIKeysOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetOrder : Allow user to set Order +func (_options *ListAPIKeysOptions) SetOrder(order string) *ListAPIKeysOptions { + _options.Order = core.StringPtr(order) + return _options +} + +// SetIncludeHistory : Allow user to set IncludeHistory +func (_options *ListAPIKeysOptions) SetIncludeHistory(includeHistory bool) *ListAPIKeysOptions { + _options.IncludeHistory = core.BoolPtr(includeHistory) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListAPIKeysOptions) SetHeaders(param map[string]string) *ListAPIKeysOptions { + options.Headers = param + return options +} + +// ListClaimRulesOptions : The ListClaimRules options. +type ListClaimRulesOptions struct { + // ID of the trusted profile. + ProfileID *string `json:"-" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListClaimRulesOptions : Instantiate ListClaimRulesOptions +func (*IamIdentityV1) NewListClaimRulesOptions(profileID string) *ListClaimRulesOptions { + return &ListClaimRulesOptions{ + ProfileID: core.StringPtr(profileID), + } +} + +// SetProfileID : Allow user to set ProfileID +func (_options *ListClaimRulesOptions) SetProfileID(profileID string) *ListClaimRulesOptions { + _options.ProfileID = core.StringPtr(profileID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListClaimRulesOptions) SetHeaders(param map[string]string) *ListClaimRulesOptions { + options.Headers = param + return options +} + +// ListLinksOptions : The ListLinks options. +type ListLinksOptions struct { + // ID of the trusted profile. + ProfileID *string `json:"-" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLinksOptions : Instantiate ListLinksOptions +func (*IamIdentityV1) NewListLinksOptions(profileID string) *ListLinksOptions { + return &ListLinksOptions{ + ProfileID: core.StringPtr(profileID), + } +} + +// SetProfileID : Allow user to set ProfileID +func (_options *ListLinksOptions) SetProfileID(profileID string) *ListLinksOptions { + _options.ProfileID = core.StringPtr(profileID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLinksOptions) SetHeaders(param map[string]string) *ListLinksOptions { + options.Headers = param + return options +} + +// ListProfilesOptions : The ListProfiles options. +type ListProfilesOptions struct { + // Account ID to query for trusted profiles. + AccountID *string `json:"-" validate:"required"` + + // Name of the trusted profile to query. + Name *string `json:"-"` + + // Optional size of a single page. Default is 20 items per page. Valid range is 1 to 100. + Pagesize *int64 `json:"-"` + + // Optional sort property, valid values are name, description, created_at and modified_at. If specified, the items are + // sorted by the value of this property. + Sort *string `json:"-"` + + // Optional sort order, valid values are asc and desc. Default: asc. + Order *string `json:"-"` + + // Defines if the entity history is included in the response. + IncludeHistory *bool `json:"-"` + + // Optional Prev or Next page token returned from a previous query execution. Default is start with first page. + Pagetoken *string `json:"-"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListProfilesOptions.Order property. +// Optional sort order, valid values are asc and desc. Default: asc. +const ( + ListProfilesOptionsOrderAscConst = "asc" + ListProfilesOptionsOrderDescConst = "desc" +) + +// NewListProfilesOptions : Instantiate ListProfilesOptions +func (*IamIdentityV1) NewListProfilesOptions(accountID string) *ListProfilesOptions { + return &ListProfilesOptions{ + AccountID: core.StringPtr(accountID), + } +} + +// SetAccountID : Allow user to set AccountID +func (_options *ListProfilesOptions) SetAccountID(accountID string) *ListProfilesOptions { + _options.AccountID = core.StringPtr(accountID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListProfilesOptions) SetName(name string) *ListProfilesOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPagesize : Allow user to set Pagesize +func (_options *ListProfilesOptions) SetPagesize(pagesize int64) *ListProfilesOptions { + _options.Pagesize = core.Int64Ptr(pagesize) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListProfilesOptions) SetSort(sort string) *ListProfilesOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetOrder : Allow user to set Order +func (_options *ListProfilesOptions) SetOrder(order string) *ListProfilesOptions { + _options.Order = core.StringPtr(order) + return _options +} + +// SetIncludeHistory : Allow user to set IncludeHistory +func (_options *ListProfilesOptions) SetIncludeHistory(includeHistory bool) *ListProfilesOptions { + _options.IncludeHistory = core.BoolPtr(includeHistory) + return _options +} + +// SetPagetoken : Allow user to set Pagetoken +func (_options *ListProfilesOptions) SetPagetoken(pagetoken string) *ListProfilesOptions { + _options.Pagetoken = core.StringPtr(pagetoken) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListProfilesOptions) SetHeaders(param map[string]string) *ListProfilesOptions { + options.Headers = param + return options +} + +// ListServiceIdsOptions : The ListServiceIds options. +type ListServiceIdsOptions struct { + // Account ID of the service ID(s) to query. This parameter is required (unless using a pagetoken). + AccountID *string `json:"-"` + + // Name of the service ID(s) to query. Optional.20 items per page. Valid range is 1 to 100. + Name *string `json:"-"` + + // Optional size of a single page. Default is 20 items per page. Valid range is 1 to 100. + Pagesize *int64 `json:"-"` + + // Optional Prev or Next page token returned from a previous query execution. Default is start with first page. + Pagetoken *string `json:"-"` + + // Optional sort property, valid values are name, description, created_at and modified_at. If specified, the items are + // sorted by the value of this property. + Sort *string `json:"-"` + + // Optional sort order, valid values are asc and desc. Default: asc. + Order *string `json:"-"` + + // Defines if the entity history is included in the response. + IncludeHistory *bool `json:"-"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListServiceIdsOptions.Order property. +// Optional sort order, valid values are asc and desc. Default: asc. +const ( + ListServiceIdsOptionsOrderAscConst = "asc" + ListServiceIdsOptionsOrderDescConst = "desc" +) + +// NewListServiceIdsOptions : Instantiate ListServiceIdsOptions +func (*IamIdentityV1) NewListServiceIdsOptions() *ListServiceIdsOptions { + return &ListServiceIdsOptions{} +} + +// SetAccountID : Allow user to set AccountID +func (_options *ListServiceIdsOptions) SetAccountID(accountID string) *ListServiceIdsOptions { + _options.AccountID = core.StringPtr(accountID) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListServiceIdsOptions) SetName(name string) *ListServiceIdsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetPagesize : Allow user to set Pagesize +func (_options *ListServiceIdsOptions) SetPagesize(pagesize int64) *ListServiceIdsOptions { + _options.Pagesize = core.Int64Ptr(pagesize) + return _options +} + +// SetPagetoken : Allow user to set Pagetoken +func (_options *ListServiceIdsOptions) SetPagetoken(pagetoken string) *ListServiceIdsOptions { + _options.Pagetoken = core.StringPtr(pagetoken) + return _options +} + +// SetSort : Allow user to set Sort +func (_options *ListServiceIdsOptions) SetSort(sort string) *ListServiceIdsOptions { + _options.Sort = core.StringPtr(sort) + return _options +} + +// SetOrder : Allow user to set Order +func (_options *ListServiceIdsOptions) SetOrder(order string) *ListServiceIdsOptions { + _options.Order = core.StringPtr(order) + return _options +} + +// SetIncludeHistory : Allow user to set IncludeHistory +func (_options *ListServiceIdsOptions) SetIncludeHistory(includeHistory bool) *ListServiceIdsOptions { + _options.IncludeHistory = core.BoolPtr(includeHistory) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListServiceIdsOptions) SetHeaders(param map[string]string) *ListServiceIdsOptions { + options.Headers = param + return options +} + +// LockAPIKeyOptions : The LockAPIKey options. +type LockAPIKeyOptions struct { + // Unique ID of the API key. + ID *string `json:"-" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewLockAPIKeyOptions : Instantiate LockAPIKeyOptions +func (*IamIdentityV1) NewLockAPIKeyOptions(id string) *LockAPIKeyOptions { + return &LockAPIKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *LockAPIKeyOptions) SetID(id string) *LockAPIKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *LockAPIKeyOptions) SetHeaders(param map[string]string) *LockAPIKeyOptions { + options.Headers = param + return options +} + +// LockServiceIDOptions : The LockServiceID options. +type LockServiceIDOptions struct { + // Unique ID of the service ID. + ID *string `json:"-" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewLockServiceIDOptions : Instantiate LockServiceIDOptions +func (*IamIdentityV1) NewLockServiceIDOptions(id string) *LockServiceIDOptions { + return &LockServiceIDOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *LockServiceIDOptions) SetID(id string) *LockServiceIDOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *LockServiceIDOptions) SetHeaders(param map[string]string) *LockServiceIDOptions { + options.Headers = param + return options +} + +// ProfileClaimRule : ProfileClaimRule struct +type ProfileClaimRule struct { + // the unique identifier of the claim rule. + ID *string `json:"id" validate:"required"` + + // version of the claim rule. + EntityTag *string `json:"entity_tag" validate:"required"` + + // If set contains a date time string of the creation date in ISO format. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If set contains a date time string of the last modification date in ISO format. + ModifiedAt *strfmt.DateTime `json:"modified_at,omitempty"` + + // The optional claim rule name. + Name *string `json:"name,omitempty"` + + // Type of the Calim rule, either 'Profile-SAML' or 'Profile-CR'. + Type *string `json:"type" validate:"required"` + + // The realm name of the Idp this claim rule applies to. + RealmName *string `json:"realm_name,omitempty"` + + // Session expiration in seconds. + Expiration *int64 `json:"expiration" validate:"required"` + + // The compute resource type. Not required if type is Profile-SAML. Valid values are VSI, IKS_SA, ROKS_SA. + CrType *string `json:"cr_type,omitempty"` + + // Conditions of this claim rule. + Conditions []ProfileClaimRuleConditions `json:"conditions" validate:"required"` +} + +// UnmarshalProfileClaimRule unmarshals an instance of ProfileClaimRule from the specified map of raw messages. +func UnmarshalProfileClaimRule(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ProfileClaimRule) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "modified_at", &obj.ModifiedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "realm_name", &obj.RealmName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "expiration", &obj.Expiration) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cr_type", &obj.CrType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "conditions", &obj.Conditions, UnmarshalProfileClaimRuleConditions) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ProfileClaimRuleConditions : ProfileClaimRuleConditions struct +type ProfileClaimRuleConditions struct { + // The claim to evaluate against. + Claim *string `json:"claim" validate:"required"` + + // The operation to perform on the claim. valid values are EQUALS, NOT_EQUALS, EQUALS_IGNORE_CASE, + // NOT_EQUALS_IGNORE_CASE, CONTAINS, IN. + Operator *string `json:"operator" validate:"required"` + + // The stringified JSON value that the claim is compared to using the operator. + Value *string `json:"value" validate:"required"` +} + +// NewProfileClaimRuleConditions : Instantiate ProfileClaimRuleConditions (Generic Model Constructor) +func (*IamIdentityV1) NewProfileClaimRuleConditions(claim string, operator string, value string) (_model *ProfileClaimRuleConditions, err error) { + _model = &ProfileClaimRuleConditions{ + Claim: core.StringPtr(claim), + Operator: core.StringPtr(operator), + Value: core.StringPtr(value), + } + err = core.ValidateStruct(_model, "required parameters") + return +} + +// UnmarshalProfileClaimRuleConditions unmarshals an instance of ProfileClaimRuleConditions from the specified map of raw messages. +func UnmarshalProfileClaimRuleConditions(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ProfileClaimRuleConditions) + err = core.UnmarshalPrimitive(m, "claim", &obj.Claim) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "operator", &obj.Operator) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ProfileClaimRuleList : ProfileClaimRuleList struct +type ProfileClaimRuleList struct { + // Context with key properties for problem determination. + Context *ResponseContext `json:"context,omitempty"` + + // List of claim rules. + Rules []ProfileClaimRule `json:"rules" validate:"required"` +} + +// UnmarshalProfileClaimRuleList unmarshals an instance of ProfileClaimRuleList from the specified map of raw messages. +func UnmarshalProfileClaimRuleList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ProfileClaimRuleList) + err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalProfileClaimRule) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ProfileLink : Link details. +type ProfileLink struct { + // the unique identifier of the claim rule. + ID *string `json:"id" validate:"required"` + + // version of the claim rule. + EntityTag *string `json:"entity_tag" validate:"required"` + + // If set contains a date time string of the creation date in ISO format. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If set contains a date time string of the last modification date in ISO format. + ModifiedAt *strfmt.DateTime `json:"modified_at" validate:"required"` + + // Optional name of the Link. + Name *string `json:"name,omitempty"` + + // The compute resource type. Valid values are VSI, IKS_SA, ROKS_SA. + CrType *string `json:"cr_type" validate:"required"` + + Link *ProfileLinkLink `json:"link" validate:"required"` +} + +// UnmarshalProfileLink unmarshals an instance of ProfileLink from the specified map of raw messages. +func UnmarshalProfileLink(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ProfileLink) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "modified_at", &obj.ModifiedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cr_type", &obj.CrType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "link", &obj.Link, UnmarshalProfileLinkLink) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ProfileLinkLink : ProfileLinkLink struct +type ProfileLinkLink struct { + // The CRN of the compute resource. + CRN *string `json:"crn,omitempty"` + + // The compute resource namespace, only required if cr_type is IKS_SA or ROKS_SA. + Namespace *string `json:"namespace,omitempty"` + + // Name of the compute resource, only required if cr_type is IKS_SA or ROKS_SA. + Name *string `json:"name,omitempty"` +} + +// UnmarshalProfileLinkLink unmarshals an instance of ProfileLinkLink from the specified map of raw messages. +func UnmarshalProfileLinkLink(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ProfileLinkLink) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "namespace", &obj.Namespace) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ProfileLinkList : ProfileLinkList struct +type ProfileLinkList struct { + // List of links to a trusted profile. + Links []ProfileLink `json:"links" validate:"required"` +} + +// UnmarshalProfileLinkList unmarshals an instance of ProfileLinkList from the specified map of raw messages. +func UnmarshalProfileLinkList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ProfileLinkList) + err = core.UnmarshalModel(m, "links", &obj.Links, UnmarshalProfileLink) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResponseContext : Context with key properties for problem determination. +type ResponseContext struct { + // The transaction ID of the inbound REST request. + TransactionID *string `json:"transaction_id,omitempty"` + + // The operation of the inbound REST request. + Operation *string `json:"operation,omitempty"` + + // The user agent of the inbound REST request. + UserAgent *string `json:"user_agent,omitempty"` + + // The URL of that cluster. + URL *string `json:"url,omitempty"` + + // The instance ID of the server instance processing the request. + InstanceID *string `json:"instance_id,omitempty"` + + // The thread ID of the server instance processing the request. + ThreadID *string `json:"thread_id,omitempty"` + + // The host of the server instance processing the request. + Host *string `json:"host,omitempty"` + + // The start time of the request. + StartTime *string `json:"start_time,omitempty"` + + // The finish time of the request. + EndTime *string `json:"end_time,omitempty"` + + // The elapsed time in msec. + ElapsedTime *string `json:"elapsed_time,omitempty"` + + // The cluster name. + ClusterName *string `json:"cluster_name,omitempty"` +} + +// UnmarshalResponseContext unmarshals an instance of ResponseContext from the specified map of raw messages. +func UnmarshalResponseContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResponseContext) + err = core.UnmarshalPrimitive(m, "transaction_id", &obj.TransactionID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "operation", &obj.Operation) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_agent", &obj.UserAgent) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instance_id", &obj.InstanceID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "thread_id", &obj.ThreadID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "host", &obj.Host) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "start_time", &obj.StartTime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "end_time", &obj.EndTime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "elapsed_time", &obj.ElapsedTime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cluster_name", &obj.ClusterName) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ServiceID : Response body format for service ID V1 REST requests. +type ServiceID struct { + // Context with key properties for problem determination. + Context *ResponseContext `json:"context,omitempty"` + + // Unique identifier of this Service Id. + ID *string `json:"id" validate:"required"` + + // Cloud wide identifier for identities of this service ID. + IamID *string `json:"iam_id" validate:"required"` + + // Version of the service ID details object. You need to specify this value when updating the service ID to avoid stale + // updates. + EntityTag *string `json:"entity_tag" validate:"required"` + + // Cloud Resource Name of the item. Example Cloud Resource Name: + // 'crn:v1:bluemix:public:iam-identity:us-south:a/myaccount::serviceid:1234-5678-9012'. + CRN *string `json:"crn" validate:"required"` + + // The service ID cannot be changed if set to true. + Locked *bool `json:"locked" validate:"required"` + + // If set contains a date time string of the creation date in ISO format. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If set contains a date time string of the last modification date in ISO format. + ModifiedAt *strfmt.DateTime `json:"modified_at" validate:"required"` + + // ID of the account the service ID belongs to. + AccountID *string `json:"account_id" validate:"required"` + + // Name of the Service Id. The name is not checked for uniqueness. Therefore multiple names with the same value can + // exist. Access is done via the UUID of the Service Id. + Name *string `json:"name" validate:"required"` + + // The optional description of the Service Id. The 'description' property is only available if a description was + // provided during a create of a Service Id. + Description *string `json:"description,omitempty"` + + // Optional list of CRNs (string array) which point to the services connected to the service ID. + UniqueInstanceCrns []string `json:"unique_instance_crns,omitempty"` + + // History of the Service ID. + History []EnityHistoryRecord `json:"history,omitempty"` + + // Response body format for API key V1 REST requests. + Apikey *APIKey `json:"apikey,omitempty"` +} + +// UnmarshalServiceID unmarshals an instance of ServiceID from the specified map of raw messages. +func UnmarshalServiceID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ServiceID) + err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iam_id", &obj.IamID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "locked", &obj.Locked) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "modified_at", &obj.ModifiedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "unique_instance_crns", &obj.UniqueInstanceCrns) + if err != nil { + return + } + err = core.UnmarshalModel(m, "history", &obj.History, UnmarshalEnityHistoryRecord) + if err != nil { + return + } + err = core.UnmarshalModel(m, "apikey", &obj.Apikey, UnmarshalAPIKey) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ServiceIDList : Response body format for the list service ID V1 REST request. +type ServiceIDList struct { + // Context with key properties for problem determination. + Context *ResponseContext `json:"context,omitempty"` + + // The offset of the current page. + Offset *int64 `json:"offset,omitempty"` + + // Optional size of a single page. Default is 20 items per page. Valid range is 1 to 100. + Limit *int64 `json:"limit,omitempty"` + + // Link to the first page. + First *string `json:"first,omitempty"` + + // Link to the previous available page. If 'previous' property is not part of the response no previous page is + // available. + Previous *string `json:"previous,omitempty"` + + // Link to the next available page. If 'next' property is not part of the response no next page is available. + Next *string `json:"next,omitempty"` + + // List of service IDs based on the query paramters and the page size. The service IDs array is always part of the + // response but might be empty depending on the query parameter values provided. + Serviceids []ServiceID `json:"serviceids" validate:"required"` +} + +// UnmarshalServiceIDList unmarshals an instance of ServiceIDList from the specified map of raw messages. +func UnmarshalServiceIDList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ServiceIDList) + err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "first", &obj.First) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "previous", &obj.Previous) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next", &obj.Next) + if err != nil { + return + } + err = core.UnmarshalModel(m, "serviceids", &obj.Serviceids, UnmarshalServiceID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TrustedProfile : Response body format for trusted profile V1 REST requests. +type TrustedProfile struct { + // Context with key properties for problem determination. + Context *ResponseContext `json:"context,omitempty"` + + // the unique identifier of the trusted profile. Example:'Profile-94497d0d-2ac3-41bf-a993-a49d1b14627c'. + ID *string `json:"id" validate:"required"` + + // Version of the trusted profile details object. You need to specify this value when updating the trusted profile to + // avoid stale updates. + EntityTag *string `json:"entity_tag" validate:"required"` + + // Cloud Resource Name of the item. Example Cloud Resource Name: + // 'crn:v1:bluemix:public:iam-identity:us-south:a/myaccount::profile:Profile-94497d0d-2ac3-41bf-a993-a49d1b14627c'. + CRN *string `json:"crn" validate:"required"` + + // Name of the trusted profile. The name is checked for uniqueness. Therefore trusted profiles with the same names can + // not exist in the same account. + Name *string `json:"name" validate:"required"` + + // The optional description of the trusted profile. The 'description' property is only available if a description was + // provided during a create of a trusted profile. + Description *string `json:"description,omitempty"` + + // If set contains a date time string of the creation date in ISO format. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // If set contains a date time string of the last modification date in ISO format. + ModifiedAt *strfmt.DateTime `json:"modified_at,omitempty"` + + // The iam_id of this trusted profile. + IamID *string `json:"iam_id" validate:"required"` + + // ID of the account that this trusted profile belong to. + AccountID *string `json:"account_id" validate:"required"` + + // IMS acount ID of the trusted profile. + ImsAccountID *int64 `json:"ims_account_id,omitempty"` + + // IMS user ID of the trusted profile. + ImsUserID *int64 `json:"ims_user_id,omitempty"` + + // History of the trusted profile. + History []EnityHistoryRecord `json:"history,omitempty"` +} + +// UnmarshalTrustedProfile unmarshals an instance of TrustedProfile from the specified map of raw messages. +func UnmarshalTrustedProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TrustedProfile) + err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "entity_tag", &obj.EntityTag) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "description", &obj.Description) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "modified_at", &obj.ModifiedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iam_id", &obj.IamID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ims_account_id", &obj.ImsAccountID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ims_user_id", &obj.ImsUserID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "history", &obj.History, UnmarshalEnityHistoryRecord) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// TrustedProfilesList : Response body format for the List trusted profiles V1 REST request. +type TrustedProfilesList struct { + // Context with key properties for problem determination. + Context *ResponseContext `json:"context,omitempty"` + + // The offset of the current page. + Offset *int64 `json:"offset,omitempty"` + + // Optional size of a single page. Default is 20 items per page. Valid range is 1 to 100. + Limit *int64 `json:"limit,omitempty"` + + // Link to the first page. + First *string `json:"first,omitempty"` + + // Link to the previous available page. If 'previous' property is not part of the response no previous page is + // available. + Previous *string `json:"previous,omitempty"` + + // Link to the next available page. If 'next' property is not part of the response no next page is available. + Next *string `json:"next,omitempty"` + + // List of trusted profiles. + Profiles []TrustedProfile `json:"profiles" validate:"required"` +} + +// UnmarshalTrustedProfilesList unmarshals an instance of TrustedProfilesList from the specified map of raw messages. +func UnmarshalTrustedProfilesList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(TrustedProfilesList) + err = core.UnmarshalModel(m, "context", &obj.Context, UnmarshalResponseContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "offset", &obj.Offset) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "first", &obj.First) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "previous", &obj.Previous) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next", &obj.Next) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalTrustedProfile) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// UnlockAPIKeyOptions : The UnlockAPIKey options. +type UnlockAPIKeyOptions struct { + // Unique ID of the API key. + ID *string `json:"-" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUnlockAPIKeyOptions : Instantiate UnlockAPIKeyOptions +func (*IamIdentityV1) NewUnlockAPIKeyOptions(id string) *UnlockAPIKeyOptions { + return &UnlockAPIKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *UnlockAPIKeyOptions) SetID(id string) *UnlockAPIKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UnlockAPIKeyOptions) SetHeaders(param map[string]string) *UnlockAPIKeyOptions { + options.Headers = param + return options +} + +// UnlockServiceIDOptions : The UnlockServiceID options. +type UnlockServiceIDOptions struct { + // Unique ID of the service ID. + ID *string `json:"-" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUnlockServiceIDOptions : Instantiate UnlockServiceIDOptions +func (*IamIdentityV1) NewUnlockServiceIDOptions(id string) *UnlockServiceIDOptions { + return &UnlockServiceIDOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *UnlockServiceIDOptions) SetID(id string) *UnlockServiceIDOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UnlockServiceIDOptions) SetHeaders(param map[string]string) *UnlockServiceIDOptions { + options.Headers = param + return options +} + +// UpdateAccountSettingsOptions : The UpdateAccountSettings options. +type UpdateAccountSettingsOptions struct { + // Version of the account settings to be updated. Specify the version that you retrieved as entity_tag (ETag header) + // when reading the account. This value helps identifying parallel usage of this API. Pass * to indicate to update any + // version available. This might result in stale updates. + IfMatch *string `json:"-" validate:"required"` + + // The id of the account to update the settings for. + AccountID *string `json:"-" validate:"required,ne="` + + // Defines whether or not creating a Service Id is access controlled. Valid values: + // * RESTRICTED - to apply access control + // * NOT_RESTRICTED - to remove access control + // * NOT_SET - to unset a previously set value. + RestrictCreateServiceID *string `json:"restrict_create_service_id,omitempty"` + + // Defines whether or not creating platform API keys is access controlled. Valid values: + // * RESTRICTED - to apply access control + // * NOT_RESTRICTED - to remove access control + // * NOT_SET - to 'unset' a previous set value. + RestrictCreatePlatformApikey *string `json:"restrict_create_platform_apikey,omitempty"` + + // Defines the IP addresses and subnets from which IAM tokens can be created for the account. + AllowedIPAddresses *string `json:"allowed_ip_addresses,omitempty"` + + // Defines the MFA trait for the account. Valid values: + // * NONE - No MFA trait set + // * TOTP - For all non-federated IBMId users + // * TOTP4ALL - For all users + // * LEVEL1 - Email-based MFA for all users + // * LEVEL2 - TOTP-based MFA for all users + // * LEVEL3 - U2F MFA for all users. + Mfa *string `json:"mfa,omitempty"` + + // Defines the session expiration in seconds for the account. Valid values: + // * Any whole number between between '900' and '86400' + // * NOT_SET - To unset account setting and use service default. + SessionExpirationInSeconds *string `json:"session_expiration_in_seconds,omitempty"` + + // Defines the period of time in seconds in which a session will be invalidated due to inactivity. Valid values: + // * Any whole number between '900' and '7200' + // * NOT_SET - To unset account setting and use service default. + SessionInvalidationInSeconds *string `json:"session_invalidation_in_seconds,omitempty"` + + // Defines the max allowed sessions per identity required by the account. Value values: + // * Any whole number greater than 0 + // * NOT_SET - To unset account setting and use service default. + MaxSessionsPerIdentity *string `json:"max_sessions_per_identity,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the UpdateAccountSettingsOptions.RestrictCreateServiceID property. +// Defines whether or not creating a Service Id is access controlled. Valid values: +// * RESTRICTED - to apply access control +// * NOT_RESTRICTED - to remove access control +// * NOT_SET - to unset a previously set value. +const ( + UpdateAccountSettingsOptionsRestrictCreateServiceIDNotRestrictedConst = "NOT_RESTRICTED" + UpdateAccountSettingsOptionsRestrictCreateServiceIDNotSetConst = "NOT_SET" + UpdateAccountSettingsOptionsRestrictCreateServiceIDRestrictedConst = "RESTRICTED" +) + +// Constants associated with the UpdateAccountSettingsOptions.RestrictCreatePlatformApikey property. +// Defines whether or not creating platform API keys is access controlled. Valid values: +// * RESTRICTED - to apply access control +// * NOT_RESTRICTED - to remove access control +// * NOT_SET - to 'unset' a previous set value. +const ( + UpdateAccountSettingsOptionsRestrictCreatePlatformApikeyNotRestrictedConst = "NOT_RESTRICTED" + UpdateAccountSettingsOptionsRestrictCreatePlatformApikeyNotSetConst = "NOT_SET" + UpdateAccountSettingsOptionsRestrictCreatePlatformApikeyRestrictedConst = "RESTRICTED" +) + +// Constants associated with the UpdateAccountSettingsOptions.Mfa property. +// Defines the MFA trait for the account. Valid values: +// * NONE - No MFA trait set +// * TOTP - For all non-federated IBMId users +// * TOTP4ALL - For all users +// * LEVEL1 - Email-based MFA for all users +// * LEVEL2 - TOTP-based MFA for all users +// * LEVEL3 - U2F MFA for all users. +const ( + UpdateAccountSettingsOptionsMfaLevel1Const = "LEVEL1" + UpdateAccountSettingsOptionsMfaLevel2Const = "LEVEL2" + UpdateAccountSettingsOptionsMfaLevel3Const = "LEVEL3" + UpdateAccountSettingsOptionsMfaNoneConst = "NONE" + UpdateAccountSettingsOptionsMfaTotpConst = "TOTP" + UpdateAccountSettingsOptionsMfaTotp4allConst = "TOTP4ALL" +) + +// NewUpdateAccountSettingsOptions : Instantiate UpdateAccountSettingsOptions +func (*IamIdentityV1) NewUpdateAccountSettingsOptions(ifMatch string, accountID string) *UpdateAccountSettingsOptions { + return &UpdateAccountSettingsOptions{ + IfMatch: core.StringPtr(ifMatch), + AccountID: core.StringPtr(accountID), + } +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateAccountSettingsOptions) SetIfMatch(ifMatch string) *UpdateAccountSettingsOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetAccountID : Allow user to set AccountID +func (_options *UpdateAccountSettingsOptions) SetAccountID(accountID string) *UpdateAccountSettingsOptions { + _options.AccountID = core.StringPtr(accountID) + return _options +} + +// SetRestrictCreateServiceID : Allow user to set RestrictCreateServiceID +func (_options *UpdateAccountSettingsOptions) SetRestrictCreateServiceID(restrictCreateServiceID string) *UpdateAccountSettingsOptions { + _options.RestrictCreateServiceID = core.StringPtr(restrictCreateServiceID) + return _options +} + +// SetRestrictCreatePlatformApikey : Allow user to set RestrictCreatePlatformApikey +func (_options *UpdateAccountSettingsOptions) SetRestrictCreatePlatformApikey(restrictCreatePlatformApikey string) *UpdateAccountSettingsOptions { + _options.RestrictCreatePlatformApikey = core.StringPtr(restrictCreatePlatformApikey) + return _options +} + +// SetAllowedIPAddresses : Allow user to set AllowedIPAddresses +func (_options *UpdateAccountSettingsOptions) SetAllowedIPAddresses(allowedIPAddresses string) *UpdateAccountSettingsOptions { + _options.AllowedIPAddresses = core.StringPtr(allowedIPAddresses) + return _options +} + +// SetMfa : Allow user to set Mfa +func (_options *UpdateAccountSettingsOptions) SetMfa(mfa string) *UpdateAccountSettingsOptions { + _options.Mfa = core.StringPtr(mfa) + return _options +} + +// SetSessionExpirationInSeconds : Allow user to set SessionExpirationInSeconds +func (_options *UpdateAccountSettingsOptions) SetSessionExpirationInSeconds(sessionExpirationInSeconds string) *UpdateAccountSettingsOptions { + _options.SessionExpirationInSeconds = core.StringPtr(sessionExpirationInSeconds) + return _options +} + +// SetSessionInvalidationInSeconds : Allow user to set SessionInvalidationInSeconds +func (_options *UpdateAccountSettingsOptions) SetSessionInvalidationInSeconds(sessionInvalidationInSeconds string) *UpdateAccountSettingsOptions { + _options.SessionInvalidationInSeconds = core.StringPtr(sessionInvalidationInSeconds) + return _options +} + +// SetMaxSessionsPerIdentity : Allow user to set MaxSessionsPerIdentity +func (_options *UpdateAccountSettingsOptions) SetMaxSessionsPerIdentity(maxSessionsPerIdentity string) *UpdateAccountSettingsOptions { + _options.MaxSessionsPerIdentity = core.StringPtr(maxSessionsPerIdentity) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateAccountSettingsOptions) SetHeaders(param map[string]string) *UpdateAccountSettingsOptions { + options.Headers = param + return options +} + +// UpdateAPIKeyOptions : The UpdateAPIKey options. +type UpdateAPIKeyOptions struct { + // Unique ID of the API key to be updated. + ID *string `json:"-" validate:"required,ne="` + + // Version of the API key to be updated. Specify the version that you retrieved when reading the API key. This value + // helps identifying parallel usage of this API. Pass * to indicate to update any version available. This might result + // in stale updates. + IfMatch *string `json:"-" validate:"required"` + + // The name of the API key to update. If specified in the request the parameter must not be empty. The name is not + // checked for uniqueness. Failure to this will result in an Error condition. + Name *string `json:"name,omitempty"` + + // The description of the API key to update. If specified an empty description will clear the description of the API + // key. If a non empty value is provided the API key will be updated. + Description *string `json:"description,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateAPIKeyOptions : Instantiate UpdateAPIKeyOptions +func (*IamIdentityV1) NewUpdateAPIKeyOptions(id string, ifMatch string) *UpdateAPIKeyOptions { + return &UpdateAPIKeyOptions{ + ID: core.StringPtr(id), + IfMatch: core.StringPtr(ifMatch), + } +} + +// SetID : Allow user to set ID +func (_options *UpdateAPIKeyOptions) SetID(id string) *UpdateAPIKeyOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateAPIKeyOptions) SetIfMatch(ifMatch string) *UpdateAPIKeyOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetName : Allow user to set Name +func (_options *UpdateAPIKeyOptions) SetName(name string) *UpdateAPIKeyOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetDescription : Allow user to set Description +func (_options *UpdateAPIKeyOptions) SetDescription(description string) *UpdateAPIKeyOptions { + _options.Description = core.StringPtr(description) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateAPIKeyOptions) SetHeaders(param map[string]string) *UpdateAPIKeyOptions { + options.Headers = param + return options +} + +// UpdateClaimRuleOptions : The UpdateClaimRule options. +type UpdateClaimRuleOptions struct { + // ID of the trusted profile. + ProfileID *string `json:"-" validate:"required,ne="` + + // ID of the claim rule to update. + RuleID *string `json:"-" validate:"required,ne="` + + // Version of the claim rule to be updated. Specify the version that you retrived when reading list of claim rules. + // This value helps to identify any parallel usage of claim rule. Pass * to indicate to update any version available. + // This might result in stale updates. + IfMatch *string `json:"-" validate:"required"` + + // Type of the calim rule, either 'Profile-SAML' or 'Profile-CR'. + Type *string `json:"type" validate:"required"` + + // Conditions of this claim rule. + Conditions []ProfileClaimRuleConditions `json:"conditions" validate:"required"` + + // Context with key properties for problem determination. + Context *ResponseContext `json:"context,omitempty"` + + // Name of the claim rule to be created or updated. + Name *string `json:"name,omitempty"` + + // The realm name of the Idp this claim rule applies to. This field is required only if the type is specified as + // 'Profile-SAML'. + RealmName *string `json:"realm_name,omitempty"` + + // The compute resource type the rule applies to, required only if type is specified as 'Profile-CR'. Valid values are + // VSI, IKS_SA, ROKS_SA. + CrType *string `json:"cr_type,omitempty"` + + // Session expiration in seconds, only required if type is 'Profile-SAML'. + Expiration *int64 `json:"expiration,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateClaimRuleOptions : Instantiate UpdateClaimRuleOptions +func (*IamIdentityV1) NewUpdateClaimRuleOptions(profileID string, ruleID string, ifMatch string, typeVar string, conditions []ProfileClaimRuleConditions) *UpdateClaimRuleOptions { + return &UpdateClaimRuleOptions{ + ProfileID: core.StringPtr(profileID), + RuleID: core.StringPtr(ruleID), + IfMatch: core.StringPtr(ifMatch), + Type: core.StringPtr(typeVar), + Conditions: conditions, + } +} + +// SetProfileID : Allow user to set ProfileID +func (_options *UpdateClaimRuleOptions) SetProfileID(profileID string) *UpdateClaimRuleOptions { + _options.ProfileID = core.StringPtr(profileID) + return _options +} + +// SetRuleID : Allow user to set RuleID +func (_options *UpdateClaimRuleOptions) SetRuleID(ruleID string) *UpdateClaimRuleOptions { + _options.RuleID = core.StringPtr(ruleID) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateClaimRuleOptions) SetIfMatch(ifMatch string) *UpdateClaimRuleOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetType : Allow user to set Type +func (_options *UpdateClaimRuleOptions) SetType(typeVar string) *UpdateClaimRuleOptions { + _options.Type = core.StringPtr(typeVar) + return _options +} + +// SetConditions : Allow user to set Conditions +func (_options *UpdateClaimRuleOptions) SetConditions(conditions []ProfileClaimRuleConditions) *UpdateClaimRuleOptions { + _options.Conditions = conditions + return _options +} + +// SetContext : Allow user to set Context +func (_options *UpdateClaimRuleOptions) SetContext(context *ResponseContext) *UpdateClaimRuleOptions { + _options.Context = context + return _options +} + +// SetName : Allow user to set Name +func (_options *UpdateClaimRuleOptions) SetName(name string) *UpdateClaimRuleOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetRealmName : Allow user to set RealmName +func (_options *UpdateClaimRuleOptions) SetRealmName(realmName string) *UpdateClaimRuleOptions { + _options.RealmName = core.StringPtr(realmName) + return _options +} + +// SetCrType : Allow user to set CrType +func (_options *UpdateClaimRuleOptions) SetCrType(crType string) *UpdateClaimRuleOptions { + _options.CrType = core.StringPtr(crType) + return _options +} + +// SetExpiration : Allow user to set Expiration +func (_options *UpdateClaimRuleOptions) SetExpiration(expiration int64) *UpdateClaimRuleOptions { + _options.Expiration = core.Int64Ptr(expiration) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateClaimRuleOptions) SetHeaders(param map[string]string) *UpdateClaimRuleOptions { + options.Headers = param + return options +} + +// UpdateProfileOptions : The UpdateProfile options. +type UpdateProfileOptions struct { + // ID of the trusted profile to be updated. + ProfileID *string `json:"-" validate:"required,ne="` + + // Version of the trusted profile to be updated. Specify the version that you retrived when reading list of trusted + // profiles. This value helps to identify any parallel usage of trusted profile. Pass * to indicate to update any + // version available. This might result in stale updates. + IfMatch *string `json:"-" validate:"required"` + + // The name of the trusted profile to update. If specified in the request the parameter must not be empty. The name is + // checked for uniqueness. Failure to this will result in an Error condition. + Name *string `json:"name,omitempty"` + + // The description of the trusted profile to update. If specified an empty description will clear the description of + // the trusted profile. If a non empty value is provided the trusted profile will be updated. + Description *string `json:"description,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateProfileOptions : Instantiate UpdateProfileOptions +func (*IamIdentityV1) NewUpdateProfileOptions(profileID string, ifMatch string) *UpdateProfileOptions { + return &UpdateProfileOptions{ + ProfileID: core.StringPtr(profileID), + IfMatch: core.StringPtr(ifMatch), + } +} + +// SetProfileID : Allow user to set ProfileID +func (_options *UpdateProfileOptions) SetProfileID(profileID string) *UpdateProfileOptions { + _options.ProfileID = core.StringPtr(profileID) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateProfileOptions) SetIfMatch(ifMatch string) *UpdateProfileOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetName : Allow user to set Name +func (_options *UpdateProfileOptions) SetName(name string) *UpdateProfileOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetDescription : Allow user to set Description +func (_options *UpdateProfileOptions) SetDescription(description string) *UpdateProfileOptions { + _options.Description = core.StringPtr(description) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateProfileOptions) SetHeaders(param map[string]string) *UpdateProfileOptions { + options.Headers = param + return options +} + +// UpdateServiceIDOptions : The UpdateServiceID options. +type UpdateServiceIDOptions struct { + // Unique ID of the service ID to be updated. + ID *string `json:"-" validate:"required,ne="` + + // Version of the service ID to be updated. Specify the version that you retrieved as entity_tag (ETag header) when + // reading the service ID. This value helps identifying parallel usage of this API. Pass * to indicate to update any + // version available. This might result in stale updates. + IfMatch *string `json:"-" validate:"required"` + + // The name of the service ID to update. If specified in the request the parameter must not be empty. The name is not + // checked for uniqueness. Failure to this will result in an Error condition. + Name *string `json:"name,omitempty"` + + // The description of the service ID to update. If specified an empty description will clear the description of the + // service ID. If an non empty value is provided the service ID will be updated. + Description *string `json:"description,omitempty"` + + // List of CRNs which point to the services connected to this service ID. If specified an empty list will clear all + // existing unique instance crns of the service ID. + UniqueInstanceCrns []string `json:"unique_instance_crns,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateServiceIDOptions : Instantiate UpdateServiceIDOptions +func (*IamIdentityV1) NewUpdateServiceIDOptions(id string, ifMatch string) *UpdateServiceIDOptions { + return &UpdateServiceIDOptions{ + ID: core.StringPtr(id), + IfMatch: core.StringPtr(ifMatch), + } +} + +// SetID : Allow user to set ID +func (_options *UpdateServiceIDOptions) SetID(id string) *UpdateServiceIDOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetIfMatch : Allow user to set IfMatch +func (_options *UpdateServiceIDOptions) SetIfMatch(ifMatch string) *UpdateServiceIDOptions { + _options.IfMatch = core.StringPtr(ifMatch) + return _options +} + +// SetName : Allow user to set Name +func (_options *UpdateServiceIDOptions) SetName(name string) *UpdateServiceIDOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetDescription : Allow user to set Description +func (_options *UpdateServiceIDOptions) SetDescription(description string) *UpdateServiceIDOptions { + _options.Description = core.StringPtr(description) + return _options +} + +// SetUniqueInstanceCrns : Allow user to set UniqueInstanceCrns +func (_options *UpdateServiceIDOptions) SetUniqueInstanceCrns(uniqueInstanceCrns []string) *UpdateServiceIDOptions { + _options.UniqueInstanceCrns = uniqueInstanceCrns + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateServiceIDOptions) SetHeaders(param map[string]string) *UpdateServiceIDOptions { + options.Headers = param + return options +} diff --git a/vendor/github.com/IBM/platform-services-go-sdk/resourcecontrollerv2/resource_controller_v2.go b/vendor/github.com/IBM/platform-services-go-sdk/resourcecontrollerv2/resource_controller_v2.go new file mode 100644 index 00000000000..f2b6ac9cd8f --- /dev/null +++ b/vendor/github.com/IBM/platform-services-go-sdk/resourcecontrollerv2/resource_controller_v2.go @@ -0,0 +1,4724 @@ +/** + * (C) Copyright IBM Corp. 2021. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 3.32.0-4c6a3129-20210514-210323 + */ + +// Package resourcecontrollerv2 : Operations and models for the ResourceControllerV2 service +package resourcecontrollerv2 + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/IBM/go-sdk-core/v5/core" + common "github.com/IBM/platform-services-go-sdk/common" + "github.com/go-openapi/strfmt" +) + +// ResourceControllerV2 : Manage lifecycle of your Cloud resources using Resource Controller APIs. Resources are +// provisioned globally in an account scope. Supports asynchronous provisioning of resources. Enables consumption of a +// global resource through a Cloud Foundry space in any region. +// +// Version: 2.0 +type ResourceControllerV2 struct { + Service *core.BaseService +} + +// DefaultServiceURL is the default URL to make service requests to. +const DefaultServiceURL = "https://resource-controller.cloud.ibm.com" + +// DefaultServiceName is the default key used to find external configuration information. +const DefaultServiceName = "resource_controller" + +// ResourceControllerV2Options : Service options +type ResourceControllerV2Options struct { + ServiceName string + URL string + Authenticator core.Authenticator +} + +// NewResourceControllerV2UsingExternalConfig : constructs an instance of ResourceControllerV2 with passed in options and external configuration. +func NewResourceControllerV2UsingExternalConfig(options *ResourceControllerV2Options) (resourceController *ResourceControllerV2, err error) { + if options.ServiceName == "" { + options.ServiceName = DefaultServiceName + } + + if options.Authenticator == nil { + options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) + if err != nil { + return + } + } + + resourceController, err = NewResourceControllerV2(options) + if err != nil { + return + } + + err = resourceController.Service.ConfigureService(options.ServiceName) + if err != nil { + return + } + + if options.URL != "" { + err = resourceController.Service.SetServiceURL(options.URL) + } + return +} + +// NewResourceControllerV2 : constructs an instance of ResourceControllerV2 with passed in options. +func NewResourceControllerV2(options *ResourceControllerV2Options) (service *ResourceControllerV2, err error) { + serviceOptions := &core.ServiceOptions{ + URL: DefaultServiceURL, + Authenticator: options.Authenticator, + } + + baseService, err := core.NewBaseService(serviceOptions) + if err != nil { + return + } + + if options.URL != "" { + err = baseService.SetServiceURL(options.URL) + if err != nil { + return + } + } + + service = &ResourceControllerV2{ + Service: baseService, + } + + return +} + +// GetServiceURLForRegion returns the service URL to be used for the specified region +func GetServiceURLForRegion(region string) (string, error) { + return "", fmt.Errorf("service does not support regional URLs") +} + +// Clone makes a copy of "resourceController" suitable for processing requests. +func (resourceController *ResourceControllerV2) Clone() *ResourceControllerV2 { + if core.IsNil(resourceController) { + return nil + } + clone := *resourceController + clone.Service = resourceController.Service.Clone() + return &clone +} + +// SetServiceURL sets the service URL +func (resourceController *ResourceControllerV2) SetServiceURL(url string) error { + return resourceController.Service.SetServiceURL(url) +} + +// GetServiceURL returns the service URL +func (resourceController *ResourceControllerV2) GetServiceURL() string { + return resourceController.Service.GetServiceURL() +} + +// SetDefaultHeaders sets HTTP headers to be sent in every request +func (resourceController *ResourceControllerV2) SetDefaultHeaders(headers http.Header) { + resourceController.Service.SetDefaultHeaders(headers) +} + +// SetEnableGzipCompression sets the service's EnableGzipCompression field +func (resourceController *ResourceControllerV2) SetEnableGzipCompression(enableGzip bool) { + resourceController.Service.SetEnableGzipCompression(enableGzip) +} + +// GetEnableGzipCompression returns the service's EnableGzipCompression field +func (resourceController *ResourceControllerV2) GetEnableGzipCompression() bool { + return resourceController.Service.GetEnableGzipCompression() +} + +// EnableRetries enables automatic retries for requests invoked for this service instance. +// If either parameter is specified as 0, then a default value is used instead. +func (resourceController *ResourceControllerV2) EnableRetries(maxRetries int, maxRetryInterval time.Duration) { + resourceController.Service.EnableRetries(maxRetries, maxRetryInterval) +} + +// DisableRetries disables automatic retries for requests invoked for this service instance. +func (resourceController *ResourceControllerV2) DisableRetries() { + resourceController.Service.DisableRetries() +} + +// ListResourceInstances : Get a list of all resource instances +// View a list of all available resource instances. Resources is a broad term that could mean anything from a service +// instance to a virtual machine associated with the customer account. +func (resourceController *ResourceControllerV2) ListResourceInstances(listResourceInstancesOptions *ListResourceInstancesOptions) (result *ResourceInstancesList, response *core.DetailedResponse, err error) { + return resourceController.ListResourceInstancesWithContext(context.Background(), listResourceInstancesOptions) +} + +// ListResourceInstancesWithContext is an alternate form of the ListResourceInstances method which supports a Context parameter +func (resourceController *ResourceControllerV2) ListResourceInstancesWithContext(ctx context.Context, listResourceInstancesOptions *ListResourceInstancesOptions) (result *ResourceInstancesList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listResourceInstancesOptions, "listResourceInstancesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_instances`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listResourceInstancesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "ListResourceInstances") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listResourceInstancesOptions.GUID != nil { + builder.AddQuery("guid", fmt.Sprint(*listResourceInstancesOptions.GUID)) + } + if listResourceInstancesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listResourceInstancesOptions.Name)) + } + if listResourceInstancesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group_id", fmt.Sprint(*listResourceInstancesOptions.ResourceGroupID)) + } + if listResourceInstancesOptions.ResourceID != nil { + builder.AddQuery("resource_id", fmt.Sprint(*listResourceInstancesOptions.ResourceID)) + } + if listResourceInstancesOptions.ResourcePlanID != nil { + builder.AddQuery("resource_plan_id", fmt.Sprint(*listResourceInstancesOptions.ResourcePlanID)) + } + if listResourceInstancesOptions.Type != nil { + builder.AddQuery("type", fmt.Sprint(*listResourceInstancesOptions.Type)) + } + if listResourceInstancesOptions.SubType != nil { + builder.AddQuery("sub_type", fmt.Sprint(*listResourceInstancesOptions.SubType)) + } + if listResourceInstancesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listResourceInstancesOptions.Limit)) + } + if listResourceInstancesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listResourceInstancesOptions.Start)) + } + if listResourceInstancesOptions.State != nil { + builder.AddQuery("state", fmt.Sprint(*listResourceInstancesOptions.State)) + } + if listResourceInstancesOptions.UpdatedFrom != nil { + builder.AddQuery("updated_from", fmt.Sprint(*listResourceInstancesOptions.UpdatedFrom)) + } + if listResourceInstancesOptions.UpdatedTo != nil { + builder.AddQuery("updated_to", fmt.Sprint(*listResourceInstancesOptions.UpdatedTo)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceInstancesList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateResourceInstance : Create (provision) a new resource instance +// When you provision a service you get an instance of that service. An instance represents the resource with which you +// create, and additionally, represents a chargeable record of which billing can occur. +func (resourceController *ResourceControllerV2) CreateResourceInstance(createResourceInstanceOptions *CreateResourceInstanceOptions) (result *ResourceInstance, response *core.DetailedResponse, err error) { + return resourceController.CreateResourceInstanceWithContext(context.Background(), createResourceInstanceOptions) +} + +// CreateResourceInstanceWithContext is an alternate form of the CreateResourceInstance method which supports a Context parameter +func (resourceController *ResourceControllerV2) CreateResourceInstanceWithContext(ctx context.Context, createResourceInstanceOptions *CreateResourceInstanceOptions) (result *ResourceInstance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createResourceInstanceOptions, "createResourceInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createResourceInstanceOptions, "createResourceInstanceOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_instances`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createResourceInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "CreateResourceInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + if createResourceInstanceOptions.EntityLock != nil { + builder.AddHeader("Entity-Lock", fmt.Sprint(*createResourceInstanceOptions.EntityLock)) + } + + body := make(map[string]interface{}) + if createResourceInstanceOptions.Name != nil { + body["name"] = createResourceInstanceOptions.Name + } + if createResourceInstanceOptions.Target != nil { + body["target"] = createResourceInstanceOptions.Target + } + if createResourceInstanceOptions.ResourceGroup != nil { + body["resource_group"] = createResourceInstanceOptions.ResourceGroup + } + if createResourceInstanceOptions.ResourcePlanID != nil { + body["resource_plan_id"] = createResourceInstanceOptions.ResourcePlanID + } + if createResourceInstanceOptions.Tags != nil { + body["tags"] = createResourceInstanceOptions.Tags + } + if createResourceInstanceOptions.AllowCleanup != nil { + body["allow_cleanup"] = createResourceInstanceOptions.AllowCleanup + } + if createResourceInstanceOptions.Parameters != nil { + body["parameters"] = createResourceInstanceOptions.Parameters + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceInstance) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetResourceInstance : Get a resource instance +// Retrieve a resource instance by ID. Find more details on a particular instance, like when it was provisioned and who +// provisioned it. +func (resourceController *ResourceControllerV2) GetResourceInstance(getResourceInstanceOptions *GetResourceInstanceOptions) (result *ResourceInstance, response *core.DetailedResponse, err error) { + return resourceController.GetResourceInstanceWithContext(context.Background(), getResourceInstanceOptions) +} + +// GetResourceInstanceWithContext is an alternate form of the GetResourceInstance method which supports a Context parameter +func (resourceController *ResourceControllerV2) GetResourceInstanceWithContext(ctx context.Context, getResourceInstanceOptions *GetResourceInstanceOptions) (result *ResourceInstance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getResourceInstanceOptions, "getResourceInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getResourceInstanceOptions, "getResourceInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getResourceInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_instances/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getResourceInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "GetResourceInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceInstance) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteResourceInstance : Delete a resource instance +// Delete a resource instance by ID. If the resource instance has any resource keys or aliases associated with it, use +// the `recursive=true parameter` to delete it. +func (resourceController *ResourceControllerV2) DeleteResourceInstance(deleteResourceInstanceOptions *DeleteResourceInstanceOptions) (response *core.DetailedResponse, err error) { + return resourceController.DeleteResourceInstanceWithContext(context.Background(), deleteResourceInstanceOptions) +} + +// DeleteResourceInstanceWithContext is an alternate form of the DeleteResourceInstance method which supports a Context parameter +func (resourceController *ResourceControllerV2) DeleteResourceInstanceWithContext(ctx context.Context, deleteResourceInstanceOptions *DeleteResourceInstanceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteResourceInstanceOptions, "deleteResourceInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteResourceInstanceOptions, "deleteResourceInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteResourceInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_instances/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteResourceInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "DeleteResourceInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + if deleteResourceInstanceOptions.Recursive != nil { + builder.AddQuery("recursive", fmt.Sprint(*deleteResourceInstanceOptions.Recursive)) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = resourceController.Service.Request(request, nil) + + return +} + +// UpdateResourceInstance : Update a resource instance +// You can use the ID to make updates to the resource instance, like changing the name or plan. +func (resourceController *ResourceControllerV2) UpdateResourceInstance(updateResourceInstanceOptions *UpdateResourceInstanceOptions) (result *ResourceInstance, response *core.DetailedResponse, err error) { + return resourceController.UpdateResourceInstanceWithContext(context.Background(), updateResourceInstanceOptions) +} + +// UpdateResourceInstanceWithContext is an alternate form of the UpdateResourceInstance method which supports a Context parameter +func (resourceController *ResourceControllerV2) UpdateResourceInstanceWithContext(ctx context.Context, updateResourceInstanceOptions *UpdateResourceInstanceOptions) (result *ResourceInstance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateResourceInstanceOptions, "updateResourceInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateResourceInstanceOptions, "updateResourceInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateResourceInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_instances/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateResourceInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "UpdateResourceInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if updateResourceInstanceOptions.Name != nil { + body["name"] = updateResourceInstanceOptions.Name + } + if updateResourceInstanceOptions.Parameters != nil { + body["parameters"] = updateResourceInstanceOptions.Parameters + } + if updateResourceInstanceOptions.ResourcePlanID != nil { + body["resource_plan_id"] = updateResourceInstanceOptions.ResourcePlanID + } + if updateResourceInstanceOptions.AllowCleanup != nil { + body["allow_cleanup"] = updateResourceInstanceOptions.AllowCleanup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceInstance) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListResourceAliasesForInstance : Get a list of all resource aliases for the instance +// Retrieving a list of all resource aliases can help you find out who's using the resource instance. +func (resourceController *ResourceControllerV2) ListResourceAliasesForInstance(listResourceAliasesForInstanceOptions *ListResourceAliasesForInstanceOptions) (result *ResourceAliasesList, response *core.DetailedResponse, err error) { + return resourceController.ListResourceAliasesForInstanceWithContext(context.Background(), listResourceAliasesForInstanceOptions) +} + +// ListResourceAliasesForInstanceWithContext is an alternate form of the ListResourceAliasesForInstance method which supports a Context parameter +func (resourceController *ResourceControllerV2) ListResourceAliasesForInstanceWithContext(ctx context.Context, listResourceAliasesForInstanceOptions *ListResourceAliasesForInstanceOptions) (result *ResourceAliasesList, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listResourceAliasesForInstanceOptions, "listResourceAliasesForInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listResourceAliasesForInstanceOptions, "listResourceAliasesForInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *listResourceAliasesForInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_instances/{id}/resource_aliases`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listResourceAliasesForInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "ListResourceAliasesForInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listResourceAliasesForInstanceOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listResourceAliasesForInstanceOptions.Limit)) + } + if listResourceAliasesForInstanceOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listResourceAliasesForInstanceOptions.Start)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceAliasesList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListResourceKeysForInstance : Get a list of all the resource keys for the instance +// You may have many resource keys for one resource instance. For example, you may have a different resource key for +// each user or each role. +func (resourceController *ResourceControllerV2) ListResourceKeysForInstance(listResourceKeysForInstanceOptions *ListResourceKeysForInstanceOptions) (result *ResourceKeysList, response *core.DetailedResponse, err error) { + return resourceController.ListResourceKeysForInstanceWithContext(context.Background(), listResourceKeysForInstanceOptions) +} + +// ListResourceKeysForInstanceWithContext is an alternate form of the ListResourceKeysForInstance method which supports a Context parameter +func (resourceController *ResourceControllerV2) ListResourceKeysForInstanceWithContext(ctx context.Context, listResourceKeysForInstanceOptions *ListResourceKeysForInstanceOptions) (result *ResourceKeysList, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listResourceKeysForInstanceOptions, "listResourceKeysForInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listResourceKeysForInstanceOptions, "listResourceKeysForInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *listResourceKeysForInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_instances/{id}/resource_keys`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listResourceKeysForInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "ListResourceKeysForInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listResourceKeysForInstanceOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listResourceKeysForInstanceOptions.Limit)) + } + if listResourceKeysForInstanceOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listResourceKeysForInstanceOptions.Start)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceKeysList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// LockResourceInstance : Lock a resource instance +// Locks a resource instance by ID. A locked instance can not be updated or deleted. It does not affect actions +// performed on child resources like aliases, bindings or keys. +func (resourceController *ResourceControllerV2) LockResourceInstance(lockResourceInstanceOptions *LockResourceInstanceOptions) (result *ResourceInstance, response *core.DetailedResponse, err error) { + return resourceController.LockResourceInstanceWithContext(context.Background(), lockResourceInstanceOptions) +} + +// LockResourceInstanceWithContext is an alternate form of the LockResourceInstance method which supports a Context parameter +func (resourceController *ResourceControllerV2) LockResourceInstanceWithContext(ctx context.Context, lockResourceInstanceOptions *LockResourceInstanceOptions) (result *ResourceInstance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(lockResourceInstanceOptions, "lockResourceInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(lockResourceInstanceOptions, "lockResourceInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *lockResourceInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_instances/{id}/lock`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range lockResourceInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "LockResourceInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceInstance) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UnlockResourceInstance : Unlock a resource instance +// Unlock a resource instance to update or delete it. Unlocking a resource instance does not affect child resources like +// aliases, bindings or keys. +func (resourceController *ResourceControllerV2) UnlockResourceInstance(unlockResourceInstanceOptions *UnlockResourceInstanceOptions) (result *ResourceInstance, response *core.DetailedResponse, err error) { + return resourceController.UnlockResourceInstanceWithContext(context.Background(), unlockResourceInstanceOptions) +} + +// UnlockResourceInstanceWithContext is an alternate form of the UnlockResourceInstance method which supports a Context parameter +func (resourceController *ResourceControllerV2) UnlockResourceInstanceWithContext(ctx context.Context, unlockResourceInstanceOptions *UnlockResourceInstanceOptions) (result *ResourceInstance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(unlockResourceInstanceOptions, "unlockResourceInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(unlockResourceInstanceOptions, "unlockResourceInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *unlockResourceInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_instances/{id}/lock`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range unlockResourceInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "UnlockResourceInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceInstance) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListResourceKeys : Get a list of all of the resource keys +// View all of the resource keys that exist for all of your resource instances. +func (resourceController *ResourceControllerV2) ListResourceKeys(listResourceKeysOptions *ListResourceKeysOptions) (result *ResourceKeysList, response *core.DetailedResponse, err error) { + return resourceController.ListResourceKeysWithContext(context.Background(), listResourceKeysOptions) +} + +// ListResourceKeysWithContext is an alternate form of the ListResourceKeys method which supports a Context parameter +func (resourceController *ResourceControllerV2) ListResourceKeysWithContext(ctx context.Context, listResourceKeysOptions *ListResourceKeysOptions) (result *ResourceKeysList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listResourceKeysOptions, "listResourceKeysOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_keys`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listResourceKeysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "ListResourceKeys") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listResourceKeysOptions.GUID != nil { + builder.AddQuery("guid", fmt.Sprint(*listResourceKeysOptions.GUID)) + } + if listResourceKeysOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listResourceKeysOptions.Name)) + } + if listResourceKeysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group_id", fmt.Sprint(*listResourceKeysOptions.ResourceGroupID)) + } + if listResourceKeysOptions.ResourceID != nil { + builder.AddQuery("resource_id", fmt.Sprint(*listResourceKeysOptions.ResourceID)) + } + if listResourceKeysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listResourceKeysOptions.Limit)) + } + if listResourceKeysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listResourceKeysOptions.Start)) + } + if listResourceKeysOptions.UpdatedFrom != nil { + builder.AddQuery("updated_from", fmt.Sprint(*listResourceKeysOptions.UpdatedFrom)) + } + if listResourceKeysOptions.UpdatedTo != nil { + builder.AddQuery("updated_to", fmt.Sprint(*listResourceKeysOptions.UpdatedTo)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceKeysList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateResourceKey : Create a new resource key +// A resource key is a saved credential you can use to authenticate with a resource instance. +func (resourceController *ResourceControllerV2) CreateResourceKey(createResourceKeyOptions *CreateResourceKeyOptions) (result *ResourceKey, response *core.DetailedResponse, err error) { + return resourceController.CreateResourceKeyWithContext(context.Background(), createResourceKeyOptions) +} + +// CreateResourceKeyWithContext is an alternate form of the CreateResourceKey method which supports a Context parameter +func (resourceController *ResourceControllerV2) CreateResourceKeyWithContext(ctx context.Context, createResourceKeyOptions *CreateResourceKeyOptions) (result *ResourceKey, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createResourceKeyOptions, "createResourceKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createResourceKeyOptions, "createResourceKeyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_keys`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createResourceKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "CreateResourceKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if createResourceKeyOptions.Name != nil { + body["name"] = createResourceKeyOptions.Name + } + if createResourceKeyOptions.Source != nil { + body["source"] = createResourceKeyOptions.Source + } + if createResourceKeyOptions.Parameters != nil { + body["parameters"] = createResourceKeyOptions.Parameters + } + if createResourceKeyOptions.Role != nil { + body["role"] = createResourceKeyOptions.Role + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetResourceKey : Get resource key by ID +// View a resource key and all of its details, like the credentials for the key and who created it. +func (resourceController *ResourceControllerV2) GetResourceKey(getResourceKeyOptions *GetResourceKeyOptions) (result *ResourceKey, response *core.DetailedResponse, err error) { + return resourceController.GetResourceKeyWithContext(context.Background(), getResourceKeyOptions) +} + +// GetResourceKeyWithContext is an alternate form of the GetResourceKey method which supports a Context parameter +func (resourceController *ResourceControllerV2) GetResourceKeyWithContext(ctx context.Context, getResourceKeyOptions *GetResourceKeyOptions) (result *ResourceKey, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getResourceKeyOptions, "getResourceKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getResourceKeyOptions, "getResourceKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getResourceKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getResourceKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "GetResourceKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteResourceKey : Delete a resource key by ID +// Deleting a resource key does not affect any resource instance or resource alias associated with the key. +func (resourceController *ResourceControllerV2) DeleteResourceKey(deleteResourceKeyOptions *DeleteResourceKeyOptions) (response *core.DetailedResponse, err error) { + return resourceController.DeleteResourceKeyWithContext(context.Background(), deleteResourceKeyOptions) +} + +// DeleteResourceKeyWithContext is an alternate form of the DeleteResourceKey method which supports a Context parameter +func (resourceController *ResourceControllerV2) DeleteResourceKeyWithContext(ctx context.Context, deleteResourceKeyOptions *DeleteResourceKeyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteResourceKeyOptions, "deleteResourceKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteResourceKeyOptions, "deleteResourceKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteResourceKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteResourceKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "DeleteResourceKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = resourceController.Service.Request(request, nil) + + return +} + +// UpdateResourceKey : Update a resource key +// Use the resource key ID to update the name of the resource key. +func (resourceController *ResourceControllerV2) UpdateResourceKey(updateResourceKeyOptions *UpdateResourceKeyOptions) (result *ResourceKey, response *core.DetailedResponse, err error) { + return resourceController.UpdateResourceKeyWithContext(context.Background(), updateResourceKeyOptions) +} + +// UpdateResourceKeyWithContext is an alternate form of the UpdateResourceKey method which supports a Context parameter +func (resourceController *ResourceControllerV2) UpdateResourceKeyWithContext(ctx context.Context, updateResourceKeyOptions *UpdateResourceKeyOptions) (result *ResourceKey, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateResourceKeyOptions, "updateResourceKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateResourceKeyOptions, "updateResourceKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateResourceKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateResourceKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "UpdateResourceKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if updateResourceKeyOptions.Name != nil { + body["name"] = updateResourceKeyOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceKey) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListResourceBindings : Get a list of all resource bindings +// View all of the resource bindings that exist for all of your resource aliases. +func (resourceController *ResourceControllerV2) ListResourceBindings(listResourceBindingsOptions *ListResourceBindingsOptions) (result *ResourceBindingsList, response *core.DetailedResponse, err error) { + return resourceController.ListResourceBindingsWithContext(context.Background(), listResourceBindingsOptions) +} + +// ListResourceBindingsWithContext is an alternate form of the ListResourceBindings method which supports a Context parameter +func (resourceController *ResourceControllerV2) ListResourceBindingsWithContext(ctx context.Context, listResourceBindingsOptions *ListResourceBindingsOptions) (result *ResourceBindingsList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listResourceBindingsOptions, "listResourceBindingsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_bindings`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listResourceBindingsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "ListResourceBindings") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listResourceBindingsOptions.GUID != nil { + builder.AddQuery("guid", fmt.Sprint(*listResourceBindingsOptions.GUID)) + } + if listResourceBindingsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listResourceBindingsOptions.Name)) + } + if listResourceBindingsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group_id", fmt.Sprint(*listResourceBindingsOptions.ResourceGroupID)) + } + if listResourceBindingsOptions.ResourceID != nil { + builder.AddQuery("resource_id", fmt.Sprint(*listResourceBindingsOptions.ResourceID)) + } + if listResourceBindingsOptions.RegionBindingID != nil { + builder.AddQuery("region_binding_id", fmt.Sprint(*listResourceBindingsOptions.RegionBindingID)) + } + if listResourceBindingsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listResourceBindingsOptions.Limit)) + } + if listResourceBindingsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listResourceBindingsOptions.Start)) + } + if listResourceBindingsOptions.UpdatedFrom != nil { + builder.AddQuery("updated_from", fmt.Sprint(*listResourceBindingsOptions.UpdatedFrom)) + } + if listResourceBindingsOptions.UpdatedTo != nil { + builder.AddQuery("updated_to", fmt.Sprint(*listResourceBindingsOptions.UpdatedTo)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceBindingsList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateResourceBinding : Create a new resource binding +// A resource binding connects credentials to a resource alias. The credentials are in the form of a resource key. +func (resourceController *ResourceControllerV2) CreateResourceBinding(createResourceBindingOptions *CreateResourceBindingOptions) (result *ResourceBinding, response *core.DetailedResponse, err error) { + return resourceController.CreateResourceBindingWithContext(context.Background(), createResourceBindingOptions) +} + +// CreateResourceBindingWithContext is an alternate form of the CreateResourceBinding method which supports a Context parameter +func (resourceController *ResourceControllerV2) CreateResourceBindingWithContext(ctx context.Context, createResourceBindingOptions *CreateResourceBindingOptions) (result *ResourceBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createResourceBindingOptions, "createResourceBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createResourceBindingOptions, "createResourceBindingOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_bindings`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createResourceBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "CreateResourceBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if createResourceBindingOptions.Source != nil { + body["source"] = createResourceBindingOptions.Source + } + if createResourceBindingOptions.Target != nil { + body["target"] = createResourceBindingOptions.Target + } + if createResourceBindingOptions.Name != nil { + body["name"] = createResourceBindingOptions.Name + } + if createResourceBindingOptions.Parameters != nil { + body["parameters"] = createResourceBindingOptions.Parameters + } + if createResourceBindingOptions.Role != nil { + body["role"] = createResourceBindingOptions.Role + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceBinding) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetResourceBinding : Get a resource binding +// View a resource binding and all of its details, like who created it, the credential, and the resource alias that the +// binding is associated with. +func (resourceController *ResourceControllerV2) GetResourceBinding(getResourceBindingOptions *GetResourceBindingOptions) (result *ResourceBinding, response *core.DetailedResponse, err error) { + return resourceController.GetResourceBindingWithContext(context.Background(), getResourceBindingOptions) +} + +// GetResourceBindingWithContext is an alternate form of the GetResourceBinding method which supports a Context parameter +func (resourceController *ResourceControllerV2) GetResourceBindingWithContext(ctx context.Context, getResourceBindingOptions *GetResourceBindingOptions) (result *ResourceBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getResourceBindingOptions, "getResourceBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getResourceBindingOptions, "getResourceBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getResourceBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_bindings/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getResourceBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "GetResourceBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceBinding) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteResourceBinding : Delete a resource binding +// Deleting a resource binding does not affect the resource alias that the binding is associated with. +func (resourceController *ResourceControllerV2) DeleteResourceBinding(deleteResourceBindingOptions *DeleteResourceBindingOptions) (response *core.DetailedResponse, err error) { + return resourceController.DeleteResourceBindingWithContext(context.Background(), deleteResourceBindingOptions) +} + +// DeleteResourceBindingWithContext is an alternate form of the DeleteResourceBinding method which supports a Context parameter +func (resourceController *ResourceControllerV2) DeleteResourceBindingWithContext(ctx context.Context, deleteResourceBindingOptions *DeleteResourceBindingOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteResourceBindingOptions, "deleteResourceBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteResourceBindingOptions, "deleteResourceBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteResourceBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_bindings/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteResourceBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "DeleteResourceBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = resourceController.Service.Request(request, nil) + + return +} + +// UpdateResourceBinding : Update a resource binding +// Use the resource binding ID to update the name of the resource binding. +func (resourceController *ResourceControllerV2) UpdateResourceBinding(updateResourceBindingOptions *UpdateResourceBindingOptions) (result *ResourceBinding, response *core.DetailedResponse, err error) { + return resourceController.UpdateResourceBindingWithContext(context.Background(), updateResourceBindingOptions) +} + +// UpdateResourceBindingWithContext is an alternate form of the UpdateResourceBinding method which supports a Context parameter +func (resourceController *ResourceControllerV2) UpdateResourceBindingWithContext(ctx context.Context, updateResourceBindingOptions *UpdateResourceBindingOptions) (result *ResourceBinding, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateResourceBindingOptions, "updateResourceBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateResourceBindingOptions, "updateResourceBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateResourceBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_bindings/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateResourceBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "UpdateResourceBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if updateResourceBindingOptions.Name != nil { + body["name"] = updateResourceBindingOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceBinding) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListResourceAliases : Get a list of all resource aliases +// View all of the resource aliases that exist for every resource instance. +func (resourceController *ResourceControllerV2) ListResourceAliases(listResourceAliasesOptions *ListResourceAliasesOptions) (result *ResourceAliasesList, response *core.DetailedResponse, err error) { + return resourceController.ListResourceAliasesWithContext(context.Background(), listResourceAliasesOptions) +} + +// ListResourceAliasesWithContext is an alternate form of the ListResourceAliases method which supports a Context parameter +func (resourceController *ResourceControllerV2) ListResourceAliasesWithContext(ctx context.Context, listResourceAliasesOptions *ListResourceAliasesOptions) (result *ResourceAliasesList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listResourceAliasesOptions, "listResourceAliasesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_aliases`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listResourceAliasesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "ListResourceAliases") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listResourceAliasesOptions.GUID != nil { + builder.AddQuery("guid", fmt.Sprint(*listResourceAliasesOptions.GUID)) + } + if listResourceAliasesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listResourceAliasesOptions.Name)) + } + if listResourceAliasesOptions.ResourceInstanceID != nil { + builder.AddQuery("resource_instance_id", fmt.Sprint(*listResourceAliasesOptions.ResourceInstanceID)) + } + if listResourceAliasesOptions.RegionInstanceID != nil { + builder.AddQuery("region_instance_id", fmt.Sprint(*listResourceAliasesOptions.RegionInstanceID)) + } + if listResourceAliasesOptions.ResourceID != nil { + builder.AddQuery("resource_id", fmt.Sprint(*listResourceAliasesOptions.ResourceID)) + } + if listResourceAliasesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group_id", fmt.Sprint(*listResourceAliasesOptions.ResourceGroupID)) + } + if listResourceAliasesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listResourceAliasesOptions.Limit)) + } + if listResourceAliasesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listResourceAliasesOptions.Start)) + } + if listResourceAliasesOptions.UpdatedFrom != nil { + builder.AddQuery("updated_from", fmt.Sprint(*listResourceAliasesOptions.UpdatedFrom)) + } + if listResourceAliasesOptions.UpdatedTo != nil { + builder.AddQuery("updated_to", fmt.Sprint(*listResourceAliasesOptions.UpdatedTo)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceAliasesList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateResourceAlias : Create a new resource alias +// Alias a resource instance into a targeted environment's (name)space. +func (resourceController *ResourceControllerV2) CreateResourceAlias(createResourceAliasOptions *CreateResourceAliasOptions) (result *ResourceAlias, response *core.DetailedResponse, err error) { + return resourceController.CreateResourceAliasWithContext(context.Background(), createResourceAliasOptions) +} + +// CreateResourceAliasWithContext is an alternate form of the CreateResourceAlias method which supports a Context parameter +func (resourceController *ResourceControllerV2) CreateResourceAliasWithContext(ctx context.Context, createResourceAliasOptions *CreateResourceAliasOptions) (result *ResourceAlias, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createResourceAliasOptions, "createResourceAliasOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createResourceAliasOptions, "createResourceAliasOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_aliases`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createResourceAliasOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "CreateResourceAlias") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if createResourceAliasOptions.Name != nil { + body["name"] = createResourceAliasOptions.Name + } + if createResourceAliasOptions.Source != nil { + body["source"] = createResourceAliasOptions.Source + } + if createResourceAliasOptions.Target != nil { + body["target"] = createResourceAliasOptions.Target + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceAlias) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetResourceAlias : Get a resource alias +// View a resource alias and all of its details, like who created it and the resource instance that it's associated +// with. +func (resourceController *ResourceControllerV2) GetResourceAlias(getResourceAliasOptions *GetResourceAliasOptions) (result *ResourceAlias, response *core.DetailedResponse, err error) { + return resourceController.GetResourceAliasWithContext(context.Background(), getResourceAliasOptions) +} + +// GetResourceAliasWithContext is an alternate form of the GetResourceAlias method which supports a Context parameter +func (resourceController *ResourceControllerV2) GetResourceAliasWithContext(ctx context.Context, getResourceAliasOptions *GetResourceAliasOptions) (result *ResourceAlias, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getResourceAliasOptions, "getResourceAliasOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getResourceAliasOptions, "getResourceAliasOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getResourceAliasOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_aliases/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getResourceAliasOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "GetResourceAlias") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceAlias) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteResourceAlias : Delete a resource alias +// If the resource alias has any resource keys or bindings associated with it, you must delete those child resources +// before deleting the resource alias. +func (resourceController *ResourceControllerV2) DeleteResourceAlias(deleteResourceAliasOptions *DeleteResourceAliasOptions) (response *core.DetailedResponse, err error) { + return resourceController.DeleteResourceAliasWithContext(context.Background(), deleteResourceAliasOptions) +} + +// DeleteResourceAliasWithContext is an alternate form of the DeleteResourceAlias method which supports a Context parameter +func (resourceController *ResourceControllerV2) DeleteResourceAliasWithContext(ctx context.Context, deleteResourceAliasOptions *DeleteResourceAliasOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteResourceAliasOptions, "deleteResourceAliasOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteResourceAliasOptions, "deleteResourceAliasOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteResourceAliasOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_aliases/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteResourceAliasOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "DeleteResourceAlias") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = resourceController.Service.Request(request, nil) + + return +} + +// UpdateResourceAlias : Update a resource alias +// Use the resource alias ID to update the name of the resource alias. +func (resourceController *ResourceControllerV2) UpdateResourceAlias(updateResourceAliasOptions *UpdateResourceAliasOptions) (result *ResourceAlias, response *core.DetailedResponse, err error) { + return resourceController.UpdateResourceAliasWithContext(context.Background(), updateResourceAliasOptions) +} + +// UpdateResourceAliasWithContext is an alternate form of the UpdateResourceAlias method which supports a Context parameter +func (resourceController *ResourceControllerV2) UpdateResourceAliasWithContext(ctx context.Context, updateResourceAliasOptions *UpdateResourceAliasOptions) (result *ResourceAlias, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateResourceAliasOptions, "updateResourceAliasOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateResourceAliasOptions, "updateResourceAliasOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateResourceAliasOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_aliases/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateResourceAliasOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "UpdateResourceAlias") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if updateResourceAliasOptions.Name != nil { + body["name"] = updateResourceAliasOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceAlias) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListResourceBindingsForAlias : Get a list of all resource bindings for the alias +// View all of the resource bindings associated with a specific resource alias. +func (resourceController *ResourceControllerV2) ListResourceBindingsForAlias(listResourceBindingsForAliasOptions *ListResourceBindingsForAliasOptions) (result *ResourceBindingsList, response *core.DetailedResponse, err error) { + return resourceController.ListResourceBindingsForAliasWithContext(context.Background(), listResourceBindingsForAliasOptions) +} + +// ListResourceBindingsForAliasWithContext is an alternate form of the ListResourceBindingsForAlias method which supports a Context parameter +func (resourceController *ResourceControllerV2) ListResourceBindingsForAliasWithContext(ctx context.Context, listResourceBindingsForAliasOptions *ListResourceBindingsForAliasOptions) (result *ResourceBindingsList, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listResourceBindingsForAliasOptions, "listResourceBindingsForAliasOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listResourceBindingsForAliasOptions, "listResourceBindingsForAliasOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *listResourceBindingsForAliasOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v2/resource_aliases/{id}/resource_bindings`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listResourceBindingsForAliasOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "ListResourceBindingsForAlias") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listResourceBindingsForAliasOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listResourceBindingsForAliasOptions.Limit)) + } + if listResourceBindingsForAliasOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listResourceBindingsForAliasOptions.Start)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceBindingsList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// ListReclamations : Get a list of all reclamations +// View all of the resource reclamations that exist for every resource instance. +func (resourceController *ResourceControllerV2) ListReclamations(listReclamationsOptions *ListReclamationsOptions) (result *ReclamationsList, response *core.DetailedResponse, err error) { + return resourceController.ListReclamationsWithContext(context.Background(), listReclamationsOptions) +} + +// ListReclamationsWithContext is an alternate form of the ListReclamations method which supports a Context parameter +func (resourceController *ResourceControllerV2) ListReclamationsWithContext(ctx context.Context, listReclamationsOptions *ListReclamationsOptions) (result *ReclamationsList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listReclamationsOptions, "listReclamationsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v1/reclamations`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listReclamationsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "ListReclamations") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listReclamationsOptions.AccountID != nil { + builder.AddQuery("account_id", fmt.Sprint(*listReclamationsOptions.AccountID)) + } + if listReclamationsOptions.ResourceInstanceID != nil { + builder.AddQuery("resource_instance_id", fmt.Sprint(*listReclamationsOptions.ResourceInstanceID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReclamationsList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// RunReclamationAction : Perform a reclamation action +// Reclaim a resource instance so that it can no longer be used, or restore the resource instance so that it's usable +// again. +func (resourceController *ResourceControllerV2) RunReclamationAction(runReclamationActionOptions *RunReclamationActionOptions) (result *Reclamation, response *core.DetailedResponse, err error) { + return resourceController.RunReclamationActionWithContext(context.Background(), runReclamationActionOptions) +} + +// RunReclamationActionWithContext is an alternate form of the RunReclamationAction method which supports a Context parameter +func (resourceController *ResourceControllerV2) RunReclamationActionWithContext(ctx context.Context, runReclamationActionOptions *RunReclamationActionOptions) (result *Reclamation, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(runReclamationActionOptions, "runReclamationActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(runReclamationActionOptions, "runReclamationActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *runReclamationActionOptions.ID, + "action_name": *runReclamationActionOptions.ActionName, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceController.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceController.Service.Options.URL, `/v1/reclamations/{id}/actions/{action_name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range runReclamationActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_controller", "V2", "RunReclamationAction") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if runReclamationActionOptions.RequestBy != nil { + body["request_by"] = runReclamationActionOptions.RequestBy + } + if runReclamationActionOptions.Comment != nil { + body["comment"] = runReclamationActionOptions.Comment + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceController.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReclamation) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateResourceAliasOptions : The CreateResourceAlias options. +type CreateResourceAliasOptions struct { + // The name of the alias. Must be 180 characters or less and cannot include any special characters other than `(space) + // - . _ :`. + Name *string `validate:"required"` + + // The short or long ID of resource instance. + Source *string `validate:"required"` + + // The CRN of target name(space) in a specific environment, for example, space in Dallas YP, CFEE instance etc. + Target *string `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateResourceAliasOptions : Instantiate CreateResourceAliasOptions +func (*ResourceControllerV2) NewCreateResourceAliasOptions(name string, source string, target string) *CreateResourceAliasOptions { + return &CreateResourceAliasOptions{ + Name: core.StringPtr(name), + Source: core.StringPtr(source), + Target: core.StringPtr(target), + } +} + +// SetName : Allow user to set Name +func (options *CreateResourceAliasOptions) SetName(name string) *CreateResourceAliasOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetSource : Allow user to set Source +func (options *CreateResourceAliasOptions) SetSource(source string) *CreateResourceAliasOptions { + options.Source = core.StringPtr(source) + return options +} + +// SetTarget : Allow user to set Target +func (options *CreateResourceAliasOptions) SetTarget(target string) *CreateResourceAliasOptions { + options.Target = core.StringPtr(target) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateResourceAliasOptions) SetHeaders(param map[string]string) *CreateResourceAliasOptions { + options.Headers = param + return options +} + +// CreateResourceBindingOptions : The CreateResourceBinding options. +type CreateResourceBindingOptions struct { + // The short or long ID of resource alias. + Source *string `validate:"required"` + + // The CRN of application to bind to in a specific environment, for example, Dallas YP, CFEE instance. + Target *string `validate:"required"` + + // The name of the binding. Must be 180 characters or less and cannot include any special characters other than + // `(space) - . _ :`. + Name *string + + // Configuration options represented as key-value pairs. Service defined options are passed through to the target + // resource brokers, whereas platform defined options are not. + Parameters *ResourceBindingPostParameters + + // The role name or it's CRN. + Role *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateResourceBindingOptions : Instantiate CreateResourceBindingOptions +func (*ResourceControllerV2) NewCreateResourceBindingOptions(source string, target string) *CreateResourceBindingOptions { + return &CreateResourceBindingOptions{ + Source: core.StringPtr(source), + Target: core.StringPtr(target), + } +} + +// SetSource : Allow user to set Source +func (options *CreateResourceBindingOptions) SetSource(source string) *CreateResourceBindingOptions { + options.Source = core.StringPtr(source) + return options +} + +// SetTarget : Allow user to set Target +func (options *CreateResourceBindingOptions) SetTarget(target string) *CreateResourceBindingOptions { + options.Target = core.StringPtr(target) + return options +} + +// SetName : Allow user to set Name +func (options *CreateResourceBindingOptions) SetName(name string) *CreateResourceBindingOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetParameters : Allow user to set Parameters +func (options *CreateResourceBindingOptions) SetParameters(parameters *ResourceBindingPostParameters) *CreateResourceBindingOptions { + options.Parameters = parameters + return options +} + +// SetRole : Allow user to set Role +func (options *CreateResourceBindingOptions) SetRole(role string) *CreateResourceBindingOptions { + options.Role = core.StringPtr(role) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateResourceBindingOptions) SetHeaders(param map[string]string) *CreateResourceBindingOptions { + options.Headers = param + return options +} + +// CreateResourceInstanceOptions : The CreateResourceInstance options. +type CreateResourceInstanceOptions struct { + // The name of the instance. Must be 180 characters or less and cannot include any special characters other than + // `(space) - . _ :`. + Name *string `validate:"required"` + + // The deployment location where the instance should be hosted. + Target *string `validate:"required"` + + // Short or long ID of resource group. + ResourceGroup *string `validate:"required"` + + // The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog. + ResourcePlanID *string `validate:"required"` + + // Tags that are attached to the instance after provisioning. These tags can be searched and managed through the + // Tagging API in IBM Cloud. + Tags []string + + // A boolean that dictates if the resource instance should be deleted (cleaned up) during the processing of a region + // instance delete call. + AllowCleanup *bool + + // Configuration options represented as key-value pairs that are passed through to the target resource brokers. + Parameters map[string]interface{} + + // Indicates if the resource instance is locked for further update or delete operations. It does not affect actions + // performed on child resources like aliases, bindings or keys. False by default. + EntityLock *bool + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateResourceInstanceOptions : Instantiate CreateResourceInstanceOptions +func (*ResourceControllerV2) NewCreateResourceInstanceOptions(name string, target string, resourceGroup string, resourcePlanID string) *CreateResourceInstanceOptions { + return &CreateResourceInstanceOptions{ + Name: core.StringPtr(name), + Target: core.StringPtr(target), + ResourceGroup: core.StringPtr(resourceGroup), + ResourcePlanID: core.StringPtr(resourcePlanID), + } +} + +// SetName : Allow user to set Name +func (options *CreateResourceInstanceOptions) SetName(name string) *CreateResourceInstanceOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetTarget : Allow user to set Target +func (options *CreateResourceInstanceOptions) SetTarget(target string) *CreateResourceInstanceOptions { + options.Target = core.StringPtr(target) + return options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (options *CreateResourceInstanceOptions) SetResourceGroup(resourceGroup string) *CreateResourceInstanceOptions { + options.ResourceGroup = core.StringPtr(resourceGroup) + return options +} + +// SetResourcePlanID : Allow user to set ResourcePlanID +func (options *CreateResourceInstanceOptions) SetResourcePlanID(resourcePlanID string) *CreateResourceInstanceOptions { + options.ResourcePlanID = core.StringPtr(resourcePlanID) + return options +} + +// SetTags : Allow user to set Tags +func (options *CreateResourceInstanceOptions) SetTags(tags []string) *CreateResourceInstanceOptions { + options.Tags = tags + return options +} + +// SetAllowCleanup : Allow user to set AllowCleanup +func (options *CreateResourceInstanceOptions) SetAllowCleanup(allowCleanup bool) *CreateResourceInstanceOptions { + options.AllowCleanup = core.BoolPtr(allowCleanup) + return options +} + +// SetParameters : Allow user to set Parameters +func (options *CreateResourceInstanceOptions) SetParameters(parameters map[string]interface{}) *CreateResourceInstanceOptions { + options.Parameters = parameters + return options +} + +// SetEntityLock : Allow user to set EntityLock +func (options *CreateResourceInstanceOptions) SetEntityLock(entityLock bool) *CreateResourceInstanceOptions { + options.EntityLock = core.BoolPtr(entityLock) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateResourceInstanceOptions) SetHeaders(param map[string]string) *CreateResourceInstanceOptions { + options.Headers = param + return options +} + +// CreateResourceKeyOptions : The CreateResourceKey options. +type CreateResourceKeyOptions struct { + // The name of the key. + Name *string `validate:"required"` + + // The short or long ID of resource instance or alias. + Source *string `validate:"required"` + + // Configuration options represented as key-value pairs. Service defined options are passed through to the target + // resource brokers, whereas platform defined options are not. + Parameters *ResourceKeyPostParameters + + // The role name or it's CRN. + Role *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateResourceKeyOptions : Instantiate CreateResourceKeyOptions +func (*ResourceControllerV2) NewCreateResourceKeyOptions(name string, source string) *CreateResourceKeyOptions { + return &CreateResourceKeyOptions{ + Name: core.StringPtr(name), + Source: core.StringPtr(source), + } +} + +// SetName : Allow user to set Name +func (options *CreateResourceKeyOptions) SetName(name string) *CreateResourceKeyOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetSource : Allow user to set Source +func (options *CreateResourceKeyOptions) SetSource(source string) *CreateResourceKeyOptions { + options.Source = core.StringPtr(source) + return options +} + +// SetParameters : Allow user to set Parameters +func (options *CreateResourceKeyOptions) SetParameters(parameters *ResourceKeyPostParameters) *CreateResourceKeyOptions { + options.Parameters = parameters + return options +} + +// SetRole : Allow user to set Role +func (options *CreateResourceKeyOptions) SetRole(role string) *CreateResourceKeyOptions { + options.Role = core.StringPtr(role) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateResourceKeyOptions) SetHeaders(param map[string]string) *CreateResourceKeyOptions { + options.Headers = param + return options +} + +// Credentials : The credentials for a resource. +type Credentials struct { + // The API key for the credentials. + Apikey *string `json:"apikey,omitempty"` + + // The optional description of the API key. + IamApikeyDescription *string `json:"iam_apikey_description,omitempty"` + + // The name of the API key. + IamApikeyName *string `json:"iam_apikey_name,omitempty"` + + // The Cloud Resource Name for the role of the credentials. + IamRoleCRN *string `json:"iam_role_crn,omitempty"` + + // The Cloud Resource Name for the service ID of the credentials. + IamServiceidCRN *string `json:"iam_serviceid_crn,omitempty"` + + // Allows users to set arbitrary properties + additionalProperties map[string]interface{} +} + +// SetProperty allows the user to set an arbitrary property on an instance of Credentials +func (o *Credentials) SetProperty(key string, value interface{}) { + if o.additionalProperties == nil { + o.additionalProperties = make(map[string]interface{}) + } + o.additionalProperties[key] = value +} + +// GetProperty allows the user to retrieve an arbitrary property from an instance of Credentials +func (o *Credentials) GetProperty(key string) interface{} { + return o.additionalProperties[key] +} + +// GetProperties allows the user to retrieve the map of arbitrary properties from an instance of Credentials +func (o *Credentials) GetProperties() map[string]interface{} { + return o.additionalProperties +} + +// MarshalJSON performs custom serialization for instances of Credentials +func (o *Credentials) MarshalJSON() (buffer []byte, err error) { + m := make(map[string]interface{}) + if len(o.additionalProperties) > 0 { + for k, v := range o.additionalProperties { + m[k] = v + } + } + if o.Apikey != nil { + m["apikey"] = o.Apikey + } + if o.IamApikeyDescription != nil { + m["iam_apikey_description"] = o.IamApikeyDescription + } + if o.IamApikeyName != nil { + m["iam_apikey_name"] = o.IamApikeyName + } + if o.IamRoleCRN != nil { + m["iam_role_crn"] = o.IamRoleCRN + } + if o.IamServiceidCRN != nil { + m["iam_serviceid_crn"] = o.IamServiceidCRN + } + buffer, err = json.Marshal(m) + return +} + +// UnmarshalCredentials unmarshals an instance of Credentials from the specified map of raw messages. +func UnmarshalCredentials(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Credentials) + err = core.UnmarshalPrimitive(m, "apikey", &obj.Apikey) + if err != nil { + return + } + delete(m, "apikey") + err = core.UnmarshalPrimitive(m, "iam_apikey_description", &obj.IamApikeyDescription) + if err != nil { + return + } + delete(m, "iam_apikey_description") + err = core.UnmarshalPrimitive(m, "iam_apikey_name", &obj.IamApikeyName) + if err != nil { + return + } + delete(m, "iam_apikey_name") + err = core.UnmarshalPrimitive(m, "iam_role_crn", &obj.IamRoleCRN) + if err != nil { + return + } + delete(m, "iam_role_crn") + err = core.UnmarshalPrimitive(m, "iam_serviceid_crn", &obj.IamServiceidCRN) + if err != nil { + return + } + delete(m, "iam_serviceid_crn") + for k := range m { + var v interface{} + e := core.UnmarshalPrimitive(m, k, &v) + if e != nil { + err = e + return + } + obj.SetProperty(k, v) + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DeleteResourceAliasOptions : The DeleteResourceAlias options. +type DeleteResourceAliasOptions struct { + // The short or long ID of the alias. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteResourceAliasOptions : Instantiate DeleteResourceAliasOptions +func (*ResourceControllerV2) NewDeleteResourceAliasOptions(id string) *DeleteResourceAliasOptions { + return &DeleteResourceAliasOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteResourceAliasOptions) SetID(id string) *DeleteResourceAliasOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteResourceAliasOptions) SetHeaders(param map[string]string) *DeleteResourceAliasOptions { + options.Headers = param + return options +} + +// DeleteResourceBindingOptions : The DeleteResourceBinding options. +type DeleteResourceBindingOptions struct { + // The short or long ID of the binding. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteResourceBindingOptions : Instantiate DeleteResourceBindingOptions +func (*ResourceControllerV2) NewDeleteResourceBindingOptions(id string) *DeleteResourceBindingOptions { + return &DeleteResourceBindingOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteResourceBindingOptions) SetID(id string) *DeleteResourceBindingOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteResourceBindingOptions) SetHeaders(param map[string]string) *DeleteResourceBindingOptions { + options.Headers = param + return options +} + +// DeleteResourceInstanceOptions : The DeleteResourceInstance options. +type DeleteResourceInstanceOptions struct { + // The short or long ID of the instance. + ID *string `validate:"required,ne="` + + // Will delete resource bindings, keys and aliases associated with the instance. + Recursive *bool + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteResourceInstanceOptions : Instantiate DeleteResourceInstanceOptions +func (*ResourceControllerV2) NewDeleteResourceInstanceOptions(id string) *DeleteResourceInstanceOptions { + return &DeleteResourceInstanceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteResourceInstanceOptions) SetID(id string) *DeleteResourceInstanceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetRecursive : Allow user to set Recursive +func (options *DeleteResourceInstanceOptions) SetRecursive(recursive bool) *DeleteResourceInstanceOptions { + options.Recursive = core.BoolPtr(recursive) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteResourceInstanceOptions) SetHeaders(param map[string]string) *DeleteResourceInstanceOptions { + options.Headers = param + return options +} + +// DeleteResourceKeyOptions : The DeleteResourceKey options. +type DeleteResourceKeyOptions struct { + // The short or long ID of the key. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteResourceKeyOptions : Instantiate DeleteResourceKeyOptions +func (*ResourceControllerV2) NewDeleteResourceKeyOptions(id string) *DeleteResourceKeyOptions { + return &DeleteResourceKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteResourceKeyOptions) SetID(id string) *DeleteResourceKeyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteResourceKeyOptions) SetHeaders(param map[string]string) *DeleteResourceKeyOptions { + options.Headers = param + return options +} + +// GetResourceAliasOptions : The GetResourceAlias options. +type GetResourceAliasOptions struct { + // The short or long ID of the alias. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetResourceAliasOptions : Instantiate GetResourceAliasOptions +func (*ResourceControllerV2) NewGetResourceAliasOptions(id string) *GetResourceAliasOptions { + return &GetResourceAliasOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetResourceAliasOptions) SetID(id string) *GetResourceAliasOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetResourceAliasOptions) SetHeaders(param map[string]string) *GetResourceAliasOptions { + options.Headers = param + return options +} + +// GetResourceBindingOptions : The GetResourceBinding options. +type GetResourceBindingOptions struct { + // The short or long ID of the binding. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetResourceBindingOptions : Instantiate GetResourceBindingOptions +func (*ResourceControllerV2) NewGetResourceBindingOptions(id string) *GetResourceBindingOptions { + return &GetResourceBindingOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetResourceBindingOptions) SetID(id string) *GetResourceBindingOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetResourceBindingOptions) SetHeaders(param map[string]string) *GetResourceBindingOptions { + options.Headers = param + return options +} + +// GetResourceInstanceOptions : The GetResourceInstance options. +type GetResourceInstanceOptions struct { + // The short or long ID of the instance. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetResourceInstanceOptions : Instantiate GetResourceInstanceOptions +func (*ResourceControllerV2) NewGetResourceInstanceOptions(id string) *GetResourceInstanceOptions { + return &GetResourceInstanceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetResourceInstanceOptions) SetID(id string) *GetResourceInstanceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetResourceInstanceOptions) SetHeaders(param map[string]string) *GetResourceInstanceOptions { + options.Headers = param + return options +} + +// GetResourceKeyOptions : The GetResourceKey options. +type GetResourceKeyOptions struct { + // The short or long ID of the key. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetResourceKeyOptions : Instantiate GetResourceKeyOptions +func (*ResourceControllerV2) NewGetResourceKeyOptions(id string) *GetResourceKeyOptions { + return &GetResourceKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetResourceKeyOptions) SetID(id string) *GetResourceKeyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetResourceKeyOptions) SetHeaders(param map[string]string) *GetResourceKeyOptions { + options.Headers = param + return options +} + +// ListReclamationsOptions : The ListReclamations options. +type ListReclamationsOptions struct { + // An alpha-numeric value identifying the account ID. + AccountID *string + + // The short ID of the resource instance. + ResourceInstanceID *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListReclamationsOptions : Instantiate ListReclamationsOptions +func (*ResourceControllerV2) NewListReclamationsOptions() *ListReclamationsOptions { + return &ListReclamationsOptions{} +} + +// SetAccountID : Allow user to set AccountID +func (options *ListReclamationsOptions) SetAccountID(accountID string) *ListReclamationsOptions { + options.AccountID = core.StringPtr(accountID) + return options +} + +// SetResourceInstanceID : Allow user to set ResourceInstanceID +func (options *ListReclamationsOptions) SetResourceInstanceID(resourceInstanceID string) *ListReclamationsOptions { + options.ResourceInstanceID = core.StringPtr(resourceInstanceID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListReclamationsOptions) SetHeaders(param map[string]string) *ListReclamationsOptions { + options.Headers = param + return options +} + +// ListResourceAliasesForInstanceOptions : The ListResourceAliasesForInstance options. +type ListResourceAliasesForInstanceOptions struct { + // The short or long ID of the instance. + ID *string `validate:"required,ne="` + + // Limit on how many items should be returned. + Limit *int64 + + // An optional token that indicates the beginning of the page of results to be returned. Any additional query + // parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is + // obtained from the 'next_url' field of the operation response. + Start *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListResourceAliasesForInstanceOptions : Instantiate ListResourceAliasesForInstanceOptions +func (*ResourceControllerV2) NewListResourceAliasesForInstanceOptions(id string) *ListResourceAliasesForInstanceOptions { + return &ListResourceAliasesForInstanceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *ListResourceAliasesForInstanceOptions) SetID(id string) *ListResourceAliasesForInstanceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListResourceAliasesForInstanceOptions) SetLimit(limit int64) *ListResourceAliasesForInstanceOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetStart : Allow user to set Start +func (options *ListResourceAliasesForInstanceOptions) SetStart(start string) *ListResourceAliasesForInstanceOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListResourceAliasesForInstanceOptions) SetHeaders(param map[string]string) *ListResourceAliasesForInstanceOptions { + options.Headers = param + return options +} + +// ListResourceAliasesOptions : The ListResourceAliases options. +type ListResourceAliasesOptions struct { + // Short ID of the alias. + GUID *string + + // The human-readable name of the alias. + Name *string + + // Resource instance short ID. + ResourceInstanceID *string + + // Short ID of the instance in a specific targeted environment. For example, `service_instance_id` in a given IBM Cloud + // environment. + RegionInstanceID *string + + // The unique ID of the offering (service name). This value is provided by and stored in the global catalog. + ResourceID *string + + // Short ID of Resource group. + ResourceGroupID *string + + // Limit on how many items should be returned. + Limit *int64 + + // An optional token that indicates the beginning of the page of results to be returned. Any additional query + // parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is + // obtained from the 'next_url' field of the operation response. + Start *string + + // Start date inclusive filter. + UpdatedFrom *string + + // End date inclusive filter. + UpdatedTo *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListResourceAliasesOptions : Instantiate ListResourceAliasesOptions +func (*ResourceControllerV2) NewListResourceAliasesOptions() *ListResourceAliasesOptions { + return &ListResourceAliasesOptions{} +} + +// SetGUID : Allow user to set GUID +func (options *ListResourceAliasesOptions) SetGUID(guid string) *ListResourceAliasesOptions { + options.GUID = core.StringPtr(guid) + return options +} + +// SetName : Allow user to set Name +func (options *ListResourceAliasesOptions) SetName(name string) *ListResourceAliasesOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetResourceInstanceID : Allow user to set ResourceInstanceID +func (options *ListResourceAliasesOptions) SetResourceInstanceID(resourceInstanceID string) *ListResourceAliasesOptions { + options.ResourceInstanceID = core.StringPtr(resourceInstanceID) + return options +} + +// SetRegionInstanceID : Allow user to set RegionInstanceID +func (options *ListResourceAliasesOptions) SetRegionInstanceID(regionInstanceID string) *ListResourceAliasesOptions { + options.RegionInstanceID = core.StringPtr(regionInstanceID) + return options +} + +// SetResourceID : Allow user to set ResourceID +func (options *ListResourceAliasesOptions) SetResourceID(resourceID string) *ListResourceAliasesOptions { + options.ResourceID = core.StringPtr(resourceID) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListResourceAliasesOptions) SetResourceGroupID(resourceGroupID string) *ListResourceAliasesOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListResourceAliasesOptions) SetLimit(limit int64) *ListResourceAliasesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetStart : Allow user to set Start +func (options *ListResourceAliasesOptions) SetStart(start string) *ListResourceAliasesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetUpdatedFrom : Allow user to set UpdatedFrom +func (options *ListResourceAliasesOptions) SetUpdatedFrom(updatedFrom string) *ListResourceAliasesOptions { + options.UpdatedFrom = core.StringPtr(updatedFrom) + return options +} + +// SetUpdatedTo : Allow user to set UpdatedTo +func (options *ListResourceAliasesOptions) SetUpdatedTo(updatedTo string) *ListResourceAliasesOptions { + options.UpdatedTo = core.StringPtr(updatedTo) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListResourceAliasesOptions) SetHeaders(param map[string]string) *ListResourceAliasesOptions { + options.Headers = param + return options +} + +// ListResourceBindingsForAliasOptions : The ListResourceBindingsForAlias options. +type ListResourceBindingsForAliasOptions struct { + // The short or long ID of the alias. + ID *string `validate:"required,ne="` + + // Limit on how many items should be returned. + Limit *int64 + + // An optional token that indicates the beginning of the page of results to be returned. Any additional query + // parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is + // obtained from the 'next_url' field of the operation response. + Start *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListResourceBindingsForAliasOptions : Instantiate ListResourceBindingsForAliasOptions +func (*ResourceControllerV2) NewListResourceBindingsForAliasOptions(id string) *ListResourceBindingsForAliasOptions { + return &ListResourceBindingsForAliasOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *ListResourceBindingsForAliasOptions) SetID(id string) *ListResourceBindingsForAliasOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListResourceBindingsForAliasOptions) SetLimit(limit int64) *ListResourceBindingsForAliasOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetStart : Allow user to set Start +func (options *ListResourceBindingsForAliasOptions) SetStart(start string) *ListResourceBindingsForAliasOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListResourceBindingsForAliasOptions) SetHeaders(param map[string]string) *ListResourceBindingsForAliasOptions { + options.Headers = param + return options +} + +// ListResourceBindingsOptions : The ListResourceBindings options. +type ListResourceBindingsOptions struct { + // The short ID of the binding. + GUID *string + + // The human-readable name of the binding. + Name *string + + // Short ID of the resource group. + ResourceGroupID *string + + // The unique ID of the offering (service name). This value is provided by and stored in the global catalog. + ResourceID *string + + // Short ID of the binding in the specific targeted environment, for example, service_binding_id in a given IBM Cloud + // environment. + RegionBindingID *string + + // Limit on how many items should be returned. + Limit *int64 + + // An optional token that indicates the beginning of the page of results to be returned. Any additional query + // parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is + // obtained from the 'next_url' field of the operation response. + Start *string + + // Start date inclusive filter. + UpdatedFrom *string + + // End date inclusive filter. + UpdatedTo *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListResourceBindingsOptions : Instantiate ListResourceBindingsOptions +func (*ResourceControllerV2) NewListResourceBindingsOptions() *ListResourceBindingsOptions { + return &ListResourceBindingsOptions{} +} + +// SetGUID : Allow user to set GUID +func (options *ListResourceBindingsOptions) SetGUID(guid string) *ListResourceBindingsOptions { + options.GUID = core.StringPtr(guid) + return options +} + +// SetName : Allow user to set Name +func (options *ListResourceBindingsOptions) SetName(name string) *ListResourceBindingsOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListResourceBindingsOptions) SetResourceGroupID(resourceGroupID string) *ListResourceBindingsOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetResourceID : Allow user to set ResourceID +func (options *ListResourceBindingsOptions) SetResourceID(resourceID string) *ListResourceBindingsOptions { + options.ResourceID = core.StringPtr(resourceID) + return options +} + +// SetRegionBindingID : Allow user to set RegionBindingID +func (options *ListResourceBindingsOptions) SetRegionBindingID(regionBindingID string) *ListResourceBindingsOptions { + options.RegionBindingID = core.StringPtr(regionBindingID) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListResourceBindingsOptions) SetLimit(limit int64) *ListResourceBindingsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetStart : Allow user to set Start +func (options *ListResourceBindingsOptions) SetStart(start string) *ListResourceBindingsOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetUpdatedFrom : Allow user to set UpdatedFrom +func (options *ListResourceBindingsOptions) SetUpdatedFrom(updatedFrom string) *ListResourceBindingsOptions { + options.UpdatedFrom = core.StringPtr(updatedFrom) + return options +} + +// SetUpdatedTo : Allow user to set UpdatedTo +func (options *ListResourceBindingsOptions) SetUpdatedTo(updatedTo string) *ListResourceBindingsOptions { + options.UpdatedTo = core.StringPtr(updatedTo) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListResourceBindingsOptions) SetHeaders(param map[string]string) *ListResourceBindingsOptions { + options.Headers = param + return options +} + +// ListResourceInstancesOptions : The ListResourceInstances options. +type ListResourceInstancesOptions struct { + // When you provision a new resource in the specified location for the selected plan, a GUID (globally unique + // identifier) is created. This is a unique internal GUID managed by Resource controller that corresponds to the + // instance. + GUID *string + + // The human-readable name of the instance. + Name *string + + // Short ID of a resource group. + ResourceGroupID *string + + // The unique ID of the offering. This value is provided by and stored in the global catalog. + ResourceID *string + + // The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog. + ResourcePlanID *string + + // The type of the instance, for example, `service_instance`. + Type *string + + // The sub-type of instance, for example, `cfaas`. + SubType *string + + // Limit on how many items should be returned. + Limit *int64 + + // An optional token that indicates the beginning of the page of results to be returned. Any additional query + // parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is + // obtained from the 'next_url' field of the operation response. + Start *string + + // The state of the instance. If not specified, instances in state `active` and `provisioning` are returned. + State *string + + // Start date inclusive filter. + UpdatedFrom *string + + // End date inclusive filter. + UpdatedTo *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListResourceInstancesOptions.State property. +// The state of the instance. If not specified, instances in state `active` and `provisioning` are returned. +const ( + ListResourceInstancesOptionsStateActiveConst = "active" + ListResourceInstancesOptionsStateProvisioningConst = "provisioning" + ListResourceInstancesOptionsStateRemovedConst = "removed" +) + +// NewListResourceInstancesOptions : Instantiate ListResourceInstancesOptions +func (*ResourceControllerV2) NewListResourceInstancesOptions() *ListResourceInstancesOptions { + return &ListResourceInstancesOptions{} +} + +// SetGUID : Allow user to set GUID +func (options *ListResourceInstancesOptions) SetGUID(guid string) *ListResourceInstancesOptions { + options.GUID = core.StringPtr(guid) + return options +} + +// SetName : Allow user to set Name +func (options *ListResourceInstancesOptions) SetName(name string) *ListResourceInstancesOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListResourceInstancesOptions) SetResourceGroupID(resourceGroupID string) *ListResourceInstancesOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetResourceID : Allow user to set ResourceID +func (options *ListResourceInstancesOptions) SetResourceID(resourceID string) *ListResourceInstancesOptions { + options.ResourceID = core.StringPtr(resourceID) + return options +} + +// SetResourcePlanID : Allow user to set ResourcePlanID +func (options *ListResourceInstancesOptions) SetResourcePlanID(resourcePlanID string) *ListResourceInstancesOptions { + options.ResourcePlanID = core.StringPtr(resourcePlanID) + return options +} + +// SetType : Allow user to set Type +func (options *ListResourceInstancesOptions) SetType(typeVar string) *ListResourceInstancesOptions { + options.Type = core.StringPtr(typeVar) + return options +} + +// SetSubType : Allow user to set SubType +func (options *ListResourceInstancesOptions) SetSubType(subType string) *ListResourceInstancesOptions { + options.SubType = core.StringPtr(subType) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListResourceInstancesOptions) SetLimit(limit int64) *ListResourceInstancesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetStart : Allow user to set Start +func (options *ListResourceInstancesOptions) SetStart(start string) *ListResourceInstancesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetState : Allow user to set State +func (options *ListResourceInstancesOptions) SetState(state string) *ListResourceInstancesOptions { + options.State = core.StringPtr(state) + return options +} + +// SetUpdatedFrom : Allow user to set UpdatedFrom +func (options *ListResourceInstancesOptions) SetUpdatedFrom(updatedFrom string) *ListResourceInstancesOptions { + options.UpdatedFrom = core.StringPtr(updatedFrom) + return options +} + +// SetUpdatedTo : Allow user to set UpdatedTo +func (options *ListResourceInstancesOptions) SetUpdatedTo(updatedTo string) *ListResourceInstancesOptions { + options.UpdatedTo = core.StringPtr(updatedTo) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListResourceInstancesOptions) SetHeaders(param map[string]string) *ListResourceInstancesOptions { + options.Headers = param + return options +} + +// ListResourceKeysForInstanceOptions : The ListResourceKeysForInstance options. +type ListResourceKeysForInstanceOptions struct { + // The short or long ID of the instance. + ID *string `validate:"required,ne="` + + // Limit on how many items should be returned. + Limit *int64 + + // An optional token that indicates the beginning of the page of results to be returned. Any additional query + // parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is + // obtained from the 'next_url' field of the operation response. + Start *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListResourceKeysForInstanceOptions : Instantiate ListResourceKeysForInstanceOptions +func (*ResourceControllerV2) NewListResourceKeysForInstanceOptions(id string) *ListResourceKeysForInstanceOptions { + return &ListResourceKeysForInstanceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *ListResourceKeysForInstanceOptions) SetID(id string) *ListResourceKeysForInstanceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListResourceKeysForInstanceOptions) SetLimit(limit int64) *ListResourceKeysForInstanceOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetStart : Allow user to set Start +func (options *ListResourceKeysForInstanceOptions) SetStart(start string) *ListResourceKeysForInstanceOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListResourceKeysForInstanceOptions) SetHeaders(param map[string]string) *ListResourceKeysForInstanceOptions { + options.Headers = param + return options +} + +// ListResourceKeysOptions : The ListResourceKeys options. +type ListResourceKeysOptions struct { + // When you create a new key, a GUID (globally unique identifier) is assigned. This is a unique internal GUID managed + // by Resource controller that corresponds to the key. + GUID *string + + // The human-readable name of the key. + Name *string + + // The short ID of the resource group. + ResourceGroupID *string + + // The unique ID of the offering. This value is provided by and stored in the global catalog. + ResourceID *string + + // Limit on how many items should be returned. + Limit *int64 + + // An optional token that indicates the beginning of the page of results to be returned. Any additional query + // parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is + // obtained from the 'next_url' field of the operation response. + Start *string + + // Start date inclusive filter. + UpdatedFrom *string + + // End date inclusive filter. + UpdatedTo *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListResourceKeysOptions : Instantiate ListResourceKeysOptions +func (*ResourceControllerV2) NewListResourceKeysOptions() *ListResourceKeysOptions { + return &ListResourceKeysOptions{} +} + +// SetGUID : Allow user to set GUID +func (options *ListResourceKeysOptions) SetGUID(guid string) *ListResourceKeysOptions { + options.GUID = core.StringPtr(guid) + return options +} + +// SetName : Allow user to set Name +func (options *ListResourceKeysOptions) SetName(name string) *ListResourceKeysOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListResourceKeysOptions) SetResourceGroupID(resourceGroupID string) *ListResourceKeysOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetResourceID : Allow user to set ResourceID +func (options *ListResourceKeysOptions) SetResourceID(resourceID string) *ListResourceKeysOptions { + options.ResourceID = core.StringPtr(resourceID) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListResourceKeysOptions) SetLimit(limit int64) *ListResourceKeysOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetStart : Allow user to set Start +func (options *ListResourceKeysOptions) SetStart(start string) *ListResourceKeysOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetUpdatedFrom : Allow user to set UpdatedFrom +func (options *ListResourceKeysOptions) SetUpdatedFrom(updatedFrom string) *ListResourceKeysOptions { + options.UpdatedFrom = core.StringPtr(updatedFrom) + return options +} + +// SetUpdatedTo : Allow user to set UpdatedTo +func (options *ListResourceKeysOptions) SetUpdatedTo(updatedTo string) *ListResourceKeysOptions { + options.UpdatedTo = core.StringPtr(updatedTo) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListResourceKeysOptions) SetHeaders(param map[string]string) *ListResourceKeysOptions { + options.Headers = param + return options +} + +// LockResourceInstanceOptions : The LockResourceInstance options. +type LockResourceInstanceOptions struct { + // The short or long ID of the instance. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewLockResourceInstanceOptions : Instantiate LockResourceInstanceOptions +func (*ResourceControllerV2) NewLockResourceInstanceOptions(id string) *LockResourceInstanceOptions { + return &LockResourceInstanceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *LockResourceInstanceOptions) SetID(id string) *LockResourceInstanceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *LockResourceInstanceOptions) SetHeaders(param map[string]string) *LockResourceInstanceOptions { + options.Headers = param + return options +} + +// PlanHistoryItem : An element of the plan history of the instance. +type PlanHistoryItem struct { + // The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog. + ResourcePlanID *string `json:"resource_plan_id" validate:"required"` + + // The date on which the plan was changed. + StartDate *strfmt.DateTime `json:"start_date" validate:"required"` + + // The subject who made the plan change. + RequestorID *string `json:"requestor_id,omitempty"` +} + +// UnmarshalPlanHistoryItem unmarshals an instance of PlanHistoryItem from the specified map of raw messages. +func UnmarshalPlanHistoryItem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PlanHistoryItem) + err = core.UnmarshalPrimitive(m, "resource_plan_id", &obj.ResourcePlanID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "start_date", &obj.StartDate) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "requestor_id", &obj.RequestorID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Reclamation : A reclamation. +type Reclamation struct { + // The ID associated with the reclamation. + ID *string `json:"id,omitempty"` + + // The short ID of the entity for the reclamation. + EntityID *string `json:"entity_id,omitempty"` + + // The short ID of the entity type for the reclamation. + EntityTypeID *string `json:"entity_type_id,omitempty"` + + // The full Cloud Resource Name (CRN) associated with the binding. For more information about this format, see [Cloud + // Resource Names](https://cloud.ibm.com/docs/overview?topic=overview-crn). + EntityCRN *string `json:"entity_crn,omitempty"` + + // The short ID of the resource instance. + ResourceInstanceID *string `json:"resource_instance_id,omitempty"` + + // The short ID of the resource group. + ResourceGroupID *string `json:"resource_group_id,omitempty"` + + // An alpha-numeric value identifying the account ID. + AccountID *string `json:"account_id,omitempty"` + + // The short ID of policy for the reclamation. + PolicyID *string `json:"policy_id,omitempty"` + + // The state of the reclamation. + State *string `json:"state,omitempty"` + + // The target time that the reclamation retention period end. + TargetTime *string `json:"target_time,omitempty"` + + // The custom properties of the reclamation. + CustomProperties map[string]interface{} `json:"custom_properties,omitempty"` + + // The date when the reclamation was created. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // The subject who created the reclamation. + CreatedBy *string `json:"created_by,omitempty"` + + // The date when the reclamation was last updated. + UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` + + // The subject who updated the reclamation. + UpdatedBy *string `json:"updated_by,omitempty"` +} + +// UnmarshalReclamation unmarshals an instance of Reclamation from the specified map of raw messages. +func UnmarshalReclamation(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Reclamation) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "entity_id", &obj.EntityID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "entity_type_id", &obj.EntityTypeID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "entity_crn", &obj.EntityCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_instance_id", &obj.ResourceInstanceID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_group_id", &obj.ResourceGroupID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_id", &obj.PolicyID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_time", &obj.TargetTime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "custom_properties", &obj.CustomProperties) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_by", &obj.UpdatedBy) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReclamationsList : A list of reclamations. +type ReclamationsList struct { + // A list of reclamations. + Resources []Reclamation `json:"resources,omitempty"` +} + +// UnmarshalReclamationsList unmarshals an instance of ReclamationsList from the specified map of raw messages. +func UnmarshalReclamationsList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReclamationsList) + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalReclamation) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceAlias : A resource alias. +type ResourceAlias struct { + // The ID associated with the alias. + ID *string `json:"id,omitempty"` + + // When you create a new alias, a globally unique identifier (GUID) is assigned. This GUID is a unique internal + // indentifier managed by the resource controller that corresponds to the alias. + GUID *string `json:"guid,omitempty"` + + // When you created a new alias, a relative URL path is created identifying the location of the alias. + URL *string `json:"url,omitempty"` + + // The date when the alias was created. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // The date when the alias was last updated. + UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` + + // The date when the alias was deleted. + DeletedAt *strfmt.DateTime `json:"deleted_at,omitempty"` + + // The subject who created the alias. + CreatedBy *string `json:"created_by,omitempty"` + + // The subject who updated the alias. + UpdatedBy *string `json:"updated_by,omitempty"` + + // The subject who deleted the alias. + DeletedBy *string `json:"deleted_by,omitempty"` + + // The human-readable name of the alias. + Name *string `json:"name,omitempty"` + + // The ID of the resource instance that is being aliased. + ResourceInstanceID *string `json:"resource_instance_id,omitempty"` + + // The CRN of the target namespace in the specific environment. + TargetCRN *string `json:"target_crn,omitempty"` + + // An alpha-numeric value identifying the account ID. + AccountID *string `json:"account_id,omitempty"` + + // The unique ID of the offering. This value is provided by and stored in the global catalog. + ResourceID *string `json:"resource_id,omitempty"` + + // The ID of the resource group. + ResourceGroupID *string `json:"resource_group_id,omitempty"` + + // The CRN of the alias. For more information about this format, see [Cloud Resource + // Names](https://cloud.ibm.com/docs/overview?topic=overview-crn). + CRN *string `json:"crn,omitempty"` + + // The ID of the instance in the specific target environment, for example, `service_instance_id` in a given IBM Cloud + // environment. + RegionInstanceID *string `json:"region_instance_id,omitempty"` + + // The CRN of the instance in the specific target environment. + RegionInstanceCRN *string `json:"region_instance_crn,omitempty"` + + // The state of the alias. + State *string `json:"state,omitempty"` + + // A boolean that dictates if the alias was migrated from a previous CF instance. + Migrated *bool `json:"migrated,omitempty"` + + // The relative path to the resource instance. + ResourceInstanceURL *string `json:"resource_instance_url,omitempty"` + + // The relative path to the resource bindings for the alias. + ResourceBindingsURL *string `json:"resource_bindings_url,omitempty"` + + // The relative path to the resource keys for the alias. + ResourceKeysURL *string `json:"resource_keys_url,omitempty"` +} + +// UnmarshalResourceAlias unmarshals an instance of ResourceAlias from the specified map of raw messages. +func UnmarshalResourceAlias(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceAlias) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "guid", &obj.GUID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deleted_at", &obj.DeletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_by", &obj.UpdatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deleted_by", &obj.DeletedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_instance_id", &obj.ResourceInstanceID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_crn", &obj.TargetCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_id", &obj.ResourceID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_group_id", &obj.ResourceGroupID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "region_instance_id", &obj.RegionInstanceID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "region_instance_crn", &obj.RegionInstanceCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "migrated", &obj.Migrated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_instance_url", &obj.ResourceInstanceURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_bindings_url", &obj.ResourceBindingsURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_keys_url", &obj.ResourceKeysURL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceAliasesList : A list of resource aliases. +type ResourceAliasesList struct { + // The number of resource aliases in `resources`. + RowsCount *int64 `json:"rows_count" validate:"required"` + + // The URL for requesting the next page of results. + NextURL *string `json:"next_url" validate:"required"` + + // A list of resource aliases. + Resources []ResourceAlias `json:"resources" validate:"required"` +} + +// UnmarshalResourceAliasesList unmarshals an instance of ResourceAliasesList from the specified map of raw messages. +func UnmarshalResourceAliasesList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceAliasesList) + err = core.UnmarshalPrimitive(m, "rows_count", &obj.RowsCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_url", &obj.NextURL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalResourceAlias) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceBinding : A resource binding. +type ResourceBinding struct { + // The ID associated with the binding. + ID *string `json:"id,omitempty"` + + // When you create a new binding, a globally unique identifier (GUID) is assigned. This GUID is a unique internal + // identifier managed by the resource controller that corresponds to the binding. + GUID *string `json:"guid,omitempty"` + + // When you provision a new binding, a relative URL path is created identifying the location of the binding. + URL *string `json:"url,omitempty"` + + // The date when the binding was created. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // The date when the binding was last updated. + UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` + + // The date when the binding was deleted. + DeletedAt *strfmt.DateTime `json:"deleted_at,omitempty"` + + // The subject who created the binding. + CreatedBy *string `json:"created_by,omitempty"` + + // The subject who updated the binding. + UpdatedBy *string `json:"updated_by,omitempty"` + + // The subject who deleted the binding. + DeletedBy *string `json:"deleted_by,omitempty"` + + // The CRN of resource alias associated to the binding. + SourceCRN *string `json:"source_crn,omitempty"` + + // The CRN of target resource, for example, application, in a specific environment. + TargetCRN *string `json:"target_crn,omitempty"` + + // The full Cloud Resource Name (CRN) associated with the binding. For more information about this format, see [Cloud + // Resource Names](https://cloud.ibm.com/docs/overview?topic=overview-crn). + CRN *string `json:"crn,omitempty"` + + // The ID of the binding in the specific target environment, for example, `service_binding_id` in a given IBM Cloud + // environment. + RegionBindingID *string `json:"region_binding_id,omitempty"` + + // The CRN of the binding in the specific target environment. + RegionBindingCRN *string `json:"region_binding_crn,omitempty"` + + // The human-readable name of the binding. + Name *string `json:"name,omitempty"` + + // An alpha-numeric value identifying the account ID. + AccountID *string `json:"account_id,omitempty"` + + // The ID of the resource group. + ResourceGroupID *string `json:"resource_group_id,omitempty"` + + // The state of the binding. + State *string `json:"state,omitempty"` + + // The credentials for the binding. Additional key-value pairs are passed through from the resource brokers. For + // additional details, see the service’s documentation. + Credentials *Credentials `json:"credentials,omitempty"` + + // Specifies whether the binding’s credentials support IAM. + IamCompatible *bool `json:"iam_compatible,omitempty"` + + // The unique ID of the offering. This value is provided by and stored in the global catalog. + ResourceID *string `json:"resource_id,omitempty"` + + // A boolean that dictates if the alias was migrated from a previous CF instance. + Migrated *bool `json:"migrated,omitempty"` + + // The relative path to the resource alias that this binding is associated with. + ResourceAliasURL *string `json:"resource_alias_url,omitempty"` +} + +// UnmarshalResourceBinding unmarshals an instance of ResourceBinding from the specified map of raw messages. +func UnmarshalResourceBinding(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceBinding) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "guid", &obj.GUID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deleted_at", &obj.DeletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_by", &obj.UpdatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deleted_by", &obj.DeletedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_crn", &obj.SourceCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_crn", &obj.TargetCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "region_binding_id", &obj.RegionBindingID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "region_binding_crn", &obj.RegionBindingCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_group_id", &obj.ResourceGroupID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalModel(m, "credentials", &obj.Credentials, UnmarshalCredentials) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iam_compatible", &obj.IamCompatible) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_id", &obj.ResourceID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "migrated", &obj.Migrated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_alias_url", &obj.ResourceAliasURL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceBindingPostParameters : Configuration options represented as key-value pairs. Service defined options are passed through to the target +// resource brokers, whereas platform defined options are not. +type ResourceBindingPostParameters struct { + // An optional platform defined option to reuse an existing IAM serviceId for the role assignment. + ServiceidCRN *string `json:"serviceid_crn,omitempty"` + + // Allows users to set arbitrary properties + additionalProperties map[string]interface{} +} + +// SetProperty allows the user to set an arbitrary property on an instance of ResourceBindingPostParameters +func (o *ResourceBindingPostParameters) SetProperty(key string, value interface{}) { + if o.additionalProperties == nil { + o.additionalProperties = make(map[string]interface{}) + } + o.additionalProperties[key] = value +} + +// GetProperty allows the user to retrieve an arbitrary property from an instance of ResourceBindingPostParameters +func (o *ResourceBindingPostParameters) GetProperty(key string) interface{} { + return o.additionalProperties[key] +} + +// GetProperties allows the user to retrieve the map of arbitrary properties from an instance of ResourceBindingPostParameters +func (o *ResourceBindingPostParameters) GetProperties() map[string]interface{} { + return o.additionalProperties +} + +// MarshalJSON performs custom serialization for instances of ResourceBindingPostParameters +func (o *ResourceBindingPostParameters) MarshalJSON() (buffer []byte, err error) { + m := make(map[string]interface{}) + if len(o.additionalProperties) > 0 { + for k, v := range o.additionalProperties { + m[k] = v + } + } + if o.ServiceidCRN != nil { + m["serviceid_crn"] = o.ServiceidCRN + } + buffer, err = json.Marshal(m) + return +} + +// UnmarshalResourceBindingPostParameters unmarshals an instance of ResourceBindingPostParameters from the specified map of raw messages. +func UnmarshalResourceBindingPostParameters(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceBindingPostParameters) + err = core.UnmarshalPrimitive(m, "serviceid_crn", &obj.ServiceidCRN) + if err != nil { + return + } + delete(m, "serviceid_crn") + for k := range m { + var v interface{} + e := core.UnmarshalPrimitive(m, k, &v) + if e != nil { + err = e + return + } + obj.SetProperty(k, v) + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceBindingsList : A list of resource bindings. +type ResourceBindingsList struct { + // The number of resource bindings in `resources`. + RowsCount *int64 `json:"rows_count" validate:"required"` + + // The URL for requesting the next page of results. + NextURL *string `json:"next_url" validate:"required"` + + // A list of resource bindings. + Resources []ResourceBinding `json:"resources" validate:"required"` +} + +// UnmarshalResourceBindingsList unmarshals an instance of ResourceBindingsList from the specified map of raw messages. +func UnmarshalResourceBindingsList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceBindingsList) + err = core.UnmarshalPrimitive(m, "rows_count", &obj.RowsCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_url", &obj.NextURL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalResourceBinding) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceInstance : A resource instance. +type ResourceInstance struct { + // The ID associated with the instance. + ID *string `json:"id,omitempty"` + + // When you create a new resource, a globally unique identifier (GUID) is assigned. This GUID is a unique internal + // identifier managed by the resource controller that corresponds to the instance. + GUID *string `json:"guid,omitempty"` + + // When you provision a new resource, a relative URL path is created identifying the location of the instance. + URL *string `json:"url,omitempty"` + + // The date when the instance was created. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // The date when the instance was last updated. + UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` + + // The date when the instance was deleted. + DeletedAt *strfmt.DateTime `json:"deleted_at,omitempty"` + + // The subject who created the instance. + CreatedBy *string `json:"created_by,omitempty"` + + // The subject who updated the instance. + UpdatedBy *string `json:"updated_by,omitempty"` + + // The subject who deleted the instance. + DeletedBy *string `json:"deleted_by,omitempty"` + + // The date when the instance was scheduled for reclamation. + ScheduledReclaimAt *strfmt.DateTime `json:"scheduled_reclaim_at,omitempty"` + + // The date when the instance under reclamation was restored. + RestoredAt *strfmt.DateTime `json:"restored_at,omitempty"` + + // The subject who restored the instance back from reclamation. + RestoredBy *string `json:"restored_by,omitempty"` + + // The subject who initiated the instance reclamation. + ScheduledReclaimBy *string `json:"scheduled_reclaim_by,omitempty"` + + // The human-readable name of the instance. + Name *string `json:"name,omitempty"` + + // The deployment location where the instance was provisioned. + RegionID *string `json:"region_id,omitempty"` + + // An alpha-numeric value identifying the account ID. + AccountID *string `json:"account_id,omitempty"` + + // The unique ID of the reseller channel where the instance was provisioned from. + ResellerChannelID *string `json:"reseller_channel_id,omitempty"` + + // The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog. + ResourcePlanID *string `json:"resource_plan_id,omitempty"` + + // The ID of the resource group. + ResourceGroupID *string `json:"resource_group_id,omitempty"` + + // The CRN of the resource group. + ResourceGroupCRN *string `json:"resource_group_crn,omitempty"` + + // The deployment CRN as defined in the global catalog. The Cloud Resource Name (CRN) of the deployment location where + // the instance is provisioned. + TargetCRN *string `json:"target_crn,omitempty"` + + // The current configuration parameters of the instance. + Parameters map[string]interface{} `json:"parameters,omitempty"` + + // A boolean that dictates if the resource instance should be deleted (cleaned up) during the processing of a region + // instance delete call. + AllowCleanup *bool `json:"allow_cleanup,omitempty"` + + // The full Cloud Resource Name (CRN) associated with the instance. For more information about this format, see [Cloud + // Resource Names](https://cloud.ibm.com/docs/overview?topic=overview-crn). + CRN *string `json:"crn,omitempty"` + + // The current state of the instance. For example, if the instance is deleted, it will return removed. + State *string `json:"state,omitempty"` + + // The type of the instance, for example, `service_instance`. + Type *string `json:"type,omitempty"` + + // The sub-type of instance, for example, `cfaas`. + SubType *string `json:"sub_type,omitempty"` + + // The unique ID of the offering. This value is provided by and stored in the global catalog. + ResourceID *string `json:"resource_id,omitempty"` + + // The resource-broker-provided URL to access administrative features of the instance. + DashboardURL *string `json:"dashboard_url,omitempty"` + + // The status of the last operation requested on the instance. + LastOperation map[string]interface{} `json:"last_operation,omitempty"` + + // The relative path to the resource aliases for the instance. + ResourceAliasesURL *string `json:"resource_aliases_url,omitempty"` + + // The relative path to the resource bindings for the instance. + ResourceBindingsURL *string `json:"resource_bindings_url,omitempty"` + + // The relative path to the resource keys for the instance. + ResourceKeysURL *string `json:"resource_keys_url,omitempty"` + + // The plan history of the instance. + PlanHistory []PlanHistoryItem `json:"plan_history,omitempty"` + + // A boolean that dictates if the resource instance was migrated from a previous CF instance. + Migrated *bool `json:"migrated,omitempty"` + + // Additional instance properties, contributed by the service and/or platform, are represented as key-value pairs. + Extensions map[string]interface{} `json:"extensions,omitempty"` + + // The CRN of the resource that has control of the instance. + ControlledBy *string `json:"controlled_by,omitempty"` + + // A boolean that dictates if the resource instance is locked or not. + Locked *bool `json:"locked,omitempty"` +} + +// UnmarshalResourceInstance unmarshals an instance of ResourceInstance from the specified map of raw messages. +func UnmarshalResourceInstance(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceInstance) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "guid", &obj.GUID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deleted_at", &obj.DeletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_by", &obj.UpdatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deleted_by", &obj.DeletedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "scheduled_reclaim_at", &obj.ScheduledReclaimAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "restored_at", &obj.RestoredAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "restored_by", &obj.RestoredBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "scheduled_reclaim_by", &obj.ScheduledReclaimBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "region_id", &obj.RegionID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "reseller_channel_id", &obj.ResellerChannelID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_plan_id", &obj.ResourcePlanID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_group_id", &obj.ResourceGroupID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_group_crn", &obj.ResourceGroupCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "target_crn", &obj.TargetCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "parameters", &obj.Parameters) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "allow_cleanup", &obj.AllowCleanup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "sub_type", &obj.SubType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_id", &obj.ResourceID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dashboard_url", &obj.DashboardURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "last_operation", &obj.LastOperation) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_aliases_url", &obj.ResourceAliasesURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_bindings_url", &obj.ResourceBindingsURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_keys_url", &obj.ResourceKeysURL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "plan_history", &obj.PlanHistory, UnmarshalPlanHistoryItem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "migrated", &obj.Migrated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "extensions", &obj.Extensions) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "controlled_by", &obj.ControlledBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "locked", &obj.Locked) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceInstancesList : A list of resource instances. +type ResourceInstancesList struct { + // The number of resource instances in `resources`. + RowsCount *int64 `json:"rows_count" validate:"required"` + + // The URL for requesting the next page of results. + NextURL *string `json:"next_url" validate:"required"` + + // A list of resource instances. + Resources []ResourceInstance `json:"resources" validate:"required"` +} + +// UnmarshalResourceInstancesList unmarshals an instance of ResourceInstancesList from the specified map of raw messages. +func UnmarshalResourceInstancesList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceInstancesList) + err = core.UnmarshalPrimitive(m, "rows_count", &obj.RowsCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_url", &obj.NextURL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalResourceInstance) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceKey : A resource key. +type ResourceKey struct { + // The ID associated with the key. + ID *string `json:"id,omitempty"` + + // When you create a new key, a globally unique identifier (GUID) is assigned. This GUID is a unique internal + // identifier managed by the resource controller that corresponds to the key. + GUID *string `json:"guid,omitempty"` + + // When you created a new key, a relative URL path is created identifying the location of the key. + URL *string `json:"url,omitempty"` + + // The date when the key was created. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // The date when the key was last updated. + UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` + + // The date when the key was deleted. + DeletedAt *strfmt.DateTime `json:"deleted_at,omitempty"` + + // The subject who created the key. + CreatedBy *string `json:"created_by,omitempty"` + + // The subject who updated the key. + UpdatedBy *string `json:"updated_by,omitempty"` + + // The subject who deleted the key. + DeletedBy *string `json:"deleted_by,omitempty"` + + // The CRN of resource instance or alias associated to the key. + SourceCRN *string `json:"source_crn,omitempty"` + + // The human-readable name of the key. + Name *string `json:"name,omitempty"` + + // The full Cloud Resource Name (CRN) associated with the key. For more information about this format, see [Cloud + // Resource Names](https://cloud.ibm.com/docs/overview?topic=overview-crn). + CRN *string `json:"crn,omitempty"` + + // The state of the key. + State *string `json:"state,omitempty"` + + // An alpha-numeric value identifying the account ID. + AccountID *string `json:"account_id,omitempty"` + + // The ID of the resource group. + ResourceGroupID *string `json:"resource_group_id,omitempty"` + + // The unique ID of the offering. This value is provided by and stored in the global catalog. + ResourceID *string `json:"resource_id,omitempty"` + + // The credentials for the key. Additional key-value pairs are passed through from the resource brokers. Refer to + // service’s documentation for additional details. + Credentials *Credentials `json:"credentials,omitempty"` + + // Specifies whether the key’s credentials support IAM. + IamCompatible *bool `json:"iam_compatible,omitempty"` + + // A boolean that dictates if the alias was migrated from a previous CF instance. + Migrated *bool `json:"migrated,omitempty"` + + // The relative path to the resource. + ResourceInstanceURL *string `json:"resource_instance_url,omitempty"` + + // The relative path to the resource alias that this binding is associated with. + ResourceAliasURL *string `json:"resource_alias_url,omitempty"` +} + +// UnmarshalResourceKey unmarshals an instance of ResourceKey from the specified map of raw messages. +func UnmarshalResourceKey(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceKey) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "guid", &obj.GUID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deleted_at", &obj.DeletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_by", &obj.CreatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_by", &obj.UpdatedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "deleted_by", &obj.DeletedBy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_crn", &obj.SourceCRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_group_id", &obj.ResourceGroupID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_id", &obj.ResourceID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "credentials", &obj.Credentials, UnmarshalCredentials) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iam_compatible", &obj.IamCompatible) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "migrated", &obj.Migrated) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_instance_url", &obj.ResourceInstanceURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_alias_url", &obj.ResourceAliasURL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceKeyPostParameters : Configuration options represented as key-value pairs. Service defined options are passed through to the target +// resource brokers, whereas platform defined options are not. +type ResourceKeyPostParameters struct { + // An optional platform defined option to reuse an existing IAM serviceId for the role assignment. + ServiceidCRN *string `json:"serviceid_crn,omitempty"` + + // Allows users to set arbitrary properties + additionalProperties map[string]interface{} +} + +// SetProperty allows the user to set an arbitrary property on an instance of ResourceKeyPostParameters +func (o *ResourceKeyPostParameters) SetProperty(key string, value interface{}) { + if o.additionalProperties == nil { + o.additionalProperties = make(map[string]interface{}) + } + o.additionalProperties[key] = value +} + +// GetProperty allows the user to retrieve an arbitrary property from an instance of ResourceKeyPostParameters +func (o *ResourceKeyPostParameters) GetProperty(key string) interface{} { + return o.additionalProperties[key] +} + +// GetProperties allows the user to retrieve the map of arbitrary properties from an instance of ResourceKeyPostParameters +func (o *ResourceKeyPostParameters) GetProperties() map[string]interface{} { + return o.additionalProperties +} + +// MarshalJSON performs custom serialization for instances of ResourceKeyPostParameters +func (o *ResourceKeyPostParameters) MarshalJSON() (buffer []byte, err error) { + m := make(map[string]interface{}) + if len(o.additionalProperties) > 0 { + for k, v := range o.additionalProperties { + m[k] = v + } + } + if o.ServiceidCRN != nil { + m["serviceid_crn"] = o.ServiceidCRN + } + buffer, err = json.Marshal(m) + return +} + +// UnmarshalResourceKeyPostParameters unmarshals an instance of ResourceKeyPostParameters from the specified map of raw messages. +func UnmarshalResourceKeyPostParameters(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceKeyPostParameters) + err = core.UnmarshalPrimitive(m, "serviceid_crn", &obj.ServiceidCRN) + if err != nil { + return + } + delete(m, "serviceid_crn") + for k := range m { + var v interface{} + e := core.UnmarshalPrimitive(m, k, &v) + if e != nil { + err = e + return + } + obj.SetProperty(k, v) + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceKeysList : A list of resource keys. +type ResourceKeysList struct { + // The number of resource keys in `resources`. + RowsCount *int64 `json:"rows_count" validate:"required"` + + // The URL for requesting the next page of results. + NextURL *string `json:"next_url" validate:"required"` + + // A list of resource keys. + Resources []ResourceKey `json:"resources" validate:"required"` +} + +// UnmarshalResourceKeysList unmarshals an instance of ResourceKeysList from the specified map of raw messages. +func UnmarshalResourceKeysList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceKeysList) + err = core.UnmarshalPrimitive(m, "rows_count", &obj.RowsCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "next_url", &obj.NextURL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalResourceKey) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RunReclamationActionOptions : The RunReclamationAction options. +type RunReclamationActionOptions struct { + // The ID associated with the reclamation. + ID *string `validate:"required,ne="` + + // The reclamation action name. Specify `reclaim` to delete a resource, or `restore` to restore a resource. + ActionName *string `validate:"required,ne="` + + // The request initiator, if different from the request token. + RequestBy *string + + // A comment to describe the action. + Comment *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewRunReclamationActionOptions : Instantiate RunReclamationActionOptions +func (*ResourceControllerV2) NewRunReclamationActionOptions(id string, actionName string) *RunReclamationActionOptions { + return &RunReclamationActionOptions{ + ID: core.StringPtr(id), + ActionName: core.StringPtr(actionName), + } +} + +// SetID : Allow user to set ID +func (options *RunReclamationActionOptions) SetID(id string) *RunReclamationActionOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetActionName : Allow user to set ActionName +func (options *RunReclamationActionOptions) SetActionName(actionName string) *RunReclamationActionOptions { + options.ActionName = core.StringPtr(actionName) + return options +} + +// SetRequestBy : Allow user to set RequestBy +func (options *RunReclamationActionOptions) SetRequestBy(requestBy string) *RunReclamationActionOptions { + options.RequestBy = core.StringPtr(requestBy) + return options +} + +// SetComment : Allow user to set Comment +func (options *RunReclamationActionOptions) SetComment(comment string) *RunReclamationActionOptions { + options.Comment = core.StringPtr(comment) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *RunReclamationActionOptions) SetHeaders(param map[string]string) *RunReclamationActionOptions { + options.Headers = param + return options +} + +// UnlockResourceInstanceOptions : The UnlockResourceInstance options. +type UnlockResourceInstanceOptions struct { + // The short or long ID of the instance. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUnlockResourceInstanceOptions : Instantiate UnlockResourceInstanceOptions +func (*ResourceControllerV2) NewUnlockResourceInstanceOptions(id string) *UnlockResourceInstanceOptions { + return &UnlockResourceInstanceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *UnlockResourceInstanceOptions) SetID(id string) *UnlockResourceInstanceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UnlockResourceInstanceOptions) SetHeaders(param map[string]string) *UnlockResourceInstanceOptions { + options.Headers = param + return options +} + +// UpdateResourceAliasOptions : The UpdateResourceAlias options. +type UpdateResourceAliasOptions struct { + // The short or long ID of the alias. + ID *string `validate:"required,ne="` + + // The new name of the alias. Must be 180 characters or less and cannot include any special characters other than + // `(space) - . _ :`. + Name *string `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateResourceAliasOptions : Instantiate UpdateResourceAliasOptions +func (*ResourceControllerV2) NewUpdateResourceAliasOptions(id string, name string) *UpdateResourceAliasOptions { + return &UpdateResourceAliasOptions{ + ID: core.StringPtr(id), + Name: core.StringPtr(name), + } +} + +// SetID : Allow user to set ID +func (options *UpdateResourceAliasOptions) SetID(id string) *UpdateResourceAliasOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetName : Allow user to set Name +func (options *UpdateResourceAliasOptions) SetName(name string) *UpdateResourceAliasOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateResourceAliasOptions) SetHeaders(param map[string]string) *UpdateResourceAliasOptions { + options.Headers = param + return options +} + +// UpdateResourceBindingOptions : The UpdateResourceBinding options. +type UpdateResourceBindingOptions struct { + // The short or long ID of the binding. + ID *string `validate:"required,ne="` + + // The new name of the binding. Must be 180 characters or less and cannot include any special characters other than + // `(space) - . _ :`. + Name *string `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateResourceBindingOptions : Instantiate UpdateResourceBindingOptions +func (*ResourceControllerV2) NewUpdateResourceBindingOptions(id string, name string) *UpdateResourceBindingOptions { + return &UpdateResourceBindingOptions{ + ID: core.StringPtr(id), + Name: core.StringPtr(name), + } +} + +// SetID : Allow user to set ID +func (options *UpdateResourceBindingOptions) SetID(id string) *UpdateResourceBindingOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetName : Allow user to set Name +func (options *UpdateResourceBindingOptions) SetName(name string) *UpdateResourceBindingOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateResourceBindingOptions) SetHeaders(param map[string]string) *UpdateResourceBindingOptions { + options.Headers = param + return options +} + +// UpdateResourceInstanceOptions : The UpdateResourceInstance options. +type UpdateResourceInstanceOptions struct { + // The short or long ID of the instance. + ID *string `validate:"required,ne="` + + // The new name of the instance. Must be 180 characters or less and cannot include any special characters other than + // `(space) - . _ :`. + Name *string + + // The new configuration options for the instance. + Parameters map[string]interface{} + + // The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog. + ResourcePlanID *string + + // A boolean that dictates if the resource instance should be deleted (cleaned up) during the processing of a region + // instance delete call. + AllowCleanup *bool + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateResourceInstanceOptions : Instantiate UpdateResourceInstanceOptions +func (*ResourceControllerV2) NewUpdateResourceInstanceOptions(id string) *UpdateResourceInstanceOptions { + return &UpdateResourceInstanceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *UpdateResourceInstanceOptions) SetID(id string) *UpdateResourceInstanceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetName : Allow user to set Name +func (options *UpdateResourceInstanceOptions) SetName(name string) *UpdateResourceInstanceOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetParameters : Allow user to set Parameters +func (options *UpdateResourceInstanceOptions) SetParameters(parameters map[string]interface{}) *UpdateResourceInstanceOptions { + options.Parameters = parameters + return options +} + +// SetResourcePlanID : Allow user to set ResourcePlanID +func (options *UpdateResourceInstanceOptions) SetResourcePlanID(resourcePlanID string) *UpdateResourceInstanceOptions { + options.ResourcePlanID = core.StringPtr(resourcePlanID) + return options +} + +// SetAllowCleanup : Allow user to set AllowCleanup +func (options *UpdateResourceInstanceOptions) SetAllowCleanup(allowCleanup bool) *UpdateResourceInstanceOptions { + options.AllowCleanup = core.BoolPtr(allowCleanup) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateResourceInstanceOptions) SetHeaders(param map[string]string) *UpdateResourceInstanceOptions { + options.Headers = param + return options +} + +// UpdateResourceKeyOptions : The UpdateResourceKey options. +type UpdateResourceKeyOptions struct { + // The short or long ID of the key. + ID *string `validate:"required,ne="` + + // The new name of the key. Must be 180 characters or less and cannot include any special characters other than + // `(space) - . _ :`. + Name *string `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateResourceKeyOptions : Instantiate UpdateResourceKeyOptions +func (*ResourceControllerV2) NewUpdateResourceKeyOptions(id string, name string) *UpdateResourceKeyOptions { + return &UpdateResourceKeyOptions{ + ID: core.StringPtr(id), + Name: core.StringPtr(name), + } +} + +// SetID : Allow user to set ID +func (options *UpdateResourceKeyOptions) SetID(id string) *UpdateResourceKeyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetName : Allow user to set Name +func (options *UpdateResourceKeyOptions) SetName(name string) *UpdateResourceKeyOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateResourceKeyOptions) SetHeaders(param map[string]string) *UpdateResourceKeyOptions { + options.Headers = param + return options +} diff --git a/vendor/github.com/IBM/platform-services-go-sdk/resourcemanagerv2/resource_manager_v2.go b/vendor/github.com/IBM/platform-services-go-sdk/resourcemanagerv2/resource_manager_v2.go new file mode 100644 index 00000000000..4aa180ae0f8 --- /dev/null +++ b/vendor/github.com/IBM/platform-services-go-sdk/resourcemanagerv2/resource_manager_v2.go @@ -0,0 +1,1166 @@ +/** + * (C) Copyright IBM Corp. 2021. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 3.41.0-f1ef0102-20211018-193503 + */ + +// Package resourcemanagerv2 : Operations and models for the ResourceManagerV2 service +package resourcemanagerv2 + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/IBM/go-sdk-core/v5/core" + common "github.com/IBM/platform-services-go-sdk/common" + "github.com/go-openapi/strfmt" +) + +// ResourceManagerV2 : Manage lifecycle of your Cloud resource groups using Resource Manager APIs. +// +// API Version: 2.0 +type ResourceManagerV2 struct { + Service *core.BaseService +} + +// DefaultServiceURL is the default URL to make service requests to. +const DefaultServiceURL = "https://resource-controller.cloud.ibm.com" + +// DefaultServiceName is the default key used to find external configuration information. +const DefaultServiceName = "resource_manager" + +// ResourceManagerV2Options : Service options +type ResourceManagerV2Options struct { + ServiceName string + URL string + Authenticator core.Authenticator +} + +// NewResourceManagerV2UsingExternalConfig : constructs an instance of ResourceManagerV2 with passed in options and external configuration. +func NewResourceManagerV2UsingExternalConfig(options *ResourceManagerV2Options) (resourceManager *ResourceManagerV2, err error) { + if options.ServiceName == "" { + options.ServiceName = DefaultServiceName + } + + if options.Authenticator == nil { + options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) + if err != nil { + return + } + } + + resourceManager, err = NewResourceManagerV2(options) + if err != nil { + return + } + + err = resourceManager.Service.ConfigureService(options.ServiceName) + if err != nil { + return + } + + if options.URL != "" { + err = resourceManager.Service.SetServiceURL(options.URL) + } + return +} + +// NewResourceManagerV2 : constructs an instance of ResourceManagerV2 with passed in options. +func NewResourceManagerV2(options *ResourceManagerV2Options) (service *ResourceManagerV2, err error) { + serviceOptions := &core.ServiceOptions{ + URL: DefaultServiceURL, + Authenticator: options.Authenticator, + } + + baseService, err := core.NewBaseService(serviceOptions) + if err != nil { + return + } + + if options.URL != "" { + err = baseService.SetServiceURL(options.URL) + if err != nil { + return + } + } + + service = &ResourceManagerV2{ + Service: baseService, + } + + return +} + +// GetServiceURLForRegion returns the service URL to be used for the specified region +func GetServiceURLForRegion(region string) (string, error) { + return "", fmt.Errorf("service does not support regional URLs") +} + +// Clone makes a copy of "resourceManager" suitable for processing requests. +func (resourceManager *ResourceManagerV2) Clone() *ResourceManagerV2 { + if core.IsNil(resourceManager) { + return nil + } + clone := *resourceManager + clone.Service = resourceManager.Service.Clone() + return &clone +} + +// SetServiceURL sets the service URL +func (resourceManager *ResourceManagerV2) SetServiceURL(url string) error { + return resourceManager.Service.SetServiceURL(url) +} + +// GetServiceURL returns the service URL +func (resourceManager *ResourceManagerV2) GetServiceURL() string { + return resourceManager.Service.GetServiceURL() +} + +// SetDefaultHeaders sets HTTP headers to be sent in every request +func (resourceManager *ResourceManagerV2) SetDefaultHeaders(headers http.Header) { + resourceManager.Service.SetDefaultHeaders(headers) +} + +// SetEnableGzipCompression sets the service's EnableGzipCompression field +func (resourceManager *ResourceManagerV2) SetEnableGzipCompression(enableGzip bool) { + resourceManager.Service.SetEnableGzipCompression(enableGzip) +} + +// GetEnableGzipCompression returns the service's EnableGzipCompression field +func (resourceManager *ResourceManagerV2) GetEnableGzipCompression() bool { + return resourceManager.Service.GetEnableGzipCompression() +} + +// EnableRetries enables automatic retries for requests invoked for this service instance. +// If either parameter is specified as 0, then a default value is used instead. +func (resourceManager *ResourceManagerV2) EnableRetries(maxRetries int, maxRetryInterval time.Duration) { + resourceManager.Service.EnableRetries(maxRetries, maxRetryInterval) +} + +// DisableRetries disables automatic retries for requests invoked for this service instance. +func (resourceManager *ResourceManagerV2) DisableRetries() { + resourceManager.Service.DisableRetries() +} + +// ListResourceGroups : Get a list of all resource groups +// Call this method to retrieve information about all resource groups and associated quotas in an account. The `id` +// returned in the response can be used to [create a resource instance +// later](https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=java#create-resource-instance). The +// response can be filtered based on queryParams such as `account_id`, `name`, `default`, and more to narrow your +// search.Users need to be assigned IAM policies with the Viewer role or higher on the targeted resource groups. +func (resourceManager *ResourceManagerV2) ListResourceGroups(listResourceGroupsOptions *ListResourceGroupsOptions) (result *ResourceGroupList, response *core.DetailedResponse, err error) { + return resourceManager.ListResourceGroupsWithContext(context.Background(), listResourceGroupsOptions) +} + +// ListResourceGroupsWithContext is an alternate form of the ListResourceGroups method which supports a Context parameter +func (resourceManager *ResourceManagerV2) ListResourceGroupsWithContext(ctx context.Context, listResourceGroupsOptions *ListResourceGroupsOptions) (result *ResourceGroupList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listResourceGroupsOptions, "listResourceGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceManager.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceManager.Service.Options.URL, `/v2/resource_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listResourceGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_manager", "V2", "ListResourceGroups") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + if listResourceGroupsOptions.AccountID != nil { + builder.AddQuery("account_id", fmt.Sprint(*listResourceGroupsOptions.AccountID)) + } + if listResourceGroupsOptions.Date != nil { + builder.AddQuery("date", fmt.Sprint(*listResourceGroupsOptions.Date)) + } + if listResourceGroupsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listResourceGroupsOptions.Name)) + } + if listResourceGroupsOptions.Default != nil { + builder.AddQuery("default", fmt.Sprint(*listResourceGroupsOptions.Default)) + } + if listResourceGroupsOptions.IncludeDeleted != nil { + builder.AddQuery("include_deleted", fmt.Sprint(*listResourceGroupsOptions.IncludeDeleted)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceManager.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceGroupList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateResourceGroup : Create a resource group +// Create a resource group in an account to organize your account resources in customizable groupings so that you can +// quickly assign users access to more than one resource at a time. To learn what makes a good resource group strategy, +// see [Best practices for organizing resources](https://cloud.ibm.com/docs/account?topic=account-account_setup). A +// default resource group is created when an account is created. If you have a Lite account or 30-day trial, you cannot +// create extra resource groups, but you can rename your default resource group. If you have a Pay-As-You-Go or +// Subscription account, you can create multiple resource groups. You must be assigned an IAM policy with the +// Administrator role on All Account Management services to create extra resource groups. +func (resourceManager *ResourceManagerV2) CreateResourceGroup(createResourceGroupOptions *CreateResourceGroupOptions) (result *ResCreateResourceGroup, response *core.DetailedResponse, err error) { + return resourceManager.CreateResourceGroupWithContext(context.Background(), createResourceGroupOptions) +} + +// CreateResourceGroupWithContext is an alternate form of the CreateResourceGroup method which supports a Context parameter +func (resourceManager *ResourceManagerV2) CreateResourceGroupWithContext(ctx context.Context, createResourceGroupOptions *CreateResourceGroupOptions) (result *ResCreateResourceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(createResourceGroupOptions, "createResourceGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceManager.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceManager.Service.Options.URL, `/v2/resource_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createResourceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_manager", "V2", "CreateResourceGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if createResourceGroupOptions.Name != nil { + body["name"] = createResourceGroupOptions.Name + } + if createResourceGroupOptions.AccountID != nil { + body["account_id"] = createResourceGroupOptions.AccountID + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceManager.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResCreateResourceGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetResourceGroup : Get a resource group +// Retrieve a resource group by alias ID. Call this method to get details about a particular resource group, like the +// name of the resource group, associated quotas, whether the state is active, the resource group ID and the CRN. The +// `id` returned in the response can be used to [create a resource instance +// later](https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=java#create-resource-instance). +// Users need to be assigned an IAM policy with the Viewer role or higher on the targeted resource group. +func (resourceManager *ResourceManagerV2) GetResourceGroup(getResourceGroupOptions *GetResourceGroupOptions) (result *ResourceGroup, response *core.DetailedResponse, err error) { + return resourceManager.GetResourceGroupWithContext(context.Background(), getResourceGroupOptions) +} + +// GetResourceGroupWithContext is an alternate form of the GetResourceGroup method which supports a Context parameter +func (resourceManager *ResourceManagerV2) GetResourceGroupWithContext(ctx context.Context, getResourceGroupOptions *GetResourceGroupOptions) (result *ResourceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getResourceGroupOptions, "getResourceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getResourceGroupOptions, "getResourceGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getResourceGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceManager.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceManager.Service.Options.URL, `/v2/resource_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getResourceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_manager", "V2", "GetResourceGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceManager.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// UpdateResourceGroup : Update a resource group +// Update a resource group by the alias ID. Call this method to update information about an existing resource group. You +// can rename a resource group and activate or suspend a particular resource group. To update a resource group, users +// need to be assigned with IAM policies with the Editor role or higher. +func (resourceManager *ResourceManagerV2) UpdateResourceGroup(updateResourceGroupOptions *UpdateResourceGroupOptions) (result *ResourceGroup, response *core.DetailedResponse, err error) { + return resourceManager.UpdateResourceGroupWithContext(context.Background(), updateResourceGroupOptions) +} + +// UpdateResourceGroupWithContext is an alternate form of the UpdateResourceGroup method which supports a Context parameter +func (resourceManager *ResourceManagerV2) UpdateResourceGroupWithContext(ctx context.Context, updateResourceGroupOptions *UpdateResourceGroupOptions) (result *ResourceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateResourceGroupOptions, "updateResourceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateResourceGroupOptions, "updateResourceGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateResourceGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceManager.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceManager.Service.Options.URL, `/v2/resource_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateResourceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_manager", "V2", "UpdateResourceGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + body := make(map[string]interface{}) + if updateResourceGroupOptions.Name != nil { + body["name"] = updateResourceGroupOptions.Name + } + if updateResourceGroupOptions.State != nil { + body["state"] = updateResourceGroupOptions.State + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceManager.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalResourceGroup) + if err != nil { + return + } + response.Result = result + } + + return +} + +// DeleteResourceGroup : Delete a resource group +// Delete a resource group by the alias ID. You can delete a resource group only if the targeted resource group does not +// contain any resources or if it is not a default resource group. When a user creates an account, a default resource +// group is created in the account. If you want to delete a resource group that contains resources, first [delete the +// resource +// instances](https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=java#delete-resource-instance). +// Then, delete the resource group when all resource instances in the group are deleted. Users need to be assigned an +// IAM policy with the Editor role or higher on the targeted resource group. +func (resourceManager *ResourceManagerV2) DeleteResourceGroup(deleteResourceGroupOptions *DeleteResourceGroupOptions) (response *core.DetailedResponse, err error) { + return resourceManager.DeleteResourceGroupWithContext(context.Background(), deleteResourceGroupOptions) +} + +// DeleteResourceGroupWithContext is an alternate form of the DeleteResourceGroup method which supports a Context parameter +func (resourceManager *ResourceManagerV2) DeleteResourceGroupWithContext(ctx context.Context, deleteResourceGroupOptions *DeleteResourceGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteResourceGroupOptions, "deleteResourceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteResourceGroupOptions, "deleteResourceGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteResourceGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceManager.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceManager.Service.Options.URL, `/v2/resource_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteResourceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_manager", "V2", "DeleteResourceGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + request, err := builder.Build() + if err != nil { + return + } + + response, err = resourceManager.Service.Request(request, nil) + + return +} + +// ListQuotaDefinitions : List quota definitions +// Get a list of all quota definitions. Quotas for a resource group limit the number of apps, instances, and memory +// allowed for that specific resource group. Each resource group that you have on your account has a specific set of +// quotas. Standard quotas are for resource groups that are created by users with a Lite account, and Pay-As-You-Go +// quotas are for resource groups that are created with a Pay-As-You-Go account. This method provides list of all +// available quota definitions. No specific IAM policy needed. +func (resourceManager *ResourceManagerV2) ListQuotaDefinitions(listQuotaDefinitionsOptions *ListQuotaDefinitionsOptions) (result *QuotaDefinitionList, response *core.DetailedResponse, err error) { + return resourceManager.ListQuotaDefinitionsWithContext(context.Background(), listQuotaDefinitionsOptions) +} + +// ListQuotaDefinitionsWithContext is an alternate form of the ListQuotaDefinitions method which supports a Context parameter +func (resourceManager *ResourceManagerV2) ListQuotaDefinitionsWithContext(ctx context.Context, listQuotaDefinitionsOptions *ListQuotaDefinitionsOptions) (result *QuotaDefinitionList, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listQuotaDefinitionsOptions, "listQuotaDefinitionsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceManager.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceManager.Service.Options.URL, `/v2/quota_definitions`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listQuotaDefinitionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_manager", "V2", "ListQuotaDefinitions") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceManager.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalQuotaDefinitionList) + if err != nil { + return + } + response.Result = result + } + + return +} + +// GetQuotaDefinition : Get a quota definition +// Call this method to retrieve information about a particular quota by passing the quota ID. The response can be used +// to identify the quota type, Standard or Paid. Information about available resources, such as number of apps, number +// of service instances, and memory, are returned in the response. Quotas for a resource group limit the number of apps, +// instances, and memory allowed for that specific resource group. Each resource group that you have on your account has +// a specific set of quotas. Standard quotas are for resource groups that are created by users with a Lite account, and +// Pay-As-You-Go quotas are for resource groups that are created with a Pay-As-You-Go account. No specific IAM policy +// needed. +func (resourceManager *ResourceManagerV2) GetQuotaDefinition(getQuotaDefinitionOptions *GetQuotaDefinitionOptions) (result *QuotaDefinition, response *core.DetailedResponse, err error) { + return resourceManager.GetQuotaDefinitionWithContext(context.Background(), getQuotaDefinitionOptions) +} + +// GetQuotaDefinitionWithContext is an alternate form of the GetQuotaDefinition method which supports a Context parameter +func (resourceManager *ResourceManagerV2) GetQuotaDefinitionWithContext(ctx context.Context, getQuotaDefinitionOptions *GetQuotaDefinitionOptions) (result *QuotaDefinition, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getQuotaDefinitionOptions, "getQuotaDefinitionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getQuotaDefinitionOptions, "getQuotaDefinitionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getQuotaDefinitionOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = resourceManager.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(resourceManager.Service.Options.URL, `/v2/quota_definitions/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getQuotaDefinitionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("resource_manager", "V2", "GetQuotaDefinition") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = resourceManager.Service.Request(request, &rawResponse) + if err != nil { + return + } + if rawResponse != nil { + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalQuotaDefinition) + if err != nil { + return + } + response.Result = result + } + + return +} + +// CreateResourceGroupOptions : The CreateResourceGroup options. +type CreateResourceGroupOptions struct { + // The new name of the resource group. + Name *string `json:"name,omitempty"` + + // The account id of the resource group. + AccountID *string `json:"account_id,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateResourceGroupOptions : Instantiate CreateResourceGroupOptions +func (*ResourceManagerV2) NewCreateResourceGroupOptions() *CreateResourceGroupOptions { + return &CreateResourceGroupOptions{} +} + +// SetName : Allow user to set Name +func (_options *CreateResourceGroupOptions) SetName(name string) *CreateResourceGroupOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetAccountID : Allow user to set AccountID +func (_options *CreateResourceGroupOptions) SetAccountID(accountID string) *CreateResourceGroupOptions { + _options.AccountID = core.StringPtr(accountID) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateResourceGroupOptions) SetHeaders(param map[string]string) *CreateResourceGroupOptions { + options.Headers = param + return options +} + +// DeleteResourceGroupOptions : The DeleteResourceGroup options. +type DeleteResourceGroupOptions struct { + // The short or long ID of the alias. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteResourceGroupOptions : Instantiate DeleteResourceGroupOptions +func (*ResourceManagerV2) NewDeleteResourceGroupOptions(id string) *DeleteResourceGroupOptions { + return &DeleteResourceGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *DeleteResourceGroupOptions) SetID(id string) *DeleteResourceGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteResourceGroupOptions) SetHeaders(param map[string]string) *DeleteResourceGroupOptions { + options.Headers = param + return options +} + +// GetQuotaDefinitionOptions : The GetQuotaDefinition options. +type GetQuotaDefinitionOptions struct { + // The id of the quota. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetQuotaDefinitionOptions : Instantiate GetQuotaDefinitionOptions +func (*ResourceManagerV2) NewGetQuotaDefinitionOptions(id string) *GetQuotaDefinitionOptions { + return &GetQuotaDefinitionOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetQuotaDefinitionOptions) SetID(id string) *GetQuotaDefinitionOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetQuotaDefinitionOptions) SetHeaders(param map[string]string) *GetQuotaDefinitionOptions { + options.Headers = param + return options +} + +// GetResourceGroupOptions : The GetResourceGroup options. +type GetResourceGroupOptions struct { + // The short or long ID of the alias. + ID *string `json:"id" validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetResourceGroupOptions : Instantiate GetResourceGroupOptions +func (*ResourceManagerV2) NewGetResourceGroupOptions(id string) *GetResourceGroupOptions { + return &GetResourceGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *GetResourceGroupOptions) SetID(id string) *GetResourceGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *GetResourceGroupOptions) SetHeaders(param map[string]string) *GetResourceGroupOptions { + options.Headers = param + return options +} + +// ListQuotaDefinitionsOptions : The ListQuotaDefinitions options. +type ListQuotaDefinitionsOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListQuotaDefinitionsOptions : Instantiate ListQuotaDefinitionsOptions +func (*ResourceManagerV2) NewListQuotaDefinitionsOptions() *ListQuotaDefinitionsOptions { + return &ListQuotaDefinitionsOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListQuotaDefinitionsOptions) SetHeaders(param map[string]string) *ListQuotaDefinitionsOptions { + options.Headers = param + return options +} + +// ListResourceGroupsOptions : The ListResourceGroups options. +type ListResourceGroupsOptions struct { + // The ID of the account that contains the resource groups that you want to get. + AccountID *string `json:"account_id,omitempty"` + + // The date in the format of YYYY-MM which returns resource groups. Deleted resource groups will be excluded before + // this month. + Date *string `json:"date,omitempty"` + + // The name of the resource group. + Name *string `json:"name,omitempty"` + + // Boolean value to specify whether or not to list default resource groups. + Default *bool `json:"default,omitempty"` + + // Boolean value to specify whether or not to list default resource groups. + IncludeDeleted *bool `json:"include_deleted,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListResourceGroupsOptions : Instantiate ListResourceGroupsOptions +func (*ResourceManagerV2) NewListResourceGroupsOptions() *ListResourceGroupsOptions { + return &ListResourceGroupsOptions{} +} + +// SetAccountID : Allow user to set AccountID +func (_options *ListResourceGroupsOptions) SetAccountID(accountID string) *ListResourceGroupsOptions { + _options.AccountID = core.StringPtr(accountID) + return _options +} + +// SetDate : Allow user to set Date +func (_options *ListResourceGroupsOptions) SetDate(date string) *ListResourceGroupsOptions { + _options.Date = core.StringPtr(date) + return _options +} + +// SetName : Allow user to set Name +func (_options *ListResourceGroupsOptions) SetName(name string) *ListResourceGroupsOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetDefault : Allow user to set Default +func (_options *ListResourceGroupsOptions) SetDefault(defaultVar bool) *ListResourceGroupsOptions { + _options.Default = core.BoolPtr(defaultVar) + return _options +} + +// SetIncludeDeleted : Allow user to set IncludeDeleted +func (_options *ListResourceGroupsOptions) SetIncludeDeleted(includeDeleted bool) *ListResourceGroupsOptions { + _options.IncludeDeleted = core.BoolPtr(includeDeleted) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *ListResourceGroupsOptions) SetHeaders(param map[string]string) *ListResourceGroupsOptions { + options.Headers = param + return options +} + +// QuotaDefinition : A returned quota definition. +type QuotaDefinition struct { + // An alpha-numeric value identifying the quota. + ID *string `json:"id,omitempty"` + + // The human-readable name of the quota. + Name *string `json:"name,omitempty"` + + // The type of the quota. + Type *string `json:"type,omitempty"` + + // The total app limit. + NumberOfApps *float64 `json:"number_of_apps,omitempty"` + + // The total service instances limit per app. + NumberOfServiceInstances *float64 `json:"number_of_service_instances,omitempty"` + + // Default number of instances per lite plan. + DefaultNumberOfInstancesPerLitePlan *float64 `json:"default_number_of_instances_per_lite_plan,omitempty"` + + // The total instances limit per app. + InstancesPerApp *float64 `json:"instances_per_app,omitempty"` + + // The total memory of app instance. + InstanceMemory *string `json:"instance_memory,omitempty"` + + // The total app memory capacity. + TotalAppMemory *string `json:"total_app_memory,omitempty"` + + // The VSI limit. + VsiLimit *float64 `json:"vsi_limit,omitempty"` + + // The resource quotas associated with a quota definition. + ResourceQuotas []ResourceQuota `json:"resource_quotas,omitempty"` + + // The date when the quota was initially created. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // The date when the quota was last updated. + UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` +} + +// UnmarshalQuotaDefinition unmarshals an instance of QuotaDefinition from the specified map of raw messages. +func UnmarshalQuotaDefinition(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(QuotaDefinition) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "number_of_apps", &obj.NumberOfApps) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "number_of_service_instances", &obj.NumberOfServiceInstances) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default_number_of_instances_per_lite_plan", &obj.DefaultNumberOfInstancesPerLitePlan) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instances_per_app", &obj.InstancesPerApp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instance_memory", &obj.InstanceMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_app_memory", &obj.TotalAppMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vsi_limit", &obj.VsiLimit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_quotas", &obj.ResourceQuotas, UnmarshalResourceQuota) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// QuotaDefinitionList : A list of quota definitions. +type QuotaDefinitionList struct { + // The list of quota definitions. + Resources []QuotaDefinition `json:"resources" validate:"required"` +} + +// UnmarshalQuotaDefinitionList unmarshals an instance of QuotaDefinitionList from the specified map of raw messages. +func UnmarshalQuotaDefinitionList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(QuotaDefinitionList) + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalQuotaDefinition) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResCreateResourceGroup : A newly-created resource group. +type ResCreateResourceGroup struct { + // An alpha-numeric value identifying the resource group. + ID *string `json:"id,omitempty"` + + // The full CRN (cloud resource name) associated with the resource group. For more on this format, see [Cloud Resource + // Names](https://cloud.ibm.com/docs/account?topic=account-crn). + CRN *string `json:"crn,omitempty"` +} + +// UnmarshalResCreateResourceGroup unmarshals an instance of ResCreateResourceGroup from the specified map of raw messages. +func UnmarshalResCreateResourceGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResCreateResourceGroup) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceGroup : A resource group. +type ResourceGroup struct { + // An alpha-numeric value identifying the resource group. + ID *string `json:"id,omitempty"` + + // The full CRN (cloud resource name) associated with the resource group. For more on this format, see [Cloud Resource + // Names](https://cloud.ibm.com/docs/account?topic=account-crn). + CRN *string `json:"crn,omitempty"` + + // An alpha-numeric value identifying the account ID. + AccountID *string `json:"account_id,omitempty"` + + // The human-readable name of the resource group. + Name *string `json:"name,omitempty"` + + // The state of the resource group. + State *string `json:"state,omitempty"` + + // Identify if this resource group is default of the account or not. + Default *bool `json:"default,omitempty"` + + // An alpha-numeric value identifying the quota ID associated with the resource group. + QuotaID *string `json:"quota_id,omitempty"` + + // The URL to access the quota details that associated with the resource group. + QuotaURL *string `json:"quota_url,omitempty"` + + // The URL to access the payment methods details that associated with the resource group. + PaymentMethodsURL *string `json:"payment_methods_url,omitempty"` + + // An array of the resources that linked to the resource group. + ResourceLinkages []interface{} `json:"resource_linkages,omitempty"` + + // The URL to access the team details that associated with the resource group. + TeamsURL *string `json:"teams_url,omitempty"` + + // The date when the resource group was initially created. + CreatedAt *strfmt.DateTime `json:"created_at,omitempty"` + + // The date when the resource group was last updated. + UpdatedAt *strfmt.DateTime `json:"updated_at,omitempty"` +} + +// UnmarshalResourceGroup unmarshals an instance of ResourceGroup from the specified map of raw messages. +func UnmarshalResourceGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroup) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "account_id", &obj.AccountID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "quota_id", &obj.QuotaID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "quota_url", &obj.QuotaURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "payment_methods_url", &obj.PaymentMethodsURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_linkages", &obj.ResourceLinkages) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "teams_url", &obj.TeamsURL) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "updated_at", &obj.UpdatedAt) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceGroupList : A list of resource groups. +type ResourceGroupList struct { + // The list of resource groups. + Resources []ResourceGroup `json:"resources" validate:"required"` +} + +// UnmarshalResourceGroupList unmarshals an instance of ResourceGroupList from the specified map of raw messages. +func UnmarshalResourceGroupList(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupList) + err = core.UnmarshalModel(m, "resources", &obj.Resources, UnmarshalResourceGroup) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceQuota : A resource quota. +type ResourceQuota struct { + // An alpha-numeric value identifying the quota. + ID *string `json:"_id,omitempty"` + + // The human-readable name of the quota. + ResourceID *string `json:"resource_id,omitempty"` + + // The full CRN (cloud resource name) associated with the quota. For more on this format, see + // https://cloud.ibm.com/docs/account?topic=account-crn. + CRN *string `json:"crn,omitempty"` + + // The limit number of this resource. + Limit *float64 `json:"limit,omitempty"` +} + +// UnmarshalResourceQuota unmarshals an instance of ResourceQuota from the specified map of raw messages. +func UnmarshalResourceQuota(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceQuota) + err = core.UnmarshalPrimitive(m, "_id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_id", &obj.ResourceID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// UpdateResourceGroupOptions : The UpdateResourceGroup options. +type UpdateResourceGroupOptions struct { + // The short or long ID of the alias. + ID *string `json:"id" validate:"required,ne="` + + // The new name of the resource group. + Name *string `json:"name,omitempty"` + + // The state of the resource group. + State *string `json:"state,omitempty"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateResourceGroupOptions : Instantiate UpdateResourceGroupOptions +func (*ResourceManagerV2) NewUpdateResourceGroupOptions(id string) *UpdateResourceGroupOptions { + return &UpdateResourceGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (_options *UpdateResourceGroupOptions) SetID(id string) *UpdateResourceGroupOptions { + _options.ID = core.StringPtr(id) + return _options +} + +// SetName : Allow user to set Name +func (_options *UpdateResourceGroupOptions) SetName(name string) *UpdateResourceGroupOptions { + _options.Name = core.StringPtr(name) + return _options +} + +// SetState : Allow user to set State +func (_options *UpdateResourceGroupOptions) SetState(state string) *UpdateResourceGroupOptions { + _options.State = core.StringPtr(state) + return _options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateResourceGroupOptions) SetHeaders(param map[string]string) *UpdateResourceGroupOptions { + options.Headers = param + return options +} diff --git a/vendor/github.com/IBM/vpc-go-sdk/LICENSE b/vendor/github.com/IBM/vpc-go-sdk/LICENSE new file mode 100644 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/vendor/github.com/IBM/vpc-go-sdk/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/IBM/vpc-go-sdk/common/headers.go b/vendor/github.com/IBM/vpc-go-sdk/common/headers.go new file mode 100644 index 00000000000..4f74ffc2967 --- /dev/null +++ b/vendor/github.com/IBM/vpc-go-sdk/common/headers.go @@ -0,0 +1,53 @@ +package common + +import ( + "fmt" + "runtime" +) + +const ( + HEADER_NAME_USER_AGENT = "User-Agent" + + SDK_NAME = "vpc-go-sdk" +) + +// +// GetSdkHeaders - returns the set of SDK-specific headers to be included in an outgoing request. +// +// This function is invoked by generated service methods (i.e. methods which implement the REST API operations +// defined within the API definition). The purpose of this function is to give the SDK implementor the opportunity +// to provide SDK-specific HTTP headers that will be sent with an outgoing REST API request. +// This function is invoked for each invocation of a generated service method, +// so the set of HTTP headers could be request-specific. +// As an optimization, if your SDK will be returning the same set of HTTP headers for each invocation of this +// function, it is recommended that you initialize the returned map just once (perhaps by using +// lazy initialization) and simply return it each time the function is invoked, instead of building it each time +// as in the example below. +// +// Parameters: +// serviceName - the name of the service as defined in the API definition (e.g. "MyService1") +// serviceVersion - the version of the service as defined in the API definition (e.g. "V1") +// operationId - the operationId as defined in the API definition (e.g. getContext) +// +// Returns: +// a Map which contains the set of headers to be included in the REST API request +// +func GetSdkHeaders(serviceName string, serviceVersion string, operationId string) map[string]string { + sdkHeaders := make(map[string]string) + + sdkHeaders[HEADER_NAME_USER_AGENT] = GetUserAgentInfo() + + return sdkHeaders +} + +var userAgent string = fmt.Sprintf("%s-%s %s", SDK_NAME, Version, GetSystemInfo()) + +func GetUserAgentInfo() string { + return userAgent +} + +var systemInfo = fmt.Sprintf("(arch=%s; os=%s; go.version=%s)", runtime.GOARCH, runtime.GOOS, runtime.Version()) + +func GetSystemInfo() string { + return systemInfo +} diff --git a/vendor/github.com/IBM/vpc-go-sdk/common/version.go b/vendor/github.com/IBM/vpc-go-sdk/common/version.go new file mode 100644 index 00000000000..157beb25bcd --- /dev/null +++ b/vendor/github.com/IBM/vpc-go-sdk/common/version.go @@ -0,0 +1,4 @@ +package common + +// Version of the SDK +const Version = "1.0.1" diff --git a/vendor/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go b/vendor/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go new file mode 100644 index 00000000000..5b5b30be5d4 --- /dev/null +++ b/vendor/github.com/IBM/vpc-go-sdk/vpcv1/vpc_v1.go @@ -0,0 +1,58241 @@ +/** + * (C) Copyright IBM Corp. 2021. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * IBM OpenAPI SDK Code Generator Version: 3.28.0-55613c9e-20210220-164656 + */ + +// Package vpcv1 : Operations and models for the VpcV1 service +package vpcv1 + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "reflect" + "time" + + "github.com/IBM/go-sdk-core/v5/core" + common "github.com/IBM/vpc-go-sdk/common" + "github.com/go-openapi/strfmt" +) + +// VpcV1 : The IBM Cloud Virtual Private Cloud (VPC) API can be used to programmatically provision and manage +// infrastructure resources, including virtual server instances, subnets, volumes, and load balancers. +// +// Version: 2021-03-30 +type VpcV1 struct { + Service *core.BaseService + + // Requests the version of the API as of a date in the format `YYYY-MM-DD`. Any date up to the current date may be + // provided. Specify the current date to request the latest version. + Version *string + + // The infrastructure generation for the request. For the API behavior documented here, use + // `2`. + generation *int64 +} + +// DefaultServiceURL is the default URL to make service requests to. +const DefaultServiceURL = "https://us-south.iaas.cloud.ibm.com/v1" + +// DefaultServiceName is the default key used to find external configuration information. +const DefaultServiceName = "vpc" + +// VpcV1Options : Service options +type VpcV1Options struct { + ServiceName string + URL string + Authenticator core.Authenticator + + // Requests the version of the API as of a date in the format `YYYY-MM-DD`. Any date up to the current date may be + // provided. Specify the current date to request the latest version. + Version *string +} + +// NewVpcV1UsingExternalConfig : constructs an instance of VpcV1 with passed in options and external configuration. +func NewVpcV1UsingExternalConfig(options *VpcV1Options) (vpc *VpcV1, err error) { + if options.ServiceName == "" { + options.ServiceName = DefaultServiceName + } + + if options.Authenticator == nil { + options.Authenticator, err = core.GetAuthenticatorFromEnvironment(options.ServiceName) + if err != nil { + return + } + } + + vpc, err = NewVpcV1(options) + if err != nil { + return + } + + err = vpc.Service.ConfigureService(options.ServiceName) + if err != nil { + return + } + + if options.URL != "" { + err = vpc.Service.SetServiceURL(options.URL) + } + return +} + +// NewVpcV1 : constructs an instance of VpcV1 with passed in options. +func NewVpcV1(options *VpcV1Options) (service *VpcV1, err error) { + serviceOptions := &core.ServiceOptions{ + URL: DefaultServiceURL, + Authenticator: options.Authenticator, + } + + err = core.ValidateStruct(options, "options") + if err != nil { + return + } + + baseService, err := core.NewBaseService(serviceOptions) + if err != nil { + return + } + + if options.URL != "" { + err = baseService.SetServiceURL(options.URL) + if err != nil { + return + } + } + + if options.Version == nil { + options.Version = core.StringPtr("2021-03-30") + } + + service = &VpcV1{ + Service: baseService, + Version: options.Version, + generation: core.Int64Ptr(2), + } + + return +} + +// GetServiceURLForRegion returns the service URL to be used for the specified region +func GetServiceURLForRegion(region string) (string, error) { + return "", fmt.Errorf("service does not support regional URLs") +} + +// Clone makes a copy of "vpc" suitable for processing requests. +func (vpc *VpcV1) Clone() *VpcV1 { + if core.IsNil(vpc) { + return nil + } + clone := *vpc + clone.Service = vpc.Service.Clone() + return &clone +} + +// SetServiceURL sets the service URL +func (vpc *VpcV1) SetServiceURL(url string) error { + return vpc.Service.SetServiceURL(url) +} + +// GetServiceURL returns the service URL +func (vpc *VpcV1) GetServiceURL() string { + return vpc.Service.GetServiceURL() +} + +// SetDefaultHeaders sets HTTP headers to be sent in every request +func (vpc *VpcV1) SetDefaultHeaders(headers http.Header) { + vpc.Service.SetDefaultHeaders(headers) +} + +// SetEnableGzipCompression sets the service's EnableGzipCompression field +func (vpc *VpcV1) SetEnableGzipCompression(enableGzip bool) { + vpc.Service.SetEnableGzipCompression(enableGzip) +} + +// GetEnableGzipCompression returns the service's EnableGzipCompression field +func (vpc *VpcV1) GetEnableGzipCompression() bool { + return vpc.Service.GetEnableGzipCompression() +} + +// EnableRetries enables automatic retries for requests invoked for this service instance. +// If either parameter is specified as 0, then a default value is used instead. +func (vpc *VpcV1) EnableRetries(maxRetries int, maxRetryInterval time.Duration) { + vpc.Service.EnableRetries(maxRetries, maxRetryInterval) +} + +// DisableRetries disables automatic retries for requests invoked for this service instance. +func (vpc *VpcV1) DisableRetries() { + vpc.Service.DisableRetries() +} + +// ListVpcs : List all VPCs +// This request lists all VPCs in the region. A VPC is a virtual network that belongs to an account and provides logical +// isolation from other networks. A VPC is made up of resources in one or more zones. VPCs are regional, and each VPC +// can contain resources in multiple zones in a region. +func (vpc *VpcV1) ListVpcs(listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { + return vpc.ListVpcsWithContext(context.Background(), listVpcsOptions) +} + +// ListVpcsWithContext is an alternate form of the ListVpcs method which supports a Context parameter +func (vpc *VpcV1) ListVpcsWithContext(ctx context.Context, listVpcsOptions *ListVpcsOptions) (result *VPCCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVpcsOptions, "listVpcsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVpcsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVpcs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVpcsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVpcsOptions.Start)) + } + if listVpcsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVpcsOptions.Limit)) + } + if listVpcsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVpcsOptions.ResourceGroupID)) + } + if listVpcsOptions.ClassicAccess != nil { + builder.AddQuery("classic_access", fmt.Sprint(*listVpcsOptions.ClassicAccess)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPCCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateVPC : Create a VPC +// This request creates a new VPC from a VPC prototype object. The prototype object is structured in the same way as a +// retrieved VPC, and contains the information necessary to create the new VPC. +func (vpc *VpcV1) CreateVPC(createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + return vpc.CreateVPCWithContext(context.Background(), createVPCOptions) +} + +// CreateVPCWithContext is an alternate form of the CreateVPC method which supports a Context parameter +func (vpc *VpcV1) CreateVPCWithContext(ctx context.Context, createVPCOptions *CreateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(createVPCOptions, "createVPCOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPC") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCOptions.AddressPrefixManagement != nil { + body["address_prefix_management"] = createVPCOptions.AddressPrefixManagement + } + if createVPCOptions.ClassicAccess != nil { + body["classic_access"] = createVPCOptions.ClassicAccess + } + if createVPCOptions.Name != nil { + body["name"] = createVPCOptions.Name + } + if createVPCOptions.ResourceGroup != nil { + body["resource_group"] = createVPCOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteVPC : Delete a VPC +// This request deletes a VPC. This operation cannot be reversed. For this request to succeed, the VPC must not contain +// any instances, subnets, or public gateways. All security groups and network ACLs associated with the VPC are +// automatically deleted. All flow log collectors with `auto_delete` set to `true` targeting the VPC or any resource in +// the VPC are automatically deleted. +func (vpc *VpcV1) DeleteVPC(deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCWithContext(context.Background(), deleteVPCOptions) +} + +// DeleteVPCWithContext is an alternate form of the DeleteVPC method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCWithContext(ctx context.Context, deleteVPCOptions *DeleteVPCOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCOptions, "deleteVPCOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCOptions, "deleteVPCOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVPCOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPC") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPC : Retrieve a VPC +// This request retrieves a single VPC specified by the identifier in the URL. +func (vpc *VpcV1) GetVPC(getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + return vpc.GetVPCWithContext(context.Background(), getVPCOptions) +} + +// GetVPCWithContext is an alternate form of the GetVPC method which supports a Context parameter +func (vpc *VpcV1) GetVPCWithContext(ctx context.Context, getVPCOptions *GetVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCOptions, "getVPCOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCOptions, "getVPCOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPC") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateVPC : Update a VPC +// This request updates a VPC's name. +func (vpc *VpcV1) UpdateVPC(updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCWithContext(context.Background(), updateVPCOptions) +} + +// UpdateVPCWithContext is an alternate form of the UpdateVPC method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCWithContext(ctx context.Context, updateVPCOptions *UpdateVPCOptions) (result *VPC, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCOptions, "updateVPCOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCOptions, "updateVPCOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVPCOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPC") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCOptions.VPCPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPC) + if err != nil { + return + } + response.Result = result + + return +} + +// GetVPCDefaultNetworkACL : Retrieve a VPC's default network ACL +// This request retrieves the default network ACL for the VPC specified by the identifier in the URL. The default +// network ACL is applied to any new subnets in the VPC which do not specify a network ACL. +func (vpc *VpcV1) GetVPCDefaultNetworkACL(getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { + return vpc.GetVPCDefaultNetworkACLWithContext(context.Background(), getVPCDefaultNetworkACLOptions) +} + +// GetVPCDefaultNetworkACLWithContext is an alternate form of the GetVPCDefaultNetworkACL method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultNetworkACLWithContext(ctx context.Context, getVPCDefaultNetworkACLOptions *GetVPCDefaultNetworkACLOptions) (result *DefaultNetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCDefaultNetworkACLOptions, "getVPCDefaultNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCDefaultNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_network_acl`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCDefaultNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultNetworkACL) + if err != nil { + return + } + response.Result = result + + return +} + +// GetVPCDefaultRoutingTable : Retrieve a VPC's default routing table +// This request retrieves the default routing table for the VPC specified by the identifier in the URL. The default +// routing table is associated with any subnets in the VPC which have not been explicitly associated with a user-defined +// routing table. +func (vpc *VpcV1) GetVPCDefaultRoutingTable(getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { + return vpc.GetVPCDefaultRoutingTableWithContext(context.Background(), getVPCDefaultRoutingTableOptions) +} + +// GetVPCDefaultRoutingTableWithContext is an alternate form of the GetVPCDefaultRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultRoutingTableWithContext(ctx context.Context, getVPCDefaultRoutingTableOptions *GetVPCDefaultRoutingTableOptions) (result *DefaultRoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCDefaultRoutingTableOptions, "getVPCDefaultRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCDefaultRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_routing_table`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCDefaultRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultRoutingTable) + if err != nil { + return + } + response.Result = result + + return +} + +// GetVPCDefaultSecurityGroup : Retrieve a VPC's default security group +// This request retrieves the default security group for the VPC specified by the identifier in the URL. The default +// security group is applied to any new network interfaces in the VPC that do not specify a security group. +func (vpc *VpcV1) GetVPCDefaultSecurityGroup(getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { + return vpc.GetVPCDefaultSecurityGroupWithContext(context.Background(), getVPCDefaultSecurityGroupOptions) +} + +// GetVPCDefaultSecurityGroupWithContext is an alternate form of the GetVPCDefaultSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) GetVPCDefaultSecurityGroupWithContext(ctx context.Context, getVPCDefaultSecurityGroupOptions *GetVPCDefaultSecurityGroupOptions) (result *DefaultSecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCDefaultSecurityGroupOptions, "getVPCDefaultSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPCDefaultSecurityGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{id}/default_security_group`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCDefaultSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCDefaultSecurityGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDefaultSecurityGroup) + if err != nil { + return + } + response.Result = result + + return +} + +// ListVPCAddressPrefixes : List all address prefixes for a VPC +// This request lists all address pool prefixes for a VPC. +func (vpc *VpcV1) ListVPCAddressPrefixes(listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCAddressPrefixesWithContext(context.Background(), listVPCAddressPrefixesOptions) +} + +// ListVPCAddressPrefixesWithContext is an alternate form of the ListVPCAddressPrefixes method which supports a Context parameter +func (vpc *VpcV1) ListVPCAddressPrefixesWithContext(ctx context.Context, listVPCAddressPrefixesOptions *ListVPCAddressPrefixesOptions) (result *AddressPrefixCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCAddressPrefixesOptions, "listVPCAddressPrefixesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCAddressPrefixesOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCAddressPrefixesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCAddressPrefixes") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCAddressPrefixesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCAddressPrefixesOptions.Start)) + } + if listVPCAddressPrefixesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCAddressPrefixesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefixCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateVPCAddressPrefix : Create an address prefix for a VPC +// This request creates a new prefix from a prefix prototype object. The prototype object is structured in the same way +// as a retrieved prefix, and contains the information necessary to create the new prefix. +func (vpc *VpcV1) CreateVPCAddressPrefix(createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + return vpc.CreateVPCAddressPrefixWithContext(context.Background(), createVPCAddressPrefixOptions) +} + +// CreateVPCAddressPrefixWithContext is an alternate form of the CreateVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) CreateVPCAddressPrefixWithContext(ctx context.Context, createVPCAddressPrefixOptions *CreateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCAddressPrefixOptions, "createVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCAddressPrefixOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCAddressPrefix") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCAddressPrefixOptions.CIDR != nil { + body["cidr"] = createVPCAddressPrefixOptions.CIDR + } + if createVPCAddressPrefixOptions.Zone != nil { + body["zone"] = createVPCAddressPrefixOptions.Zone + } + if createVPCAddressPrefixOptions.IsDefault != nil { + body["is_default"] = createVPCAddressPrefixOptions.IsDefault + } + if createVPCAddressPrefixOptions.Name != nil { + body["name"] = createVPCAddressPrefixOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteVPCAddressPrefix : Delete an address prefix +// This request deletes a prefix. This operation cannot be reversed. The request will fail if any subnets use addresses +// from this prefix. +func (vpc *VpcV1) DeleteVPCAddressPrefix(deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCAddressPrefixWithContext(context.Background(), deleteVPCAddressPrefixOptions) +} + +// DeleteVPCAddressPrefixWithContext is an alternate form of the DeleteVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCAddressPrefixWithContext(ctx context.Context, deleteVPCAddressPrefixOptions *DeleteVPCAddressPrefixOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCAddressPrefixOptions, "deleteVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCAddressPrefixOptions.VPCID, + "id": *deleteVPCAddressPrefixOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCAddressPrefix") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPCAddressPrefix : Retrieve an address prefix +// This request retrieves a single prefix specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCAddressPrefix(getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + return vpc.GetVPCAddressPrefixWithContext(context.Background(), getVPCAddressPrefixOptions) +} + +// GetVPCAddressPrefixWithContext is an alternate form of the GetVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) GetVPCAddressPrefixWithContext(ctx context.Context, getVPCAddressPrefixOptions *GetVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCAddressPrefixOptions, "getVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCAddressPrefixOptions.VPCID, + "id": *getVPCAddressPrefixOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCAddressPrefix") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateVPCAddressPrefix : Update an address prefix +// This request updates a prefix with the information in a provided prefix patch. The prefix patch object is structured +// in the same way as a retrieved prefix and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCAddressPrefix(updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCAddressPrefixWithContext(context.Background(), updateVPCAddressPrefixOptions) +} + +// UpdateVPCAddressPrefixWithContext is an alternate form of the UpdateVPCAddressPrefix method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCAddressPrefixWithContext(ctx context.Context, updateVPCAddressPrefixOptions *UpdateVPCAddressPrefixOptions) (result *AddressPrefix, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCAddressPrefixOptions, "updateVPCAddressPrefixOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCAddressPrefixOptions.VPCID, + "id": *updateVPCAddressPrefixOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/address_prefixes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCAddressPrefixOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCAddressPrefix") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCAddressPrefixOptions.AddressPrefixPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalAddressPrefix) + if err != nil { + return + } + response.Result = result + + return +} + +// ListVPCRoutes : List all routes in a VPC's default routing table +// This request lists all routes in the VPC's default routing table. Each route is zone-specific and directs any packets +// matching its destination CIDR block to a `next_hop` IP address. The most specific route matching a packet's +// destination will be used. If multiple equally-specific routes exist, traffic will be distributed across them. +func (vpc *VpcV1) ListVPCRoutes(listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCRoutesWithContext(context.Background(), listVPCRoutesOptions) +} + +// ListVPCRoutesWithContext is an alternate form of the ListVPCRoutes method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutesWithContext(ctx context.Context, listVPCRoutesOptions *ListVPCRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutesOptions, "listVPCRoutesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCRoutesOptions, "listVPCRoutesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCRoutesOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCRoutesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutes") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCRoutesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVPCRoutesOptions.ZoneName)) + } + if listVPCRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutesOptions.Start)) + } + if listVPCRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateVPCRoute : Create a route in a VPC's default routing table +// This request creates a new route in the VPC's default routing table. The route prototype object is structured in the +// same way as a retrieved route, and contains the information necessary to create the new route. The request will fail +// if the new route will cause a loop. +func (vpc *VpcV1) CreateVPCRoute(createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.CreateVPCRouteWithContext(context.Background(), createVPCRouteOptions) +} + +// CreateVPCRouteWithContext is an alternate form of the CreateVPCRoute method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRouteWithContext(ctx context.Context, createVPCRouteOptions *CreateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRouteOptions, "createVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCRouteOptions, "createVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCRouteOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCRouteOptions.Destination != nil { + body["destination"] = createVPCRouteOptions.Destination + } + if createVPCRouteOptions.Zone != nil { + body["zone"] = createVPCRouteOptions.Zone + } + if createVPCRouteOptions.Action != nil { + body["action"] = createVPCRouteOptions.Action + } + if createVPCRouteOptions.Name != nil { + body["name"] = createVPCRouteOptions.Name + } + if createVPCRouteOptions.NextHop != nil { + body["next_hop"] = createVPCRouteOptions.NextHop + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteVPCRoute : Delete a VPC route +// This request deletes a route. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPCRoute(deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCRouteWithContext(context.Background(), deleteVPCRouteOptions) +} + +// DeleteVPCRouteWithContext is an alternate form of the DeleteVPCRoute method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRouteWithContext(ctx context.Context, deleteVPCRouteOptions *DeleteVPCRouteOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRouteOptions, "deleteVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCRouteOptions, "deleteVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRouteOptions.VPCID, + "id": *deleteVPCRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPCRoute : Retrieve a VPC route +// This request retrieves a single route specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCRoute(getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.GetVPCRouteWithContext(context.Background(), getVPCRouteOptions) +} + +// GetVPCRouteWithContext is an alternate form of the GetVPCRoute method which supports a Context parameter +func (vpc *VpcV1) GetVPCRouteWithContext(ctx context.Context, getVPCRouteOptions *GetVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRouteOptions, "getVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCRouteOptions, "getVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCRouteOptions.VPCID, + "id": *getVPCRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateVPCRoute : Update a VPC route +// This request updates a route with the information in a provided route patch. The route patch object is structured in +// the same way as a retrieved route and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCRoute(updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCRouteWithContext(context.Background(), updateVPCRouteOptions) +} + +// UpdateVPCRouteWithContext is an alternate form of the UpdateVPCRoute method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCRouteWithContext(ctx context.Context, updateVPCRouteOptions *UpdateVPCRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCRouteOptions, "updateVPCRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCRouteOptions, "updateVPCRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCRouteOptions.VPCID, + "id": *updateVPCRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCRouteOptions.RoutePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + + return +} + +// ListVPCRoutingTables : List all routing tables for a VPC +// This request lists all user-defined routing tables for a VPC. Each subnet in a VPC is associated with a routing +// table, which controls delivery of packets sent on that subnet according to the action of the most specific matching +// route in the table. If multiple equally-specific routes exist, traffic will be distributed across them. If no +// routes match, delivery will be controlled by the system's built-in routes. +func (vpc *VpcV1) ListVPCRoutingTables(listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCRoutingTablesWithContext(context.Background(), listVPCRoutingTablesOptions) +} + +// ListVPCRoutingTablesWithContext is an alternate form of the ListVPCRoutingTables method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutingTablesWithContext(ctx context.Context, listVPCRoutingTablesOptions *ListVPCRoutingTablesOptions) (result *RoutingTableCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCRoutingTablesOptions, "listVPCRoutingTablesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCRoutingTablesOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCRoutingTablesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTables") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCRoutingTablesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTablesOptions.Start)) + } + if listVPCRoutingTablesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTablesOptions.Limit)) + } + if listVPCRoutingTablesOptions.IsDefault != nil { + builder.AddQuery("is_default", fmt.Sprint(*listVPCRoutingTablesOptions.IsDefault)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTableCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateVPCRoutingTable : Create a routing table for a VPC +// This request creates a user-defined routing table from a routing table prototype object. The prototype object is +// structured in the same way as a retrieved routing table, and contains the information necessary to create the new +// routing table. +func (vpc *VpcV1) CreateVPCRoutingTable(createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.CreateVPCRoutingTableWithContext(context.Background(), createVPCRoutingTableOptions) +} + +// CreateVPCRoutingTableWithContext is an alternate form of the CreateVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRoutingTableWithContext(ctx context.Context, createVPCRoutingTableOptions *CreateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRoutingTableOptions, "createVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCRoutingTableOptions, "createVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCRoutingTableOptions.VPCID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCRoutingTableOptions.Name != nil { + body["name"] = createVPCRoutingTableOptions.Name + } + if createVPCRoutingTableOptions.RouteDirectLinkIngress != nil { + body["route_direct_link_ingress"] = createVPCRoutingTableOptions.RouteDirectLinkIngress + } + if createVPCRoutingTableOptions.RouteTransitGatewayIngress != nil { + body["route_transit_gateway_ingress"] = createVPCRoutingTableOptions.RouteTransitGatewayIngress + } + if createVPCRoutingTableOptions.RouteVPCZoneIngress != nil { + body["route_vpc_zone_ingress"] = createVPCRoutingTableOptions.RouteVPCZoneIngress + } + if createVPCRoutingTableOptions.Routes != nil { + body["routes"] = createVPCRoutingTableOptions.Routes + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteVPCRoutingTable : Delete a VPC routing table +// This request deletes a routing table. A routing table cannot be deleted if it is associated with any subnets in the +// VPC. Additionally, a VPC's default routing table cannot be deleted. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPCRoutingTable(deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCRoutingTableWithContext(context.Background(), deleteVPCRoutingTableOptions) +} + +// DeleteVPCRoutingTableWithContext is an alternate form of the DeleteVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRoutingTableWithContext(ctx context.Context, deleteVPCRoutingTableOptions *DeleteVPCRoutingTableOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCRoutingTableOptions, "deleteVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRoutingTableOptions.VPCID, + "id": *deleteVPCRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPCRoutingTable : Retrieve a VPC routing table +// This request retrieves a single routing table specified by the identifier in the URL. +func (vpc *VpcV1) GetVPCRoutingTable(getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.GetVPCRoutingTableWithContext(context.Background(), getVPCRoutingTableOptions) +} + +// GetVPCRoutingTableWithContext is an alternate form of the GetVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetVPCRoutingTableWithContext(ctx context.Context, getVPCRoutingTableOptions *GetVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRoutingTableOptions, "getVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCRoutingTableOptions, "getVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCRoutingTableOptions.VPCID, + "id": *getVPCRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateVPCRoutingTable : Update a VPC routing table +// This request updates a routing table with the information in a provided routing table patch. The patch object is +// structured in the same way as a retrieved table and contains only the information to be updated. +func (vpc *VpcV1) UpdateVPCRoutingTable(updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCRoutingTableWithContext(context.Background(), updateVPCRoutingTableOptions) +} + +// UpdateVPCRoutingTableWithContext is an alternate form of the UpdateVPCRoutingTable method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCRoutingTableWithContext(ctx context.Context, updateVPCRoutingTableOptions *UpdateVPCRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCRoutingTableOptions, "updateVPCRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCRoutingTableOptions.VPCID, + "id": *updateVPCRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCRoutingTableOptions.RoutingTablePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + + return +} + +// ListVPCRoutingTableRoutes : List all routes in a VPC routing table +// This request lists all routes in a VPC routing table. If a subnet has been associated with this routing table, +// delivery of packets sent on a subnet is performed according to the action of the most specific matching route in the +// table (provided the subnet and route are in the same zone). If multiple equally-specific routes exist, traffic will +// be distributed across them. If no routes match, delivery will be controlled by the system's built-in routes. +func (vpc *VpcV1) ListVPCRoutingTableRoutes(listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPCRoutingTableRoutesWithContext(context.Background(), listVPCRoutingTableRoutesOptions) +} + +// ListVPCRoutingTableRoutesWithContext is an alternate form of the ListVPCRoutingTableRoutes method which supports a Context parameter +func (vpc *VpcV1) ListVPCRoutingTableRoutesWithContext(ctx context.Context, listVPCRoutingTableRoutesOptions *ListVPCRoutingTableRoutesOptions) (result *RouteCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPCRoutingTableRoutesOptions, "listVPCRoutingTableRoutesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *listVPCRoutingTableRoutesOptions.VPCID, + "routing_table_id": *listVPCRoutingTableRoutesOptions.RoutingTableID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPCRoutingTableRoutesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPCRoutingTableRoutes") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPCRoutingTableRoutesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Start)) + } + if listVPCRoutingTableRoutesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPCRoutingTableRoutesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRouteCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateVPCRoutingTableRoute : Create a route in a VPC routing table +// This request creates a new VPC route from a VPC route prototype object. The prototype object is structured in the +// same way as a retrieved VPC route and contains the information necessary to create the route. +func (vpc *VpcV1) CreateVPCRoutingTableRoute(createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.CreateVPCRoutingTableRouteWithContext(context.Background(), createVPCRoutingTableRouteOptions) +} + +// CreateVPCRoutingTableRouteWithContext is an alternate form of the CreateVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) CreateVPCRoutingTableRouteWithContext(ctx context.Context, createVPCRoutingTableRouteOptions *CreateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPCRoutingTableRouteOptions, "createVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *createVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *createVPCRoutingTableRouteOptions.RoutingTableID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPCRoutingTableRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createVPCRoutingTableRouteOptions.Destination != nil { + body["destination"] = createVPCRoutingTableRouteOptions.Destination + } + if createVPCRoutingTableRouteOptions.Zone != nil { + body["zone"] = createVPCRoutingTableRouteOptions.Zone + } + if createVPCRoutingTableRouteOptions.Action != nil { + body["action"] = createVPCRoutingTableRouteOptions.Action + } + if createVPCRoutingTableRouteOptions.Name != nil { + body["name"] = createVPCRoutingTableRouteOptions.Name + } + if createVPCRoutingTableRouteOptions.NextHop != nil { + body["next_hop"] = createVPCRoutingTableRouteOptions.NextHop + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteVPCRoutingTableRoute : Delete a VPC routing table route +// This request deletes a VPC route. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPCRoutingTableRoute(deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPCRoutingTableRouteWithContext(context.Background(), deleteVPCRoutingTableRouteOptions) +} + +// DeleteVPCRoutingTableRouteWithContext is an alternate form of the DeleteVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) DeleteVPCRoutingTableRouteWithContext(ctx context.Context, deleteVPCRoutingTableRouteOptions *DeleteVPCRoutingTableRouteOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPCRoutingTableRouteOptions, "deleteVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *deleteVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *deleteVPCRoutingTableRouteOptions.RoutingTableID, + "id": *deleteVPCRoutingTableRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPCRoutingTableRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPCRoutingTableRoute : Retrieve a VPC routing table route +// This request retrieves a single VPC route specified by the identifier in the URL path. +func (vpc *VpcV1) GetVPCRoutingTableRoute(getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.GetVPCRoutingTableRouteWithContext(context.Background(), getVPCRoutingTableRouteOptions) +} + +// GetVPCRoutingTableRouteWithContext is an alternate form of the GetVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) GetVPCRoutingTableRouteWithContext(ctx context.Context, getVPCRoutingTableRouteOptions *GetVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPCRoutingTableRouteOptions, "getVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *getVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *getVPCRoutingTableRouteOptions.RoutingTableID, + "id": *getVPCRoutingTableRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPCRoutingTableRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateVPCRoutingTableRoute : Update a VPC routing table route +// This request updates a VPC route with the information provided in a route patch object. The patch object is +// structured in the same way as a retrieved VPC route and needs to contain only the information to be updated. +func (vpc *VpcV1) UpdateVPCRoutingTableRoute(updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + return vpc.UpdateVPCRoutingTableRouteWithContext(context.Background(), updateVPCRoutingTableRouteOptions) +} + +// UpdateVPCRoutingTableRouteWithContext is an alternate form of the UpdateVPCRoutingTableRoute method which supports a Context parameter +func (vpc *VpcV1) UpdateVPCRoutingTableRouteWithContext(ctx context.Context, updateVPCRoutingTableRouteOptions *UpdateVPCRoutingTableRouteOptions) (result *Route, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPCRoutingTableRouteOptions, "updateVPCRoutingTableRouteOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpc_id": *updateVPCRoutingTableRouteOptions.VPCID, + "routing_table_id": *updateVPCRoutingTableRouteOptions.RoutingTableID, + "id": *updateVPCRoutingTableRouteOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpcs/{vpc_id}/routing_tables/{routing_table_id}/routes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPCRoutingTableRouteOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPCRoutingTableRoute") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPCRoutingTableRouteOptions.RoutePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoute) + if err != nil { + return + } + response.Result = result + + return +} + +// ListSubnets : List all subnets +// This request lists all subnets in the region. Subnets are contiguous ranges of IP addresses specified in CIDR block +// notation. Each subnet is within a particular zone and cannot span multiple zones or regions. +func (vpc *VpcV1) ListSubnets(listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { + return vpc.ListSubnetsWithContext(context.Background(), listSubnetsOptions) +} + +// ListSubnetsWithContext is an alternate form of the ListSubnets method which supports a Context parameter +func (vpc *VpcV1) ListSubnetsWithContext(ctx context.Context, listSubnetsOptions *ListSubnetsOptions) (result *SubnetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSubnetsOptions, "listSubnetsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSubnetsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnets") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSubnetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSubnetsOptions.Start)) + } + if listSubnetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSubnetsOptions.Limit)) + } + if listSubnetsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSubnetsOptions.ResourceGroupID)) + } + if listSubnetsOptions.RoutingTableID != nil { + builder.AddQuery("routing_table.id", fmt.Sprint(*listSubnetsOptions.RoutingTableID)) + } + if listSubnetsOptions.RoutingTableName != nil { + builder.AddQuery("routing_table.name", fmt.Sprint(*listSubnetsOptions.RoutingTableName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnetCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateSubnet : Create a subnet +// This request creates a new subnet from a subnet prototype object. The prototype object is structured in the same way +// as a retrieved subnet, and contains the information necessary to create the new subnet. For this request to succeed, +// the prototype's CIDR block must not overlap with an existing subnet in the VPC. +func (vpc *VpcV1) CreateSubnet(createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + return vpc.CreateSubnetWithContext(context.Background(), createSubnetOptions) +} + +// CreateSubnetWithContext is an alternate form of the CreateSubnet method which supports a Context parameter +func (vpc *VpcV1) CreateSubnetWithContext(ctx context.Context, createSubnetOptions *CreateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSubnetOptions, "createSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSubnetOptions, "createSubnetOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnet") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createSubnetOptions.SubnetPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteSubnet : Delete a subnet +// This request deletes a subnet. This operation cannot be reversed. For this request to succeed, the subnet must not be +// referenced by any network interfaces, VPN gateways, or load balancers. A delete operation automatically detaches the +// subnet from any network ACLs, public gateways, or endpoint gateways. All flow log collectors with `auto_delete` set +// to `true` targeting the subnet or any resource in the subnet are automatically deleted. +func (vpc *VpcV1) DeleteSubnet(deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSubnetWithContext(context.Background(), deleteSubnetOptions) +} + +// DeleteSubnetWithContext is an alternate form of the DeleteSubnet method which supports a Context parameter +func (vpc *VpcV1) DeleteSubnetWithContext(ctx context.Context, deleteSubnetOptions *DeleteSubnetOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSubnetOptions, "deleteSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSubnetOptions, "deleteSubnetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSubnetOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnet") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSubnet : Retrieve a subnet +// This request retrieves a single subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnet(getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + return vpc.GetSubnetWithContext(context.Background(), getSubnetOptions) +} + +// GetSubnetWithContext is an alternate form of the GetSubnet method which supports a Context parameter +func (vpc *VpcV1) GetSubnetWithContext(ctx context.Context, getSubnetOptions *GetSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetOptions, "getSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetOptions, "getSubnetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnet") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateSubnet : Update a subnet +// This request updates a subnet with the information in a provided subnet patch. The subnet patch object is structured +// in the same way as a retrieved subnet and contains only the information to be updated. +func (vpc *VpcV1) UpdateSubnet(updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + return vpc.UpdateSubnetWithContext(context.Background(), updateSubnetOptions) +} + +// UpdateSubnetWithContext is an alternate form of the UpdateSubnet method which supports a Context parameter +func (vpc *VpcV1) UpdateSubnetWithContext(ctx context.Context, updateSubnetOptions *UpdateSubnetOptions) (result *Subnet, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSubnetOptions, "updateSubnetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSubnetOptions, "updateSubnetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateSubnetOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSubnetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnet") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSubnetOptions.SubnetPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSubnet) + if err != nil { + return + } + response.Result = result + + return +} + +// GetSubnetNetworkACL : Retrieve a subnet's attached network ACL +// This request retrieves the network ACL attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetNetworkACL(getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.GetSubnetNetworkACLWithContext(context.Background(), getSubnetNetworkACLOptions) +} + +// GetSubnetNetworkACLWithContext is an alternate form of the GetSubnetNetworkACL method which supports a Context parameter +func (vpc *VpcV1) GetSubnetNetworkACLWithContext(ctx context.Context, getSubnetNetworkACLOptions *GetSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetNetworkACLOptions, "getSubnetNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + + return +} + +// ReplaceSubnetNetworkACL : Attach a network ACL to a subnet +// This request attaches the network ACL, specified in the request body, to the subnet specified by the subnet +// identifier in the URL. This replaces the existing network ACL on the subnet. +func (vpc *VpcV1) ReplaceSubnetNetworkACL(replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.ReplaceSubnetNetworkACLWithContext(context.Background(), replaceSubnetNetworkACLOptions) +} + +// ReplaceSubnetNetworkACLWithContext is an alternate form of the ReplaceSubnetNetworkACL method which supports a Context parameter +func (vpc *VpcV1) ReplaceSubnetNetworkACLWithContext(ctx context.Context, replaceSubnetNetworkACLOptions *ReplaceSubnetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(replaceSubnetNetworkACLOptions, "replaceSubnetNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *replaceSubnetNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/network_acl`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range replaceSubnetNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(replaceSubnetNetworkACLOptions.NetworkACLIdentity) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + + return +} + +// UnsetSubnetPublicGateway : Detach a public gateway from a subnet +// This request detaches the public gateway from the subnet specified by the subnet identifier in the URL. +func (vpc *VpcV1) UnsetSubnetPublicGateway(unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { + return vpc.UnsetSubnetPublicGatewayWithContext(context.Background(), unsetSubnetPublicGatewayOptions) +} + +// UnsetSubnetPublicGatewayWithContext is an alternate form of the UnsetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) UnsetSubnetPublicGatewayWithContext(ctx context.Context, unsetSubnetPublicGatewayOptions *UnsetSubnetPublicGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(unsetSubnetPublicGatewayOptions, "unsetSubnetPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *unsetSubnetPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range unsetSubnetPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UnsetSubnetPublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSubnetPublicGateway : Retrieve a subnet's attached public gateway +// This request retrieves the public gateway attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetPublicGateway(getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.GetSubnetPublicGatewayWithContext(context.Background(), getSubnetPublicGatewayOptions) +} + +// GetSubnetPublicGatewayWithContext is an alternate form of the GetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) GetSubnetPublicGatewayWithContext(ctx context.Context, getSubnetPublicGatewayOptions *GetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetPublicGatewayOptions, "getSubnetPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetPublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + + return +} + +// SetSubnetPublicGateway : Attach a public gateway to a subnet +// This request attaches the public gateway, specified in the request body, to the subnet specified by the subnet +// identifier in the URL. The public gateway must have the same VPC and zone as the subnet. +func (vpc *VpcV1) SetSubnetPublicGateway(setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.SetSubnetPublicGatewayWithContext(context.Background(), setSubnetPublicGatewayOptions) +} + +// SetSubnetPublicGatewayWithContext is an alternate form of the SetSubnetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) SetSubnetPublicGatewayWithContext(ctx context.Context, setSubnetPublicGatewayOptions *SetSubnetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(setSubnetPublicGatewayOptions, "setSubnetPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *setSubnetPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/public_gateway`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range setSubnetPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "SetSubnetPublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(setSubnetPublicGatewayOptions.PublicGatewayIdentity) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + + return +} + +// GetSubnetRoutingTable : Retrieve a subnet's attached routing table +// This request retrieves the routing table attached to the subnet specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetRoutingTable(getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.GetSubnetRoutingTableWithContext(context.Background(), getSubnetRoutingTableOptions) +} + +// GetSubnetRoutingTableWithContext is an alternate form of the GetSubnetRoutingTable method which supports a Context parameter +func (vpc *VpcV1) GetSubnetRoutingTableWithContext(ctx context.Context, getSubnetRoutingTableOptions *GetSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetRoutingTableOptions, "getSubnetRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSubnetRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + + return +} + +// ReplaceSubnetRoutingTable : Attach a routing table to a subnet +// This request attaches the routing table, specified in the request body, to the subnet specified by the subnet +// identifier in the URL. This replaces the existing routing table on the subnet. +// +// For this request to succeed, the routing table `route_direct_link_ingress`, +// `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` properties must be `false`. +func (vpc *VpcV1) ReplaceSubnetRoutingTable(replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + return vpc.ReplaceSubnetRoutingTableWithContext(context.Background(), replaceSubnetRoutingTableOptions) +} + +// ReplaceSubnetRoutingTableWithContext is an alternate form of the ReplaceSubnetRoutingTable method which supports a Context parameter +func (vpc *VpcV1) ReplaceSubnetRoutingTableWithContext(ctx context.Context, replaceSubnetRoutingTableOptions *ReplaceSubnetRoutingTableOptions) (result *RoutingTable, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(replaceSubnetRoutingTableOptions, "replaceSubnetRoutingTableOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *replaceSubnetRoutingTableOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{id}/routing_table`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range replaceSubnetRoutingTableOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceSubnetRoutingTable") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(replaceSubnetRoutingTableOptions.RoutingTableIdentity) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRoutingTable) + if err != nil { + return + } + response.Result = result + + return +} + +// ListSubnetReservedIps : List all reserved IPs in a subnet +// This request lists reserved IPs in a subnet that are unbound or bound to an endpoint gateway. +func (vpc *VpcV1) ListSubnetReservedIps(listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { + return vpc.ListSubnetReservedIpsWithContext(context.Background(), listSubnetReservedIpsOptions) +} + +// ListSubnetReservedIpsWithContext is an alternate form of the ListSubnetReservedIps method which supports a Context parameter +func (vpc *VpcV1) ListSubnetReservedIpsWithContext(ctx context.Context, listSubnetReservedIpsOptions *ListSubnetReservedIpsOptions) (result *ReservedIPCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listSubnetReservedIpsOptions, "listSubnetReservedIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *listSubnetReservedIpsOptions.SubnetID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listSubnetReservedIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSubnetReservedIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSubnetReservedIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSubnetReservedIpsOptions.Start)) + } + if listSubnetReservedIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSubnetReservedIpsOptions.Limit)) + } + if listSubnetReservedIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listSubnetReservedIpsOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateSubnetReservedIP : Reserve an IP in a subnet +// This request reserves a system-selected IP address in a subnet. +func (vpc *VpcV1) CreateSubnetReservedIP(createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.CreateSubnetReservedIPWithContext(context.Background(), createSubnetReservedIPOptions) +} + +// CreateSubnetReservedIPWithContext is an alternate form of the CreateSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) CreateSubnetReservedIPWithContext(ctx context.Context, createSubnetReservedIPOptions *CreateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSubnetReservedIPOptions, "createSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSubnetReservedIPOptions, "createSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *createSubnetReservedIPOptions.SubnetID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createSubnetReservedIPOptions.AutoDelete != nil { + body["auto_delete"] = createSubnetReservedIPOptions.AutoDelete + } + if createSubnetReservedIPOptions.Name != nil { + body["name"] = createSubnetReservedIPOptions.Name + } + if createSubnetReservedIPOptions.Target != nil { + body["target"] = createSubnetReservedIPOptions.Target + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteSubnetReservedIP : Release a reserved IP +// This request releases a reserved IP. This operation cannot be reversed. +func (vpc *VpcV1) DeleteSubnetReservedIP(deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSubnetReservedIPWithContext(context.Background(), deleteSubnetReservedIPOptions) +} + +// DeleteSubnetReservedIPWithContext is an alternate form of the DeleteSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) DeleteSubnetReservedIPWithContext(ctx context.Context, deleteSubnetReservedIPOptions *DeleteSubnetReservedIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSubnetReservedIPOptions, "deleteSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *deleteSubnetReservedIPOptions.SubnetID, + "id": *deleteSubnetReservedIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSubnetReservedIP : Retrieve a reserved IP +// This request retrieves a single reserved IP specified by the identifier in the URL. +func (vpc *VpcV1) GetSubnetReservedIP(getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetSubnetReservedIPWithContext(context.Background(), getSubnetReservedIPOptions) +} + +// GetSubnetReservedIPWithContext is an alternate form of the GetSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) GetSubnetReservedIPWithContext(ctx context.Context, getSubnetReservedIPOptions *GetSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSubnetReservedIPOptions, "getSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSubnetReservedIPOptions, "getSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *getSubnetReservedIPOptions.SubnetID, + "id": *getSubnetReservedIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateSubnetReservedIP : Update a reserved IP +// This request updates a reserved IP with the information in a provided reserved IP patch. The reserved IP patch object +// is structured in the same way as a retrieved reserved IP and contains only the information to be updated. +func (vpc *VpcV1) UpdateSubnetReservedIP(updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.UpdateSubnetReservedIPWithContext(context.Background(), updateSubnetReservedIPOptions) +} + +// UpdateSubnetReservedIPWithContext is an alternate form of the UpdateSubnetReservedIP method which supports a Context parameter +func (vpc *VpcV1) UpdateSubnetReservedIPWithContext(ctx context.Context, updateSubnetReservedIPOptions *UpdateSubnetReservedIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSubnetReservedIPOptions, "updateSubnetReservedIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "subnet_id": *updateSubnetReservedIPOptions.SubnetID, + "id": *updateSubnetReservedIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/subnets/{subnet_id}/reserved_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSubnetReservedIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSubnetReservedIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSubnetReservedIPOptions.ReservedIPPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + + return +} + +// ListImages : List all images +// This request lists all provisionable images available in the region. An image provides source data for a volume. +// Images are either system-provided, or created from another source, such as importing from object storage. +// +// The images will be sorted by their `created_at` property values, with the newest first. Images with identical +// `created_at` values will be secondarily sorted by ascending `id` property values. +func (vpc *VpcV1) ListImages(listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { + return vpc.ListImagesWithContext(context.Background(), listImagesOptions) +} + +// ListImagesWithContext is an alternate form of the ListImages method which supports a Context parameter +func (vpc *VpcV1) ListImagesWithContext(ctx context.Context, listImagesOptions *ListImagesOptions) (result *ImageCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listImagesOptions, "listImagesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listImagesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListImages") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listImagesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listImagesOptions.Start)) + } + if listImagesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listImagesOptions.Limit)) + } + if listImagesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listImagesOptions.ResourceGroupID)) + } + if listImagesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listImagesOptions.Name)) + } + if listImagesOptions.Visibility != nil { + builder.AddQuery("visibility", fmt.Sprint(*listImagesOptions.Visibility)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImageCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateImage : Create an image +// This request creates a new image from an image prototype object. The prototype object is structured in the same way +// as a retrieved image, and contains the information necessary to create the new image. A URL to the image file on +// object storage must be provided. +func (vpc *VpcV1) CreateImage(createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + return vpc.CreateImageWithContext(context.Background(), createImageOptions) +} + +// CreateImageWithContext is an alternate form of the CreateImage method which supports a Context parameter +func (vpc *VpcV1) CreateImageWithContext(ctx context.Context, createImageOptions *CreateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createImageOptions, "createImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createImageOptions, "createImageOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateImage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createImageOptions.ImagePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteImage : Delete an image +// This request deletes an image. This operation cannot be reversed. System-provided images are not allowed to be +// deleted. An image with a `status` of `pending`, `tentative`, or `deleting` cannot be deleted. +func (vpc *VpcV1) DeleteImage(deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteImageWithContext(context.Background(), deleteImageOptions) +} + +// DeleteImageWithContext is an alternate form of the DeleteImage method which supports a Context parameter +func (vpc *VpcV1) DeleteImageWithContext(ctx context.Context, deleteImageOptions *DeleteImageOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteImageOptions, "deleteImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteImageOptions, "deleteImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteImage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetImage : Retrieve an image +// This request retrieves a single image specified by the identifier in the URL. +func (vpc *VpcV1) GetImage(getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { + return vpc.GetImageWithContext(context.Background(), getImageOptions) +} + +// GetImageWithContext is an alternate form of the GetImage method which supports a Context parameter +func (vpc *VpcV1) GetImageWithContext(ctx context.Context, getImageOptions *GetImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getImageOptions, "getImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getImageOptions, "getImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetImage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateImage : Update an image +// This request updates an image with the information in a provided image patch. The image patch object is structured in +// the same way as a retrieved image and contains only the information to be updated. System-provided images are not +// allowed to be updated. An image with a `status` of `deleting` cannot be updated. +func (vpc *VpcV1) UpdateImage(updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + return vpc.UpdateImageWithContext(context.Background(), updateImageOptions) +} + +// UpdateImageWithContext is an alternate form of the UpdateImage method which supports a Context parameter +func (vpc *VpcV1) UpdateImageWithContext(ctx context.Context, updateImageOptions *UpdateImageOptions) (result *Image, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateImageOptions, "updateImageOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateImageOptions, "updateImageOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateImageOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/images/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateImageOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateImage") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateImageOptions.ImagePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalImage) + if err != nil { + return + } + response.Result = result + + return +} + +// ListOperatingSystems : List all operating systems +// This request lists all operating systems in the region. +func (vpc *VpcV1) ListOperatingSystems(listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { + return vpc.ListOperatingSystemsWithContext(context.Background(), listOperatingSystemsOptions) +} + +// ListOperatingSystemsWithContext is an alternate form of the ListOperatingSystems method which supports a Context parameter +func (vpc *VpcV1) ListOperatingSystemsWithContext(ctx context.Context, listOperatingSystemsOptions *ListOperatingSystemsOptions) (result *OperatingSystemCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listOperatingSystemsOptions, "listOperatingSystemsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listOperatingSystemsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListOperatingSystems") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listOperatingSystemsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listOperatingSystemsOptions.Start)) + } + if listOperatingSystemsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listOperatingSystemsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystemCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// GetOperatingSystem : Retrieve an operating system +// This request retrieves a single operating system specified by the name in the URL. +func (vpc *VpcV1) GetOperatingSystem(getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { + return vpc.GetOperatingSystemWithContext(context.Background(), getOperatingSystemOptions) +} + +// GetOperatingSystemWithContext is an alternate form of the GetOperatingSystem method which supports a Context parameter +func (vpc *VpcV1) GetOperatingSystemWithContext(ctx context.Context, getOperatingSystemOptions *GetOperatingSystemOptions) (result *OperatingSystem, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getOperatingSystemOptions, "getOperatingSystemOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getOperatingSystemOptions, "getOperatingSystemOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getOperatingSystemOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/operating_systems/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getOperatingSystemOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetOperatingSystem") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalOperatingSystem) + if err != nil { + return + } + response.Result = result + + return +} + +// ListKeys : List all keys +// This request lists all keys in the region. A key contains a public SSH key which may be installed on instances when +// they are created. Private keys are not stored. +func (vpc *VpcV1) ListKeys(listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { + return vpc.ListKeysWithContext(context.Background(), listKeysOptions) +} + +// ListKeysWithContext is an alternate form of the ListKeys method which supports a Context parameter +func (vpc *VpcV1) ListKeysWithContext(ctx context.Context, listKeysOptions *ListKeysOptions) (result *KeyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listKeysOptions, "listKeysOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listKeysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListKeys") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listKeysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listKeysOptions.ResourceGroupID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKeyCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateKey : Create a key +// This request creates a new SSH key from an key prototype object. The prototype object is structured in the same way +// as a retrieved key, and contains the information necessary to create the new key. The public key value must be +// provided. +func (vpc *VpcV1) CreateKey(createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + return vpc.CreateKeyWithContext(context.Background(), createKeyOptions) +} + +// CreateKeyWithContext is an alternate form of the CreateKey method which supports a Context parameter +func (vpc *VpcV1) CreateKeyWithContext(ctx context.Context, createKeyOptions *CreateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createKeyOptions, "createKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createKeyOptions, "createKeyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createKeyOptions.PublicKey != nil { + body["public_key"] = createKeyOptions.PublicKey + } + if createKeyOptions.Name != nil { + body["name"] = createKeyOptions.Name + } + if createKeyOptions.ResourceGroup != nil { + body["resource_group"] = createKeyOptions.ResourceGroup + } + if createKeyOptions.Type != nil { + body["type"] = createKeyOptions.Type + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteKey : Delete a key +// This request deletes a key. This operation cannot be reversed. +func (vpc *VpcV1) DeleteKey(deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteKeyWithContext(context.Background(), deleteKeyOptions) +} + +// DeleteKeyWithContext is an alternate form of the DeleteKey method which supports a Context parameter +func (vpc *VpcV1) DeleteKeyWithContext(ctx context.Context, deleteKeyOptions *DeleteKeyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteKeyOptions, "deleteKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteKeyOptions, "deleteKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetKey : Retrieve a key +// This request retrieves a single key specified by the identifier in the URL. +func (vpc *VpcV1) GetKey(getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + return vpc.GetKeyWithContext(context.Background(), getKeyOptions) +} + +// GetKeyWithContext is an alternate form of the GetKey method which supports a Context parameter +func (vpc *VpcV1) GetKeyWithContext(ctx context.Context, getKeyOptions *GetKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getKeyOptions, "getKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getKeyOptions, "getKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateKey : Update a key +// This request updates a key's name. +func (vpc *VpcV1) UpdateKey(updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + return vpc.UpdateKeyWithContext(context.Background(), updateKeyOptions) +} + +// UpdateKeyWithContext is an alternate form of the UpdateKey method which supports a Context parameter +func (vpc *VpcV1) UpdateKeyWithContext(ctx context.Context, updateKeyOptions *UpdateKeyOptions) (result *Key, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateKeyOptions, "updateKeyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateKeyOptions, "updateKeyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateKeyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/keys/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateKeyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateKey") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateKeyOptions.KeyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalKey) + if err != nil { + return + } + response.Result = result + + return +} + +// ListInstanceProfiles : List all instance profiles +// This request lists provisionable instance profiles in the region. An instance profile specifies the performance +// characteristics and pricing model for an instance. +func (vpc *VpcV1) ListInstanceProfiles(listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceProfilesWithContext(context.Background(), listInstanceProfilesOptions) +} + +// ListInstanceProfilesWithContext is an alternate form of the ListInstanceProfiles method which supports a Context parameter +func (vpc *VpcV1) ListInstanceProfilesWithContext(ctx context.Context, listInstanceProfilesOptions *ListInstanceProfilesOptions) (result *InstanceProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceProfilesOptions, "listInstanceProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfileCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// GetInstanceProfile : Retrieve an instance profile +// This request retrieves a single instance profile specified by the name in the URL. +func (vpc *VpcV1) GetInstanceProfile(getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { + return vpc.GetInstanceProfileWithContext(context.Background(), getInstanceProfileOptions) +} + +// GetInstanceProfileWithContext is an alternate form of the GetInstanceProfile method which supports a Context parameter +func (vpc *VpcV1) GetInstanceProfileWithContext(ctx context.Context, getInstanceProfileOptions *GetInstanceProfileOptions) (result *InstanceProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceProfileOptions, "getInstanceProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceProfileOptions, "getInstanceProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getInstanceProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceProfile) + if err != nil { + return + } + response.Result = result + + return +} + +// ListInstanceTemplates : List all instance templates +// This request lists all instance templates in the region. +func (vpc *VpcV1) ListInstanceTemplates(listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceTemplatesWithContext(context.Background(), listInstanceTemplatesOptions) +} + +// ListInstanceTemplatesWithContext is an alternate form of the ListInstanceTemplates method which supports a Context parameter +func (vpc *VpcV1) ListInstanceTemplatesWithContext(ctx context.Context, listInstanceTemplatesOptions *ListInstanceTemplatesOptions) (result *InstanceTemplateCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceTemplatesOptions, "listInstanceTemplatesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceTemplatesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceTemplates") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplateCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateInstanceTemplate : Create an instance template +// This request creates a new instance template. +func (vpc *VpcV1) CreateInstanceTemplate(createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceTemplateWithContext(context.Background(), createInstanceTemplateOptions) +} + +// CreateInstanceTemplateWithContext is an alternate form of the CreateInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceTemplateWithContext(ctx context.Context, createInstanceTemplateOptions *CreateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceTemplateOptions, "createInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceTemplateOptions, "createInstanceTemplateOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceTemplate") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createInstanceTemplateOptions.InstanceTemplatePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteInstanceTemplate : Delete an instance template +// This request deletes the instance template. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceTemplate(deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceTemplateWithContext(context.Background(), deleteInstanceTemplateOptions) +} + +// DeleteInstanceTemplateWithContext is an alternate form of the DeleteInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceTemplateWithContext(ctx context.Context, deleteInstanceTemplateOptions *DeleteInstanceTemplateOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceTemplateOptions, "deleteInstanceTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteInstanceTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceTemplate") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceTemplate : Retrieve an instance template +// This request retrieves a single instance template specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceTemplate(getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceTemplateWithContext(context.Background(), getInstanceTemplateOptions) +} + +// GetInstanceTemplateWithContext is an alternate form of the GetInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) GetInstanceTemplateWithContext(ctx context.Context, getInstanceTemplateOptions *GetInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceTemplateOptions, "getInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceTemplateOptions, "getInstanceTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceTemplate") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateInstanceTemplate : Update an instance template +// This request updates an instance template with the information provided in the instance template patch. The instance +// template patch object is structured in the same way as a retrieved instance template and contains only the +// information to be updated. +func (vpc *VpcV1) UpdateInstanceTemplate(updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceTemplateWithContext(context.Background(), updateInstanceTemplateOptions) +} + +// UpdateInstanceTemplateWithContext is an alternate form of the UpdateInstanceTemplate method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceTemplateWithContext(ctx context.Context, updateInstanceTemplateOptions *UpdateInstanceTemplateOptions) (result InstanceTemplateIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceTemplateOptions, "updateInstanceTemplateOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceTemplateOptions, "updateInstanceTemplateOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateInstanceTemplateOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance/templates/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceTemplateOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceTemplate") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceTemplateOptions.InstanceTemplatePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceTemplate) + if err != nil { + return + } + response.Result = result + + return +} + +// ListInstances : List all instances +// This request lists all instances in the region. +func (vpc *VpcV1) ListInstances(listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstancesWithContext(context.Background(), listInstancesOptions) +} + +// ListInstancesWithContext is an alternate form of the ListInstances method which supports a Context parameter +func (vpc *VpcV1) ListInstancesWithContext(ctx context.Context, listInstancesOptions *ListInstancesOptions) (result *InstanceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstancesOptions, "listInstancesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstancesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstances") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstancesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstancesOptions.Start)) + } + if listInstancesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstancesOptions.Limit)) + } + if listInstancesOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listInstancesOptions.ResourceGroupID)) + } + if listInstancesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listInstancesOptions.Name)) + } + if listInstancesOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listInstancesOptions.VPCID)) + } + if listInstancesOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listInstancesOptions.VPCCRN)) + } + if listInstancesOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listInstancesOptions.VPCName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateInstance : Create an instance +// This request provisions a new instance from an instance prototype object. The prototype object is structured in the +// same way as a retrieved instance, and contains the information necessary to provision the new instance. The instance +// is automatically started. +func (vpc *VpcV1) CreateInstance(createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceWithContext(context.Background(), createInstanceOptions) +} + +// CreateInstanceWithContext is an alternate form of the CreateInstance method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceWithContext(ctx context.Context, createInstanceOptions *CreateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceOptions, "createInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceOptions, "createInstanceOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createInstanceOptions.InstancePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteInstance : Delete an instance +// This request deletes an instance. This operation cannot be reversed. Any floating IPs associated with the instance's +// network interfaces are implicitly disassociated. All flow log collectors with `auto_delete` set to `true` targeting +// the instance and/or the instance's network interfaces are automatically deleted. +func (vpc *VpcV1) DeleteInstance(deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceWithContext(context.Background(), deleteInstanceOptions) +} + +// DeleteInstanceWithContext is an alternate form of the DeleteInstance method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceWithContext(ctx context.Context, deleteInstanceOptions *DeleteInstanceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceOptions, "deleteInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceOptions, "deleteInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstance : Retrieve an instance +// This request retrieves a single instance specified by the identifier in the URL. +func (vpc *VpcV1) GetInstance(getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + return vpc.GetInstanceWithContext(context.Background(), getInstanceOptions) +} + +// GetInstanceWithContext is an alternate form of the GetInstance method which supports a Context parameter +func (vpc *VpcV1) GetInstanceWithContext(ctx context.Context, getInstanceOptions *GetInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceOptions, "getInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceOptions, "getInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateInstance : Update an instance +// This request updates an instance with the information in a provided instance patch. The instance patch object is +// structured in the same way as a retrieved instance and contains only the information to be updated. +func (vpc *VpcV1) UpdateInstance(updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceWithContext(context.Background(), updateInstanceOptions) +} + +// UpdateInstanceWithContext is an alternate form of the UpdateInstance method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceWithContext(ctx context.Context, updateInstanceOptions *UpdateInstanceOptions) (result *Instance, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceOptions, "updateInstanceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceOptions, "updateInstanceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateInstanceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstance") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceOptions.InstancePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstance) + if err != nil { + return + } + response.Result = result + + return +} + +// GetInstanceInitialization : Retrieve initialization configuration for an instance +// This request retrieves configuration variables used to initialize the instance, such as SSH keys and the Windows +// administrator password. +func (vpc *VpcV1) GetInstanceInitialization(getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { + return vpc.GetInstanceInitializationWithContext(context.Background(), getInstanceInitializationOptions) +} + +// GetInstanceInitializationWithContext is an alternate form of the GetInstanceInitialization method which supports a Context parameter +func (vpc *VpcV1) GetInstanceInitializationWithContext(ctx context.Context, getInstanceInitializationOptions *GetInstanceInitializationOptions) (result *InstanceInitialization, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceInitializationOptions, "getInstanceInitializationOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceInitializationOptions, "getInstanceInitializationOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceInitializationOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{id}/initialization`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceInitializationOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceInitialization") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceInitialization) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateInstanceAction : Create an instance action +// This request creates a new action which will be queued up to run as soon as any pending or running actions have +// completed. +func (vpc *VpcV1) CreateInstanceAction(createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceActionWithContext(context.Background(), createInstanceActionOptions) +} + +// CreateInstanceActionWithContext is an alternate form of the CreateInstanceAction method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceActionWithContext(ctx context.Context, createInstanceActionOptions *CreateInstanceActionOptions) (result *InstanceAction, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceActionOptions, "createInstanceActionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceActionOptions, "createInstanceActionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceActionOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/actions`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceActionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceAction") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceActionOptions.Type != nil { + body["type"] = createInstanceActionOptions.Type + } + if createInstanceActionOptions.Force != nil { + body["force"] = createInstanceActionOptions.Force + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceAction) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateInstanceConsoleAccessToken : Create a console access token for an instance +// This request creates a new single-use console access token for an instance. All console configuration is provided at +// token create time, and the token is subsequently used in the `access_token` query parameter for the WebSocket +// request. The access token is only valid for a short period of time, and a maximum of one token is valid for a given +// instance at a time. +func (vpc *VpcV1) CreateInstanceConsoleAccessToken(createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceConsoleAccessTokenWithContext(context.Background(), createInstanceConsoleAccessTokenOptions) +} + +// CreateInstanceConsoleAccessTokenWithContext is an alternate form of the CreateInstanceConsoleAccessToken method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceConsoleAccessTokenWithContext(ctx context.Context, createInstanceConsoleAccessTokenOptions *CreateInstanceConsoleAccessTokenOptions) (result *InstanceConsoleAccessToken, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceConsoleAccessTokenOptions, "createInstanceConsoleAccessTokenOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceConsoleAccessTokenOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/console_access_token`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceConsoleAccessTokenOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceConsoleAccessToken") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceConsoleAccessTokenOptions.ConsoleType != nil { + body["console_type"] = createInstanceConsoleAccessTokenOptions.ConsoleType + } + if createInstanceConsoleAccessTokenOptions.Force != nil { + body["force"] = createInstanceConsoleAccessTokenOptions.Force + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceConsoleAccessToken) + if err != nil { + return + } + response.Result = result + + return +} + +// ListInstanceDisks : List all disks on an instance +// This request lists all disks on an instance. A disk is a block device that is locally attached to the instance's +// physical host and is also referred to as instance storage. By default, the listed disks are sorted by their +// `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListInstanceDisks(listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceDisksWithContext(context.Background(), listInstanceDisksOptions) +} + +// ListInstanceDisksWithContext is an alternate form of the ListInstanceDisks method which supports a Context parameter +func (vpc *VpcV1) ListInstanceDisksWithContext(ctx context.Context, listInstanceDisksOptions *ListInstanceDisksOptions) (result *InstanceDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceDisksOptions, "listInstanceDisksOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceDisksOptions, "listInstanceDisksOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceDisksOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceDisksOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceDisks") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDiskCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// GetInstanceDisk : Retrieve an instance disk +// This request retrieves a single instance disk specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceDisk(getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + return vpc.GetInstanceDiskWithContext(context.Background(), getInstanceDiskOptions) +} + +// GetInstanceDiskWithContext is an alternate form of the GetInstanceDisk method which supports a Context parameter +func (vpc *VpcV1) GetInstanceDiskWithContext(ctx context.Context, getInstanceDiskOptions *GetInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceDiskOptions, "getInstanceDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceDiskOptions, "getInstanceDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceDiskOptions.InstanceID, + "id": *getInstanceDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceDisk") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateInstanceDisk : Update an instance disk +// This request updates the instance disk with the information in a provided patch. +func (vpc *VpcV1) UpdateInstanceDisk(updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceDiskWithContext(context.Background(), updateInstanceDiskOptions) +} + +// UpdateInstanceDiskWithContext is an alternate form of the UpdateInstanceDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceDiskWithContext(ctx context.Context, updateInstanceDiskOptions *UpdateInstanceDiskOptions) (result *InstanceDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceDiskOptions, "updateInstanceDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceDiskOptions, "updateInstanceDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceDiskOptions.InstanceID, + "id": *updateInstanceDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceDisk") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceDiskOptions.InstanceDiskPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceDisk) + if err != nil { + return + } + response.Result = result + + return +} + +// ListInstanceNetworkInterfaces : List all network interfaces on an instance +// This request lists all network interfaces on an instance. A network interface is an abstract representation of a +// network interface card and connects an instance to a subnet. While each network interface can attach to only one +// subnet, multiple network interfaces can be created to attach to multiple subnets. Multiple interfaces may also attach +// to the same subnet. +func (vpc *VpcV1) ListInstanceNetworkInterfaces(listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkInterfacesWithContext(context.Background(), listInstanceNetworkInterfacesOptions) +} + +// ListInstanceNetworkInterfacesWithContext is an alternate form of the ListInstanceNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkInterfacesWithContext(ctx context.Context, listInstanceNetworkInterfacesOptions *ListInstanceNetworkInterfacesOptions) (result *NetworkInterfaceUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceNetworkInterfacesOptions, "listInstanceNetworkInterfacesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkInterfacesOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterfaceUnpaginatedCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateInstanceNetworkInterface : Create a network interface on an instance +// This request creates a new network interface from a network interface prototype object. The prototype object is +// structured in the same way as a retrieved network interface, and contains the information necessary to create the new +// network interface. Any subnet in the instance's VPC may be specified, even if it is already attached to another +// network interface. Addresses on the network interface must be within the specified subnet's CIDR blocks. +func (vpc *VpcV1) CreateInstanceNetworkInterface(createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceNetworkInterfaceWithContext(context.Background(), createInstanceNetworkInterfaceOptions) +} + +// CreateInstanceNetworkInterfaceWithContext is an alternate form of the CreateInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceNetworkInterfaceWithContext(ctx context.Context, createInstanceNetworkInterfaceOptions *CreateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceNetworkInterfaceOptions, "createInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceNetworkInterfaceOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceNetworkInterfaceOptions.Subnet != nil { + body["subnet"] = createInstanceNetworkInterfaceOptions.Subnet + } + if createInstanceNetworkInterfaceOptions.AllowIPSpoofing != nil { + body["allow_ip_spoofing"] = createInstanceNetworkInterfaceOptions.AllowIPSpoofing + } + if createInstanceNetworkInterfaceOptions.Name != nil { + body["name"] = createInstanceNetworkInterfaceOptions.Name + } + if createInstanceNetworkInterfaceOptions.PrimaryIpv4Address != nil { + body["primary_ipv4_address"] = createInstanceNetworkInterfaceOptions.PrimaryIpv4Address + } + if createInstanceNetworkInterfaceOptions.SecurityGroups != nil { + body["security_groups"] = createInstanceNetworkInterfaceOptions.SecurityGroups + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteInstanceNetworkInterface : Delete a network interface +// This request deletes a network interface. This operation cannot be reversed. Any floating IPs associated with the +// network interface are implicitly disassociated. All flow log collectors with `auto_delete` set to `true` targeting +// the network interface are automatically deleted. The primary network interface is not allowed to be deleted. +func (vpc *VpcV1) DeleteInstanceNetworkInterface(deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceNetworkInterfaceWithContext(context.Background(), deleteInstanceNetworkInterfaceOptions) +} + +// DeleteInstanceNetworkInterfaceWithContext is an alternate form of the DeleteInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceNetworkInterfaceWithContext(ctx context.Context, deleteInstanceNetworkInterfaceOptions *DeleteInstanceNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceNetworkInterfaceOptions, "deleteInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *deleteInstanceNetworkInterfaceOptions.InstanceID, + "id": *deleteInstanceNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceNetworkInterface : Retrieve a network interface +// This request retrieves a single network interface specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceNetworkInterface(getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkInterfaceWithContext(context.Background(), getInstanceNetworkInterfaceOptions) +} + +// GetInstanceNetworkInterfaceWithContext is an alternate form of the GetInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkInterfaceWithContext(ctx context.Context, getInstanceNetworkInterfaceOptions *GetInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceNetworkInterfaceOptions, "getInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkInterfaceOptions.InstanceID, + "id": *getInstanceNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateInstanceNetworkInterface : Update a network interface +// This request updates a network interface with the information in a provided network interface patch. The network +// interface patch object is structured in the same way as a retrieved network interface and can contain an updated name +// and/or port speed. +func (vpc *VpcV1) UpdateInstanceNetworkInterface(updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceNetworkInterfaceWithContext(context.Background(), updateInstanceNetworkInterfaceOptions) +} + +// UpdateInstanceNetworkInterfaceWithContext is an alternate form of the UpdateInstanceNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceNetworkInterfaceWithContext(ctx context.Context, updateInstanceNetworkInterfaceOptions *UpdateInstanceNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceNetworkInterfaceOptions, "updateInstanceNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceNetworkInterfaceOptions.InstanceID, + "id": *updateInstanceNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceNetworkInterfaceOptions.NetworkInterfacePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + if err != nil { + return + } + response.Result = result + + return +} + +// ListInstanceNetworkInterfaceFloatingIps : List all floating IPs associated with a network interface +// This request lists all floating IPs associated with a network interface. +func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIps(listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceNetworkInterfaceFloatingIpsWithContext(context.Background(), listInstanceNetworkInterfaceFloatingIpsOptions) +} + +// ListInstanceNetworkInterfaceFloatingIpsWithContext is an alternate form of the ListInstanceNetworkInterfaceFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListInstanceNetworkInterfaceFloatingIpsWithContext(ctx context.Context, listInstanceNetworkInterfaceFloatingIpsOptions *ListInstanceNetworkInterfaceFloatingIpsOptions) (result *FloatingIPUnpaginatedCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceNetworkInterfaceFloatingIpsOptions, "listInstanceNetworkInterfaceFloatingIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceNetworkInterfaceFloatingIpsOptions.InstanceID, + "network_interface_id": *listInstanceNetworkInterfaceFloatingIpsOptions.NetworkInterfaceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceNetworkInterfaceFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceNetworkInterfaceFloatingIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPUnpaginatedCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// RemoveInstanceNetworkInterfaceFloatingIP : Disassociate a floating IP from a network interface +// This request disassociates the specified floating IP from the specified network interface. +func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIP(removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), removeInstanceNetworkInterfaceFloatingIPOptions) +} + +// RemoveInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the RemoveInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) RemoveInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, removeInstanceNetworkInterfaceFloatingIPOptions *RemoveInstanceNetworkInterfaceFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeInstanceNetworkInterfaceFloatingIPOptions, "removeInstanceNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *removeInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *removeInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *removeInstanceNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeInstanceNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveInstanceNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceNetworkInterfaceFloatingIP : Retrieve associated floating IP +// This request a retrieves a specified floating IP address if it is associated with the network interface and instance +// specified in the URL. +func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIP(getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.GetInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), getInstanceNetworkInterfaceFloatingIPOptions) +} + +// GetInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the GetInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, getInstanceNetworkInterfaceFloatingIPOptions *GetInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceNetworkInterfaceFloatingIPOptions, "getInstanceNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *getInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *getInstanceNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + + return +} + +// AddInstanceNetworkInterfaceFloatingIP : Associate a floating IP with a network interface +// This request associates the specified floating IP with the specified network interface, replacing any existing +// association. For this request to succeed, the existing floating IP must not be required by another resource, such as +// a public gateway. A request body is not required, and if supplied, is ignored. +func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIP(addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.AddInstanceNetworkInterfaceFloatingIPWithContext(context.Background(), addInstanceNetworkInterfaceFloatingIPOptions) +} + +// AddInstanceNetworkInterfaceFloatingIPWithContext is an alternate form of the AddInstanceNetworkInterfaceFloatingIP method which supports a Context parameter +func (vpc *VpcV1) AddInstanceNetworkInterfaceFloatingIPWithContext(ctx context.Context, addInstanceNetworkInterfaceFloatingIPOptions *AddInstanceNetworkInterfaceFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addInstanceNetworkInterfaceFloatingIPOptions, "addInstanceNetworkInterfaceFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *addInstanceNetworkInterfaceFloatingIPOptions.InstanceID, + "network_interface_id": *addInstanceNetworkInterfaceFloatingIPOptions.NetworkInterfaceID, + "id": *addInstanceNetworkInterfaceFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/network_interfaces/{network_interface_id}/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addInstanceNetworkInterfaceFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddInstanceNetworkInterfaceFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + + return +} + +// ListInstanceVolumeAttachments : List all volumes attachments on an instance +// This request lists all volume attachments on an instance. A volume attachment connects a volume to an instance. Each +// instance may have many volume attachments but each volume attachment connects exactly one instance to exactly one +// volume. +func (vpc *VpcV1) ListInstanceVolumeAttachments(listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceVolumeAttachmentsWithContext(context.Background(), listInstanceVolumeAttachmentsOptions) +} + +// ListInstanceVolumeAttachmentsWithContext is an alternate form of the ListInstanceVolumeAttachments method which supports a Context parameter +func (vpc *VpcV1) ListInstanceVolumeAttachmentsWithContext(ctx context.Context, listInstanceVolumeAttachmentsOptions *ListInstanceVolumeAttachmentsOptions) (result *VolumeAttachmentCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceVolumeAttachmentsOptions, "listInstanceVolumeAttachmentsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *listInstanceVolumeAttachmentsOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceVolumeAttachmentsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceVolumeAttachments") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachmentCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateInstanceVolumeAttachment : Create a volume attachment on an instance +// This request creates a new volume attachment from a volume attachment prototype object. The prototype object is +// structured in the same way as a retrieved volume attachment, and contains the information necessary to create the new +// volume attachment. The creation of a new volume attachment connects a volume to an instance. +func (vpc *VpcV1) CreateInstanceVolumeAttachment(createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceVolumeAttachmentWithContext(context.Background(), createInstanceVolumeAttachmentOptions) +} + +// CreateInstanceVolumeAttachmentWithContext is an alternate form of the CreateInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceVolumeAttachmentWithContext(ctx context.Context, createInstanceVolumeAttachmentOptions *CreateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceVolumeAttachmentOptions, "createInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *createInstanceVolumeAttachmentOptions.InstanceID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceVolumeAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceVolumeAttachmentOptions.Volume != nil { + body["volume"] = createInstanceVolumeAttachmentOptions.Volume + } + if createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete != nil { + body["delete_volume_on_instance_delete"] = createInstanceVolumeAttachmentOptions.DeleteVolumeOnInstanceDelete + } + if createInstanceVolumeAttachmentOptions.Name != nil { + body["name"] = createInstanceVolumeAttachmentOptions.Name + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteInstanceVolumeAttachment : Delete a volume attachment +// This request deletes a volume attachment. The deletion of a volume attachment detaches a volume from an instance. +func (vpc *VpcV1) DeleteInstanceVolumeAttachment(deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceVolumeAttachmentWithContext(context.Background(), deleteInstanceVolumeAttachmentOptions) +} + +// DeleteInstanceVolumeAttachmentWithContext is an alternate form of the DeleteInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceVolumeAttachmentWithContext(ctx context.Context, deleteInstanceVolumeAttachmentOptions *DeleteInstanceVolumeAttachmentOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceVolumeAttachmentOptions, "deleteInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *deleteInstanceVolumeAttachmentOptions.InstanceID, + "id": *deleteInstanceVolumeAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceVolumeAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceVolumeAttachment : Retrieve a volume attachment +// This request retrieves a single volume attachment specified by the identifier in the URL. +func (vpc *VpcV1) GetInstanceVolumeAttachment(getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + return vpc.GetInstanceVolumeAttachmentWithContext(context.Background(), getInstanceVolumeAttachmentOptions) +} + +// GetInstanceVolumeAttachmentWithContext is an alternate form of the GetInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) GetInstanceVolumeAttachmentWithContext(ctx context.Context, getInstanceVolumeAttachmentOptions *GetInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceVolumeAttachmentOptions, "getInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *getInstanceVolumeAttachmentOptions.InstanceID, + "id": *getInstanceVolumeAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceVolumeAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateInstanceVolumeAttachment : Update a volume attachment +// This request updates a volume attachment with the information in a provided volume attachment patch. The volume +// attachment patch object is structured in the same way as a retrieved volume attachment and can contain an updated +// name. +func (vpc *VpcV1) UpdateInstanceVolumeAttachment(updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceVolumeAttachmentWithContext(context.Background(), updateInstanceVolumeAttachmentOptions) +} + +// UpdateInstanceVolumeAttachmentWithContext is an alternate form of the UpdateInstanceVolumeAttachment method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceVolumeAttachmentWithContext(ctx context.Context, updateInstanceVolumeAttachmentOptions *UpdateInstanceVolumeAttachmentOptions) (result *VolumeAttachment, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceVolumeAttachmentOptions, "updateInstanceVolumeAttachmentOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_id": *updateInstanceVolumeAttachmentOptions.InstanceID, + "id": *updateInstanceVolumeAttachmentOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instances/{instance_id}/volume_attachments/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceVolumeAttachmentOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceVolumeAttachment") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceVolumeAttachmentOptions.VolumeAttachmentPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeAttachment) + if err != nil { + return + } + response.Result = result + + return +} + +// ListInstanceGroups : List all instance groups +// This request lists all instance groups in the region. +func (vpc *VpcV1) ListInstanceGroups(listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupsWithContext(context.Background(), listInstanceGroupsOptions) +} + +// ListInstanceGroupsWithContext is an alternate form of the ListInstanceGroups method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupsWithContext(ctx context.Context, listInstanceGroupsOptions *ListInstanceGroupsOptions) (result *InstanceGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listInstanceGroupsOptions, "listInstanceGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroups") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupsOptions.Start)) + } + if listInstanceGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateInstanceGroup : Create an instance group +// This request creates a new instance group. +func (vpc *VpcV1) CreateInstanceGroup(createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupWithContext(context.Background(), createInstanceGroupOptions) +} + +// CreateInstanceGroupWithContext is an alternate form of the CreateInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupWithContext(ctx context.Context, createInstanceGroupOptions *CreateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupOptions, "createInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceGroupOptions, "createInstanceGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createInstanceGroupOptions.InstanceTemplate != nil { + body["instance_template"] = createInstanceGroupOptions.InstanceTemplate + } + if createInstanceGroupOptions.Subnets != nil { + body["subnets"] = createInstanceGroupOptions.Subnets + } + if createInstanceGroupOptions.ApplicationPort != nil { + body["application_port"] = createInstanceGroupOptions.ApplicationPort + } + if createInstanceGroupOptions.LoadBalancer != nil { + body["load_balancer"] = createInstanceGroupOptions.LoadBalancer + } + if createInstanceGroupOptions.LoadBalancerPool != nil { + body["load_balancer_pool"] = createInstanceGroupOptions.LoadBalancerPool + } + if createInstanceGroupOptions.MembershipCount != nil { + body["membership_count"] = createInstanceGroupOptions.MembershipCount + } + if createInstanceGroupOptions.Name != nil { + body["name"] = createInstanceGroupOptions.Name + } + if createInstanceGroupOptions.ResourceGroup != nil { + body["resource_group"] = createInstanceGroupOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteInstanceGroup : Delete an instance group +// This request deletes an instance group. This operation cannot be reversed. Any instances associated with the group +// will be deleted. +func (vpc *VpcV1) DeleteInstanceGroup(deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupWithContext(context.Background(), deleteInstanceGroupOptions) +} + +// DeleteInstanceGroupWithContext is an alternate form of the DeleteInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupWithContext(ctx context.Context, deleteInstanceGroupOptions *DeleteInstanceGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupOptions, "deleteInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupOptions, "deleteInstanceGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteInstanceGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceGroup : Retrieve an instance group +// This request retrieves a single instance group specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroup(getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupWithContext(context.Background(), getInstanceGroupOptions) +} + +// GetInstanceGroupWithContext is an alternate form of the GetInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupWithContext(ctx context.Context, getInstanceGroupOptions *GetInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupOptions, "getInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupOptions, "getInstanceGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getInstanceGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateInstanceGroup : Update an instance group +// This request updates an instance group with the information provided instance group patch. The instance group patch +// object is structured in the same way as a retrieved instance group and contains only the information to be updated. +func (vpc *VpcV1) UpdateInstanceGroup(updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupWithContext(context.Background(), updateInstanceGroupOptions) +} + +// UpdateInstanceGroupWithContext is an alternate form of the UpdateInstanceGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupWithContext(ctx context.Context, updateInstanceGroupOptions *UpdateInstanceGroupOptions) (result *InstanceGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupOptions, "updateInstanceGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupOptions, "updateInstanceGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateInstanceGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupOptions.InstanceGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroup) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteInstanceGroupLoadBalancer : Delete an instance group load balancer +// This request unbinds the instance group from the load balancer pool, and deletes the load balancer pool members. +func (vpc *VpcV1) DeleteInstanceGroupLoadBalancer(deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupLoadBalancerWithContext(context.Background(), deleteInstanceGroupLoadBalancerOptions) +} + +// DeleteInstanceGroupLoadBalancerWithContext is an alternate form of the DeleteInstanceGroupLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupLoadBalancerWithContext(ctx context.Context, deleteInstanceGroupLoadBalancerOptions *DeleteInstanceGroupLoadBalancerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupLoadBalancerOptions, "deleteInstanceGroupLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupLoadBalancerOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/load_balancer`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupLoadBalancer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListInstanceGroupManagers : List all managers for an instance group +// This request lists all managers for an instance group. +func (vpc *VpcV1) ListInstanceGroupManagers(listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupManagersWithContext(context.Background(), listInstanceGroupManagersOptions) +} + +// ListInstanceGroupManagersWithContext is an alternate form of the ListInstanceGroupManagers method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagersWithContext(ctx context.Context, listInstanceGroupManagersOptions *ListInstanceGroupManagersOptions) (result *InstanceGroupManagerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceGroupManagersOptions, "listInstanceGroupManagersOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *listInstanceGroupManagersOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupManagersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupManagersOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagersOptions.Start)) + } + if listInstanceGroupManagersOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagersOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateInstanceGroupManager : Create a manager for an instance group +// This request creates a new instance group manager. +func (vpc *VpcV1) CreateInstanceGroupManager(createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupManagerWithContext(context.Background(), createInstanceGroupManagerOptions) +} + +// CreateInstanceGroupManagerWithContext is an alternate form of the CreateInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerWithContext(ctx context.Context, createInstanceGroupManagerOptions *CreateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceGroupManagerOptions, "createInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *createInstanceGroupManagerOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManager") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createInstanceGroupManagerOptions.InstanceGroupManagerPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteInstanceGroupManager : Delete an instance group manager +// This request deletes an instance group manager. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManager(deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupManagerWithContext(context.Background(), deleteInstanceGroupManagerOptions) +} + +// DeleteInstanceGroupManagerWithContext is an alternate form of the DeleteInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerWithContext(ctx context.Context, deleteInstanceGroupManagerOptions *DeleteInstanceGroupManagerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupManagerOptions, "deleteInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupManagerOptions.InstanceGroupID, + "id": *deleteInstanceGroupManagerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManager") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceGroupManager : Retrieve an instance group manager +// This request retrieves a single instance group manager specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManager(getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupManagerWithContext(context.Background(), getInstanceGroupManagerOptions) +} + +// GetInstanceGroupManagerWithContext is an alternate form of the GetInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerWithContext(ctx context.Context, getInstanceGroupManagerOptions *GetInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupManagerOptions, "getInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *getInstanceGroupManagerOptions.InstanceGroupID, + "id": *getInstanceGroupManagerOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManager") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateInstanceGroupManager : Update an instance group manager +// This request updates an instance group manager with the information provided instance group manager patch. +func (vpc *VpcV1) UpdateInstanceGroupManager(updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupManagerWithContext(context.Background(), updateInstanceGroupManagerOptions) +} + +// UpdateInstanceGroupManagerWithContext is an alternate form of the UpdateInstanceGroupManager method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerWithContext(ctx context.Context, updateInstanceGroupManagerOptions *UpdateInstanceGroupManagerOptions) (result InstanceGroupManagerIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupManagerOptions, "updateInstanceGroupManagerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *updateInstanceGroupManagerOptions.InstanceGroupID, + "id": *updateInstanceGroupManagerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupManagerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManager") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerOptions.InstanceGroupManagerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManager) + if err != nil { + return + } + response.Result = result + + return +} + +// ListInstanceGroupManagerPolicies : List all policies for an instance group manager +// This request lists all policies for an instance group manager. +func (vpc *VpcV1) ListInstanceGroupManagerPolicies(listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupManagerPoliciesWithContext(context.Background(), listInstanceGroupManagerPoliciesOptions) +} + +// ListInstanceGroupManagerPoliciesWithContext is an alternate form of the ListInstanceGroupManagerPolicies method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupManagerPoliciesWithContext(ctx context.Context, listInstanceGroupManagerPoliciesOptions *ListInstanceGroupManagerPoliciesOptions) (result *InstanceGroupManagerPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceGroupManagerPoliciesOptions, "listInstanceGroupManagerPoliciesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupID, + "instance_group_manager_id": *listInstanceGroupManagerPoliciesOptions.InstanceGroupManagerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupManagerPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupManagerPolicies") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupManagerPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Start)) + } + if listInstanceGroupManagerPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupManagerPoliciesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicyCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateInstanceGroupManagerPolicy : Create a policy for an instance group manager +// This request creates a new instance group manager policy. +func (vpc *VpcV1) CreateInstanceGroupManagerPolicy(createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.CreateInstanceGroupManagerPolicyWithContext(context.Background(), createInstanceGroupManagerPolicyOptions) +} + +// CreateInstanceGroupManagerPolicyWithContext is an alternate form of the CreateInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateInstanceGroupManagerPolicyWithContext(ctx context.Context, createInstanceGroupManagerPolicyOptions *CreateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createInstanceGroupManagerPolicyOptions, "createInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *createInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateInstanceGroupManagerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteInstanceGroupManagerPolicy : Delete an instance group manager policy +// This request deletes an instance group manager policy. This operation cannot be reversed. +func (vpc *VpcV1) DeleteInstanceGroupManagerPolicy(deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupManagerPolicyWithContext(context.Background(), deleteInstanceGroupManagerPolicyOptions) +} + +// DeleteInstanceGroupManagerPolicyWithContext is an alternate form of the DeleteInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupManagerPolicyWithContext(ctx context.Context, deleteInstanceGroupManagerPolicyOptions *DeleteInstanceGroupManagerPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupManagerPolicyOptions, "deleteInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *deleteInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *deleteInstanceGroupManagerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupManagerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceGroupManagerPolicy : Retrieve an instance group manager policy +// This request retrieves a single instance group manager policy specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupManagerPolicy(getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupManagerPolicyWithContext(context.Background(), getInstanceGroupManagerPolicyOptions) +} + +// GetInstanceGroupManagerPolicyWithContext is an alternate form of the GetInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupManagerPolicyWithContext(ctx context.Context, getInstanceGroupManagerPolicyOptions *GetInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupManagerPolicyOptions, "getInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *getInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *getInstanceGroupManagerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupManagerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateInstanceGroupManagerPolicy : Update an instance group manager policy +// This request updates an instance group manager policy. +func (vpc *VpcV1) UpdateInstanceGroupManagerPolicy(updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupManagerPolicyWithContext(context.Background(), updateInstanceGroupManagerPolicyOptions) +} + +// UpdateInstanceGroupManagerPolicyWithContext is an alternate form of the UpdateInstanceGroupManagerPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupManagerPolicyWithContext(ctx context.Context, updateInstanceGroupManagerPolicyOptions *UpdateInstanceGroupManagerPolicyOptions) (result InstanceGroupManagerPolicyIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupManagerPolicyOptions, "updateInstanceGroupManagerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupID, + "instance_group_manager_id": *updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerID, + "id": *updateInstanceGroupManagerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/managers/{instance_group_manager_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupManagerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupManagerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupManagerPolicyOptions.InstanceGroupManagerPolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteInstanceGroupMemberships : Delete all memberships from an instance group +// This request deletes all memberships of an instance group. This operation cannot be reversed. reversed. Any +// memberships that have `delete_instance_on_membership_delete` set to `true` will also have their instances deleted. +func (vpc *VpcV1) DeleteInstanceGroupMemberships(deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupMembershipsWithContext(context.Background(), deleteInstanceGroupMembershipsOptions) +} + +// DeleteInstanceGroupMembershipsWithContext is an alternate form of the DeleteInstanceGroupMemberships method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupMembershipsWithContext(ctx context.Context, deleteInstanceGroupMembershipsOptions *DeleteInstanceGroupMembershipsOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupMembershipsOptions, "deleteInstanceGroupMembershipsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupMembershipsOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupMembershipsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMemberships") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListInstanceGroupMemberships : List all memberships for an instance group +// This request lists all instance group memberships for an instance group. +func (vpc *VpcV1) ListInstanceGroupMemberships(listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { + return vpc.ListInstanceGroupMembershipsWithContext(context.Background(), listInstanceGroupMembershipsOptions) +} + +// ListInstanceGroupMembershipsWithContext is an alternate form of the ListInstanceGroupMemberships method which supports a Context parameter +func (vpc *VpcV1) ListInstanceGroupMembershipsWithContext(ctx context.Context, listInstanceGroupMembershipsOptions *ListInstanceGroupMembershipsOptions) (result *InstanceGroupMembershipCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listInstanceGroupMembershipsOptions, "listInstanceGroupMembershipsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *listInstanceGroupMembershipsOptions.InstanceGroupID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listInstanceGroupMembershipsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListInstanceGroupMemberships") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listInstanceGroupMembershipsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listInstanceGroupMembershipsOptions.Start)) + } + if listInstanceGroupMembershipsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listInstanceGroupMembershipsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembershipCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteInstanceGroupMembership : Delete an instance group membership +// This request deletes a memberships of an instance group. This operation cannot be reversed. reversed. If the +// membership has `delete_instance_on_membership_delete` set to `true`, the instance will also be deleted. +func (vpc *VpcV1) DeleteInstanceGroupMembership(deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteInstanceGroupMembershipWithContext(context.Background(), deleteInstanceGroupMembershipOptions) +} + +// DeleteInstanceGroupMembershipWithContext is an alternate form of the DeleteInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) DeleteInstanceGroupMembershipWithContext(ctx context.Context, deleteInstanceGroupMembershipOptions *DeleteInstanceGroupMembershipOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteInstanceGroupMembershipOptions, "deleteInstanceGroupMembershipOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *deleteInstanceGroupMembershipOptions.InstanceGroupID, + "id": *deleteInstanceGroupMembershipOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteInstanceGroupMembershipOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteInstanceGroupMembership") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetInstanceGroupMembership : Retrieve an instance group membership +// This request retrieves a single instance group membership specified by identifier in the URL. +func (vpc *VpcV1) GetInstanceGroupMembership(getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + return vpc.GetInstanceGroupMembershipWithContext(context.Background(), getInstanceGroupMembershipOptions) +} + +// GetInstanceGroupMembershipWithContext is an alternate form of the GetInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) GetInstanceGroupMembershipWithContext(ctx context.Context, getInstanceGroupMembershipOptions *GetInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getInstanceGroupMembershipOptions, "getInstanceGroupMembershipOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *getInstanceGroupMembershipOptions.InstanceGroupID, + "id": *getInstanceGroupMembershipOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getInstanceGroupMembershipOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetInstanceGroupMembership") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateInstanceGroupMembership : Update an instance group membership +// This request updates an instance group membership with the information provided instance group membership patch. +func (vpc *VpcV1) UpdateInstanceGroupMembership(updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + return vpc.UpdateInstanceGroupMembershipWithContext(context.Background(), updateInstanceGroupMembershipOptions) +} + +// UpdateInstanceGroupMembershipWithContext is an alternate form of the UpdateInstanceGroupMembership method which supports a Context parameter +func (vpc *VpcV1) UpdateInstanceGroupMembershipWithContext(ctx context.Context, updateInstanceGroupMembershipOptions *UpdateInstanceGroupMembershipOptions) (result *InstanceGroupMembership, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateInstanceGroupMembershipOptions, "updateInstanceGroupMembershipOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "instance_group_id": *updateInstanceGroupMembershipOptions.InstanceGroupID, + "id": *updateInstanceGroupMembershipOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/instance_groups/{instance_group_id}/memberships/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateInstanceGroupMembershipOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateInstanceGroupMembership") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateInstanceGroupMembershipOptions.InstanceGroupMembershipPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalInstanceGroupMembership) + if err != nil { + return + } + response.Result = result + + return +} + +// ListDedicatedHostGroups : List all dedicated host groups +// This request lists all dedicated host groups in the region. Host groups are a collection of dedicated hosts for +// placement of instances. Each dedicated host must belong to one and only one group. Host groups do not span zones. +func (vpc *VpcV1) ListDedicatedHostGroups(listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostGroupsWithContext(context.Background(), listDedicatedHostGroupsOptions) +} + +// ListDedicatedHostGroupsWithContext is an alternate form of the ListDedicatedHostGroups method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostGroupsWithContext(ctx context.Context, listDedicatedHostGroupsOptions *ListDedicatedHostGroupsOptions) (result *DedicatedHostGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostGroupsOptions, "listDedicatedHostGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostGroups") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listDedicatedHostGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostGroupsOptions.Start)) + } + if listDedicatedHostGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostGroupsOptions.Limit)) + } + if listDedicatedHostGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostGroupsOptions.ResourceGroupID)) + } + if listDedicatedHostGroupsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostGroupsOptions.ZoneName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroupCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateDedicatedHostGroup : Create a dedicated host group +// This request creates a new dedicated host group. +func (vpc *VpcV1) CreateDedicatedHostGroup(createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + return vpc.CreateDedicatedHostGroupWithContext(context.Background(), createDedicatedHostGroupOptions) +} + +// CreateDedicatedHostGroupWithContext is an alternate form of the CreateDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) CreateDedicatedHostGroupWithContext(ctx context.Context, createDedicatedHostGroupOptions *CreateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(createDedicatedHostGroupOptions, "createDedicatedHostGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHostGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createDedicatedHostGroupOptions.Class != nil { + body["class"] = createDedicatedHostGroupOptions.Class + } + if createDedicatedHostGroupOptions.Family != nil { + body["family"] = createDedicatedHostGroupOptions.Family + } + if createDedicatedHostGroupOptions.Name != nil { + body["name"] = createDedicatedHostGroupOptions.Name + } + if createDedicatedHostGroupOptions.ResourceGroup != nil { + body["resource_group"] = createDedicatedHostGroupOptions.ResourceGroup + } + if createDedicatedHostGroupOptions.Zone != nil { + body["zone"] = createDedicatedHostGroupOptions.Zone + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteDedicatedHostGroup : Delete a dedicated host group +// This request deletes a dedicated host group. +func (vpc *VpcV1) DeleteDedicatedHostGroup(deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteDedicatedHostGroupWithContext(context.Background(), deleteDedicatedHostGroupOptions) +} + +// DeleteDedicatedHostGroupWithContext is an alternate form of the DeleteDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteDedicatedHostGroupWithContext(ctx context.Context, deleteDedicatedHostGroupOptions *DeleteDedicatedHostGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteDedicatedHostGroupOptions, "deleteDedicatedHostGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteDedicatedHostGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHostGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetDedicatedHostGroup : Retrieve a dedicated host group +// This request retrieves a single dedicated host group specified by the identifier in the URL. +func (vpc *VpcV1) GetDedicatedHostGroup(getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostGroupWithContext(context.Background(), getDedicatedHostGroupOptions) +} + +// GetDedicatedHostGroupWithContext is an alternate form of the GetDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostGroupWithContext(ctx context.Context, getDedicatedHostGroupOptions *GetDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostGroupOptions, "getDedicatedHostGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getDedicatedHostGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateDedicatedHostGroup : Update a dedicated host group +// This request updates a dedicated host group with the information in a provided dedicated host group patch. The +// dedicated host group patch object is structured in the same way as a retrieved dedicated host group and contains only +// the information to be updated. +func (vpc *VpcV1) UpdateDedicatedHostGroup(updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateDedicatedHostGroupWithContext(context.Background(), updateDedicatedHostGroupOptions) +} + +// UpdateDedicatedHostGroupWithContext is an alternate form of the UpdateDedicatedHostGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostGroupWithContext(ctx context.Context, updateDedicatedHostGroupOptions *UpdateDedicatedHostGroupOptions) (result *DedicatedHostGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateDedicatedHostGroupOptions, "updateDedicatedHostGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateDedicatedHostGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateDedicatedHostGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateDedicatedHostGroupOptions.DedicatedHostGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + response.Result = result + + return +} + +// ListDedicatedHostProfiles : List all dedicated host profiles +// This request lists all provisionable dedicated host profiles in the region. A dedicated host profile specifies the +// hardware characteristics for a dedicated host. +func (vpc *VpcV1) ListDedicatedHostProfiles(listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostProfilesWithContext(context.Background(), listDedicatedHostProfilesOptions) +} + +// ListDedicatedHostProfilesWithContext is an alternate form of the ListDedicatedHostProfiles method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostProfilesWithContext(ctx context.Context, listDedicatedHostProfilesOptions *ListDedicatedHostProfilesOptions) (result *DedicatedHostProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostProfilesOptions, "listDedicatedHostProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listDedicatedHostProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostProfilesOptions.Start)) + } + if listDedicatedHostProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostProfilesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfileCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// GetDedicatedHostProfile : Retrieve a dedicated host profile +// This request retrieves a single dedicated host profile specified by the name in the URL. +func (vpc *VpcV1) GetDedicatedHostProfile(getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostProfileWithContext(context.Background(), getDedicatedHostProfileOptions) +} + +// GetDedicatedHostProfileWithContext is an alternate form of the GetDedicatedHostProfile method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostProfileWithContext(ctx context.Context, getDedicatedHostProfileOptions *GetDedicatedHostProfileOptions) (result *DedicatedHostProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostProfileOptions, "getDedicatedHostProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getDedicatedHostProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_host/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostProfile) + if err != nil { + return + } + response.Result = result + + return +} + +// ListDedicatedHosts : List all dedicated hosts +// This request lists all dedicated hosts in the region. +func (vpc *VpcV1) ListDedicatedHosts(listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostsWithContext(context.Background(), listDedicatedHostsOptions) +} + +// ListDedicatedHostsWithContext is an alternate form of the ListDedicatedHosts method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostsWithContext(ctx context.Context, listDedicatedHostsOptions *ListDedicatedHostsOptions) (result *DedicatedHostCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listDedicatedHostsOptions, "listDedicatedHostsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHosts") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listDedicatedHostsOptions.DedicatedHostGroupID != nil { + builder.AddQuery("dedicated_host_group.id", fmt.Sprint(*listDedicatedHostsOptions.DedicatedHostGroupID)) + } + if listDedicatedHostsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listDedicatedHostsOptions.Start)) + } + if listDedicatedHostsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listDedicatedHostsOptions.Limit)) + } + if listDedicatedHostsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listDedicatedHostsOptions.ResourceGroupID)) + } + if listDedicatedHostsOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listDedicatedHostsOptions.ZoneName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateDedicatedHost : Create a dedicated host +// This request creates a new dedicated host. +func (vpc *VpcV1) CreateDedicatedHost(createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + return vpc.CreateDedicatedHostWithContext(context.Background(), createDedicatedHostOptions) +} + +// CreateDedicatedHostWithContext is an alternate form of the CreateDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) CreateDedicatedHostWithContext(ctx context.Context, createDedicatedHostOptions *CreateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createDedicatedHostOptions, "createDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createDedicatedHostOptions, "createDedicatedHostOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateDedicatedHost") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createDedicatedHostOptions.DedicatedHostPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + if err != nil { + return + } + response.Result = result + + return +} + +// ListDedicatedHostDisks : List all disks on a dedicated host +// This request lists all disks on a dedicated host. A disk is a physical device that is locally attached to the +// compute node. By default, the listed disks are sorted by their +// `created_at` property values, with the newest disk first. +func (vpc *VpcV1) ListDedicatedHostDisks(listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { + return vpc.ListDedicatedHostDisksWithContext(context.Background(), listDedicatedHostDisksOptions) +} + +// ListDedicatedHostDisksWithContext is an alternate form of the ListDedicatedHostDisks method which supports a Context parameter +func (vpc *VpcV1) ListDedicatedHostDisksWithContext(ctx context.Context, listDedicatedHostDisksOptions *ListDedicatedHostDisksOptions) (result *DedicatedHostDiskCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listDedicatedHostDisksOptions, "listDedicatedHostDisksOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "dedicated_host_id": *listDedicatedHostDisksOptions.DedicatedHostID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listDedicatedHostDisksOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListDedicatedHostDisks") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDiskCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// GetDedicatedHostDisk : Retrieve a dedicated host disk +// This request retrieves a single dedicated host disk specified by the identifier in the URL. +func (vpc *VpcV1) GetDedicatedHostDisk(getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostDiskWithContext(context.Background(), getDedicatedHostDiskOptions) +} + +// GetDedicatedHostDiskWithContext is an alternate form of the GetDedicatedHostDisk method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostDiskWithContext(ctx context.Context, getDedicatedHostDiskOptions *GetDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostDiskOptions, "getDedicatedHostDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "dedicated_host_id": *getDedicatedHostDiskOptions.DedicatedHostID, + "id": *getDedicatedHostDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHostDisk") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateDedicatedHostDisk : Update a dedicated host disk +// This request updates the dedicated host disk with the information in a provided patch. +func (vpc *VpcV1) UpdateDedicatedHostDisk(updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + return vpc.UpdateDedicatedHostDiskWithContext(context.Background(), updateDedicatedHostDiskOptions) +} + +// UpdateDedicatedHostDiskWithContext is an alternate form of the UpdateDedicatedHostDisk method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostDiskWithContext(ctx context.Context, updateDedicatedHostDiskOptions *UpdateDedicatedHostDiskOptions) (result *DedicatedHostDisk, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateDedicatedHostDiskOptions, "updateDedicatedHostDiskOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "dedicated_host_id": *updateDedicatedHostDiskOptions.DedicatedHostID, + "id": *updateDedicatedHostDiskOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{dedicated_host_id}/disks/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateDedicatedHostDiskOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHostDisk") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateDedicatedHostDiskOptions.DedicatedHostDiskPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteDedicatedHost : Delete a dedicated host +// This request deletes a dedicated host. +func (vpc *VpcV1) DeleteDedicatedHost(deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteDedicatedHostWithContext(context.Background(), deleteDedicatedHostOptions) +} + +// DeleteDedicatedHostWithContext is an alternate form of the DeleteDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) DeleteDedicatedHostWithContext(ctx context.Context, deleteDedicatedHostOptions *DeleteDedicatedHostOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteDedicatedHostOptions, "deleteDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteDedicatedHostOptions, "deleteDedicatedHostOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteDedicatedHostOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteDedicatedHost") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetDedicatedHost : Retrieve a dedicated host +// This request retrieves a single dedicated host specified by the identifiers in the URL. +func (vpc *VpcV1) GetDedicatedHost(getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + return vpc.GetDedicatedHostWithContext(context.Background(), getDedicatedHostOptions) +} + +// GetDedicatedHostWithContext is an alternate form of the GetDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) GetDedicatedHostWithContext(ctx context.Context, getDedicatedHostOptions *GetDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getDedicatedHostOptions, "getDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getDedicatedHostOptions, "getDedicatedHostOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getDedicatedHostOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetDedicatedHost") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateDedicatedHost : Update a dedicated host +// This request updates a dedicated host with the information in a provided dedicated host patch. The dedicated host +// patch object is structured in the same way as a retrieved dedicated host and contains only the information to be +// updated. +func (vpc *VpcV1) UpdateDedicatedHost(updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + return vpc.UpdateDedicatedHostWithContext(context.Background(), updateDedicatedHostOptions) +} + +// UpdateDedicatedHostWithContext is an alternate form of the UpdateDedicatedHost method which supports a Context parameter +func (vpc *VpcV1) UpdateDedicatedHostWithContext(ctx context.Context, updateDedicatedHostOptions *UpdateDedicatedHostOptions) (result *DedicatedHost, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateDedicatedHostOptions, "updateDedicatedHostOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateDedicatedHostOptions, "updateDedicatedHostOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateDedicatedHostOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/dedicated_hosts/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateDedicatedHostOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateDedicatedHost") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateDedicatedHostOptions.DedicatedHostPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalDedicatedHost) + if err != nil { + return + } + response.Result = result + + return +} + +// ListVolumeProfiles : List all volume profiles +// This request lists all volume profiles available in the region. A volume profile specifies the performance +// characteristics and pricing model for a volume. +func (vpc *VpcV1) ListVolumeProfiles(listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListVolumeProfilesWithContext(context.Background(), listVolumeProfilesOptions) +} + +// ListVolumeProfilesWithContext is an alternate form of the ListVolumeProfiles method which supports a Context parameter +func (vpc *VpcV1) ListVolumeProfilesWithContext(ctx context.Context, listVolumeProfilesOptions *ListVolumeProfilesOptions) (result *VolumeProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumeProfilesOptions, "listVolumeProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVolumeProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumeProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVolumeProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumeProfilesOptions.Start)) + } + if listVolumeProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumeProfilesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfileCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// GetVolumeProfile : Retrieve a volume profile +// This request retrieves a single volume profile specified by the name in the URL. +func (vpc *VpcV1) GetVolumeProfile(getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + return vpc.GetVolumeProfileWithContext(context.Background(), getVolumeProfileOptions) +} + +// GetVolumeProfileWithContext is an alternate form of the GetVolumeProfile method which supports a Context parameter +func (vpc *VpcV1) GetVolumeProfileWithContext(ctx context.Context, getVolumeProfileOptions *GetVolumeProfileOptions) (result *VolumeProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeProfileOptions, "getVolumeProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVolumeProfileOptions, "getVolumeProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getVolumeProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volume/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVolumeProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolumeProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeProfile) + if err != nil { + return + } + response.Result = result + + return +} + +// ListVolumes : List all volumes +// This request lists all volumes in the region. Volumes are network-connected block storage devices that may be +// attached to one or more instances in the same region. +func (vpc *VpcV1) ListVolumes(listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + return vpc.ListVolumesWithContext(context.Background(), listVolumesOptions) +} + +// ListVolumesWithContext is an alternate form of the ListVolumes method which supports a Context parameter +func (vpc *VpcV1) ListVolumesWithContext(ctx context.Context, listVolumesOptions *ListVolumesOptions) (result *VolumeCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVolumesOptions, "listVolumesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVolumesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVolumes") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVolumesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVolumesOptions.Start)) + } + if listVolumesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVolumesOptions.Limit)) + } + if listVolumesOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listVolumesOptions.Name)) + } + if listVolumesOptions.ZoneName != nil { + builder.AddQuery("zone.name", fmt.Sprint(*listVolumesOptions.ZoneName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolumeCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateVolume : Create a volume +// This request creates a new volume from a volume prototype object. The prototype object is structured in the same way +// as a retrieved volume, and contains the information necessary to create the new volume. +func (vpc *VpcV1) CreateVolume(createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.CreateVolumeWithContext(context.Background(), createVolumeOptions) +} + +// CreateVolumeWithContext is an alternate form of the CreateVolume method which supports a Context parameter +func (vpc *VpcV1) CreateVolumeWithContext(ctx context.Context, createVolumeOptions *CreateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVolumeOptions, "createVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVolumeOptions, "createVolumeOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVolume") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createVolumeOptions.VolumePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteVolume : Delete a volume +// This request deletes a volume. This operation cannot be reversed. For this request to succeed, the volume must not be +// attached to any instances. +func (vpc *VpcV1) DeleteVolume(deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVolumeWithContext(context.Background(), deleteVolumeOptions) +} + +// DeleteVolumeWithContext is an alternate form of the DeleteVolume method which supports a Context parameter +func (vpc *VpcV1) DeleteVolumeWithContext(ctx context.Context, deleteVolumeOptions *DeleteVolumeOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVolumeOptions, "deleteVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVolumeOptions, "deleteVolumeOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVolumeOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVolume") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVolume : Retrieve a volume +// This request retrieves a single volume specified by the identifier in the URL. +func (vpc *VpcV1) GetVolume(getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.GetVolumeWithContext(context.Background(), getVolumeOptions) +} + +// GetVolumeWithContext is an alternate form of the GetVolume method which supports a Context parameter +func (vpc *VpcV1) GetVolumeWithContext(ctx context.Context, getVolumeOptions *GetVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVolumeOptions, "getVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVolumeOptions, "getVolumeOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVolumeOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVolume") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateVolume : Update a volume +// This request updates a volume with the information in a provided volume patch. The volume patch object is structured +// in the same way as a retrieved volume and contains only the information to be updated. +func (vpc *VpcV1) UpdateVolume(updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + return vpc.UpdateVolumeWithContext(context.Background(), updateVolumeOptions) +} + +// UpdateVolumeWithContext is an alternate form of the UpdateVolume method which supports a Context parameter +func (vpc *VpcV1) UpdateVolumeWithContext(ctx context.Context, updateVolumeOptions *UpdateVolumeOptions) (result *Volume, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVolumeOptions, "updateVolumeOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVolumeOptions, "updateVolumeOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVolumeOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/volumes/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVolumeOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVolume") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVolumeOptions.VolumePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVolume) + if err != nil { + return + } + response.Result = result + + return +} + +// ListRegions : List all regions +// This request lists all regions. Each region is a separate geographic area that contains multiple isolated zones. +// Resources can be provisioned into one or more zones in a region. Each zone is isolated, but connected to other zones +// in the same region with low-latency and high-bandwidth links. Regions represent the top-level of fault isolation +// available. Resources deployed within a single region also benefit from the low latency afforded by geographic +// proximity. +func (vpc *VpcV1) ListRegions(listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + return vpc.ListRegionsWithContext(context.Background(), listRegionsOptions) +} + +// ListRegionsWithContext is an alternate form of the ListRegions method which supports a Context parameter +func (vpc *VpcV1) ListRegionsWithContext(ctx context.Context, listRegionsOptions *ListRegionsOptions) (result *RegionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listRegionsOptions, "listRegionsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listRegionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegions") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegionCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// GetRegion : Retrieve a region +// This request retrieves a single region specified by the name in the URL. +func (vpc *VpcV1) GetRegion(getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { + return vpc.GetRegionWithContext(context.Background(), getRegionOptions) +} + +// GetRegionWithContext is an alternate form of the GetRegion method which supports a Context parameter +func (vpc *VpcV1) GetRegionWithContext(ctx context.Context, getRegionOptions *GetRegionOptions) (result *Region, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getRegionOptions, "getRegionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getRegionOptions, "getRegionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getRegionOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getRegionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegion") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalRegion) + if err != nil { + return + } + response.Result = result + + return +} + +// ListRegionZones : List all zones in a region +// This request lists all zones in a region. Zones represent logically-isolated data centers with high-bandwidth and +// low-latency interconnects to other zones in the same region. Faults in a zone do not affect other zones. +func (vpc *VpcV1) ListRegionZones(listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { + return vpc.ListRegionZonesWithContext(context.Background(), listRegionZonesOptions) +} + +// ListRegionZonesWithContext is an alternate form of the ListRegionZones method which supports a Context parameter +func (vpc *VpcV1) ListRegionZonesWithContext(ctx context.Context, listRegionZonesOptions *ListRegionZonesOptions) (result *ZoneCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listRegionZonesOptions, "listRegionZonesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listRegionZonesOptions, "listRegionZonesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "region_name": *listRegionZonesOptions.RegionName, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listRegionZonesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListRegionZones") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZoneCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// GetRegionZone : Retrieve a zone +// This request retrieves a single zone specified by the region and zone names in the URL. +func (vpc *VpcV1) GetRegionZone(getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { + return vpc.GetRegionZoneWithContext(context.Background(), getRegionZoneOptions) +} + +// GetRegionZoneWithContext is an alternate form of the GetRegionZone method which supports a Context parameter +func (vpc *VpcV1) GetRegionZoneWithContext(ctx context.Context, getRegionZoneOptions *GetRegionZoneOptions) (result *Zone, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getRegionZoneOptions, "getRegionZoneOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getRegionZoneOptions, "getRegionZoneOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "region_name": *getRegionZoneOptions.RegionName, + "name": *getRegionZoneOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/regions/{region_name}/zones/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getRegionZoneOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetRegionZone") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalZone) + if err != nil { + return + } + response.Result = result + + return +} + +// ListPublicGateways : List all public gateways +// This request lists all public gateways in the region. A public gateway is a virtual network device associated with a +// VPC, which allows access to the Internet. A public gateway resides in a zone and can be connected to subnets in the +// same zone only. +func (vpc *VpcV1) ListPublicGateways(listPublicGatewaysOptions *ListPublicGatewaysOptions) (result *PublicGatewayCollection, response *core.DetailedResponse, err error) { + return vpc.ListPublicGatewaysWithContext(context.Background(), listPublicGatewaysOptions) +} + +// ListPublicGatewaysWithContext is an alternate form of the ListPublicGateways method which supports a Context parameter +func (vpc *VpcV1) ListPublicGatewaysWithContext(ctx context.Context, listPublicGatewaysOptions *ListPublicGatewaysOptions) (result *PublicGatewayCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listPublicGatewaysOptions, "listPublicGatewaysOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listPublicGatewaysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListPublicGateways") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listPublicGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listPublicGatewaysOptions.Start)) + } + if listPublicGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listPublicGatewaysOptions.Limit)) + } + if listPublicGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listPublicGatewaysOptions.ResourceGroupID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGatewayCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreatePublicGateway : Create a public gateway +// This request creates a new public gateway from a public gateway prototype object. For this to succeed, the VPC must +// not already have a public gateway in the specified zone. +// +// If a floating IP is provided, it must be unbound. If a floating IP is not provided, one will be created and bound to +// the public gateway. Once a public gateway has been created, its floating IP cannot be unbound. A public gateway must +// be explicitly attached to each subnet it will provide connectivity for. +func (vpc *VpcV1) CreatePublicGateway(createPublicGatewayOptions *CreatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.CreatePublicGatewayWithContext(context.Background(), createPublicGatewayOptions) +} + +// CreatePublicGatewayWithContext is an alternate form of the CreatePublicGateway method which supports a Context parameter +func (vpc *VpcV1) CreatePublicGatewayWithContext(ctx context.Context, createPublicGatewayOptions *CreatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createPublicGatewayOptions, "createPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createPublicGatewayOptions, "createPublicGatewayOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreatePublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createPublicGatewayOptions.VPC != nil { + body["vpc"] = createPublicGatewayOptions.VPC + } + if createPublicGatewayOptions.Zone != nil { + body["zone"] = createPublicGatewayOptions.Zone + } + if createPublicGatewayOptions.FloatingIP != nil { + body["floating_ip"] = createPublicGatewayOptions.FloatingIP + } + if createPublicGatewayOptions.Name != nil { + body["name"] = createPublicGatewayOptions.Name + } + if createPublicGatewayOptions.ResourceGroup != nil { + body["resource_group"] = createPublicGatewayOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + + return +} + +// DeletePublicGateway : Delete a public gateway +// This request deletes a public gateway. This operation cannot be reversed. For this request to succeed, the public +// gateway must not be attached to any subnets. The public gateway's floating IP will be automatically unbound. If the +// floating IP was created when the public gateway was created, it will be deleted. +func (vpc *VpcV1) DeletePublicGateway(deletePublicGatewayOptions *DeletePublicGatewayOptions) (response *core.DetailedResponse, err error) { + return vpc.DeletePublicGatewayWithContext(context.Background(), deletePublicGatewayOptions) +} + +// DeletePublicGatewayWithContext is an alternate form of the DeletePublicGateway method which supports a Context parameter +func (vpc *VpcV1) DeletePublicGatewayWithContext(ctx context.Context, deletePublicGatewayOptions *DeletePublicGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deletePublicGatewayOptions, "deletePublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deletePublicGatewayOptions, "deletePublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deletePublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deletePublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeletePublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetPublicGateway : Retrieve a public gateway +// This request retrieves a single public gateway specified by the identifier in the URL. +func (vpc *VpcV1) GetPublicGateway(getPublicGatewayOptions *GetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.GetPublicGatewayWithContext(context.Background(), getPublicGatewayOptions) +} + +// GetPublicGatewayWithContext is an alternate form of the GetPublicGateway method which supports a Context parameter +func (vpc *VpcV1) GetPublicGatewayWithContext(ctx context.Context, getPublicGatewayOptions *GetPublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getPublicGatewayOptions, "getPublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getPublicGatewayOptions, "getPublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getPublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getPublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetPublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdatePublicGateway : Update a public gateway +// This request updates a public gateway's name. +func (vpc *VpcV1) UpdatePublicGateway(updatePublicGatewayOptions *UpdatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + return vpc.UpdatePublicGatewayWithContext(context.Background(), updatePublicGatewayOptions) +} + +// UpdatePublicGatewayWithContext is an alternate form of the UpdatePublicGateway method which supports a Context parameter +func (vpc *VpcV1) UpdatePublicGatewayWithContext(ctx context.Context, updatePublicGatewayOptions *UpdatePublicGatewayOptions) (result *PublicGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updatePublicGatewayOptions, "updatePublicGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updatePublicGatewayOptions, "updatePublicGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updatePublicGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/public_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updatePublicGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdatePublicGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updatePublicGatewayOptions.PublicGatewayPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalPublicGateway) + if err != nil { + return + } + response.Result = result + + return +} + +// ListFloatingIps : List all floating IPs +// This request lists all floating IPs in the region. Floating IPs allow inbound and outbound traffic from the Internet +// to an instance. +func (vpc *VpcV1) ListFloatingIps(listFloatingIpsOptions *ListFloatingIpsOptions) (result *FloatingIPCollection, response *core.DetailedResponse, err error) { + return vpc.ListFloatingIpsWithContext(context.Background(), listFloatingIpsOptions) +} + +// ListFloatingIpsWithContext is an alternate form of the ListFloatingIps method which supports a Context parameter +func (vpc *VpcV1) ListFloatingIpsWithContext(ctx context.Context, listFloatingIpsOptions *ListFloatingIpsOptions) (result *FloatingIPCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listFloatingIpsOptions, "listFloatingIpsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listFloatingIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFloatingIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listFloatingIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listFloatingIpsOptions.Start)) + } + if listFloatingIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listFloatingIpsOptions.Limit)) + } + if listFloatingIpsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listFloatingIpsOptions.ResourceGroupID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIPCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateFloatingIP : Reserve a floating IP +// This request reserves a new floating IP. +func (vpc *VpcV1) CreateFloatingIP(createFloatingIPOptions *CreateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.CreateFloatingIPWithContext(context.Background(), createFloatingIPOptions) +} + +// CreateFloatingIPWithContext is an alternate form of the CreateFloatingIP method which supports a Context parameter +func (vpc *VpcV1) CreateFloatingIPWithContext(ctx context.Context, createFloatingIPOptions *CreateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createFloatingIPOptions, "createFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createFloatingIPOptions, "createFloatingIPOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createFloatingIPOptions.FloatingIPPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteFloatingIP : Release a floating IP +// This request disassociates (if associated) and releases a floating IP. This operation cannot be reversed. For this +// request to succeed, the floating IP must not be required by another resource, such as a public gateway. +func (vpc *VpcV1) DeleteFloatingIP(deleteFloatingIPOptions *DeleteFloatingIPOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteFloatingIPWithContext(context.Background(), deleteFloatingIPOptions) +} + +// DeleteFloatingIPWithContext is an alternate form of the DeleteFloatingIP method which supports a Context parameter +func (vpc *VpcV1) DeleteFloatingIPWithContext(ctx context.Context, deleteFloatingIPOptions *DeleteFloatingIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteFloatingIPOptions, "deleteFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteFloatingIPOptions, "deleteFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetFloatingIP : Retrieve a floating IP +// This request retrieves a single floating IP specified by the identifier in the URL. +func (vpc *VpcV1) GetFloatingIP(getFloatingIPOptions *GetFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.GetFloatingIPWithContext(context.Background(), getFloatingIPOptions) +} + +// GetFloatingIPWithContext is an alternate form of the GetFloatingIP method which supports a Context parameter +func (vpc *VpcV1) GetFloatingIPWithContext(ctx context.Context, getFloatingIPOptions *GetFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getFloatingIPOptions, "getFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getFloatingIPOptions, "getFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateFloatingIP : Update a floating IP +// This request updates a floating IP's name and/or target. +func (vpc *VpcV1) UpdateFloatingIP(updateFloatingIPOptions *UpdateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + return vpc.UpdateFloatingIPWithContext(context.Background(), updateFloatingIPOptions) +} + +// UpdateFloatingIPWithContext is an alternate form of the UpdateFloatingIP method which supports a Context parameter +func (vpc *VpcV1) UpdateFloatingIPWithContext(ctx context.Context, updateFloatingIPOptions *UpdateFloatingIPOptions) (result *FloatingIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateFloatingIPOptions, "updateFloatingIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateFloatingIPOptions, "updateFloatingIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateFloatingIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/floating_ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateFloatingIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFloatingIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateFloatingIPOptions.FloatingIPPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFloatingIP) + if err != nil { + return + } + response.Result = result + + return +} + +// ListNetworkAcls : List all network ACLs +// This request lists all network ACLs in the region. A network ACL defines a set of packet filtering (5-tuple) rules +// for all traffic in and out of a subnet. Both allow and deny rules can be defined, and rules are stateless such that +// reverse traffic in response to allowed traffic is not automatically permitted. +func (vpc *VpcV1) ListNetworkAcls(listNetworkAclsOptions *ListNetworkAclsOptions) (result *NetworkACLCollection, response *core.DetailedResponse, err error) { + return vpc.ListNetworkAclsWithContext(context.Background(), listNetworkAclsOptions) +} + +// ListNetworkAclsWithContext is an alternate form of the ListNetworkAcls method which supports a Context parameter +func (vpc *VpcV1) ListNetworkAclsWithContext(ctx context.Context, listNetworkAclsOptions *ListNetworkAclsOptions) (result *NetworkACLCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listNetworkAclsOptions, "listNetworkAclsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listNetworkAclsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkAcls") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listNetworkAclsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkAclsOptions.Start)) + } + if listNetworkAclsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkAclsOptions.Limit)) + } + if listNetworkAclsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listNetworkAclsOptions.ResourceGroupID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateNetworkACL : Create a network ACL +// This request creates a new network ACL from a network ACL prototype object. The prototype object is structured in the +// same way as a retrieved network ACL, and contains the information necessary to create the new network ACL. +func (vpc *VpcV1) CreateNetworkACL(createNetworkACLOptions *CreateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.CreateNetworkACLWithContext(context.Background(), createNetworkACLOptions) +} + +// CreateNetworkACLWithContext is an alternate form of the CreateNetworkACL method which supports a Context parameter +func (vpc *VpcV1) CreateNetworkACLWithContext(ctx context.Context, createNetworkACLOptions *CreateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(createNetworkACLOptions, "createNetworkACLOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + if createNetworkACLOptions.NetworkACLPrototype != nil { + _, err = builder.SetBodyContentJSON(createNetworkACLOptions.NetworkACLPrototype) + if err != nil { + return + } + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteNetworkACL : Delete a network ACL +// This request deletes a network ACL. This operation cannot be reversed. For this request to succeed, the network ACL +// must not be the default network ACL for any VPCs, and the network ACL must not be attached to any subnets. +func (vpc *VpcV1) DeleteNetworkACL(deleteNetworkACLOptions *DeleteNetworkACLOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteNetworkACLWithContext(context.Background(), deleteNetworkACLOptions) +} + +// DeleteNetworkACLWithContext is an alternate form of the DeleteNetworkACL method which supports a Context parameter +func (vpc *VpcV1) DeleteNetworkACLWithContext(ctx context.Context, deleteNetworkACLOptions *DeleteNetworkACLOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteNetworkACLOptions, "deleteNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteNetworkACLOptions, "deleteNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetNetworkACL : Retrieve a network ACL +// This request retrieves a single network ACL specified by the identifier in the URL. +func (vpc *VpcV1) GetNetworkACL(getNetworkACLOptions *GetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.GetNetworkACLWithContext(context.Background(), getNetworkACLOptions) +} + +// GetNetworkACLWithContext is an alternate form of the GetNetworkACL method which supports a Context parameter +func (vpc *VpcV1) GetNetworkACLWithContext(ctx context.Context, getNetworkACLOptions *GetNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getNetworkACLOptions, "getNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getNetworkACLOptions, "getNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateNetworkACL : Update a network ACL +// This request updates a network ACL's name. +func (vpc *VpcV1) UpdateNetworkACL(updateNetworkACLOptions *UpdateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + return vpc.UpdateNetworkACLWithContext(context.Background(), updateNetworkACLOptions) +} + +// UpdateNetworkACLWithContext is an alternate form of the UpdateNetworkACL method which supports a Context parameter +func (vpc *VpcV1) UpdateNetworkACLWithContext(ctx context.Context, updateNetworkACLOptions *UpdateNetworkACLOptions) (result *NetworkACL, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateNetworkACLOptions, "updateNetworkACLOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateNetworkACLOptions, "updateNetworkACLOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateNetworkACLOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateNetworkACLOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACL") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateNetworkACLOptions.NetworkACLPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACL) + if err != nil { + return + } + response.Result = result + + return +} + +// ListNetworkACLRules : List all rules for a network ACL +// This request lists all rules for a network ACL. These rules can allow or deny traffic between a source CIDR block and +// a destination CIDR block over a particular protocol and port range. +func (vpc *VpcV1) ListNetworkACLRules(listNetworkACLRulesOptions *ListNetworkACLRulesOptions) (result *NetworkACLRuleCollection, response *core.DetailedResponse, err error) { + return vpc.ListNetworkACLRulesWithContext(context.Background(), listNetworkACLRulesOptions) +} + +// ListNetworkACLRulesWithContext is an alternate form of the ListNetworkACLRules method which supports a Context parameter +func (vpc *VpcV1) ListNetworkACLRulesWithContext(ctx context.Context, listNetworkACLRulesOptions *ListNetworkACLRulesOptions) (result *NetworkACLRuleCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listNetworkACLRulesOptions, "listNetworkACLRulesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listNetworkACLRulesOptions, "listNetworkACLRulesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *listNetworkACLRulesOptions.NetworkACLID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listNetworkACLRulesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListNetworkACLRules") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listNetworkACLRulesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listNetworkACLRulesOptions.Start)) + } + if listNetworkACLRulesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listNetworkACLRulesOptions.Limit)) + } + if listNetworkACLRulesOptions.Direction != nil { + builder.AddQuery("direction", fmt.Sprint(*listNetworkACLRulesOptions.Direction)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRuleCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateNetworkACLRule : Create a rule for a network ACL +// This request creates a new rule from a network ACL rule prototype object. The prototype object is structured in the +// same way as a retrieved rule, and contains the information necessary to create the new rule. +func (vpc *VpcV1) CreateNetworkACLRule(createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + return vpc.CreateNetworkACLRuleWithContext(context.Background(), createNetworkACLRuleOptions) +} + +// CreateNetworkACLRuleWithContext is an alternate form of the CreateNetworkACLRule method which supports a Context parameter +func (vpc *VpcV1) CreateNetworkACLRuleWithContext(ctx context.Context, createNetworkACLRuleOptions *CreateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createNetworkACLRuleOptions, "createNetworkACLRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createNetworkACLRuleOptions, "createNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *createNetworkACLRuleOptions.NetworkACLID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateNetworkACLRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createNetworkACLRuleOptions.NetworkACLRulePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteNetworkACLRule : Delete a network ACL rule +// This request deletes a rule. This operation cannot be reversed. +func (vpc *VpcV1) DeleteNetworkACLRule(deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteNetworkACLRuleWithContext(context.Background(), deleteNetworkACLRuleOptions) +} + +// DeleteNetworkACLRuleWithContext is an alternate form of the DeleteNetworkACLRule method which supports a Context parameter +func (vpc *VpcV1) DeleteNetworkACLRuleWithContext(ctx context.Context, deleteNetworkACLRuleOptions *DeleteNetworkACLRuleOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteNetworkACLRuleOptions, "deleteNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *deleteNetworkACLRuleOptions.NetworkACLID, + "id": *deleteNetworkACLRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteNetworkACLRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetNetworkACLRule : Retrieve a network ACL rule +// This request retrieves a single rule specified by the identifier in the URL. +func (vpc *VpcV1) GetNetworkACLRule(getNetworkACLRuleOptions *GetNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + return vpc.GetNetworkACLRuleWithContext(context.Background(), getNetworkACLRuleOptions) +} + +// GetNetworkACLRuleWithContext is an alternate form of the GetNetworkACLRule method which supports a Context parameter +func (vpc *VpcV1) GetNetworkACLRuleWithContext(ctx context.Context, getNetworkACLRuleOptions *GetNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getNetworkACLRuleOptions, "getNetworkACLRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getNetworkACLRuleOptions, "getNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *getNetworkACLRuleOptions.NetworkACLID, + "id": *getNetworkACLRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetNetworkACLRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateNetworkACLRule : Update a network ACL rule +// This request updates a rule with the information in a provided rule patch. The rule patch object contains only the +// information to be updated. The request will fail if the information is not applicable to the rule's protocol. +func (vpc *VpcV1) UpdateNetworkACLRule(updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateNetworkACLRuleWithContext(context.Background(), updateNetworkACLRuleOptions) +} + +// UpdateNetworkACLRuleWithContext is an alternate form of the UpdateNetworkACLRule method which supports a Context parameter +func (vpc *VpcV1) UpdateNetworkACLRuleWithContext(ctx context.Context, updateNetworkACLRuleOptions *UpdateNetworkACLRuleOptions) (result NetworkACLRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateNetworkACLRuleOptions, "updateNetworkACLRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "network_acl_id": *updateNetworkACLRuleOptions.NetworkACLID, + "id": *updateNetworkACLRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/network_acls/{network_acl_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateNetworkACLRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateNetworkACLRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateNetworkACLRuleOptions.NetworkACLRulePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkACLRule) + if err != nil { + return + } + response.Result = result + + return +} + +// ListSecurityGroups : List all security groups +// This request lists all security groups in the region. Security groups provide a way to apply IP filtering rules to +// instances in the associated VPC. With security groups, all traffic is denied by default, and rules added to security +// groups define which traffic the security group permits. Security group rules are stateful such that reverse traffic +// in response to allowed traffic is automatically permitted. +func (vpc *VpcV1) ListSecurityGroups(listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) { + return vpc.ListSecurityGroupsWithContext(context.Background(), listSecurityGroupsOptions) +} + +// ListSecurityGroupsWithContext is an alternate form of the ListSecurityGroups method which supports a Context parameter +func (vpc *VpcV1) ListSecurityGroupsWithContext(ctx context.Context, listSecurityGroupsOptions *ListSecurityGroupsOptions) (result *SecurityGroupCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listSecurityGroupsOptions, "listSecurityGroupsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listSecurityGroupsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroups") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSecurityGroupsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSecurityGroupsOptions.Start)) + } + if listSecurityGroupsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupsOptions.Limit)) + } + if listSecurityGroupsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listSecurityGroupsOptions.ResourceGroupID)) + } + if listSecurityGroupsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listSecurityGroupsOptions.VPCID)) + } + if listSecurityGroupsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listSecurityGroupsOptions.VPCCRN)) + } + if listSecurityGroupsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listSecurityGroupsOptions.VPCName)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateSecurityGroup : Create a security group +// This request creates a new security group from a security group prototype object. The prototype object is structured +// in the same way as a retrieved security group, and contains the information necessary to create the new security +// group. If security group rules are included in the prototype object, those rules will be added to the security group. +// Each security group is scoped to one VPC. Only network interfaces on instances in that VPC can be added to the +// security group. +func (vpc *VpcV1) CreateSecurityGroup(createSecurityGroupOptions *CreateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + return vpc.CreateSecurityGroupWithContext(context.Background(), createSecurityGroupOptions) +} + +// CreateSecurityGroupWithContext is an alternate form of the CreateSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) CreateSecurityGroupWithContext(ctx context.Context, createSecurityGroupOptions *CreateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSecurityGroupOptions, "createSecurityGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSecurityGroupOptions, "createSecurityGroupOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createSecurityGroupOptions.VPC != nil { + body["vpc"] = createSecurityGroupOptions.VPC + } + if createSecurityGroupOptions.Name != nil { + body["name"] = createSecurityGroupOptions.Name + } + if createSecurityGroupOptions.ResourceGroup != nil { + body["resource_group"] = createSecurityGroupOptions.ResourceGroup + } + if createSecurityGroupOptions.Rules != nil { + body["rules"] = createSecurityGroupOptions.Rules + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteSecurityGroup : Delete a security group +// This request deletes a security group. A security group cannot be deleted if it is referenced by any network +// interfaces or other security group rules. Additionally, a VPC's default security group cannot be deleted. This +// operation cannot be reversed. +func (vpc *VpcV1) DeleteSecurityGroup(deleteSecurityGroupOptions *DeleteSecurityGroupOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSecurityGroupWithContext(context.Background(), deleteSecurityGroupOptions) +} + +// DeleteSecurityGroupWithContext is an alternate form of the DeleteSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) DeleteSecurityGroupWithContext(ctx context.Context, deleteSecurityGroupOptions *DeleteSecurityGroupOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSecurityGroupOptions, "deleteSecurityGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSecurityGroupOptions, "deleteSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteSecurityGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSecurityGroup : Retrieve a security group +// This request retrieves a single security group specified by the identifier in the URL path. +func (vpc *VpcV1) GetSecurityGroup(getSecurityGroupOptions *GetSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + return vpc.GetSecurityGroupWithContext(context.Background(), getSecurityGroupOptions) +} + +// GetSecurityGroupWithContext is an alternate form of the GetSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) GetSecurityGroupWithContext(ctx context.Context, getSecurityGroupOptions *GetSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSecurityGroupOptions, "getSecurityGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSecurityGroupOptions, "getSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getSecurityGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateSecurityGroup : Update a security group +// This request updates a security group with the information provided in a security group patch object. The security +// group patch object is structured in the same way as a retrieved security group and contains only the information to +// be updated. +func (vpc *VpcV1) UpdateSecurityGroup(updateSecurityGroupOptions *UpdateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + return vpc.UpdateSecurityGroupWithContext(context.Background(), updateSecurityGroupOptions) +} + +// UpdateSecurityGroupWithContext is an alternate form of the UpdateSecurityGroup method which supports a Context parameter +func (vpc *VpcV1) UpdateSecurityGroupWithContext(ctx context.Context, updateSecurityGroupOptions *UpdateSecurityGroupOptions) (result *SecurityGroup, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSecurityGroupOptions, "updateSecurityGroupOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSecurityGroupOptions, "updateSecurityGroupOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateSecurityGroupOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSecurityGroupOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroup") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSecurityGroupOptions.SecurityGroupPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroup) + if err != nil { + return + } + response.Result = result + + return +} + +// ListSecurityGroupNetworkInterfaces : List all network interfaces associated with a security group +// This request lists all network interfaces associated with a security group, to which the rules in the security group +// are applied. +func (vpc *VpcV1) ListSecurityGroupNetworkInterfaces(listSecurityGroupNetworkInterfacesOptions *ListSecurityGroupNetworkInterfacesOptions) (result *NetworkInterfaceCollection, response *core.DetailedResponse, err error) { + return vpc.ListSecurityGroupNetworkInterfacesWithContext(context.Background(), listSecurityGroupNetworkInterfacesOptions) +} + +// ListSecurityGroupNetworkInterfacesWithContext is an alternate form of the ListSecurityGroupNetworkInterfaces method which supports a Context parameter +func (vpc *VpcV1) ListSecurityGroupNetworkInterfacesWithContext(ctx context.Context, listSecurityGroupNetworkInterfacesOptions *ListSecurityGroupNetworkInterfacesOptions) (result *NetworkInterfaceCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSecurityGroupNetworkInterfacesOptions, "listSecurityGroupNetworkInterfacesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listSecurityGroupNetworkInterfacesOptions, "listSecurityGroupNetworkInterfacesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *listSecurityGroupNetworkInterfacesOptions.SecurityGroupID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/network_interfaces`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listSecurityGroupNetworkInterfacesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupNetworkInterfaces") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSecurityGroupNetworkInterfacesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSecurityGroupNetworkInterfacesOptions.Start)) + } + if listSecurityGroupNetworkInterfacesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupNetworkInterfacesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterfaceCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// RemoveSecurityGroupNetworkInterface : Remove a network interface from a security group +// This request removes a network interface from a security group. Security groups are stateful, so any changes to a +// network interface's security groups are applied to new connections. Existing connections are not affected. If the +// network interface being removed has no other security groups, it will be attached to the VPC's default security +// group. +func (vpc *VpcV1) RemoveSecurityGroupNetworkInterface(removeSecurityGroupNetworkInterfaceOptions *RemoveSecurityGroupNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveSecurityGroupNetworkInterfaceWithContext(context.Background(), removeSecurityGroupNetworkInterfaceOptions) +} + +// RemoveSecurityGroupNetworkInterfaceWithContext is an alternate form of the RemoveSecurityGroupNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) RemoveSecurityGroupNetworkInterfaceWithContext(ctx context.Context, removeSecurityGroupNetworkInterfaceOptions *RemoveSecurityGroupNetworkInterfaceOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeSecurityGroupNetworkInterfaceOptions, "removeSecurityGroupNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeSecurityGroupNetworkInterfaceOptions, "removeSecurityGroupNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *removeSecurityGroupNetworkInterfaceOptions.SecurityGroupID, + "id": *removeSecurityGroupNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeSecurityGroupNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveSecurityGroupNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSecurityGroupNetworkInterface : Retrieve a network interface in a security group +// This request retrieves a single network interface specified by the identifier in the URL path. The network interface +// must be an existing member of the security group. +func (vpc *VpcV1) GetSecurityGroupNetworkInterface(getSecurityGroupNetworkInterfaceOptions *GetSecurityGroupNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.GetSecurityGroupNetworkInterfaceWithContext(context.Background(), getSecurityGroupNetworkInterfaceOptions) +} + +// GetSecurityGroupNetworkInterfaceWithContext is an alternate form of the GetSecurityGroupNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) GetSecurityGroupNetworkInterfaceWithContext(ctx context.Context, getSecurityGroupNetworkInterfaceOptions *GetSecurityGroupNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSecurityGroupNetworkInterfaceOptions, "getSecurityGroupNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSecurityGroupNetworkInterfaceOptions, "getSecurityGroupNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *getSecurityGroupNetworkInterfaceOptions.SecurityGroupID, + "id": *getSecurityGroupNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSecurityGroupNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + if err != nil { + return + } + response.Result = result + + return +} + +// AddSecurityGroupNetworkInterface : Add a network interface to a security group +// This request adds an existing network interface to an existing security group. When a network interface is added to a +// security group, the security group rules are applied to the network interface. A request body is not required, and if +// supplied, is ignored. +func (vpc *VpcV1) AddSecurityGroupNetworkInterface(addSecurityGroupNetworkInterfaceOptions *AddSecurityGroupNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + return vpc.AddSecurityGroupNetworkInterfaceWithContext(context.Background(), addSecurityGroupNetworkInterfaceOptions) +} + +// AddSecurityGroupNetworkInterfaceWithContext is an alternate form of the AddSecurityGroupNetworkInterface method which supports a Context parameter +func (vpc *VpcV1) AddSecurityGroupNetworkInterfaceWithContext(ctx context.Context, addSecurityGroupNetworkInterfaceOptions *AddSecurityGroupNetworkInterfaceOptions) (result *NetworkInterface, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addSecurityGroupNetworkInterfaceOptions, "addSecurityGroupNetworkInterfaceOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addSecurityGroupNetworkInterfaceOptions, "addSecurityGroupNetworkInterfaceOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *addSecurityGroupNetworkInterfaceOptions.SecurityGroupID, + "id": *addSecurityGroupNetworkInterfaceOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/network_interfaces/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addSecurityGroupNetworkInterfaceOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddSecurityGroupNetworkInterface") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalNetworkInterface) + if err != nil { + return + } + response.Result = result + + return +} + +// ListSecurityGroupRules : List all rules in a security group +// This request lists all rules in a security group. These rules define what traffic the security group permits. +// Security group rules are stateful, such that reverse traffic in response to allowed traffic is automatically +// permitted. +func (vpc *VpcV1) ListSecurityGroupRules(listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions) (result *SecurityGroupRuleCollection, response *core.DetailedResponse, err error) { + return vpc.ListSecurityGroupRulesWithContext(context.Background(), listSecurityGroupRulesOptions) +} + +// ListSecurityGroupRulesWithContext is an alternate form of the ListSecurityGroupRules method which supports a Context parameter +func (vpc *VpcV1) ListSecurityGroupRulesWithContext(ctx context.Context, listSecurityGroupRulesOptions *ListSecurityGroupRulesOptions) (result *SecurityGroupRuleCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listSecurityGroupRulesOptions, "listSecurityGroupRulesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *listSecurityGroupRulesOptions.SecurityGroupID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listSecurityGroupRulesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupRules") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRuleCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateSecurityGroupRule : Create a rule for a security group +// This request creates a new security group rule from a security group rule prototype object. The prototype object is +// structured in the same way as a retrieved security group rule and contains the information necessary to create the +// rule. As part of creating a new rule in a security group, the rule is applied to all the networking interfaces in the +// security group. Rules specify which IP traffic a security group should allow. Security group rules are stateful, such +// that reverse traffic in response to allowed traffic is automatically permitted. A rule allowing inbound TCP traffic +// on port 80 also allows outbound TCP traffic on port 80 without the need for an additional rule. +func (vpc *VpcV1) CreateSecurityGroupRule(createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + return vpc.CreateSecurityGroupRuleWithContext(context.Background(), createSecurityGroupRuleOptions) +} + +// CreateSecurityGroupRuleWithContext is an alternate form of the CreateSecurityGroupRule method which supports a Context parameter +func (vpc *VpcV1) CreateSecurityGroupRuleWithContext(ctx context.Context, createSecurityGroupRuleOptions *CreateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSecurityGroupRuleOptions, "createSecurityGroupRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *createSecurityGroupRuleOptions.SecurityGroupID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createSecurityGroupRuleOptions.SecurityGroupRulePrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteSecurityGroupRule : Delete a security group rule +// This request deletes a security group rule. This operation cannot be reversed. Removing a security group rule will +// not end existing connections allowed by that rule. +func (vpc *VpcV1) DeleteSecurityGroupRule(deleteSecurityGroupRuleOptions *DeleteSecurityGroupRuleOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSecurityGroupRuleWithContext(context.Background(), deleteSecurityGroupRuleOptions) +} + +// DeleteSecurityGroupRuleWithContext is an alternate form of the DeleteSecurityGroupRule method which supports a Context parameter +func (vpc *VpcV1) DeleteSecurityGroupRuleWithContext(ctx context.Context, deleteSecurityGroupRuleOptions *DeleteSecurityGroupRuleOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSecurityGroupRuleOptions, "deleteSecurityGroupRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *deleteSecurityGroupRuleOptions.SecurityGroupID, + "id": *deleteSecurityGroupRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSecurityGroupRule : Retrieve a security group rule +// This request retrieves a single security group rule specified by the identifier in the URL path. +func (vpc *VpcV1) GetSecurityGroupRule(getSecurityGroupRuleOptions *GetSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + return vpc.GetSecurityGroupRuleWithContext(context.Background(), getSecurityGroupRuleOptions) +} + +// GetSecurityGroupRuleWithContext is an alternate form of the GetSecurityGroupRule method which supports a Context parameter +func (vpc *VpcV1) GetSecurityGroupRuleWithContext(ctx context.Context, getSecurityGroupRuleOptions *GetSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSecurityGroupRuleOptions, "getSecurityGroupRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *getSecurityGroupRuleOptions.SecurityGroupID, + "id": *getSecurityGroupRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateSecurityGroupRule : Update a security group rule +// This request updates a security group rule with the information in a provided rule patch object. The rule patch +// object contains only the information to be updated. The request will fail if the information is not applicable to the +// rule's protocol. +func (vpc *VpcV1) UpdateSecurityGroupRule(updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateSecurityGroupRuleWithContext(context.Background(), updateSecurityGroupRuleOptions) +} + +// UpdateSecurityGroupRuleWithContext is an alternate form of the UpdateSecurityGroupRule method which supports a Context parameter +func (vpc *VpcV1) UpdateSecurityGroupRuleWithContext(ctx context.Context, updateSecurityGroupRuleOptions *UpdateSecurityGroupRuleOptions) (result SecurityGroupRuleIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateSecurityGroupRuleOptions, "updateSecurityGroupRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *updateSecurityGroupRuleOptions.SecurityGroupID, + "id": *updateSecurityGroupRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateSecurityGroupRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateSecurityGroupRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateSecurityGroupRuleOptions.SecurityGroupRulePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupRule) + if err != nil { + return + } + response.Result = result + + return +} + +// ListSecurityGroupTargets : List all targets associated with a security group +// This request lists all targets associated with a security group, to which the rules in the security group are +// applied. +func (vpc *VpcV1) ListSecurityGroupTargets(listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions) (result *SecurityGroupTargetCollection, response *core.DetailedResponse, err error) { + return vpc.ListSecurityGroupTargetsWithContext(context.Background(), listSecurityGroupTargetsOptions) +} + +// ListSecurityGroupTargetsWithContext is an alternate form of the ListSecurityGroupTargets method which supports a Context parameter +func (vpc *VpcV1) ListSecurityGroupTargetsWithContext(ctx context.Context, listSecurityGroupTargetsOptions *ListSecurityGroupTargetsOptions) (result *SecurityGroupTargetCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listSecurityGroupTargetsOptions, "listSecurityGroupTargetsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *listSecurityGroupTargetsOptions.SecurityGroupID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listSecurityGroupTargetsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListSecurityGroupTargets") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listSecurityGroupTargetsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listSecurityGroupTargetsOptions.Start)) + } + if listSecurityGroupTargetsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listSecurityGroupTargetsOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteSecurityGroupTargetBinding : Remove a target from a security group +// This request removes a target from a security group. For this request to succeed, the target must be attached to at +// least one other security group. The supplied target identifier can be: +// +// - A network interface identifier +// - An application load balancer identifier +// +// Security groups are stateful, so any changes to a target's security groups are applied to new connections. Existing +// connections are not affected. +func (vpc *VpcV1) DeleteSecurityGroupTargetBinding(deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteSecurityGroupTargetBindingWithContext(context.Background(), deleteSecurityGroupTargetBindingOptions) +} + +// DeleteSecurityGroupTargetBindingWithContext is an alternate form of the DeleteSecurityGroupTargetBinding method which supports a Context parameter +func (vpc *VpcV1) DeleteSecurityGroupTargetBindingWithContext(ctx context.Context, deleteSecurityGroupTargetBindingOptions *DeleteSecurityGroupTargetBindingOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteSecurityGroupTargetBindingOptions, "deleteSecurityGroupTargetBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *deleteSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *deleteSecurityGroupTargetBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteSecurityGroupTargetBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteSecurityGroupTargetBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetSecurityGroupTarget : Retrieve a security group target +// This request retrieves a single target specified by the identifier in the URL path. The target must be an existing +// target of the security group. +func (vpc *VpcV1) GetSecurityGroupTarget(getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + return vpc.GetSecurityGroupTargetWithContext(context.Background(), getSecurityGroupTargetOptions) +} + +// GetSecurityGroupTargetWithContext is an alternate form of the GetSecurityGroupTarget method which supports a Context parameter +func (vpc *VpcV1) GetSecurityGroupTargetWithContext(ctx context.Context, getSecurityGroupTargetOptions *GetSecurityGroupTargetOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getSecurityGroupTargetOptions, "getSecurityGroupTargetOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *getSecurityGroupTargetOptions.SecurityGroupID, + "id": *getSecurityGroupTargetOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getSecurityGroupTargetOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetSecurityGroupTarget") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateSecurityGroupTargetBinding : Add a target to a security group +// This request adds a resource to an existing security group. The supplied target identifier can be: +// +// - A network interface identifier +// - An application load balancer identifier +// +// When a target is added to a security group, the security group rules are applied to the target. A request body is not +// required, and if supplied, is ignored. +func (vpc *VpcV1) CreateSecurityGroupTargetBinding(createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + return vpc.CreateSecurityGroupTargetBindingWithContext(context.Background(), createSecurityGroupTargetBindingOptions) +} + +// CreateSecurityGroupTargetBindingWithContext is an alternate form of the CreateSecurityGroupTargetBinding method which supports a Context parameter +func (vpc *VpcV1) CreateSecurityGroupTargetBindingWithContext(ctx context.Context, createSecurityGroupTargetBindingOptions *CreateSecurityGroupTargetBindingOptions) (result SecurityGroupTargetReferenceIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createSecurityGroupTargetBindingOptions, "createSecurityGroupTargetBindingOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "security_group_id": *createSecurityGroupTargetBindingOptions.SecurityGroupID, + "id": *createSecurityGroupTargetBindingOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/security_groups/{security_group_id}/targets/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createSecurityGroupTargetBindingOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateSecurityGroupTargetBinding") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + response.Result = result + + return +} + +// ListIkePolicies : List all IKE policies +// This request lists all IKE policies in the region. +func (vpc *VpcV1) ListIkePolicies(listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListIkePoliciesWithContext(context.Background(), listIkePoliciesOptions) +} + +// ListIkePoliciesWithContext is an alternate form of the ListIkePolicies method which supports a Context parameter +func (vpc *VpcV1) ListIkePoliciesWithContext(ctx context.Context, listIkePoliciesOptions *ListIkePoliciesOptions) (result *IkePolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listIkePoliciesOptions, "listIkePoliciesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listIkePoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicies") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listIkePoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listIkePoliciesOptions.Start)) + } + if listIkePoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listIkePoliciesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicyCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateIkePolicy : Create an IKE policy +// This request creates a new IKE policy. +func (vpc *VpcV1) CreateIkePolicy(createIkePolicyOptions *CreateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + return vpc.CreateIkePolicyWithContext(context.Background(), createIkePolicyOptions) +} + +// CreateIkePolicyWithContext is an alternate form of the CreateIkePolicy method which supports a Context parameter +func (vpc *VpcV1) CreateIkePolicyWithContext(ctx context.Context, createIkePolicyOptions *CreateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createIkePolicyOptions, "createIkePolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createIkePolicyOptions, "createIkePolicyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIkePolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createIkePolicyOptions.AuthenticationAlgorithm != nil { + body["authentication_algorithm"] = createIkePolicyOptions.AuthenticationAlgorithm + } + if createIkePolicyOptions.DhGroup != nil { + body["dh_group"] = createIkePolicyOptions.DhGroup + } + if createIkePolicyOptions.EncryptionAlgorithm != nil { + body["encryption_algorithm"] = createIkePolicyOptions.EncryptionAlgorithm + } + if createIkePolicyOptions.IkeVersion != nil { + body["ike_version"] = createIkePolicyOptions.IkeVersion + } + if createIkePolicyOptions.KeyLifetime != nil { + body["key_lifetime"] = createIkePolicyOptions.KeyLifetime + } + if createIkePolicyOptions.Name != nil { + body["name"] = createIkePolicyOptions.Name + } + if createIkePolicyOptions.ResourceGroup != nil { + body["resource_group"] = createIkePolicyOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteIkePolicy : Delete an IKE policy +// This request deletes an IKE policy. This operation cannot be reversed. +func (vpc *VpcV1) DeleteIkePolicy(deleteIkePolicyOptions *DeleteIkePolicyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteIkePolicyWithContext(context.Background(), deleteIkePolicyOptions) +} + +// DeleteIkePolicyWithContext is an alternate form of the DeleteIkePolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteIkePolicyWithContext(ctx context.Context, deleteIkePolicyOptions *DeleteIkePolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteIkePolicyOptions, "deleteIkePolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteIkePolicyOptions, "deleteIkePolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteIkePolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIkePolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetIkePolicy : Retrieve an IKE policy +// This request retrieves a single IKE policy specified by the identifier in the URL. +func (vpc *VpcV1) GetIkePolicy(getIkePolicyOptions *GetIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + return vpc.GetIkePolicyWithContext(context.Background(), getIkePolicyOptions) +} + +// GetIkePolicyWithContext is an alternate form of the GetIkePolicy method which supports a Context parameter +func (vpc *VpcV1) GetIkePolicyWithContext(ctx context.Context, getIkePolicyOptions *GetIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getIkePolicyOptions, "getIkePolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getIkePolicyOptions, "getIkePolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getIkePolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIkePolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateIkePolicy : Update an IKE policy +// This request updates the properties of an existing IKE policy. +func (vpc *VpcV1) UpdateIkePolicy(updateIkePolicyOptions *UpdateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + return vpc.UpdateIkePolicyWithContext(context.Background(), updateIkePolicyOptions) +} + +// UpdateIkePolicyWithContext is an alternate form of the UpdateIkePolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateIkePolicyWithContext(ctx context.Context, updateIkePolicyOptions *UpdateIkePolicyOptions) (result *IkePolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateIkePolicyOptions, "updateIkePolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateIkePolicyOptions, "updateIkePolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateIkePolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateIkePolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIkePolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateIkePolicyOptions.IkePolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIkePolicy) + if err != nil { + return + } + response.Result = result + + return +} + +// ListIkePolicyConnections : List all VPN gateway connections that use a specified IKE policy +// This request lists all VPN gateway connections that use a policy. +func (vpc *VpcV1) ListIkePolicyConnections(listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListIkePolicyConnectionsWithContext(context.Background(), listIkePolicyConnectionsOptions) +} + +// ListIkePolicyConnectionsWithContext is an alternate form of the ListIkePolicyConnections method which supports a Context parameter +func (vpc *VpcV1) ListIkePolicyConnectionsWithContext(ctx context.Context, listIkePolicyConnectionsOptions *ListIkePolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listIkePolicyConnectionsOptions, "listIkePolicyConnectionsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *listIkePolicyConnectionsOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ike_policies/{id}/connections`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listIkePolicyConnectionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIkePolicyConnections") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// ListIpsecPolicies : List all IPsec policies +// This request lists all IPsec policies in the region. +func (vpc *VpcV1) ListIpsecPolicies(listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListIpsecPoliciesWithContext(context.Background(), listIpsecPoliciesOptions) +} + +// ListIpsecPoliciesWithContext is an alternate form of the ListIpsecPolicies method which supports a Context parameter +func (vpc *VpcV1) ListIpsecPoliciesWithContext(ctx context.Context, listIpsecPoliciesOptions *ListIpsecPoliciesOptions) (result *IPsecPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listIpsecPoliciesOptions, "listIpsecPoliciesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listIpsecPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicies") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listIpsecPoliciesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listIpsecPoliciesOptions.Start)) + } + if listIpsecPoliciesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listIpsecPoliciesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicyCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateIpsecPolicy : Create an IPsec policy +// This request creates a new IPsec policy. +func (vpc *VpcV1) CreateIpsecPolicy(createIpsecPolicyOptions *CreateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + return vpc.CreateIpsecPolicyWithContext(context.Background(), createIpsecPolicyOptions) +} + +// CreateIpsecPolicyWithContext is an alternate form of the CreateIpsecPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateIpsecPolicyWithContext(ctx context.Context, createIpsecPolicyOptions *CreateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createIpsecPolicyOptions, "createIpsecPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createIpsecPolicyOptions, "createIpsecPolicyOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateIpsecPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createIpsecPolicyOptions.AuthenticationAlgorithm != nil { + body["authentication_algorithm"] = createIpsecPolicyOptions.AuthenticationAlgorithm + } + if createIpsecPolicyOptions.EncryptionAlgorithm != nil { + body["encryption_algorithm"] = createIpsecPolicyOptions.EncryptionAlgorithm + } + if createIpsecPolicyOptions.Pfs != nil { + body["pfs"] = createIpsecPolicyOptions.Pfs + } + if createIpsecPolicyOptions.KeyLifetime != nil { + body["key_lifetime"] = createIpsecPolicyOptions.KeyLifetime + } + if createIpsecPolicyOptions.Name != nil { + body["name"] = createIpsecPolicyOptions.Name + } + if createIpsecPolicyOptions.ResourceGroup != nil { + body["resource_group"] = createIpsecPolicyOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteIpsecPolicy : Delete an IPsec policy +// This request deletes an IPsec policy. This operation cannot be reversed. +func (vpc *VpcV1) DeleteIpsecPolicy(deleteIpsecPolicyOptions *DeleteIpsecPolicyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteIpsecPolicyWithContext(context.Background(), deleteIpsecPolicyOptions) +} + +// DeleteIpsecPolicyWithContext is an alternate form of the DeleteIpsecPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteIpsecPolicyWithContext(ctx context.Context, deleteIpsecPolicyOptions *DeleteIpsecPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteIpsecPolicyOptions, "deleteIpsecPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteIpsecPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteIpsecPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetIpsecPolicy : Retrieve an IPsec policy +// This request retrieves a single IPsec policy specified by the identifier in the URL. +func (vpc *VpcV1) GetIpsecPolicy(getIpsecPolicyOptions *GetIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + return vpc.GetIpsecPolicyWithContext(context.Background(), getIpsecPolicyOptions) +} + +// GetIpsecPolicyWithContext is an alternate form of the GetIpsecPolicy method which supports a Context parameter +func (vpc *VpcV1) GetIpsecPolicyWithContext(ctx context.Context, getIpsecPolicyOptions *GetIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getIpsecPolicyOptions, "getIpsecPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getIpsecPolicyOptions, "getIpsecPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getIpsecPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetIpsecPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateIpsecPolicy : Update an IPsec policy +// This request updates the properties of an existing IPsec policy. +func (vpc *VpcV1) UpdateIpsecPolicy(updateIpsecPolicyOptions *UpdateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + return vpc.UpdateIpsecPolicyWithContext(context.Background(), updateIpsecPolicyOptions) +} + +// UpdateIpsecPolicyWithContext is an alternate form of the UpdateIpsecPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateIpsecPolicyWithContext(ctx context.Context, updateIpsecPolicyOptions *UpdateIpsecPolicyOptions) (result *IPsecPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateIpsecPolicyOptions, "updateIpsecPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateIpsecPolicyOptions, "updateIpsecPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateIpsecPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateIpsecPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateIpsecPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateIpsecPolicyOptions.IPsecPolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalIPsecPolicy) + if err != nil { + return + } + response.Result = result + + return +} + +// ListIpsecPolicyConnections : List all VPN gateway connections that use a specified IPsec policy +// This request lists all VPN gateway connections that use a policy. +func (vpc *VpcV1) ListIpsecPolicyConnections(listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListIpsecPolicyConnectionsWithContext(context.Background(), listIpsecPolicyConnectionsOptions) +} + +// ListIpsecPolicyConnectionsWithContext is an alternate form of the ListIpsecPolicyConnections method which supports a Context parameter +func (vpc *VpcV1) ListIpsecPolicyConnectionsWithContext(ctx context.Context, listIpsecPolicyConnectionsOptions *ListIpsecPolicyConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listIpsecPolicyConnectionsOptions, "listIpsecPolicyConnectionsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *listIpsecPolicyConnectionsOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/ipsec_policies/{id}/connections`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listIpsecPolicyConnectionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListIpsecPolicyConnections") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// ListVPNGateways : List all VPN gateways +// This request lists all VPN gateways in the region. +func (vpc *VpcV1) ListVPNGateways(listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewaysWithContext(context.Background(), listVPNGatewaysOptions) +} + +// ListVPNGatewaysWithContext is an alternate form of the ListVPNGateways method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewaysWithContext(ctx context.Context, listVPNGatewaysOptions *ListVPNGatewaysOptions) (result *VPNGatewayCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listVPNGatewaysOptions, "listVPNGatewaysOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewaysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGateways") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPNGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listVPNGatewaysOptions.Start)) + } + if listVPNGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listVPNGatewaysOptions.Limit)) + } + if listVPNGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listVPNGatewaysOptions.ResourceGroupID)) + } + if listVPNGatewaysOptions.Mode != nil { + builder.AddQuery("mode", fmt.Sprint(*listVPNGatewaysOptions.Mode)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateVPNGateway : Create a VPN gateway +// This request creates a new VPN gateway. +func (vpc *VpcV1) CreateVPNGateway(createVPNGatewayOptions *CreateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + return vpc.CreateVPNGatewayWithContext(context.Background(), createVPNGatewayOptions) +} + +// CreateVPNGatewayWithContext is an alternate form of the CreateVPNGateway method which supports a Context parameter +func (vpc *VpcV1) CreateVPNGatewayWithContext(ctx context.Context, createVPNGatewayOptions *CreateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNGatewayOptions, "createVPNGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPNGatewayOptions, "createVPNGatewayOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createVPNGatewayOptions.VPNGatewayPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteVPNGateway : Delete a VPN gateway +// This request deletes a VPN gateway. A VPN gateway with a `status` of `pending` cannot be deleted. This operation +// deletes all VPN gateway connections associated with this VPN gateway. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPNGateway(deleteVPNGatewayOptions *DeleteVPNGatewayOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPNGatewayWithContext(context.Background(), deleteVPNGatewayOptions) +} + +// DeleteVPNGatewayWithContext is an alternate form of the DeleteVPNGateway method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNGatewayWithContext(ctx context.Context, deleteVPNGatewayOptions *DeleteVPNGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNGatewayOptions, "deleteVPNGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPNGatewayOptions, "deleteVPNGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteVPNGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPNGateway : Retrieve a VPN gateway +// This request retrieves a single VPN gateway specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNGateway(getVPNGatewayOptions *GetVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + return vpc.GetVPNGatewayWithContext(context.Background(), getVPNGatewayOptions) +} + +// GetVPNGatewayWithContext is an alternate form of the GetVPNGateway method which supports a Context parameter +func (vpc *VpcV1) GetVPNGatewayWithContext(ctx context.Context, getVPNGatewayOptions *GetVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNGatewayOptions, "getVPNGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPNGatewayOptions, "getVPNGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getVPNGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateVPNGateway : Update a VPN gateway +// This request updates the properties of an existing VPN gateway. +func (vpc *VpcV1) UpdateVPNGateway(updateVPNGatewayOptions *UpdateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateVPNGatewayWithContext(context.Background(), updateVPNGatewayOptions) +} + +// UpdateVPNGatewayWithContext is an alternate form of the UpdateVPNGateway method which supports a Context parameter +func (vpc *VpcV1) UpdateVPNGatewayWithContext(ctx context.Context, updateVPNGatewayOptions *UpdateVPNGatewayOptions) (result VPNGatewayIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPNGatewayOptions, "updateVPNGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPNGatewayOptions, "updateVPNGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateVPNGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPNGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPNGatewayOptions.VPNGatewayPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGateway) + if err != nil { + return + } + response.Result = result + + return +} + +// ListVPNGatewayConnections : List all connections of a VPN gateway +// This request lists all connections of a VPN gateway. +func (vpc *VpcV1) ListVPNGatewayConnections(listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionsWithContext(context.Background(), listVPNGatewayConnectionsOptions) +} + +// ListVPNGatewayConnectionsWithContext is an alternate form of the ListVPNGatewayConnections method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionsWithContext(ctx context.Context, listVPNGatewayConnectionsOptions *ListVPNGatewayConnectionsOptions) (result *VPNGatewayConnectionCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPNGatewayConnectionsOptions, "listVPNGatewayConnectionsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *listVPNGatewayConnectionsOptions.VPNGatewayID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewayConnectionsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnections") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listVPNGatewayConnectionsOptions.Status != nil { + builder.AddQuery("status", fmt.Sprint(*listVPNGatewayConnectionsOptions.Status)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateVPNGatewayConnection : Create a connection for a VPN gateway +// This request creates a new VPN gateway connection. +func (vpc *VpcV1) CreateVPNGatewayConnection(createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + return vpc.CreateVPNGatewayConnectionWithContext(context.Background(), createVPNGatewayConnectionOptions) +} + +// CreateVPNGatewayConnectionWithContext is an alternate form of the CreateVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) CreateVPNGatewayConnectionWithContext(ctx context.Context, createVPNGatewayConnectionOptions *CreateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createVPNGatewayConnectionOptions, "createVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *createVPNGatewayConnectionOptions.VPNGatewayID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateVPNGatewayConnection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(createVPNGatewayConnectionOptions.VPNGatewayConnectionPrototype) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteVPNGatewayConnection : Delete a VPN gateway connection +// This request deletes a VPN gateway connection. This operation cannot be reversed. +func (vpc *VpcV1) DeleteVPNGatewayConnection(deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteVPNGatewayConnectionWithContext(context.Background(), deleteVPNGatewayConnectionOptions) +} + +// DeleteVPNGatewayConnectionWithContext is an alternate form of the DeleteVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) DeleteVPNGatewayConnectionWithContext(ctx context.Context, deleteVPNGatewayConnectionOptions *DeleteVPNGatewayConnectionOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteVPNGatewayConnectionOptions, "deleteVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *deleteVPNGatewayConnectionOptions.VPNGatewayID, + "id": *deleteVPNGatewayConnectionOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteVPNGatewayConnection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetVPNGatewayConnection : Retrieve a VPN gateway connection +// This request retrieves a single VPN gateway connection specified by the identifier in the URL. +func (vpc *VpcV1) GetVPNGatewayConnection(getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + return vpc.GetVPNGatewayConnectionWithContext(context.Background(), getVPNGatewayConnectionOptions) +} + +// GetVPNGatewayConnectionWithContext is an alternate form of the GetVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) GetVPNGatewayConnectionWithContext(ctx context.Context, getVPNGatewayConnectionOptions *GetVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getVPNGatewayConnectionOptions, "getVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *getVPNGatewayConnectionOptions.VPNGatewayID, + "id": *getVPNGatewayConnectionOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetVPNGatewayConnection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateVPNGatewayConnection : Update a VPN gateway connection +// This request updates the properties of an existing VPN gateway connection. +func (vpc *VpcV1) UpdateVPNGatewayConnection(updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + return vpc.UpdateVPNGatewayConnectionWithContext(context.Background(), updateVPNGatewayConnectionOptions) +} + +// UpdateVPNGatewayConnectionWithContext is an alternate form of the UpdateVPNGatewayConnection method which supports a Context parameter +func (vpc *VpcV1) UpdateVPNGatewayConnectionWithContext(ctx context.Context, updateVPNGatewayConnectionOptions *UpdateVPNGatewayConnectionOptions) (result VPNGatewayConnectionIntf, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateVPNGatewayConnectionOptions, "updateVPNGatewayConnectionOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *updateVPNGatewayConnectionOptions.VPNGatewayID, + "id": *updateVPNGatewayConnectionOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateVPNGatewayConnectionOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateVPNGatewayConnection") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateVPNGatewayConnectionOptions.VPNGatewayConnectionPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + response.Result = result + + return +} + +// ListVPNGatewayConnectionLocalCIDRs : List all local CIDRs for a VPN gateway connection +// This request lists all local CIDRs for a VPN gateway connection. +func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRs(listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionLocalCIDRsWithContext(context.Background(), listVPNGatewayConnectionLocalCIDRsOptions) +} + +// ListVPNGatewayConnectionLocalCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionLocalCIDRs method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionLocalCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionLocalCIDRsOptions *ListVPNGatewayConnectionLocalCIDRsOptions) (result *VPNGatewayConnectionLocalCIDRs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPNGatewayConnectionLocalCIDRsOptions, "listVPNGatewayConnectionLocalCIDRsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *listVPNGatewayConnectionLocalCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionLocalCIDRsOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewayConnectionLocalCIDRsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionLocalCIDRs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionLocalCIDRs) + if err != nil { + return + } + response.Result = result + + return +} + +// RemoveVPNGatewayConnectionLocalCIDR : Remove a local CIDR from a VPN gateway connection +// This request removes a CIDR from a VPN gateway connection. +func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDR(removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveVPNGatewayConnectionLocalCIDRWithContext(context.Background(), removeVPNGatewayConnectionLocalCIDROptions) +} + +// RemoveVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) RemoveVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionLocalCIDROptions *RemoveVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeVPNGatewayConnectionLocalCIDROptions, "removeVPNGatewayConnectionLocalCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *removeVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, + "id": *removeVPNGatewayConnectionLocalCIDROptions.ID, + "cidr_prefix": *removeVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, + "prefix_length": *removeVPNGatewayConnectionLocalCIDROptions.PrefixLength, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeVPNGatewayConnectionLocalCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionLocalCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// CheckVPNGatewayConnectionLocalCIDR : Check if the specified local CIDR exists on a VPN gateway connection +// This request succeeds if a CIDR exists on the specified VPN gateway connection and fails otherwise. +func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDR(checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.CheckVPNGatewayConnectionLocalCIDRWithContext(context.Background(), checkVPNGatewayConnectionLocalCIDROptions) +} + +// CheckVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) CheckVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionLocalCIDROptions *CheckVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(checkVPNGatewayConnectionLocalCIDROptions, "checkVPNGatewayConnectionLocalCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *checkVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, + "id": *checkVPNGatewayConnectionLocalCIDROptions.ID, + "cidr_prefix": *checkVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, + "prefix_length": *checkVPNGatewayConnectionLocalCIDROptions.PrefixLength, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range checkVPNGatewayConnectionLocalCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionLocalCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// AddVPNGatewayConnectionLocalCIDR : Set a local CIDR on a VPN gateway connection +// This request adds the specified CIDR to the specified VPN gateway connection. A request body is not required, and if +// supplied, is ignored. This request succeeds if the CIDR already exists on the specified VPN gateway connection. +func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDR(addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.AddVPNGatewayConnectionLocalCIDRWithContext(context.Background(), addVPNGatewayConnectionLocalCIDROptions) +} + +// AddVPNGatewayConnectionLocalCIDRWithContext is an alternate form of the AddVPNGatewayConnectionLocalCIDR method which supports a Context parameter +func (vpc *VpcV1) AddVPNGatewayConnectionLocalCIDRWithContext(ctx context.Context, addVPNGatewayConnectionLocalCIDROptions *AddVPNGatewayConnectionLocalCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addVPNGatewayConnectionLocalCIDROptions, "addVPNGatewayConnectionLocalCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *addVPNGatewayConnectionLocalCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionLocalCIDROptions.ID, + "cidr_prefix": *addVPNGatewayConnectionLocalCIDROptions.CIDRPrefix, + "prefix_length": *addVPNGatewayConnectionLocalCIDROptions.PrefixLength, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/local_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addVPNGatewayConnectionLocalCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionLocalCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListVPNGatewayConnectionPeerCIDRs : List all peer CIDRs for a VPN gateway connection +// This request lists all peer CIDRs for a VPN gateway connection. +func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRs(listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { + return vpc.ListVPNGatewayConnectionPeerCIDRsWithContext(context.Background(), listVPNGatewayConnectionPeerCIDRsOptions) +} + +// ListVPNGatewayConnectionPeerCIDRsWithContext is an alternate form of the ListVPNGatewayConnectionPeerCIDRs method which supports a Context parameter +func (vpc *VpcV1) ListVPNGatewayConnectionPeerCIDRsWithContext(ctx context.Context, listVPNGatewayConnectionPeerCIDRsOptions *ListVPNGatewayConnectionPeerCIDRsOptions) (result *VPNGatewayConnectionPeerCIDRs, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listVPNGatewayConnectionPeerCIDRsOptions, "listVPNGatewayConnectionPeerCIDRsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *listVPNGatewayConnectionPeerCIDRsOptions.VPNGatewayID, + "id": *listVPNGatewayConnectionPeerCIDRsOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listVPNGatewayConnectionPeerCIDRsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListVPNGatewayConnectionPeerCIDRs") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalVPNGatewayConnectionPeerCIDRs) + if err != nil { + return + } + response.Result = result + + return +} + +// RemoveVPNGatewayConnectionPeerCIDR : Remove a peer CIDR from a VPN gateway connection +// This request removes a CIDR from a VPN gateway connection. +func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDR(removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveVPNGatewayConnectionPeerCIDRWithContext(context.Background(), removeVPNGatewayConnectionPeerCIDROptions) +} + +// RemoveVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the RemoveVPNGatewayConnectionPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) RemoveVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, removeVPNGatewayConnectionPeerCIDROptions *RemoveVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeVPNGatewayConnectionPeerCIDROptions, "removeVPNGatewayConnectionPeerCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *removeVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, + "id": *removeVPNGatewayConnectionPeerCIDROptions.ID, + "cidr_prefix": *removeVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, + "prefix_length": *removeVPNGatewayConnectionPeerCIDROptions.PrefixLength, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeVPNGatewayConnectionPeerCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveVPNGatewayConnectionPeerCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// CheckVPNGatewayConnectionPeerCIDR : Check if the specified peer CIDR exists on a VPN gateway connection +// This request succeeds if a CIDR exists on the specified VPN gateway connection and fails otherwise. +func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDR(checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.CheckVPNGatewayConnectionPeerCIDRWithContext(context.Background(), checkVPNGatewayConnectionPeerCIDROptions) +} + +// CheckVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the CheckVPNGatewayConnectionPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) CheckVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, checkVPNGatewayConnectionPeerCIDROptions *CheckVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(checkVPNGatewayConnectionPeerCIDROptions, "checkVPNGatewayConnectionPeerCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *checkVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, + "id": *checkVPNGatewayConnectionPeerCIDROptions.ID, + "cidr_prefix": *checkVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, + "prefix_length": *checkVPNGatewayConnectionPeerCIDROptions.PrefixLength, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range checkVPNGatewayConnectionPeerCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CheckVPNGatewayConnectionPeerCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// AddVPNGatewayConnectionPeerCIDR : Set a peer CIDR on a VPN gateway connection +// This request adds the specified CIDR to the specified VPN gateway connection. A request body is not required, and if +// supplied, is ignored. This request succeeds if the CIDR already exists on the specified VPN gateway connection. +func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDR(addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + return vpc.AddVPNGatewayConnectionPeerCIDRWithContext(context.Background(), addVPNGatewayConnectionPeerCIDROptions) +} + +// AddVPNGatewayConnectionPeerCIDRWithContext is an alternate form of the AddVPNGatewayConnectionPeerCIDR method which supports a Context parameter +func (vpc *VpcV1) AddVPNGatewayConnectionPeerCIDRWithContext(ctx context.Context, addVPNGatewayConnectionPeerCIDROptions *AddVPNGatewayConnectionPeerCIDROptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addVPNGatewayConnectionPeerCIDROptions, "addVPNGatewayConnectionPeerCIDROptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "vpn_gateway_id": *addVPNGatewayConnectionPeerCIDROptions.VPNGatewayID, + "id": *addVPNGatewayConnectionPeerCIDROptions.ID, + "cidr_prefix": *addVPNGatewayConnectionPeerCIDROptions.CIDRPrefix, + "prefix_length": *addVPNGatewayConnectionPeerCIDROptions.PrefixLength, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/vpn_gateways/{vpn_gateway_id}/connections/{id}/peer_cidrs/{cidr_prefix}/{prefix_length}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addVPNGatewayConnectionPeerCIDROptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddVPNGatewayConnectionPeerCIDR") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// ListLoadBalancerProfiles : List all load balancer profiles +// This request lists all load balancer profiles available in the region. A load balancer profile specifies the +// performance characteristics and pricing model for a load balancer. +func (vpc *VpcV1) ListLoadBalancerProfiles(listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerProfilesWithContext(context.Background(), listLoadBalancerProfilesOptions) +} + +// ListLoadBalancerProfilesWithContext is an alternate form of the ListLoadBalancerProfiles method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerProfilesWithContext(ctx context.Context, listLoadBalancerProfilesOptions *ListLoadBalancerProfilesOptions) (result *LoadBalancerProfileCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listLoadBalancerProfilesOptions, "listLoadBalancerProfilesOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerProfilesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerProfiles") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listLoadBalancerProfilesOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listLoadBalancerProfilesOptions.Start)) + } + if listLoadBalancerProfilesOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listLoadBalancerProfilesOptions.Limit)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfileCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// GetLoadBalancerProfile : Retrieve a load balancer profile +// This request retrieves a load balancer profile specified by the name in the URL. +func (vpc *VpcV1) GetLoadBalancerProfile(getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerProfileWithContext(context.Background(), getLoadBalancerProfileOptions) +} + +// GetLoadBalancerProfileWithContext is an alternate form of the GetLoadBalancerProfile method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerProfileWithContext(ctx context.Context, getLoadBalancerProfileOptions *GetLoadBalancerProfileOptions) (result *LoadBalancerProfile, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerProfileOptions, "getLoadBalancerProfileOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "name": *getLoadBalancerProfileOptions.Name, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancer/profiles/{name}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerProfileOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerProfile") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerProfile) + if err != nil { + return + } + response.Result = result + + return +} + +// ListLoadBalancers : List all load balancers +// This request lists all load balancers in the region. +func (vpc *VpcV1) ListLoadBalancers(listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancersWithContext(context.Background(), listLoadBalancersOptions) +} + +// ListLoadBalancersWithContext is an alternate form of the ListLoadBalancers method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancersWithContext(ctx context.Context, listLoadBalancersOptions *ListLoadBalancersOptions) (result *LoadBalancerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listLoadBalancersOptions, "listLoadBalancersOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateLoadBalancer : Create a load balancer +// This request creates and provisions a new load balancer. +func (vpc *VpcV1) CreateLoadBalancer(createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerWithContext(context.Background(), createLoadBalancerOptions) +} + +// CreateLoadBalancerWithContext is an alternate form of the CreateLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerWithContext(ctx context.Context, createLoadBalancerOptions *CreateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerOptions, "createLoadBalancerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createLoadBalancerOptions, "createLoadBalancerOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createLoadBalancerOptions.IsPublic != nil { + body["is_public"] = createLoadBalancerOptions.IsPublic + } + if createLoadBalancerOptions.Subnets != nil { + body["subnets"] = createLoadBalancerOptions.Subnets + } + if createLoadBalancerOptions.Listeners != nil { + body["listeners"] = createLoadBalancerOptions.Listeners + } + if createLoadBalancerOptions.Logging != nil { + body["logging"] = createLoadBalancerOptions.Logging + } + if createLoadBalancerOptions.Name != nil { + body["name"] = createLoadBalancerOptions.Name + } + if createLoadBalancerOptions.Pools != nil { + body["pools"] = createLoadBalancerOptions.Pools + } + if createLoadBalancerOptions.Profile != nil { + body["profile"] = createLoadBalancerOptions.Profile + } + if createLoadBalancerOptions.ResourceGroup != nil { + body["resource_group"] = createLoadBalancerOptions.ResourceGroup + } + if createLoadBalancerOptions.SecurityGroups != nil { + body["security_groups"] = createLoadBalancerOptions.SecurityGroups + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteLoadBalancer : Delete a load balancer +// This request deletes a load balancer. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancer(deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerWithContext(context.Background(), deleteLoadBalancerOptions) +} + +// DeleteLoadBalancerWithContext is an alternate form of the DeleteLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerWithContext(ctx context.Context, deleteLoadBalancerOptions *DeleteLoadBalancerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerOptions, "deleteLoadBalancerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteLoadBalancerOptions, "deleteLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteLoadBalancerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetLoadBalancer : Retrieve a load balancer +// This request retrieves a single load balancer specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancer(getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerWithContext(context.Background(), getLoadBalancerOptions) +} + +// GetLoadBalancerWithContext is an alternate form of the GetLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerWithContext(ctx context.Context, getLoadBalancerOptions *GetLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerOptions, "getLoadBalancerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerOptions, "getLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getLoadBalancerOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateLoadBalancer : Update a load balancer +// This request updates a load balancer. +func (vpc *VpcV1) UpdateLoadBalancer(updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerWithContext(context.Background(), updateLoadBalancerOptions) +} + +// UpdateLoadBalancerWithContext is an alternate form of the UpdateLoadBalancer method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerWithContext(ctx context.Context, updateLoadBalancerOptions *UpdateLoadBalancerOptions) (result *LoadBalancer, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerOptions, "updateLoadBalancerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateLoadBalancerOptions, "updateLoadBalancerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateLoadBalancerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancer") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerOptions.LoadBalancerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancer) + if err != nil { + return + } + response.Result = result + + return +} + +// GetLoadBalancerStatistics : List all statistics of a load balancer +// This request lists statistics of a load balancer. +func (vpc *VpcV1) GetLoadBalancerStatistics(getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerStatisticsWithContext(context.Background(), getLoadBalancerStatisticsOptions) +} + +// GetLoadBalancerStatisticsWithContext is an alternate form of the GetLoadBalancerStatistics method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerStatisticsWithContext(ctx context.Context, getLoadBalancerStatisticsOptions *GetLoadBalancerStatisticsOptions) (result *LoadBalancerStatistics, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerStatisticsOptions, "getLoadBalancerStatisticsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getLoadBalancerStatisticsOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{id}/statistics`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerStatisticsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerStatistics") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerStatistics) + if err != nil { + return + } + response.Result = result + + return +} + +// ListLoadBalancerListeners : List all listeners for a load balancer +// This request lists all listeners for a load balancer. +func (vpc *VpcV1) ListLoadBalancerListeners(listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenersWithContext(context.Background(), listLoadBalancerListenersOptions) +} + +// ListLoadBalancerListenersWithContext is an alternate form of the ListLoadBalancerListeners method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerListenersWithContext(ctx context.Context, listLoadBalancerListenersOptions *ListLoadBalancerListenersOptions) (result *LoadBalancerListenerCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listLoadBalancerListenersOptions, "listLoadBalancerListenersOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerListenersOptions.LoadBalancerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerListenersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListeners") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateLoadBalancerListener : Create a listener for a load balancer +// This request creates a new listener for a load balancer. +func (vpc *VpcV1) CreateLoadBalancerListener(createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerListenerWithContext(context.Background(), createLoadBalancerListenerOptions) +} + +// CreateLoadBalancerListenerWithContext is an alternate form of the CreateLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerListenerWithContext(ctx context.Context, createLoadBalancerListenerOptions *CreateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createLoadBalancerListenerOptions, "createLoadBalancerListenerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *createLoadBalancerListenerOptions.LoadBalancerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListener") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createLoadBalancerListenerOptions.Port != nil { + body["port"] = createLoadBalancerListenerOptions.Port + } + if createLoadBalancerListenerOptions.Protocol != nil { + body["protocol"] = createLoadBalancerListenerOptions.Protocol + } + if createLoadBalancerListenerOptions.AcceptProxyProtocol != nil { + body["accept_proxy_protocol"] = createLoadBalancerListenerOptions.AcceptProxyProtocol + } + if createLoadBalancerListenerOptions.CertificateInstance != nil { + body["certificate_instance"] = createLoadBalancerListenerOptions.CertificateInstance + } + if createLoadBalancerListenerOptions.ConnectionLimit != nil { + body["connection_limit"] = createLoadBalancerListenerOptions.ConnectionLimit + } + if createLoadBalancerListenerOptions.DefaultPool != nil { + body["default_pool"] = createLoadBalancerListenerOptions.DefaultPool + } + if createLoadBalancerListenerOptions.Policies != nil { + body["policies"] = createLoadBalancerListenerOptions.Policies + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteLoadBalancerListener : Delete a load balancer listener +// This request deletes a load balancer listener. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerListener(deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerListenerWithContext(context.Background(), deleteLoadBalancerListenerOptions) +} + +// DeleteLoadBalancerListenerWithContext is an alternate form of the DeleteLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerListenerWithContext(ctx context.Context, deleteLoadBalancerListenerOptions *DeleteLoadBalancerListenerOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteLoadBalancerListenerOptions, "deleteLoadBalancerListenerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *deleteLoadBalancerListenerOptions.LoadBalancerID, + "id": *deleteLoadBalancerListenerOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListener") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetLoadBalancerListener : Retrieve a load balancer listener +// This request retrieves a single listener specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerListener(getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerListenerWithContext(context.Background(), getLoadBalancerListenerOptions) +} + +// GetLoadBalancerListenerWithContext is an alternate form of the GetLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerListenerWithContext(ctx context.Context, getLoadBalancerListenerOptions *GetLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerListenerOptions, "getLoadBalancerListenerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerListenerOptions.LoadBalancerID, + "id": *getLoadBalancerListenerOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListener") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateLoadBalancerListener : Update a load balancer listener +// This request updates a load balancer listener from a listener patch. +func (vpc *VpcV1) UpdateLoadBalancerListener(updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerListenerWithContext(context.Background(), updateLoadBalancerListenerOptions) +} + +// UpdateLoadBalancerListenerWithContext is an alternate form of the UpdateLoadBalancerListener method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerListenerWithContext(ctx context.Context, updateLoadBalancerListenerOptions *UpdateLoadBalancerListenerOptions) (result *LoadBalancerListener, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateLoadBalancerListenerOptions, "updateLoadBalancerListenerOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerListenerOptions.LoadBalancerID, + "id": *updateLoadBalancerListenerOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerListenerOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListener") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerOptions.LoadBalancerListenerPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListener) + if err != nil { + return + } + response.Result = result + + return +} + +// ListLoadBalancerListenerPolicies : List all policies for a load balancer listener +// This request lists all policies for a load balancer listener. +func (vpc *VpcV1) ListLoadBalancerListenerPolicies(listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenerPoliciesWithContext(context.Background(), listLoadBalancerListenerPoliciesOptions) +} + +// ListLoadBalancerListenerPoliciesWithContext is an alternate form of the ListLoadBalancerListenerPolicies method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerListenerPoliciesWithContext(ctx context.Context, listLoadBalancerListenerPoliciesOptions *ListLoadBalancerListenerPoliciesOptions) (result *LoadBalancerListenerPolicyCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listLoadBalancerListenerPoliciesOptions, "listLoadBalancerListenerPoliciesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerListenerPoliciesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPoliciesOptions.ListenerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerListenerPoliciesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicies") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateLoadBalancerListenerPolicy : Create a policy for a load balancer listener +// Creates a new policy for a load balancer listener. +func (vpc *VpcV1) CreateLoadBalancerListenerPolicy(createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerListenerPolicyWithContext(context.Background(), createLoadBalancerListenerPolicyOptions) +} + +// CreateLoadBalancerListenerPolicyWithContext is an alternate form of the CreateLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerListenerPolicyWithContext(ctx context.Context, createLoadBalancerListenerPolicyOptions *CreateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createLoadBalancerListenerPolicyOptions, "createLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *createLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyOptions.ListenerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createLoadBalancerListenerPolicyOptions.Action != nil { + body["action"] = createLoadBalancerListenerPolicyOptions.Action + } + if createLoadBalancerListenerPolicyOptions.Priority != nil { + body["priority"] = createLoadBalancerListenerPolicyOptions.Priority + } + if createLoadBalancerListenerPolicyOptions.Name != nil { + body["name"] = createLoadBalancerListenerPolicyOptions.Name + } + if createLoadBalancerListenerPolicyOptions.Rules != nil { + body["rules"] = createLoadBalancerListenerPolicyOptions.Rules + } + if createLoadBalancerListenerPolicyOptions.Target != nil { + body["target"] = createLoadBalancerListenerPolicyOptions.Target + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteLoadBalancerListenerPolicy : Delete a load balancer listener policy +// Deletes a policy of the load balancer listener. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicy(deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerListenerPolicyWithContext(context.Background(), deleteLoadBalancerListenerPolicyOptions) +} + +// DeleteLoadBalancerListenerPolicyWithContext is an alternate form of the DeleteLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyOptions *DeleteLoadBalancerListenerPolicyOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyOptions, "deleteLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *deleteLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *deleteLoadBalancerListenerPolicyOptions.ListenerID, + "id": *deleteLoadBalancerListenerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetLoadBalancerListenerPolicy : Retrieve a load balancer listener policy +// Retrieve a single policy specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerListenerPolicy(getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerListenerPolicyWithContext(context.Background(), getLoadBalancerListenerPolicyOptions) +} + +// GetLoadBalancerListenerPolicyWithContext is an alternate form of the GetLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerListenerPolicyWithContext(ctx context.Context, getLoadBalancerListenerPolicyOptions *GetLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerListenerPolicyOptions, "getLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyOptions.ListenerID, + "id": *getLoadBalancerListenerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateLoadBalancerListenerPolicy : Update a load balancer listener policy +// Updates a policy from a policy patch. +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicy(updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerListenerPolicyWithContext(context.Background(), updateLoadBalancerListenerPolicyOptions) +} + +// UpdateLoadBalancerListenerPolicyWithContext is an alternate form of the UpdateLoadBalancerListenerPolicy method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyWithContext(ctx context.Context, updateLoadBalancerListenerPolicyOptions *UpdateLoadBalancerListenerPolicyOptions) (result *LoadBalancerListenerPolicy, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateLoadBalancerListenerPolicyOptions, "updateLoadBalancerListenerPolicyOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerListenerPolicyOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyOptions.ListenerID, + "id": *updateLoadBalancerListenerPolicyOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerListenerPolicyOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicy") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyOptions.LoadBalancerListenerPolicyPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + response.Result = result + + return +} + +// ListLoadBalancerListenerPolicyRules : List all rules of a load balancer listener policy +// This request lists all rules of a load balancer listener policy. +func (vpc *VpcV1) ListLoadBalancerListenerPolicyRules(listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerListenerPolicyRulesWithContext(context.Background(), listLoadBalancerListenerPolicyRulesOptions) +} + +// ListLoadBalancerListenerPolicyRulesWithContext is an alternate form of the ListLoadBalancerListenerPolicyRules method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerListenerPolicyRulesWithContext(ctx context.Context, listLoadBalancerListenerPolicyRulesOptions *ListLoadBalancerListenerPolicyRulesOptions) (result *LoadBalancerListenerPolicyRuleCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listLoadBalancerListenerPolicyRulesOptions, "listLoadBalancerListenerPolicyRulesOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerListenerPolicyRulesOptions.LoadBalancerID, + "listener_id": *listLoadBalancerListenerPolicyRulesOptions.ListenerID, + "policy_id": *listLoadBalancerListenerPolicyRulesOptions.PolicyID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerListenerPolicyRulesOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerListenerPolicyRules") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRuleCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateLoadBalancerListenerPolicyRule : Create a rule for a load balancer listener policy +// Creates a new rule for the load balancer listener policy. +func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRule(createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerListenerPolicyRuleWithContext(context.Background(), createLoadBalancerListenerPolicyRuleOptions) +} + +// CreateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the CreateLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, createLoadBalancerListenerPolicyRuleOptions *CreateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createLoadBalancerListenerPolicyRuleOptions, "createLoadBalancerListenerPolicyRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *createLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *createLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *createLoadBalancerListenerPolicyRuleOptions.PolicyID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerListenerPolicyRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createLoadBalancerListenerPolicyRuleOptions.Condition != nil { + body["condition"] = createLoadBalancerListenerPolicyRuleOptions.Condition + } + if createLoadBalancerListenerPolicyRuleOptions.Type != nil { + body["type"] = createLoadBalancerListenerPolicyRuleOptions.Type + } + if createLoadBalancerListenerPolicyRuleOptions.Value != nil { + body["value"] = createLoadBalancerListenerPolicyRuleOptions.Value + } + if createLoadBalancerListenerPolicyRuleOptions.Field != nil { + body["field"] = createLoadBalancerListenerPolicyRuleOptions.Field + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteLoadBalancerListenerPolicyRule : Delete a load balancer listener policy rule +// Deletes a rule from the load balancer listener policy. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRule(deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerListenerPolicyRuleWithContext(context.Background(), deleteLoadBalancerListenerPolicyRuleOptions) +} + +// DeleteLoadBalancerListenerPolicyRuleWithContext is an alternate form of the DeleteLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, deleteLoadBalancerListenerPolicyRuleOptions *DeleteLoadBalancerListenerPolicyRuleOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteLoadBalancerListenerPolicyRuleOptions, "deleteLoadBalancerListenerPolicyRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *deleteLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *deleteLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *deleteLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *deleteLoadBalancerListenerPolicyRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerListenerPolicyRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetLoadBalancerListenerPolicyRule : Retrieve a load balancer listener policy rule +// Retrieves a single rule specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerListenerPolicyRule(getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerListenerPolicyRuleWithContext(context.Background(), getLoadBalancerListenerPolicyRuleOptions) +} + +// GetLoadBalancerListenerPolicyRuleWithContext is an alternate form of the GetLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, getLoadBalancerListenerPolicyRuleOptions *GetLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerListenerPolicyRuleOptions, "getLoadBalancerListenerPolicyRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *getLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *getLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *getLoadBalancerListenerPolicyRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerListenerPolicyRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateLoadBalancerListenerPolicyRule : Update a load balancer listener policy rule +// Updates a rule of the load balancer listener policy. +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRule(updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerListenerPolicyRuleWithContext(context.Background(), updateLoadBalancerListenerPolicyRuleOptions) +} + +// UpdateLoadBalancerListenerPolicyRuleWithContext is an alternate form of the UpdateLoadBalancerListenerPolicyRule method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerListenerPolicyRuleWithContext(ctx context.Context, updateLoadBalancerListenerPolicyRuleOptions *UpdateLoadBalancerListenerPolicyRuleOptions) (result *LoadBalancerListenerPolicyRule, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateLoadBalancerListenerPolicyRuleOptions, "updateLoadBalancerListenerPolicyRuleOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerID, + "listener_id": *updateLoadBalancerListenerPolicyRuleOptions.ListenerID, + "policy_id": *updateLoadBalancerListenerPolicyRuleOptions.PolicyID, + "id": *updateLoadBalancerListenerPolicyRuleOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/listeners/{listener_id}/policies/{policy_id}/rules/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerListenerPolicyRuleOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerListenerPolicyRule") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerListenerPolicyRuleOptions.LoadBalancerListenerPolicyRulePatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + response.Result = result + + return +} + +// ListLoadBalancerPools : List all pools of a load balancer +// This request lists all pools of a load balancer. +func (vpc *VpcV1) ListLoadBalancerPools(listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerPoolsWithContext(context.Background(), listLoadBalancerPoolsOptions) +} + +// ListLoadBalancerPoolsWithContext is an alternate form of the ListLoadBalancerPools method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerPoolsWithContext(ctx context.Context, listLoadBalancerPoolsOptions *ListLoadBalancerPoolsOptions) (result *LoadBalancerPoolCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listLoadBalancerPoolsOptions, "listLoadBalancerPoolsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerPoolsOptions.LoadBalancerID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerPoolsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPools") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateLoadBalancerPool : Create a load balancer pool +// This request creates a new pool from a pool prototype object. +func (vpc *VpcV1) CreateLoadBalancerPool(createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerPoolWithContext(context.Background(), createLoadBalancerPoolOptions) +} + +// CreateLoadBalancerPoolWithContext is an alternate form of the CreateLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerPoolWithContext(ctx context.Context, createLoadBalancerPoolOptions *CreateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createLoadBalancerPoolOptions, "createLoadBalancerPoolOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *createLoadBalancerPoolOptions.LoadBalancerID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPool") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createLoadBalancerPoolOptions.Algorithm != nil { + body["algorithm"] = createLoadBalancerPoolOptions.Algorithm + } + if createLoadBalancerPoolOptions.HealthMonitor != nil { + body["health_monitor"] = createLoadBalancerPoolOptions.HealthMonitor + } + if createLoadBalancerPoolOptions.Protocol != nil { + body["protocol"] = createLoadBalancerPoolOptions.Protocol + } + if createLoadBalancerPoolOptions.Members != nil { + body["members"] = createLoadBalancerPoolOptions.Members + } + if createLoadBalancerPoolOptions.Name != nil { + body["name"] = createLoadBalancerPoolOptions.Name + } + if createLoadBalancerPoolOptions.ProxyProtocol != nil { + body["proxy_protocol"] = createLoadBalancerPoolOptions.ProxyProtocol + } + if createLoadBalancerPoolOptions.SessionPersistence != nil { + body["session_persistence"] = createLoadBalancerPoolOptions.SessionPersistence + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteLoadBalancerPool : Delete a load balancer pool +// This request deletes a load balancer pool. This operation cannot be reversed. The pool must not currently be the +// default pool for any listener in the load balancer. +func (vpc *VpcV1) DeleteLoadBalancerPool(deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerPoolWithContext(context.Background(), deleteLoadBalancerPoolOptions) +} + +// DeleteLoadBalancerPoolWithContext is an alternate form of the DeleteLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerPoolWithContext(ctx context.Context, deleteLoadBalancerPoolOptions *DeleteLoadBalancerPoolOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteLoadBalancerPoolOptions, "deleteLoadBalancerPoolOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *deleteLoadBalancerPoolOptions.LoadBalancerID, + "id": *deleteLoadBalancerPoolOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPool") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetLoadBalancerPool : Retrieve a load balancer pool +// This request retrieves a single pool specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerPool(getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerPoolWithContext(context.Background(), getLoadBalancerPoolOptions) +} + +// GetLoadBalancerPoolWithContext is an alternate form of the GetLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerPoolWithContext(ctx context.Context, getLoadBalancerPoolOptions *GetLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerPoolOptions, "getLoadBalancerPoolOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerPoolOptions.LoadBalancerID, + "id": *getLoadBalancerPoolOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPool") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateLoadBalancerPool : Update a load balancer pool +// This request updates a load balancer pool from a pool patch. +func (vpc *VpcV1) UpdateLoadBalancerPool(updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerPoolWithContext(context.Background(), updateLoadBalancerPoolOptions) +} + +// UpdateLoadBalancerPoolWithContext is an alternate form of the UpdateLoadBalancerPool method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerPoolWithContext(ctx context.Context, updateLoadBalancerPoolOptions *UpdateLoadBalancerPoolOptions) (result *LoadBalancerPool, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateLoadBalancerPoolOptions, "updateLoadBalancerPoolOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerPoolOptions.LoadBalancerID, + "id": *updateLoadBalancerPoolOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerPoolOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPool") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolOptions.LoadBalancerPoolPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPool) + if err != nil { + return + } + response.Result = result + + return +} + +// ListLoadBalancerPoolMembers : List all members of a load balancer pool +// This request lists all members of a load balancer pool. +func (vpc *VpcV1) ListLoadBalancerPoolMembers(listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + return vpc.ListLoadBalancerPoolMembersWithContext(context.Background(), listLoadBalancerPoolMembersOptions) +} + +// ListLoadBalancerPoolMembersWithContext is an alternate form of the ListLoadBalancerPoolMembers method which supports a Context parameter +func (vpc *VpcV1) ListLoadBalancerPoolMembersWithContext(ctx context.Context, listLoadBalancerPoolMembersOptions *ListLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listLoadBalancerPoolMembersOptions, "listLoadBalancerPoolMembersOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *listLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *listLoadBalancerPoolMembersOptions.PoolID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listLoadBalancerPoolMembersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListLoadBalancerPoolMembers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateLoadBalancerPoolMember : Create a member in a load balancer pool +// This request creates a new member and adds the member to the pool. +func (vpc *VpcV1) CreateLoadBalancerPoolMember(createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + return vpc.CreateLoadBalancerPoolMemberWithContext(context.Background(), createLoadBalancerPoolMemberOptions) +} + +// CreateLoadBalancerPoolMemberWithContext is an alternate form of the CreateLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) CreateLoadBalancerPoolMemberWithContext(ctx context.Context, createLoadBalancerPoolMemberOptions *CreateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createLoadBalancerPoolMemberOptions, "createLoadBalancerPoolMemberOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *createLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *createLoadBalancerPoolMemberOptions.PoolID, + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range createLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createLoadBalancerPoolMemberOptions.Port != nil { + body["port"] = createLoadBalancerPoolMemberOptions.Port + } + if createLoadBalancerPoolMemberOptions.Target != nil { + body["target"] = createLoadBalancerPoolMemberOptions.Target + } + if createLoadBalancerPoolMemberOptions.Weight != nil { + body["weight"] = createLoadBalancerPoolMemberOptions.Weight + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + response.Result = result + + return +} + +// ReplaceLoadBalancerPoolMembers : Replace load balancer pool members +// This request replaces the existing members of the load balancer pool with new members created from the collection of +// member prototype objects. +func (vpc *VpcV1) ReplaceLoadBalancerPoolMembers(replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + return vpc.ReplaceLoadBalancerPoolMembersWithContext(context.Background(), replaceLoadBalancerPoolMembersOptions) +} + +// ReplaceLoadBalancerPoolMembersWithContext is an alternate form of the ReplaceLoadBalancerPoolMembers method which supports a Context parameter +func (vpc *VpcV1) ReplaceLoadBalancerPoolMembersWithContext(ctx context.Context, replaceLoadBalancerPoolMembersOptions *ReplaceLoadBalancerPoolMembersOptions) (result *LoadBalancerPoolMemberCollection, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(replaceLoadBalancerPoolMembersOptions, "replaceLoadBalancerPoolMembersOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *replaceLoadBalancerPoolMembersOptions.LoadBalancerID, + "pool_id": *replaceLoadBalancerPoolMembersOptions.PoolID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range replaceLoadBalancerPoolMembersOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ReplaceLoadBalancerPoolMembers") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if replaceLoadBalancerPoolMembersOptions.Members != nil { + body["members"] = replaceLoadBalancerPoolMembersOptions.Members + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMemberCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteLoadBalancerPoolMember : Delete a load balancer pool member +// This request deletes a member from the pool. This operation cannot be reversed. +func (vpc *VpcV1) DeleteLoadBalancerPoolMember(deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteLoadBalancerPoolMemberWithContext(context.Background(), deleteLoadBalancerPoolMemberOptions) +} + +// DeleteLoadBalancerPoolMemberWithContext is an alternate form of the DeleteLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) DeleteLoadBalancerPoolMemberWithContext(ctx context.Context, deleteLoadBalancerPoolMemberOptions *DeleteLoadBalancerPoolMemberOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteLoadBalancerPoolMemberOptions, "deleteLoadBalancerPoolMemberOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *deleteLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *deleteLoadBalancerPoolMemberOptions.PoolID, + "id": *deleteLoadBalancerPoolMemberOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetLoadBalancerPoolMember : Retrieve a load balancer pool member +// This request retrieves a single member specified by the identifier in the URL path. +func (vpc *VpcV1) GetLoadBalancerPoolMember(getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + return vpc.GetLoadBalancerPoolMemberWithContext(context.Background(), getLoadBalancerPoolMemberOptions) +} + +// GetLoadBalancerPoolMemberWithContext is an alternate form of the GetLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) GetLoadBalancerPoolMemberWithContext(ctx context.Context, getLoadBalancerPoolMemberOptions *GetLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getLoadBalancerPoolMemberOptions, "getLoadBalancerPoolMemberOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *getLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *getLoadBalancerPoolMemberOptions.PoolID, + "id": *getLoadBalancerPoolMemberOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateLoadBalancerPoolMember : Update a load balancer pool member +// This request updates an existing member from a member patch. +func (vpc *VpcV1) UpdateLoadBalancerPoolMember(updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + return vpc.UpdateLoadBalancerPoolMemberWithContext(context.Background(), updateLoadBalancerPoolMemberOptions) +} + +// UpdateLoadBalancerPoolMemberWithContext is an alternate form of the UpdateLoadBalancerPoolMember method which supports a Context parameter +func (vpc *VpcV1) UpdateLoadBalancerPoolMemberWithContext(ctx context.Context, updateLoadBalancerPoolMemberOptions *UpdateLoadBalancerPoolMemberOptions) (result *LoadBalancerPoolMember, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateLoadBalancerPoolMemberOptions, "updateLoadBalancerPoolMemberOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "load_balancer_id": *updateLoadBalancerPoolMemberOptions.LoadBalancerID, + "pool_id": *updateLoadBalancerPoolMemberOptions.PoolID, + "id": *updateLoadBalancerPoolMemberOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/load_balancers/{load_balancer_id}/pools/{pool_id}/members/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateLoadBalancerPoolMemberOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateLoadBalancerPoolMember") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateLoadBalancerPoolMemberOptions.LoadBalancerPoolMemberPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + response.Result = result + + return +} + +// ListEndpointGateways : List all endpoint gateways +// This request lists all endpoint gateways in the region. An endpoint gateway maps one or more reserved IPs in a VPC to +// a target outside the VPC. +func (vpc *VpcV1) ListEndpointGateways(listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { + return vpc.ListEndpointGatewaysWithContext(context.Background(), listEndpointGatewaysOptions) +} + +// ListEndpointGatewaysWithContext is an alternate form of the ListEndpointGateways method which supports a Context parameter +func (vpc *VpcV1) ListEndpointGatewaysWithContext(ctx context.Context, listEndpointGatewaysOptions *ListEndpointGatewaysOptions) (result *EndpointGatewayCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listEndpointGatewaysOptions, "listEndpointGatewaysOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listEndpointGatewaysOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGateways") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listEndpointGatewaysOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listEndpointGatewaysOptions.Name)) + } + if listEndpointGatewaysOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listEndpointGatewaysOptions.Start)) + } + if listEndpointGatewaysOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewaysOptions.Limit)) + } + if listEndpointGatewaysOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listEndpointGatewaysOptions.ResourceGroupID)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGatewayCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateEndpointGateway : Create an endpoint gateway +// This request creates a new endpoint gateway. An endpoint gateway maps one or more reserved IPs in a VPC to a target +// outside the VPC. +func (vpc *VpcV1) CreateEndpointGateway(createEndpointGatewayOptions *CreateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + return vpc.CreateEndpointGatewayWithContext(context.Background(), createEndpointGatewayOptions) +} + +// CreateEndpointGatewayWithContext is an alternate form of the CreateEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) CreateEndpointGatewayWithContext(ctx context.Context, createEndpointGatewayOptions *CreateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createEndpointGatewayOptions, "createEndpointGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createEndpointGatewayOptions, "createEndpointGatewayOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createEndpointGatewayOptions.Target != nil { + body["target"] = createEndpointGatewayOptions.Target + } + if createEndpointGatewayOptions.VPC != nil { + body["vpc"] = createEndpointGatewayOptions.VPC + } + if createEndpointGatewayOptions.Ips != nil { + body["ips"] = createEndpointGatewayOptions.Ips + } + if createEndpointGatewayOptions.Name != nil { + body["name"] = createEndpointGatewayOptions.Name + } + if createEndpointGatewayOptions.ResourceGroup != nil { + body["resource_group"] = createEndpointGatewayOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + + return +} + +// ListEndpointGatewayIps : List all reserved IPs bound to an endpoint gateway +// This request lists all reserved IPs bound to an endpoint gateway. +func (vpc *VpcV1) ListEndpointGatewayIps(listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { + return vpc.ListEndpointGatewayIpsWithContext(context.Background(), listEndpointGatewayIpsOptions) +} + +// ListEndpointGatewayIpsWithContext is an alternate form of the ListEndpointGatewayIps method which supports a Context parameter +func (vpc *VpcV1) ListEndpointGatewayIpsWithContext(ctx context.Context, listEndpointGatewayIpsOptions *ListEndpointGatewayIpsOptions) (result *ReservedIPCollectionEndpointGatewayContext, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(listEndpointGatewayIpsOptions, "listEndpointGatewayIpsOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *listEndpointGatewayIpsOptions.EndpointGatewayID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range listEndpointGatewayIpsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListEndpointGatewayIps") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listEndpointGatewayIpsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listEndpointGatewayIpsOptions.Start)) + } + if listEndpointGatewayIpsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listEndpointGatewayIpsOptions.Limit)) + } + if listEndpointGatewayIpsOptions.Sort != nil { + builder.AddQuery("sort", fmt.Sprint(*listEndpointGatewayIpsOptions.Sort)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIPCollectionEndpointGatewayContext) + if err != nil { + return + } + response.Result = result + + return +} + +// RemoveEndpointGatewayIP : Unbind a reserved IP from an endpoint gateway +// This request unbinds the specified reserved IP from the specified endpoint gateway. If the reserved IP has +// `auto_delete` set to `true`, the reserved IP will be deleted. +func (vpc *VpcV1) RemoveEndpointGatewayIP(removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { + return vpc.RemoveEndpointGatewayIPWithContext(context.Background(), removeEndpointGatewayIPOptions) +} + +// RemoveEndpointGatewayIPWithContext is an alternate form of the RemoveEndpointGatewayIP method which supports a Context parameter +func (vpc *VpcV1) RemoveEndpointGatewayIPWithContext(ctx context.Context, removeEndpointGatewayIPOptions *RemoveEndpointGatewayIPOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(removeEndpointGatewayIPOptions, "removeEndpointGatewayIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *removeEndpointGatewayIPOptions.EndpointGatewayID, + "id": *removeEndpointGatewayIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range removeEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "RemoveEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetEndpointGatewayIP : Retrieve a reserved IP bound to an endpoint gateway +// This request a retrieves the specified reserved IP address if it is bound to the endpoint gateway specified in the +// URL. +func (vpc *VpcV1) GetEndpointGatewayIP(getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.GetEndpointGatewayIPWithContext(context.Background(), getEndpointGatewayIPOptions) +} + +// GetEndpointGatewayIPWithContext is an alternate form of the GetEndpointGatewayIP method which supports a Context parameter +func (vpc *VpcV1) GetEndpointGatewayIPWithContext(ctx context.Context, getEndpointGatewayIPOptions *GetEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getEndpointGatewayIPOptions, "getEndpointGatewayIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *getEndpointGatewayIPOptions.EndpointGatewayID, + "id": *getEndpointGatewayIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + + return +} + +// AddEndpointGatewayIP : Bind a reserved IP to an endpoint gateway +// This request binds the specified reserved IP to the specified endpoint gateway. The reserved IP: +// +// - must currently be unbound +// - must not be in the same zone as any other reserved IP bound to the endpoint gateway. +func (vpc *VpcV1) AddEndpointGatewayIP(addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + return vpc.AddEndpointGatewayIPWithContext(context.Background(), addEndpointGatewayIPOptions) +} + +// AddEndpointGatewayIPWithContext is an alternate form of the AddEndpointGatewayIP method which supports a Context parameter +func (vpc *VpcV1) AddEndpointGatewayIPWithContext(ctx context.Context, addEndpointGatewayIPOptions *AddEndpointGatewayIPOptions) (result *ReservedIP, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(addEndpointGatewayIPOptions, "addEndpointGatewayIPOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "endpoint_gateway_id": *addEndpointGatewayIPOptions.EndpointGatewayID, + "id": *addEndpointGatewayIPOptions.ID, + } + + builder := core.NewRequestBuilder(core.PUT) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{endpoint_gateway_id}/ips/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range addEndpointGatewayIPOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "AddEndpointGatewayIP") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalReservedIP) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteEndpointGateway : Delete an endpoint gateway +// This request deletes an endpoint gateway. This operation cannot be reversed. +// +// Reserved IPs that were bound to the endpoint gateway will be released if their +// `auto_delete` property is set to true. +func (vpc *VpcV1) DeleteEndpointGateway(deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteEndpointGatewayWithContext(context.Background(), deleteEndpointGatewayOptions) +} + +// DeleteEndpointGatewayWithContext is an alternate form of the DeleteEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) DeleteEndpointGatewayWithContext(ctx context.Context, deleteEndpointGatewayOptions *DeleteEndpointGatewayOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteEndpointGatewayOptions, "deleteEndpointGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteEndpointGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetEndpointGateway : Retrieve an endpoint gateway +// This request retrieves a single endpoint gateway specified by the identifier in the URL. +func (vpc *VpcV1) GetEndpointGateway(getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + return vpc.GetEndpointGatewayWithContext(context.Background(), getEndpointGatewayOptions) +} + +// GetEndpointGatewayWithContext is an alternate form of the GetEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) GetEndpointGatewayWithContext(ctx context.Context, getEndpointGatewayOptions *GetEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getEndpointGatewayOptions, "getEndpointGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getEndpointGatewayOptions, "getEndpointGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getEndpointGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateEndpointGateway : Update an endpoint gateway +// This request updates an endpoint gateway's name. +func (vpc *VpcV1) UpdateEndpointGateway(updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + return vpc.UpdateEndpointGatewayWithContext(context.Background(), updateEndpointGatewayOptions) +} + +// UpdateEndpointGatewayWithContext is an alternate form of the UpdateEndpointGateway method which supports a Context parameter +func (vpc *VpcV1) UpdateEndpointGatewayWithContext(ctx context.Context, updateEndpointGatewayOptions *UpdateEndpointGatewayOptions) (result *EndpointGateway, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateEndpointGatewayOptions, "updateEndpointGatewayOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateEndpointGatewayOptions, "updateEndpointGatewayOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateEndpointGatewayOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/endpoint_gateways/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateEndpointGatewayOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateEndpointGateway") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateEndpointGatewayOptions.EndpointGatewayPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalEndpointGateway) + if err != nil { + return + } + response.Result = result + + return +} + +// ListFlowLogCollectors : List all flow log collectors +// This request lists all flow log collectors in the region. A flow log collector summarizes data sent over one or more +// network interfaces within a VPC, depending on the chosen target. +func (vpc *VpcV1) ListFlowLogCollectors(listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { + return vpc.ListFlowLogCollectorsWithContext(context.Background(), listFlowLogCollectorsOptions) +} + +// ListFlowLogCollectorsWithContext is an alternate form of the ListFlowLogCollectors method which supports a Context parameter +func (vpc *VpcV1) ListFlowLogCollectorsWithContext(ctx context.Context, listFlowLogCollectorsOptions *ListFlowLogCollectorsOptions) (result *FlowLogCollectorCollection, response *core.DetailedResponse, err error) { + err = core.ValidateStruct(listFlowLogCollectorsOptions, "listFlowLogCollectorsOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) + if err != nil { + return + } + + for headerName, headerValue := range listFlowLogCollectorsOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "ListFlowLogCollectors") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + if listFlowLogCollectorsOptions.Start != nil { + builder.AddQuery("start", fmt.Sprint(*listFlowLogCollectorsOptions.Start)) + } + if listFlowLogCollectorsOptions.Limit != nil { + builder.AddQuery("limit", fmt.Sprint(*listFlowLogCollectorsOptions.Limit)) + } + if listFlowLogCollectorsOptions.ResourceGroupID != nil { + builder.AddQuery("resource_group.id", fmt.Sprint(*listFlowLogCollectorsOptions.ResourceGroupID)) + } + if listFlowLogCollectorsOptions.Name != nil { + builder.AddQuery("name", fmt.Sprint(*listFlowLogCollectorsOptions.Name)) + } + if listFlowLogCollectorsOptions.VPCID != nil { + builder.AddQuery("vpc.id", fmt.Sprint(*listFlowLogCollectorsOptions.VPCID)) + } + if listFlowLogCollectorsOptions.VPCCRN != nil { + builder.AddQuery("vpc.crn", fmt.Sprint(*listFlowLogCollectorsOptions.VPCCRN)) + } + if listFlowLogCollectorsOptions.VPCName != nil { + builder.AddQuery("vpc.name", fmt.Sprint(*listFlowLogCollectorsOptions.VPCName)) + } + if listFlowLogCollectorsOptions.TargetID != nil { + builder.AddQuery("target.id", fmt.Sprint(*listFlowLogCollectorsOptions.TargetID)) + } + if listFlowLogCollectorsOptions.TargetResourceType != nil { + builder.AddQuery("target.resource_type", fmt.Sprint(*listFlowLogCollectorsOptions.TargetResourceType)) + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollectorCollection) + if err != nil { + return + } + response.Result = result + + return +} + +// CreateFlowLogCollector : Create a flow log collector +// This request creates and starts a new flow log collector from a flow log collector prototype object. The prototype +// object is structured in the same way as a retrieved flow log collector, and contains the information necessary to +// create and start the new flow log collector. +func (vpc *VpcV1) CreateFlowLogCollector(createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + return vpc.CreateFlowLogCollectorWithContext(context.Background(), createFlowLogCollectorOptions) +} + +// CreateFlowLogCollectorWithContext is an alternate form of the CreateFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) CreateFlowLogCollectorWithContext(ctx context.Context, createFlowLogCollectorOptions *CreateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(createFlowLogCollectorOptions, "createFlowLogCollectorOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(createFlowLogCollectorOptions, "createFlowLogCollectorOptions") + if err != nil { + return + } + + builder := core.NewRequestBuilder(core.POST) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors`, nil) + if err != nil { + return + } + + for headerName, headerValue := range createFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "CreateFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + body := make(map[string]interface{}) + if createFlowLogCollectorOptions.StorageBucket != nil { + body["storage_bucket"] = createFlowLogCollectorOptions.StorageBucket + } + if createFlowLogCollectorOptions.Target != nil { + body["target"] = createFlowLogCollectorOptions.Target + } + if createFlowLogCollectorOptions.Active != nil { + body["active"] = createFlowLogCollectorOptions.Active + } + if createFlowLogCollectorOptions.Name != nil { + body["name"] = createFlowLogCollectorOptions.Name + } + if createFlowLogCollectorOptions.ResourceGroup != nil { + body["resource_group"] = createFlowLogCollectorOptions.ResourceGroup + } + _, err = builder.SetBodyContentJSON(body) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + + return +} + +// DeleteFlowLogCollector : Delete a flow log collector +// This request stops and deletes a flow log collector. Collected flow logs remain available within the flow log +// collector's bucket. +func (vpc *VpcV1) DeleteFlowLogCollector(deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions) (response *core.DetailedResponse, err error) { + return vpc.DeleteFlowLogCollectorWithContext(context.Background(), deleteFlowLogCollectorOptions) +} + +// DeleteFlowLogCollectorWithContext is an alternate form of the DeleteFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) DeleteFlowLogCollectorWithContext(ctx context.Context, deleteFlowLogCollectorOptions *DeleteFlowLogCollectorOptions) (response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(deleteFlowLogCollectorOptions, "deleteFlowLogCollectorOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *deleteFlowLogCollectorOptions.ID, + } + + builder := core.NewRequestBuilder(core.DELETE) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range deleteFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "DeleteFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + response, err = vpc.Service.Request(request, nil) + + return +} + +// GetFlowLogCollector : Retrieve a flow log collector +// This request retrieves a single flow log collector specified by the identifier in the URL. +func (vpc *VpcV1) GetFlowLogCollector(getFlowLogCollectorOptions *GetFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + return vpc.GetFlowLogCollectorWithContext(context.Background(), getFlowLogCollectorOptions) +} + +// GetFlowLogCollectorWithContext is an alternate form of the GetFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) GetFlowLogCollectorWithContext(ctx context.Context, getFlowLogCollectorOptions *GetFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(getFlowLogCollectorOptions, "getFlowLogCollectorOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(getFlowLogCollectorOptions, "getFlowLogCollectorOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *getFlowLogCollectorOptions.ID, + } + + builder := core.NewRequestBuilder(core.GET) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range getFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "GetFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + + return +} + +// UpdateFlowLogCollector : Update a flow log collector +// This request updates a flow log collector with the information in a provided flow log collector patch. The flow log +// collector patch object is structured in the same way as a retrieved flow log collector and contains only the +// information to be updated. +func (vpc *VpcV1) UpdateFlowLogCollector(updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + return vpc.UpdateFlowLogCollectorWithContext(context.Background(), updateFlowLogCollectorOptions) +} + +// UpdateFlowLogCollectorWithContext is an alternate form of the UpdateFlowLogCollector method which supports a Context parameter +func (vpc *VpcV1) UpdateFlowLogCollectorWithContext(ctx context.Context, updateFlowLogCollectorOptions *UpdateFlowLogCollectorOptions) (result *FlowLogCollector, response *core.DetailedResponse, err error) { + err = core.ValidateNotNil(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions cannot be nil") + if err != nil { + return + } + err = core.ValidateStruct(updateFlowLogCollectorOptions, "updateFlowLogCollectorOptions") + if err != nil { + return + } + + pathParamsMap := map[string]string{ + "id": *updateFlowLogCollectorOptions.ID, + } + + builder := core.NewRequestBuilder(core.PATCH) + builder = builder.WithContext(ctx) + builder.EnableGzipCompression = vpc.GetEnableGzipCompression() + _, err = builder.ResolveRequestURL(vpc.Service.Options.URL, `/flow_log_collectors/{id}`, pathParamsMap) + if err != nil { + return + } + + for headerName, headerValue := range updateFlowLogCollectorOptions.Headers { + builder.AddHeader(headerName, headerValue) + } + + sdkHeaders := common.GetSdkHeaders("vpc", "V1", "UpdateFlowLogCollector") + for headerName, headerValue := range sdkHeaders { + builder.AddHeader(headerName, headerValue) + } + builder.AddHeader("Accept", "application/json") + builder.AddHeader("Content-Type", "application/merge-patch+json") + + builder.AddQuery("version", fmt.Sprint(*vpc.Version)) + builder.AddQuery("generation", fmt.Sprint(*vpc.generation)) + + _, err = builder.SetBodyContentJSON(updateFlowLogCollectorOptions.FlowLogCollectorPatch) + if err != nil { + return + } + + request, err := builder.Build() + if err != nil { + return + } + + var rawResponse map[string]json.RawMessage + response, err = vpc.Service.Request(request, &rawResponse) + if err != nil { + return + } + err = core.UnmarshalModel(rawResponse, "", &result, UnmarshalFlowLogCollector) + if err != nil { + return + } + response.Result = result + + return +} + +// AddEndpointGatewayIPOptions : The AddEndpointGatewayIP options. +type AddEndpointGatewayIPOptions struct { + // The endpoint gateway identifier. + EndpointGatewayID *string `validate:"required,ne="` + + // The reserved IP identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddEndpointGatewayIPOptions : Instantiate AddEndpointGatewayIPOptions +func (*VpcV1) NewAddEndpointGatewayIPOptions(endpointGatewayID string, id string) *AddEndpointGatewayIPOptions { + return &AddEndpointGatewayIPOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + ID: core.StringPtr(id), + } +} + +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (options *AddEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *AddEndpointGatewayIPOptions { + options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return options +} + +// SetID : Allow user to set ID +func (options *AddEndpointGatewayIPOptions) SetID(id string) *AddEndpointGatewayIPOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *AddEndpointGatewayIPOptions) SetHeaders(param map[string]string) *AddEndpointGatewayIPOptions { + options.Headers = param + return options +} + +// AddInstanceNetworkInterfaceFloatingIPOptions : The AddInstanceNetworkInterfaceFloatingIP options. +type AddInstanceNetworkInterfaceFloatingIPOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The network interface identifier. + NetworkInterfaceID *string `validate:"required,ne="` + + // The floating IP identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddInstanceNetworkInterfaceFloatingIPOptions : Instantiate AddInstanceNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewAddInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *AddInstanceNetworkInterfaceFloatingIPOptions { + return &AddInstanceNetworkInterfaceFloatingIPOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *AddInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *AddInstanceNetworkInterfaceFloatingIPOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (options *AddInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *AddInstanceNetworkInterfaceFloatingIPOptions { + options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return options +} + +// SetID : Allow user to set ID +func (options *AddInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *AddInstanceNetworkInterfaceFloatingIPOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *AddInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *AddInstanceNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// AddSecurityGroupNetworkInterfaceOptions : The AddSecurityGroupNetworkInterface options. +type AddSecurityGroupNetworkInterfaceOptions struct { + // The security group identifier. + SecurityGroupID *string `validate:"required,ne="` + + // The network interface identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddSecurityGroupNetworkInterfaceOptions : Instantiate AddSecurityGroupNetworkInterfaceOptions +func (*VpcV1) NewAddSecurityGroupNetworkInterfaceOptions(securityGroupID string, id string) *AddSecurityGroupNetworkInterfaceOptions { + return &AddSecurityGroupNetworkInterfaceOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (options *AddSecurityGroupNetworkInterfaceOptions) SetSecurityGroupID(securityGroupID string) *AddSecurityGroupNetworkInterfaceOptions { + options.SecurityGroupID = core.StringPtr(securityGroupID) + return options +} + +// SetID : Allow user to set ID +func (options *AddSecurityGroupNetworkInterfaceOptions) SetID(id string) *AddSecurityGroupNetworkInterfaceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *AddSecurityGroupNetworkInterfaceOptions) SetHeaders(param map[string]string) *AddSecurityGroupNetworkInterfaceOptions { + options.Headers = param + return options +} + +// AddVPNGatewayConnectionLocalCIDROptions : The AddVPNGatewayConnectionLocalCIDR options. +type AddVPNGatewayConnectionLocalCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `validate:"required,ne="` + + // The address prefix part of the CIDR. + CIDRPrefix *string `validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddVPNGatewayConnectionLocalCIDROptions : Instantiate AddVPNGatewayConnectionLocalCIDROptions +func (*VpcV1) NewAddVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { + return &AddVPNGatewayConnectionLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (options *AddVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionLocalCIDROptions { + options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return options +} + +// SetID : Allow user to set ID +func (options *AddVPNGatewayConnectionLocalCIDROptions) SetID(id string) *AddVPNGatewayConnectionLocalCIDROptions { + options.ID = core.StringPtr(id) + return options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (options *AddVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionLocalCIDROptions { + options.CIDRPrefix = core.StringPtr(cidrPrefix) + return options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (options *AddVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionLocalCIDROptions { + options.PrefixLength = core.StringPtr(prefixLength) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionLocalCIDROptions { + options.Headers = param + return options +} + +// AddVPNGatewayConnectionPeerCIDROptions : The AddVPNGatewayConnectionPeerCIDR options. +type AddVPNGatewayConnectionPeerCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `validate:"required,ne="` + + // The address prefix part of the CIDR. + CIDRPrefix *string `validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewAddVPNGatewayConnectionPeerCIDROptions : Instantiate AddVPNGatewayConnectionPeerCIDROptions +func (*VpcV1) NewAddVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { + return &AddVPNGatewayConnectionPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (options *AddVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *AddVPNGatewayConnectionPeerCIDROptions { + options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return options +} + +// SetID : Allow user to set ID +func (options *AddVPNGatewayConnectionPeerCIDROptions) SetID(id string) *AddVPNGatewayConnectionPeerCIDROptions { + options.ID = core.StringPtr(id) + return options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (options *AddVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *AddVPNGatewayConnectionPeerCIDROptions { + options.CIDRPrefix = core.StringPtr(cidrPrefix) + return options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (options *AddVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *AddVPNGatewayConnectionPeerCIDROptions { + options.PrefixLength = core.StringPtr(prefixLength) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *AddVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *AddVPNGatewayConnectionPeerCIDROptions { + options.Headers = param + return options +} + +// AddressPrefix : AddressPrefix struct +type AddressPrefix struct { + // The CIDR block for this prefix. + CIDR *string `json:"cidr" validate:"required"` + + // The date and time that the prefix was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // Indicates whether subnets exist with addresses from this prefix. + HasSubnets *bool `json:"has_subnets" validate:"required"` + + // The URL for this address prefix. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this address prefix. + ID *string `json:"id" validate:"required"` + + // Indicates whether this is the default prefix for this zone in this VPC. If a default prefix was automatically + // created when the VPC was created, the prefix is automatically named using a hyphenated list of randomly-selected + // words, but may be updated with a user-specified name. + IsDefault *bool `json:"is_default" validate:"required"` + + // The user-defined name for this address prefix. Names must be unique within the VPC the address prefix resides in. + Name *string `json:"name" validate:"required"` + + // The zone this address prefix resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalAddressPrefix unmarshals an instance of AddressPrefix from the specified map of raw messages. +func UnmarshalAddressPrefix(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefix) + err = core.UnmarshalPrimitive(m, "cidr", &obj.CIDR) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "has_subnets", &obj.HasSubnets) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AddressPrefixCollection : AddressPrefixCollection struct +type AddressPrefixCollection struct { + // Collection of address prefixes. + AddressPrefixes []AddressPrefix `json:"address_prefixes" validate:"required"` + + // A link to the first page of resources. + First *AddressPrefixCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *AddressPrefixCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalAddressPrefixCollection unmarshals an instance of AddressPrefixCollection from the specified map of raw messages. +func UnmarshalAddressPrefixCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefixCollection) + err = core.UnmarshalModel(m, "address_prefixes", &obj.AddressPrefixes, UnmarshalAddressPrefix) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalAddressPrefixCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalAddressPrefixCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AddressPrefixCollectionFirst : A link to the first page of resources. +type AddressPrefixCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalAddressPrefixCollectionFirst unmarshals an instance of AddressPrefixCollectionFirst from the specified map of raw messages. +func UnmarshalAddressPrefixCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefixCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AddressPrefixCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type AddressPrefixCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalAddressPrefixCollectionNext unmarshals an instance of AddressPrefixCollectionNext from the specified map of raw messages. +func UnmarshalAddressPrefixCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefixCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AddressPrefixPatch : AddressPrefixPatch struct +type AddressPrefixPatch struct { + // Indicates whether this is the default prefix for this zone in this VPC. Updating to true makes this prefix the + // default prefix for this zone in this VPC, provided the VPC currently has no default address prefix for this zone. + // Updating to false removes the default prefix for this zone in this VPC. + IsDefault *bool `json:"is_default,omitempty"` + + // The user-defined name for this address prefix. Names must be unique within the VPC the address prefix resides in. + Name *string `json:"name,omitempty"` +} + +// UnmarshalAddressPrefixPatch unmarshals an instance of AddressPrefixPatch from the specified map of raw messages. +func UnmarshalAddressPrefixPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(AddressPrefixPatch) + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the AddressPrefixPatch +func (addressPrefixPatch *AddressPrefixPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(addressPrefixPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// CertificateInstanceIdentity : Identifies a certificate instance by a unique property. +// Models which "extend" this model: +// - CertificateInstanceIdentityByCRN +type CertificateInstanceIdentity struct { + // The CRN for this certificate instance. + CRN *string `json:"crn,omitempty"` +} + +func (*CertificateInstanceIdentity) isaCertificateInstanceIdentity() bool { + return true +} + +type CertificateInstanceIdentityIntf interface { + isaCertificateInstanceIdentity() bool +} + +// UnmarshalCertificateInstanceIdentity unmarshals an instance of CertificateInstanceIdentity from the specified map of raw messages. +func UnmarshalCertificateInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CertificateInstanceIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CertificateInstanceReference : CertificateInstanceReference struct +type CertificateInstanceReference struct { + // The CRN for this certificate instance. + CRN *string `json:"crn" validate:"required"` +} + +// UnmarshalCertificateInstanceReference unmarshals an instance of CertificateInstanceReference from the specified map of raw messages. +func UnmarshalCertificateInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CertificateInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CheckVPNGatewayConnectionLocalCIDROptions : The CheckVPNGatewayConnectionLocalCIDR options. +type CheckVPNGatewayConnectionLocalCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `validate:"required,ne="` + + // The address prefix part of the CIDR. + CIDRPrefix *string `validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCheckVPNGatewayConnectionLocalCIDROptions : Instantiate CheckVPNGatewayConnectionLocalCIDROptions +func (*VpcV1) NewCheckVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { + return &CheckVPNGatewayConnectionLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (options *CheckVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionLocalCIDROptions { + options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return options +} + +// SetID : Allow user to set ID +func (options *CheckVPNGatewayConnectionLocalCIDROptions) SetID(id string) *CheckVPNGatewayConnectionLocalCIDROptions { + options.ID = core.StringPtr(id) + return options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (options *CheckVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *CheckVPNGatewayConnectionLocalCIDROptions { + options.CIDRPrefix = core.StringPtr(cidrPrefix) + return options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (options *CheckVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *CheckVPNGatewayConnectionLocalCIDROptions { + options.PrefixLength = core.StringPtr(prefixLength) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CheckVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionLocalCIDROptions { + options.Headers = param + return options +} + +// CheckVPNGatewayConnectionPeerCIDROptions : The CheckVPNGatewayConnectionPeerCIDR options. +type CheckVPNGatewayConnectionPeerCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `validate:"required,ne="` + + // The address prefix part of the CIDR. + CIDRPrefix *string `validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCheckVPNGatewayConnectionPeerCIDROptions : Instantiate CheckVPNGatewayConnectionPeerCIDROptions +func (*VpcV1) NewCheckVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *CheckVPNGatewayConnectionPeerCIDROptions { + return &CheckVPNGatewayConnectionPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (options *CheckVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *CheckVPNGatewayConnectionPeerCIDROptions { + options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return options +} + +// SetID : Allow user to set ID +func (options *CheckVPNGatewayConnectionPeerCIDROptions) SetID(id string) *CheckVPNGatewayConnectionPeerCIDROptions { + options.ID = core.StringPtr(id) + return options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (options *CheckVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *CheckVPNGatewayConnectionPeerCIDROptions { + options.CIDRPrefix = core.StringPtr(cidrPrefix) + return options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (options *CheckVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *CheckVPNGatewayConnectionPeerCIDROptions { + options.PrefixLength = core.StringPtr(prefixLength) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CheckVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *CheckVPNGatewayConnectionPeerCIDROptions { + options.Headers = param + return options +} + +// CloudObjectStorageBucketIdentity : Identifies a Cloud Object Storage bucket by a unique property. +// Models which "extend" this model: +// - CloudObjectStorageBucketIdentityByName +type CloudObjectStorageBucketIdentity struct { + // The globally unique name of this COS bucket. + Name *string `json:"name,omitempty"` +} + +func (*CloudObjectStorageBucketIdentity) isaCloudObjectStorageBucketIdentity() bool { + return true +} + +type CloudObjectStorageBucketIdentityIntf interface { + isaCloudObjectStorageBucketIdentity() bool +} + +// UnmarshalCloudObjectStorageBucketIdentity unmarshals an instance of CloudObjectStorageBucketIdentity from the specified map of raw messages. +func UnmarshalCloudObjectStorageBucketIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CloudObjectStorageBucketIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CloudObjectStorageBucketReference : CloudObjectStorageBucketReference struct +type CloudObjectStorageBucketReference struct { + // The globally unique name of this COS bucket. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalCloudObjectStorageBucketReference unmarshals an instance of CloudObjectStorageBucketReference from the specified map of raw messages. +func UnmarshalCloudObjectStorageBucketReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CloudObjectStorageBucketReference) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CreateDedicatedHostGroupOptions : The CreateDedicatedHostGroup options. +type CreateDedicatedHostGroupOptions struct { + // The dedicated host profile class for hosts in this group. + Class *string + + // The dedicated host profile family for hosts in this group. + Family *string + + // The unique user-defined name for this dedicated host group. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf + + // The zone this dedicated host group will reside in. + Zone ZoneIdentityIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateDedicatedHostGroupOptions.Family property. +// The dedicated host profile family for hosts in this group. +const ( + CreateDedicatedHostGroupOptionsFamilyBalancedConst = "balanced" + CreateDedicatedHostGroupOptionsFamilyComputeConst = "compute" + CreateDedicatedHostGroupOptionsFamilyMemoryConst = "memory" +) + +// NewCreateDedicatedHostGroupOptions : Instantiate CreateDedicatedHostGroupOptions +func (*VpcV1) NewCreateDedicatedHostGroupOptions() *CreateDedicatedHostGroupOptions { + return &CreateDedicatedHostGroupOptions{} +} + +// SetClass : Allow user to set Class +func (options *CreateDedicatedHostGroupOptions) SetClass(class string) *CreateDedicatedHostGroupOptions { + options.Class = core.StringPtr(class) + return options +} + +// SetFamily : Allow user to set Family +func (options *CreateDedicatedHostGroupOptions) SetFamily(family string) *CreateDedicatedHostGroupOptions { + options.Family = core.StringPtr(family) + return options +} + +// SetName : Allow user to set Name +func (options *CreateDedicatedHostGroupOptions) SetName(name string) *CreateDedicatedHostGroupOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (options *CreateDedicatedHostGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateDedicatedHostGroupOptions { + options.ResourceGroup = resourceGroup + return options +} + +// SetZone : Allow user to set Zone +func (options *CreateDedicatedHostGroupOptions) SetZone(zone ZoneIdentityIntf) *CreateDedicatedHostGroupOptions { + options.Zone = zone + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateDedicatedHostGroupOptions) SetHeaders(param map[string]string) *CreateDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// CreateDedicatedHostOptions : The CreateDedicatedHost options. +type CreateDedicatedHostOptions struct { + // The dedicated host prototype object. + DedicatedHostPrototype DedicatedHostPrototypeIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateDedicatedHostOptions : Instantiate CreateDedicatedHostOptions +func (*VpcV1) NewCreateDedicatedHostOptions(dedicatedHostPrototype DedicatedHostPrototypeIntf) *CreateDedicatedHostOptions { + return &CreateDedicatedHostOptions{ + DedicatedHostPrototype: dedicatedHostPrototype, + } +} + +// SetDedicatedHostPrototype : Allow user to set DedicatedHostPrototype +func (options *CreateDedicatedHostOptions) SetDedicatedHostPrototype(dedicatedHostPrototype DedicatedHostPrototypeIntf) *CreateDedicatedHostOptions { + options.DedicatedHostPrototype = dedicatedHostPrototype + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateDedicatedHostOptions) SetHeaders(param map[string]string) *CreateDedicatedHostOptions { + options.Headers = param + return options +} + +// CreateEndpointGatewayOptions : The CreateEndpointGateway options. +type CreateEndpointGatewayOptions struct { + // The target for this endpoint gateway. + Target EndpointGatewayTargetPrototypeIntf `validate:"required"` + + // The VPC this endpoint gateway will serve. + VPC VPCIdentityIntf `validate:"required"` + + // An array of reserved IPs to bind to this endpoint gateway. At most one reserved IP per zone is allowed. + Ips []EndpointGatewayReservedIPIntf + + // The user-defined name for this endpoint gateway. If unspecified, the name will be a hyphenated list of + // randomly-selected words. Names must be unique within the VPC this endpoint gateway is serving. + Name *string + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateEndpointGatewayOptions : Instantiate CreateEndpointGatewayOptions +func (*VpcV1) NewCreateEndpointGatewayOptions(target EndpointGatewayTargetPrototypeIntf, vpc VPCIdentityIntf) *CreateEndpointGatewayOptions { + return &CreateEndpointGatewayOptions{ + Target: target, + VPC: vpc, + } +} + +// SetTarget : Allow user to set Target +func (options *CreateEndpointGatewayOptions) SetTarget(target EndpointGatewayTargetPrototypeIntf) *CreateEndpointGatewayOptions { + options.Target = target + return options +} + +// SetVPC : Allow user to set VPC +func (options *CreateEndpointGatewayOptions) SetVPC(vpc VPCIdentityIntf) *CreateEndpointGatewayOptions { + options.VPC = vpc + return options +} + +// SetIps : Allow user to set Ips +func (options *CreateEndpointGatewayOptions) SetIps(ips []EndpointGatewayReservedIPIntf) *CreateEndpointGatewayOptions { + options.Ips = ips + return options +} + +// SetName : Allow user to set Name +func (options *CreateEndpointGatewayOptions) SetName(name string) *CreateEndpointGatewayOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (options *CreateEndpointGatewayOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateEndpointGatewayOptions { + options.ResourceGroup = resourceGroup + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateEndpointGatewayOptions) SetHeaders(param map[string]string) *CreateEndpointGatewayOptions { + options.Headers = param + return options +} + +// CreateFloatingIPOptions : The CreateFloatingIP options. +type CreateFloatingIPOptions struct { + // The floating IP prototype object. + FloatingIPPrototype FloatingIPPrototypeIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateFloatingIPOptions : Instantiate CreateFloatingIPOptions +func (*VpcV1) NewCreateFloatingIPOptions(floatingIPPrototype FloatingIPPrototypeIntf) *CreateFloatingIPOptions { + return &CreateFloatingIPOptions{ + FloatingIPPrototype: floatingIPPrototype, + } +} + +// SetFloatingIPPrototype : Allow user to set FloatingIPPrototype +func (options *CreateFloatingIPOptions) SetFloatingIPPrototype(floatingIPPrototype FloatingIPPrototypeIntf) *CreateFloatingIPOptions { + options.FloatingIPPrototype = floatingIPPrototype + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateFloatingIPOptions) SetHeaders(param map[string]string) *CreateFloatingIPOptions { + options.Headers = param + return options +} + +// CreateFlowLogCollectorOptions : The CreateFlowLogCollector options. +type CreateFlowLogCollectorOptions struct { + // The Cloud Object Storage bucket where the collected flows will be logged. + // The bucket must exist and an IAM service authorization must grant + // `IBM Cloud Flow Logs` resources of `VPC Infrastructure Services` writer + // access to the bucket. + StorageBucket CloudObjectStorageBucketIdentityIntf `validate:"required"` + + // The target this collector will collect flow logs for. If the target is an instance, + // subnet, or VPC, flow logs will not be collected for any network interfaces within the + // target that are themselves the target of a more specific flow log collector. + Target FlowLogCollectorTargetPrototypeIntf `validate:"required"` + + // Indicates whether this collector will be active upon creation. + Active *bool + + // The unique user-defined name for this flow log collector. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateFlowLogCollectorOptions : Instantiate CreateFlowLogCollectorOptions +func (*VpcV1) NewCreateFlowLogCollectorOptions(storageBucket CloudObjectStorageBucketIdentityIntf, target FlowLogCollectorTargetPrototypeIntf) *CreateFlowLogCollectorOptions { + return &CreateFlowLogCollectorOptions{ + StorageBucket: storageBucket, + Target: target, + } +} + +// SetStorageBucket : Allow user to set StorageBucket +func (options *CreateFlowLogCollectorOptions) SetStorageBucket(storageBucket CloudObjectStorageBucketIdentityIntf) *CreateFlowLogCollectorOptions { + options.StorageBucket = storageBucket + return options +} + +// SetTarget : Allow user to set Target +func (options *CreateFlowLogCollectorOptions) SetTarget(target FlowLogCollectorTargetPrototypeIntf) *CreateFlowLogCollectorOptions { + options.Target = target + return options +} + +// SetActive : Allow user to set Active +func (options *CreateFlowLogCollectorOptions) SetActive(active bool) *CreateFlowLogCollectorOptions { + options.Active = core.BoolPtr(active) + return options +} + +// SetName : Allow user to set Name +func (options *CreateFlowLogCollectorOptions) SetName(name string) *CreateFlowLogCollectorOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (options *CreateFlowLogCollectorOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateFlowLogCollectorOptions { + options.ResourceGroup = resourceGroup + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateFlowLogCollectorOptions) SetHeaders(param map[string]string) *CreateFlowLogCollectorOptions { + options.Headers = param + return options +} + +// CreateIkePolicyOptions : The CreateIkePolicy options. +type CreateIkePolicyOptions struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `validate:"required"` + + // The Diffie-Hellman group. + DhGroup *int64 `validate:"required"` + + // The encryption algorithm. + EncryptionAlgorithm *string `validate:"required"` + + // The IKE protocol version. + IkeVersion *int64 `validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 + + // The user-defined name for this IKE policy. + Name *string + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateIkePolicyOptions.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + CreateIkePolicyOptionsAuthenticationAlgorithmMd5Const = "md5" + CreateIkePolicyOptionsAuthenticationAlgorithmSha1Const = "sha1" + CreateIkePolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" + CreateIkePolicyOptionsAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the CreateIkePolicyOptions.EncryptionAlgorithm property. +// The encryption algorithm. +const ( + CreateIkePolicyOptionsEncryptionAlgorithmAes128Const = "aes128" + CreateIkePolicyOptionsEncryptionAlgorithmAes256Const = "aes256" + CreateIkePolicyOptionsEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// NewCreateIkePolicyOptions : Instantiate CreateIkePolicyOptions +func (*VpcV1) NewCreateIkePolicyOptions(authenticationAlgorithm string, dhGroup int64, encryptionAlgorithm string, ikeVersion int64) *CreateIkePolicyOptions { + return &CreateIkePolicyOptions{ + AuthenticationAlgorithm: core.StringPtr(authenticationAlgorithm), + DhGroup: core.Int64Ptr(dhGroup), + EncryptionAlgorithm: core.StringPtr(encryptionAlgorithm), + IkeVersion: core.Int64Ptr(ikeVersion), + } +} + +// SetAuthenticationAlgorithm : Allow user to set AuthenticationAlgorithm +func (options *CreateIkePolicyOptions) SetAuthenticationAlgorithm(authenticationAlgorithm string) *CreateIkePolicyOptions { + options.AuthenticationAlgorithm = core.StringPtr(authenticationAlgorithm) + return options +} + +// SetDhGroup : Allow user to set DhGroup +func (options *CreateIkePolicyOptions) SetDhGroup(dhGroup int64) *CreateIkePolicyOptions { + options.DhGroup = core.Int64Ptr(dhGroup) + return options +} + +// SetEncryptionAlgorithm : Allow user to set EncryptionAlgorithm +func (options *CreateIkePolicyOptions) SetEncryptionAlgorithm(encryptionAlgorithm string) *CreateIkePolicyOptions { + options.EncryptionAlgorithm = core.StringPtr(encryptionAlgorithm) + return options +} + +// SetIkeVersion : Allow user to set IkeVersion +func (options *CreateIkePolicyOptions) SetIkeVersion(ikeVersion int64) *CreateIkePolicyOptions { + options.IkeVersion = core.Int64Ptr(ikeVersion) + return options +} + +// SetKeyLifetime : Allow user to set KeyLifetime +func (options *CreateIkePolicyOptions) SetKeyLifetime(keyLifetime int64) *CreateIkePolicyOptions { + options.KeyLifetime = core.Int64Ptr(keyLifetime) + return options +} + +// SetName : Allow user to set Name +func (options *CreateIkePolicyOptions) SetName(name string) *CreateIkePolicyOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (options *CreateIkePolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateIkePolicyOptions { + options.ResourceGroup = resourceGroup + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateIkePolicyOptions) SetHeaders(param map[string]string) *CreateIkePolicyOptions { + options.Headers = param + return options +} + +// CreateImageOptions : The CreateImage options. +type CreateImageOptions struct { + // The image prototype object. + ImagePrototype ImagePrototypeIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateImageOptions : Instantiate CreateImageOptions +func (*VpcV1) NewCreateImageOptions(imagePrototype ImagePrototypeIntf) *CreateImageOptions { + return &CreateImageOptions{ + ImagePrototype: imagePrototype, + } +} + +// SetImagePrototype : Allow user to set ImagePrototype +func (options *CreateImageOptions) SetImagePrototype(imagePrototype ImagePrototypeIntf) *CreateImageOptions { + options.ImagePrototype = imagePrototype + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateImageOptions) SetHeaders(param map[string]string) *CreateImageOptions { + options.Headers = param + return options +} + +// CreateInstanceActionOptions : The CreateInstanceAction options. +type CreateInstanceActionOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The type of action. + Type *string `validate:"required"` + + // If set to true, the action will be forced immediately, and all queued actions deleted. Ignored for the start action. + Force *bool + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateInstanceActionOptions.Type property. +// The type of action. +const ( + CreateInstanceActionOptionsTypeRebootConst = "reboot" + CreateInstanceActionOptionsTypeStartConst = "start" + CreateInstanceActionOptionsTypeStopConst = "stop" +) + +// NewCreateInstanceActionOptions : Instantiate CreateInstanceActionOptions +func (*VpcV1) NewCreateInstanceActionOptions(instanceID string, typeVar string) *CreateInstanceActionOptions { + return &CreateInstanceActionOptions{ + InstanceID: core.StringPtr(instanceID), + Type: core.StringPtr(typeVar), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *CreateInstanceActionOptions) SetInstanceID(instanceID string) *CreateInstanceActionOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetType : Allow user to set Type +func (options *CreateInstanceActionOptions) SetType(typeVar string) *CreateInstanceActionOptions { + options.Type = core.StringPtr(typeVar) + return options +} + +// SetForce : Allow user to set Force +func (options *CreateInstanceActionOptions) SetForce(force bool) *CreateInstanceActionOptions { + options.Force = core.BoolPtr(force) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceActionOptions) SetHeaders(param map[string]string) *CreateInstanceActionOptions { + options.Headers = param + return options +} + +// CreateInstanceConsoleAccessTokenOptions : The CreateInstanceConsoleAccessToken options. +type CreateInstanceConsoleAccessTokenOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The instance console type for which this token may be used. + ConsoleType *string `validate:"required"` + + // Indicates whether to disconnect an existing serial console session as the serial console cannot be shared. This has + // no effect on VNC consoles. + Force *bool + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateInstanceConsoleAccessTokenOptions.ConsoleType property. +// The instance console type for which this token may be used. +const ( + CreateInstanceConsoleAccessTokenOptionsConsoleTypeSerialConst = "serial" + CreateInstanceConsoleAccessTokenOptionsConsoleTypeVncConst = "vnc" +) + +// NewCreateInstanceConsoleAccessTokenOptions : Instantiate CreateInstanceConsoleAccessTokenOptions +func (*VpcV1) NewCreateInstanceConsoleAccessTokenOptions(instanceID string, consoleType string) *CreateInstanceConsoleAccessTokenOptions { + return &CreateInstanceConsoleAccessTokenOptions{ + InstanceID: core.StringPtr(instanceID), + ConsoleType: core.StringPtr(consoleType), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *CreateInstanceConsoleAccessTokenOptions) SetInstanceID(instanceID string) *CreateInstanceConsoleAccessTokenOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetConsoleType : Allow user to set ConsoleType +func (options *CreateInstanceConsoleAccessTokenOptions) SetConsoleType(consoleType string) *CreateInstanceConsoleAccessTokenOptions { + options.ConsoleType = core.StringPtr(consoleType) + return options +} + +// SetForce : Allow user to set Force +func (options *CreateInstanceConsoleAccessTokenOptions) SetForce(force bool) *CreateInstanceConsoleAccessTokenOptions { + options.Force = core.BoolPtr(force) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceConsoleAccessTokenOptions) SetHeaders(param map[string]string) *CreateInstanceConsoleAccessTokenOptions { + options.Headers = param + return options +} + +// CreateInstanceGroupManagerOptions : The CreateInstanceGroupManager options. +type CreateInstanceGroupManagerOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // The instance group manager prototype object. + InstanceGroupManagerPrototype InstanceGroupManagerPrototypeIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceGroupManagerOptions : Instantiate CreateInstanceGroupManagerOptions +func (*VpcV1) NewCreateInstanceGroupManagerOptions(instanceGroupID string, instanceGroupManagerPrototype InstanceGroupManagerPrototypeIntf) *CreateInstanceGroupManagerOptions { + return &CreateInstanceGroupManagerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerPrototype: instanceGroupManagerPrototype, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *CreateInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *CreateInstanceGroupManagerOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetInstanceGroupManagerPrototype : Allow user to set InstanceGroupManagerPrototype +func (options *CreateInstanceGroupManagerOptions) SetInstanceGroupManagerPrototype(instanceGroupManagerPrototype InstanceGroupManagerPrototypeIntf) *CreateInstanceGroupManagerOptions { + options.InstanceGroupManagerPrototype = instanceGroupManagerPrototype + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceGroupManagerOptions) SetHeaders(param map[string]string) *CreateInstanceGroupManagerOptions { + options.Headers = param + return options +} + +// CreateInstanceGroupManagerPolicyOptions : The CreateInstanceGroupManagerPolicy options. +type CreateInstanceGroupManagerPolicyOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `validate:"required,ne="` + + // The instance group manager policy prototype object. + InstanceGroupManagerPolicyPrototype InstanceGroupManagerPolicyPrototypeIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceGroupManagerPolicyOptions : Instantiate CreateInstanceGroupManagerPolicyOptions +func (*VpcV1) NewCreateInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, instanceGroupManagerPolicyPrototype InstanceGroupManagerPolicyPrototypeIntf) *CreateInstanceGroupManagerPolicyOptions { + return &CreateInstanceGroupManagerPolicyOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + InstanceGroupManagerPolicyPrototype: instanceGroupManagerPolicyPrototype, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *CreateInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *CreateInstanceGroupManagerPolicyOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (options *CreateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *CreateInstanceGroupManagerPolicyOptions { + options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return options +} + +// SetInstanceGroupManagerPolicyPrototype : Allow user to set InstanceGroupManagerPolicyPrototype +func (options *CreateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerPolicyPrototype(instanceGroupManagerPolicyPrototype InstanceGroupManagerPolicyPrototypeIntf) *CreateInstanceGroupManagerPolicyOptions { + options.InstanceGroupManagerPolicyPrototype = instanceGroupManagerPolicyPrototype + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *CreateInstanceGroupManagerPolicyOptions { + options.Headers = param + return options +} + +// CreateInstanceGroupOptions : The CreateInstanceGroup options. +type CreateInstanceGroupOptions struct { + // Instance template to use when creating new instances. + InstanceTemplate InstanceTemplateIdentityIntf `validate:"required"` + + // Array of identities to subnets to use when creating new instances. + Subnets []SubnetIdentityIntf `validate:"required"` + + // Required if specifying a load balancer pool only. Used by the instance group when scaling up instances to supply the + // port for the load balancer pool member. + ApplicationPort *int64 + + // The load balancer that the load balancer pool used by this group + // is in. Must be supplied when using a load balancer pool. + LoadBalancer LoadBalancerIdentityIntf + + // When specified, the load balancer pool will be managed by this + // group. Instances created by this group will have a new load + // balancer pool member in that pool created. Must be used with + // `application_port`. + LoadBalancerPool LoadBalancerPoolIdentityIntf + + // The number of instances in the instance group. + MembershipCount *int64 + + // The user-defined name for this instance group. + Name *string + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceGroupOptions : Instantiate CreateInstanceGroupOptions +func (*VpcV1) NewCreateInstanceGroupOptions(instanceTemplate InstanceTemplateIdentityIntf, subnets []SubnetIdentityIntf) *CreateInstanceGroupOptions { + return &CreateInstanceGroupOptions{ + InstanceTemplate: instanceTemplate, + Subnets: subnets, + } +} + +// SetInstanceTemplate : Allow user to set InstanceTemplate +func (options *CreateInstanceGroupOptions) SetInstanceTemplate(instanceTemplate InstanceTemplateIdentityIntf) *CreateInstanceGroupOptions { + options.InstanceTemplate = instanceTemplate + return options +} + +// SetSubnets : Allow user to set Subnets +func (options *CreateInstanceGroupOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateInstanceGroupOptions { + options.Subnets = subnets + return options +} + +// SetApplicationPort : Allow user to set ApplicationPort +func (options *CreateInstanceGroupOptions) SetApplicationPort(applicationPort int64) *CreateInstanceGroupOptions { + options.ApplicationPort = core.Int64Ptr(applicationPort) + return options +} + +// SetLoadBalancer : Allow user to set LoadBalancer +func (options *CreateInstanceGroupOptions) SetLoadBalancer(loadBalancer LoadBalancerIdentityIntf) *CreateInstanceGroupOptions { + options.LoadBalancer = loadBalancer + return options +} + +// SetLoadBalancerPool : Allow user to set LoadBalancerPool +func (options *CreateInstanceGroupOptions) SetLoadBalancerPool(loadBalancerPool LoadBalancerPoolIdentityIntf) *CreateInstanceGroupOptions { + options.LoadBalancerPool = loadBalancerPool + return options +} + +// SetMembershipCount : Allow user to set MembershipCount +func (options *CreateInstanceGroupOptions) SetMembershipCount(membershipCount int64) *CreateInstanceGroupOptions { + options.MembershipCount = core.Int64Ptr(membershipCount) + return options +} + +// SetName : Allow user to set Name +func (options *CreateInstanceGroupOptions) SetName(name string) *CreateInstanceGroupOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (options *CreateInstanceGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateInstanceGroupOptions { + options.ResourceGroup = resourceGroup + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceGroupOptions) SetHeaders(param map[string]string) *CreateInstanceGroupOptions { + options.Headers = param + return options +} + +// CreateInstanceNetworkInterfaceOptions : The CreateInstanceNetworkInterface options. +type CreateInstanceNetworkInterfaceOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The associated subnet. + Subnet SubnetIdentityIntf `validate:"required"` + + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool + + // The user-defined name for this network interface. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string + + // The primary IPv4 address. If specified, it must be an available address on the network interface's subnet. If + // unspecified, an available address on the subnet will be automatically selected. + PrimaryIpv4Address *string + + // Collection of security groups. + SecurityGroups []SecurityGroupIdentityIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceNetworkInterfaceOptions : Instantiate CreateInstanceNetworkInterfaceOptions +func (*VpcV1) NewCreateInstanceNetworkInterfaceOptions(instanceID string, subnet SubnetIdentityIntf) *CreateInstanceNetworkInterfaceOptions { + return &CreateInstanceNetworkInterfaceOptions{ + InstanceID: core.StringPtr(instanceID), + Subnet: subnet, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *CreateInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *CreateInstanceNetworkInterfaceOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetSubnet : Allow user to set Subnet +func (options *CreateInstanceNetworkInterfaceOptions) SetSubnet(subnet SubnetIdentityIntf) *CreateInstanceNetworkInterfaceOptions { + options.Subnet = subnet + return options +} + +// SetAllowIPSpoofing : Allow user to set AllowIPSpoofing +func (options *CreateInstanceNetworkInterfaceOptions) SetAllowIPSpoofing(allowIPSpoofing bool) *CreateInstanceNetworkInterfaceOptions { + options.AllowIPSpoofing = core.BoolPtr(allowIPSpoofing) + return options +} + +// SetName : Allow user to set Name +func (options *CreateInstanceNetworkInterfaceOptions) SetName(name string) *CreateInstanceNetworkInterfaceOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetPrimaryIpv4Address : Allow user to set PrimaryIpv4Address +func (options *CreateInstanceNetworkInterfaceOptions) SetPrimaryIpv4Address(primaryIpv4Address string) *CreateInstanceNetworkInterfaceOptions { + options.PrimaryIpv4Address = core.StringPtr(primaryIpv4Address) + return options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (options *CreateInstanceNetworkInterfaceOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateInstanceNetworkInterfaceOptions { + options.SecurityGroups = securityGroups + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *CreateInstanceNetworkInterfaceOptions { + options.Headers = param + return options +} + +// CreateInstanceOptions : The CreateInstance options. +type CreateInstanceOptions struct { + // The instance prototype object. + InstancePrototype InstancePrototypeIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceOptions : Instantiate CreateInstanceOptions +func (*VpcV1) NewCreateInstanceOptions(instancePrototype InstancePrototypeIntf) *CreateInstanceOptions { + return &CreateInstanceOptions{ + InstancePrototype: instancePrototype, + } +} + +// SetInstancePrototype : Allow user to set InstancePrototype +func (options *CreateInstanceOptions) SetInstancePrototype(instancePrototype InstancePrototypeIntf) *CreateInstanceOptions { + options.InstancePrototype = instancePrototype + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceOptions) SetHeaders(param map[string]string) *CreateInstanceOptions { + options.Headers = param + return options +} + +// CreateInstanceTemplateOptions : The CreateInstanceTemplate options. +type CreateInstanceTemplateOptions struct { + // The instance template prototype object. + InstanceTemplatePrototype InstanceTemplatePrototypeIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceTemplateOptions : Instantiate CreateInstanceTemplateOptions +func (*VpcV1) NewCreateInstanceTemplateOptions(instanceTemplatePrototype InstanceTemplatePrototypeIntf) *CreateInstanceTemplateOptions { + return &CreateInstanceTemplateOptions{ + InstanceTemplatePrototype: instanceTemplatePrototype, + } +} + +// SetInstanceTemplatePrototype : Allow user to set InstanceTemplatePrototype +func (options *CreateInstanceTemplateOptions) SetInstanceTemplatePrototype(instanceTemplatePrototype InstanceTemplatePrototypeIntf) *CreateInstanceTemplateOptions { + options.InstanceTemplatePrototype = instanceTemplatePrototype + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceTemplateOptions) SetHeaders(param map[string]string) *CreateInstanceTemplateOptions { + options.Headers = param + return options +} + +// CreateInstanceVolumeAttachmentOptions : The CreateInstanceVolumeAttachment options. +type CreateInstanceVolumeAttachmentOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The identity of the volume to attach to the instance. + Volume VolumeIdentityIntf `validate:"required"` + + // If set to true, when deleting the instance the volume will also be deleted. + DeleteVolumeOnInstanceDelete *bool + + // The user-defined name for this volume attachment. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateInstanceVolumeAttachmentOptions : Instantiate CreateInstanceVolumeAttachmentOptions +func (*VpcV1) NewCreateInstanceVolumeAttachmentOptions(instanceID string, volume VolumeIdentityIntf) *CreateInstanceVolumeAttachmentOptions { + return &CreateInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + Volume: volume, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *CreateInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *CreateInstanceVolumeAttachmentOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetVolume : Allow user to set Volume +func (options *CreateInstanceVolumeAttachmentOptions) SetVolume(volume VolumeIdentityIntf) *CreateInstanceVolumeAttachmentOptions { + options.Volume = volume + return options +} + +// SetDeleteVolumeOnInstanceDelete : Allow user to set DeleteVolumeOnInstanceDelete +func (options *CreateInstanceVolumeAttachmentOptions) SetDeleteVolumeOnInstanceDelete(deleteVolumeOnInstanceDelete bool) *CreateInstanceVolumeAttachmentOptions { + options.DeleteVolumeOnInstanceDelete = core.BoolPtr(deleteVolumeOnInstanceDelete) + return options +} + +// SetName : Allow user to set Name +func (options *CreateInstanceVolumeAttachmentOptions) SetName(name string) *CreateInstanceVolumeAttachmentOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *CreateInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// CreateIpsecPolicyOptions : The CreateIpsecPolicy options. +type CreateIpsecPolicyOptions struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `validate:"required"` + + // The encryption algorithm. + EncryptionAlgorithm *string `validate:"required"` + + // Perfect Forward Secrecy. + Pfs *string `validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 + + // The user-defined name for this IPsec policy. + Name *string + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateIpsecPolicyOptions.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + CreateIpsecPolicyOptionsAuthenticationAlgorithmMd5Const = "md5" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha1Const = "sha1" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha256Const = "sha256" + CreateIpsecPolicyOptionsAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the CreateIpsecPolicyOptions.EncryptionAlgorithm property. +// The encryption algorithm. +const ( + CreateIpsecPolicyOptionsEncryptionAlgorithmAes128Const = "aes128" + CreateIpsecPolicyOptionsEncryptionAlgorithmAes256Const = "aes256" + CreateIpsecPolicyOptionsEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// Constants associated with the CreateIpsecPolicyOptions.Pfs property. +// Perfect Forward Secrecy. +const ( + CreateIpsecPolicyOptionsPfsDisabledConst = "disabled" + CreateIpsecPolicyOptionsPfsGroup14Const = "group_14" + CreateIpsecPolicyOptionsPfsGroup19Const = "group_19" + CreateIpsecPolicyOptionsPfsGroup2Const = "group_2" + CreateIpsecPolicyOptionsPfsGroup5Const = "group_5" +) + +// NewCreateIpsecPolicyOptions : Instantiate CreateIpsecPolicyOptions +func (*VpcV1) NewCreateIpsecPolicyOptions(authenticationAlgorithm string, encryptionAlgorithm string, pfs string) *CreateIpsecPolicyOptions { + return &CreateIpsecPolicyOptions{ + AuthenticationAlgorithm: core.StringPtr(authenticationAlgorithm), + EncryptionAlgorithm: core.StringPtr(encryptionAlgorithm), + Pfs: core.StringPtr(pfs), + } +} + +// SetAuthenticationAlgorithm : Allow user to set AuthenticationAlgorithm +func (options *CreateIpsecPolicyOptions) SetAuthenticationAlgorithm(authenticationAlgorithm string) *CreateIpsecPolicyOptions { + options.AuthenticationAlgorithm = core.StringPtr(authenticationAlgorithm) + return options +} + +// SetEncryptionAlgorithm : Allow user to set EncryptionAlgorithm +func (options *CreateIpsecPolicyOptions) SetEncryptionAlgorithm(encryptionAlgorithm string) *CreateIpsecPolicyOptions { + options.EncryptionAlgorithm = core.StringPtr(encryptionAlgorithm) + return options +} + +// SetPfs : Allow user to set Pfs +func (options *CreateIpsecPolicyOptions) SetPfs(pfs string) *CreateIpsecPolicyOptions { + options.Pfs = core.StringPtr(pfs) + return options +} + +// SetKeyLifetime : Allow user to set KeyLifetime +func (options *CreateIpsecPolicyOptions) SetKeyLifetime(keyLifetime int64) *CreateIpsecPolicyOptions { + options.KeyLifetime = core.Int64Ptr(keyLifetime) + return options +} + +// SetName : Allow user to set Name +func (options *CreateIpsecPolicyOptions) SetName(name string) *CreateIpsecPolicyOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (options *CreateIpsecPolicyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateIpsecPolicyOptions { + options.ResourceGroup = resourceGroup + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateIpsecPolicyOptions) SetHeaders(param map[string]string) *CreateIpsecPolicyOptions { + options.Headers = param + return options +} + +// CreateKeyOptions : The CreateKey options. +type CreateKeyOptions struct { + // A unique public SSH key to import, encoded in PEM format. The key (prior to encoding) must be either 2048 or 4096 + // bits long. + PublicKey *string `validate:"required"` + + // The unique user-defined name for this key. If unspecified, the name will be a hyphenated list of randomly-selected + // words. + Name *string + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf + + // The crypto-system used by this key. + Type *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateKeyOptions.Type property. +// The crypto-system used by this key. +const ( + CreateKeyOptionsTypeRsaConst = "rsa" +) + +// NewCreateKeyOptions : Instantiate CreateKeyOptions +func (*VpcV1) NewCreateKeyOptions(publicKey string) *CreateKeyOptions { + return &CreateKeyOptions{ + PublicKey: core.StringPtr(publicKey), + } +} + +// SetPublicKey : Allow user to set PublicKey +func (options *CreateKeyOptions) SetPublicKey(publicKey string) *CreateKeyOptions { + options.PublicKey = core.StringPtr(publicKey) + return options +} + +// SetName : Allow user to set Name +func (options *CreateKeyOptions) SetName(name string) *CreateKeyOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (options *CreateKeyOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateKeyOptions { + options.ResourceGroup = resourceGroup + return options +} + +// SetType : Allow user to set Type +func (options *CreateKeyOptions) SetType(typeVar string) *CreateKeyOptions { + options.Type = core.StringPtr(typeVar) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateKeyOptions) SetHeaders(param map[string]string) *CreateKeyOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerListenerOptions : The CreateLoadBalancerListener options. +type CreateLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The listener port number. Each listener in the load balancer must have a unique + // `port` and `protocol` combination. + Port *int64 `validate:"required"` + + // The listener protocol. Load balancers in the `network` family support `tcp`. Load balancers in the `application` + // family support `tcp`, `http`, and `https`. Each listener in the load balancer must have a unique `port` and + // `protocol` combination. + Protocol *string `validate:"required"` + + // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in + // the `application` family (otherwise always `false`). + AcceptProxyProtocol *bool + + // The certificate instance used for SSL termination. It is applicable only to `https` + // protocol. + CertificateInstance CertificateInstanceIdentityIntf + + // The connection limit of the listener. + ConnectionLimit *int64 + + // The default pool associated with the listener. The specified pool must: + // + // - Belong to this load balancer + // - Have the same `protocol` as this listener + // - Not already be the default pool for another listener. + DefaultPool LoadBalancerPoolIdentityIntf + + // An array of policies for this listener. + Policies []LoadBalancerListenerPolicyPrototype + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerListenerOptions.Protocol property. +// The listener protocol. Load balancers in the `network` family support `tcp`. Load balancers in the `application` +// family support `tcp`, `http`, and `https`. Each listener in the load balancer must have a unique `port` and +// `protocol` combination. +const ( + CreateLoadBalancerListenerOptionsProtocolHTTPConst = "http" + CreateLoadBalancerListenerOptionsProtocolHTTPSConst = "https" + CreateLoadBalancerListenerOptionsProtocolTCPConst = "tcp" +) + +// NewCreateLoadBalancerListenerOptions : Instantiate CreateLoadBalancerListenerOptions +func (*VpcV1) NewCreateLoadBalancerListenerOptions(loadBalancerID string, port int64, protocol string) *CreateLoadBalancerListenerOptions { + return &CreateLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + Port: core.Int64Ptr(port), + Protocol: core.StringPtr(protocol), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *CreateLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetPort : Allow user to set Port +func (options *CreateLoadBalancerListenerOptions) SetPort(port int64) *CreateLoadBalancerListenerOptions { + options.Port = core.Int64Ptr(port) + return options +} + +// SetProtocol : Allow user to set Protocol +func (options *CreateLoadBalancerListenerOptions) SetProtocol(protocol string) *CreateLoadBalancerListenerOptions { + options.Protocol = core.StringPtr(protocol) + return options +} + +// SetAcceptProxyProtocol : Allow user to set AcceptProxyProtocol +func (options *CreateLoadBalancerListenerOptions) SetAcceptProxyProtocol(acceptProxyProtocol bool) *CreateLoadBalancerListenerOptions { + options.AcceptProxyProtocol = core.BoolPtr(acceptProxyProtocol) + return options +} + +// SetCertificateInstance : Allow user to set CertificateInstance +func (options *CreateLoadBalancerListenerOptions) SetCertificateInstance(certificateInstance CertificateInstanceIdentityIntf) *CreateLoadBalancerListenerOptions { + options.CertificateInstance = certificateInstance + return options +} + +// SetConnectionLimit : Allow user to set ConnectionLimit +func (options *CreateLoadBalancerListenerOptions) SetConnectionLimit(connectionLimit int64) *CreateLoadBalancerListenerOptions { + options.ConnectionLimit = core.Int64Ptr(connectionLimit) + return options +} + +// SetDefaultPool : Allow user to set DefaultPool +func (options *CreateLoadBalancerListenerOptions) SetDefaultPool(defaultPool LoadBalancerPoolIdentityIntf) *CreateLoadBalancerListenerOptions { + options.DefaultPool = defaultPool + return options +} + +// SetPolicies : Allow user to set Policies +func (options *CreateLoadBalancerListenerOptions) SetPolicies(policies []LoadBalancerListenerPolicyPrototype) *CreateLoadBalancerListenerOptions { + options.Policies = policies + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerListenerOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerListenerPolicyOptions : The CreateLoadBalancerListenerPolicy options. +type CreateLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The listener identifier. + ListenerID *string `validate:"required,ne="` + + // The policy action. + Action *string `validate:"required"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `validate:"required"` + + // The user-defined name for this policy. Names must be unique within the load balancer listener the policy resides in. + Name *string + + // An array of rules for this policy. + Rules []LoadBalancerListenerPolicyRulePrototype + + // When `action` is `forward`, `LoadBalancerPoolIdentity` is required to specify which + // pool the load balancer forwards the traffic to. When `action` is `redirect`, + // `LoadBalancerListenerPolicyRedirectURLPrototype` is required to specify the url and + // http status code used in the redirect response. + Target LoadBalancerListenerPolicyTargetPrototypeIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerListenerPolicyOptions.Action property. +// The policy action. +const ( + CreateLoadBalancerListenerPolicyOptionsActionForwardConst = "forward" + CreateLoadBalancerListenerPolicyOptionsActionRedirectConst = "redirect" + CreateLoadBalancerListenerPolicyOptionsActionRejectConst = "reject" +) + +// NewCreateLoadBalancerListenerPolicyOptions : Instantiate CreateLoadBalancerListenerPolicyOptions +func (*VpcV1) NewCreateLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, action string, priority int64) *CreateLoadBalancerListenerPolicyOptions { + return &CreateLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + Action: core.StringPtr(action), + Priority: core.Int64Ptr(priority), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *CreateLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerPolicyOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetListenerID : Allow user to set ListenerID +func (options *CreateLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *CreateLoadBalancerListenerPolicyOptions { + options.ListenerID = core.StringPtr(listenerID) + return options +} + +// SetAction : Allow user to set Action +func (options *CreateLoadBalancerListenerPolicyOptions) SetAction(action string) *CreateLoadBalancerListenerPolicyOptions { + options.Action = core.StringPtr(action) + return options +} + +// SetPriority : Allow user to set Priority +func (options *CreateLoadBalancerListenerPolicyOptions) SetPriority(priority int64) *CreateLoadBalancerListenerPolicyOptions { + options.Priority = core.Int64Ptr(priority) + return options +} + +// SetName : Allow user to set Name +func (options *CreateLoadBalancerListenerPolicyOptions) SetName(name string) *CreateLoadBalancerListenerPolicyOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetRules : Allow user to set Rules +func (options *CreateLoadBalancerListenerPolicyOptions) SetRules(rules []LoadBalancerListenerPolicyRulePrototype) *CreateLoadBalancerListenerPolicyOptions { + options.Rules = rules + return options +} + +// SetTarget : Allow user to set Target +func (options *CreateLoadBalancerListenerPolicyOptions) SetTarget(target LoadBalancerListenerPolicyTargetPrototypeIntf) *CreateLoadBalancerListenerPolicyOptions { + options.Target = target + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerListenerPolicyRuleOptions : The CreateLoadBalancerListenerPolicyRule options. +type CreateLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The listener identifier. + ListenerID *string `validate:"required,ne="` + + // The policy identifier. + PolicyID *string `validate:"required,ne="` + + // The condition of the rule. + Condition *string `validate:"required"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `validate:"required"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `validate:"required"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this field is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Condition property. +// The condition of the rule. +const ( + CreateLoadBalancerListenerPolicyRuleOptionsConditionContainsConst = "contains" + CreateLoadBalancerListenerPolicyRuleOptionsConditionEqualsConst = "equals" + CreateLoadBalancerListenerPolicyRuleOptionsConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the CreateLoadBalancerListenerPolicyRuleOptions.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + CreateLoadBalancerListenerPolicyRuleOptionsTypeBodyConst = "body" + CreateLoadBalancerListenerPolicyRuleOptionsTypeHeaderConst = "header" + CreateLoadBalancerListenerPolicyRuleOptionsTypeHostnameConst = "hostname" + CreateLoadBalancerListenerPolicyRuleOptionsTypePathConst = "path" + CreateLoadBalancerListenerPolicyRuleOptionsTypeQueryConst = "query" +) + +// NewCreateLoadBalancerListenerPolicyRuleOptions : Instantiate CreateLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewCreateLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, condition string, typeVar string, value string) *CreateLoadBalancerListenerPolicyRuleOptions { + return &CreateLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + Condition: core.StringPtr(condition), + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *CreateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerListenerPolicyRuleOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetListenerID : Allow user to set ListenerID +func (options *CreateLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *CreateLoadBalancerListenerPolicyRuleOptions { + options.ListenerID = core.StringPtr(listenerID) + return options +} + +// SetPolicyID : Allow user to set PolicyID +func (options *CreateLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *CreateLoadBalancerListenerPolicyRuleOptions { + options.PolicyID = core.StringPtr(policyID) + return options +} + +// SetCondition : Allow user to set Condition +func (options *CreateLoadBalancerListenerPolicyRuleOptions) SetCondition(condition string) *CreateLoadBalancerListenerPolicyRuleOptions { + options.Condition = core.StringPtr(condition) + return options +} + +// SetType : Allow user to set Type +func (options *CreateLoadBalancerListenerPolicyRuleOptions) SetType(typeVar string) *CreateLoadBalancerListenerPolicyRuleOptions { + options.Type = core.StringPtr(typeVar) + return options +} + +// SetValue : Allow user to set Value +func (options *CreateLoadBalancerListenerPolicyRuleOptions) SetValue(value string) *CreateLoadBalancerListenerPolicyRuleOptions { + options.Value = core.StringPtr(value) + return options +} + +// SetField : Allow user to set Field +func (options *CreateLoadBalancerListenerPolicyRuleOptions) SetField(field string) *CreateLoadBalancerListenerPolicyRuleOptions { + options.Field = core.StringPtr(field) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *CreateLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerOptions : The CreateLoadBalancer options. +type CreateLoadBalancerOptions struct { + // Indicates whether this load balancer is public or private. + IsPublic *bool `validate:"required"` + + // The subnets to provision this load balancer. + Subnets []SubnetIdentityIntf `validate:"required"` + + // The listeners of this load balancer. + Listeners []LoadBalancerListenerPrototypeLoadBalancerContext + + // The logging configuration to use for this load balancer. See [VPC Datapath + // Logging](https://cloud.ibm.com/docs/vpc?topic=vpc-datapath-logging) + // on the logging format, fields and permitted values. + // + // To activate logging, the load balancer profile must support the specified logging + // type. + Logging *LoadBalancerLogging + + // The user-defined name for this load balancer. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string + + // The pools of this load balancer. + Pools []LoadBalancerPoolPrototype + + // The profile to use for this load balancer. + Profile LoadBalancerProfileIdentityIntf + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf + + // The security groups to use for this load balancer. + // + // The load balancer profile must support security groups. + SecurityGroups []SecurityGroupIdentityIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateLoadBalancerOptions : Instantiate CreateLoadBalancerOptions +func (*VpcV1) NewCreateLoadBalancerOptions(isPublic bool, subnets []SubnetIdentityIntf) *CreateLoadBalancerOptions { + return &CreateLoadBalancerOptions{ + IsPublic: core.BoolPtr(isPublic), + Subnets: subnets, + } +} + +// SetIsPublic : Allow user to set IsPublic +func (options *CreateLoadBalancerOptions) SetIsPublic(isPublic bool) *CreateLoadBalancerOptions { + options.IsPublic = core.BoolPtr(isPublic) + return options +} + +// SetSubnets : Allow user to set Subnets +func (options *CreateLoadBalancerOptions) SetSubnets(subnets []SubnetIdentityIntf) *CreateLoadBalancerOptions { + options.Subnets = subnets + return options +} + +// SetListeners : Allow user to set Listeners +func (options *CreateLoadBalancerOptions) SetListeners(listeners []LoadBalancerListenerPrototypeLoadBalancerContext) *CreateLoadBalancerOptions { + options.Listeners = listeners + return options +} + +// SetLogging : Allow user to set Logging +func (options *CreateLoadBalancerOptions) SetLogging(logging *LoadBalancerLogging) *CreateLoadBalancerOptions { + options.Logging = logging + return options +} + +// SetName : Allow user to set Name +func (options *CreateLoadBalancerOptions) SetName(name string) *CreateLoadBalancerOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetPools : Allow user to set Pools +func (options *CreateLoadBalancerOptions) SetPools(pools []LoadBalancerPoolPrototype) *CreateLoadBalancerOptions { + options.Pools = pools + return options +} + +// SetProfile : Allow user to set Profile +func (options *CreateLoadBalancerOptions) SetProfile(profile LoadBalancerProfileIdentityIntf) *CreateLoadBalancerOptions { + options.Profile = profile + return options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (options *CreateLoadBalancerOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateLoadBalancerOptions { + options.ResourceGroup = resourceGroup + return options +} + +// SetSecurityGroups : Allow user to set SecurityGroups +func (options *CreateLoadBalancerOptions) SetSecurityGroups(securityGroups []SecurityGroupIdentityIntf) *CreateLoadBalancerOptions { + options.SecurityGroups = securityGroups + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerOptions) SetHeaders(param map[string]string) *CreateLoadBalancerOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerPoolMemberOptions : The CreateLoadBalancerPoolMember options. +type CreateLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The pool identifier. + PoolID *string `validate:"required,ne="` + + // The port number of the application running in the server member. + Port *int64 `validate:"required"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. + Target LoadBalancerPoolMemberTargetPrototypeIntf `validate:"required"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateLoadBalancerPoolMemberOptions : Instantiate CreateLoadBalancerPoolMemberOptions +func (*VpcV1) NewCreateLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, port int64, target LoadBalancerPoolMemberTargetPrototypeIntf) *CreateLoadBalancerPoolMemberOptions { + return &CreateLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + Port: core.Int64Ptr(port), + Target: target, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *CreateLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerPoolMemberOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetPoolID : Allow user to set PoolID +func (options *CreateLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *CreateLoadBalancerPoolMemberOptions { + options.PoolID = core.StringPtr(poolID) + return options +} + +// SetPort : Allow user to set Port +func (options *CreateLoadBalancerPoolMemberOptions) SetPort(port int64) *CreateLoadBalancerPoolMemberOptions { + options.Port = core.Int64Ptr(port) + return options +} + +// SetTarget : Allow user to set Target +func (options *CreateLoadBalancerPoolMemberOptions) SetTarget(target LoadBalancerPoolMemberTargetPrototypeIntf) *CreateLoadBalancerPoolMemberOptions { + options.Target = target + return options +} + +// SetWeight : Allow user to set Weight +func (options *CreateLoadBalancerPoolMemberOptions) SetWeight(weight int64) *CreateLoadBalancerPoolMemberOptions { + options.Weight = core.Int64Ptr(weight) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *CreateLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// CreateLoadBalancerPoolOptions : The CreateLoadBalancerPool options. +type CreateLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The load balancing algorithm. + Algorithm *string `validate:"required"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitorPrototype `validate:"required"` + + // The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp`. Load balancers + // in the `application` family support `tcp`, `http`, and + // `https`. + Protocol *string `validate:"required"` + + // The members for this load balancer pool. For load balancers in the `network` family, the same `port` and `target` + // tuple cannot be shared by a pool member of any other load balancer in the same VPC. + Members []LoadBalancerPoolMemberPrototype + + // The user-defined name for this load balancer pool. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string + + // The session persistence of this pool. + SessionPersistence *LoadBalancerPoolSessionPersistencePrototype + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateLoadBalancerPoolOptions.Algorithm property. +// The load balancing algorithm. +const ( + CreateLoadBalancerPoolOptionsAlgorithmLeastConnectionsConst = "least_connections" + CreateLoadBalancerPoolOptionsAlgorithmRoundRobinConst = "round_robin" + CreateLoadBalancerPoolOptionsAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the CreateLoadBalancerPoolOptions.Protocol property. +// The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp`. Load balancers +// in the `application` family support `tcp`, `http`, and +// `https`. +const ( + CreateLoadBalancerPoolOptionsProtocolHTTPConst = "http" + CreateLoadBalancerPoolOptionsProtocolHTTPSConst = "https" + CreateLoadBalancerPoolOptionsProtocolTCPConst = "tcp" +) + +// Constants associated with the CreateLoadBalancerPoolOptions.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + CreateLoadBalancerPoolOptionsProxyProtocolDisabledConst = "disabled" + CreateLoadBalancerPoolOptionsProxyProtocolV1Const = "v1" + CreateLoadBalancerPoolOptionsProxyProtocolV2Const = "v2" +) + +// NewCreateLoadBalancerPoolOptions : Instantiate CreateLoadBalancerPoolOptions +func (*VpcV1) NewCreateLoadBalancerPoolOptions(loadBalancerID string, algorithm string, healthMonitor *LoadBalancerPoolHealthMonitorPrototype, protocol string) *CreateLoadBalancerPoolOptions { + return &CreateLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + Algorithm: core.StringPtr(algorithm), + HealthMonitor: healthMonitor, + Protocol: core.StringPtr(protocol), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *CreateLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *CreateLoadBalancerPoolOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetAlgorithm : Allow user to set Algorithm +func (options *CreateLoadBalancerPoolOptions) SetAlgorithm(algorithm string) *CreateLoadBalancerPoolOptions { + options.Algorithm = core.StringPtr(algorithm) + return options +} + +// SetHealthMonitor : Allow user to set HealthMonitor +func (options *CreateLoadBalancerPoolOptions) SetHealthMonitor(healthMonitor *LoadBalancerPoolHealthMonitorPrototype) *CreateLoadBalancerPoolOptions { + options.HealthMonitor = healthMonitor + return options +} + +// SetProtocol : Allow user to set Protocol +func (options *CreateLoadBalancerPoolOptions) SetProtocol(protocol string) *CreateLoadBalancerPoolOptions { + options.Protocol = core.StringPtr(protocol) + return options +} + +// SetMembers : Allow user to set Members +func (options *CreateLoadBalancerPoolOptions) SetMembers(members []LoadBalancerPoolMemberPrototype) *CreateLoadBalancerPoolOptions { + options.Members = members + return options +} + +// SetName : Allow user to set Name +func (options *CreateLoadBalancerPoolOptions) SetName(name string) *CreateLoadBalancerPoolOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetProxyProtocol : Allow user to set ProxyProtocol +func (options *CreateLoadBalancerPoolOptions) SetProxyProtocol(proxyProtocol string) *CreateLoadBalancerPoolOptions { + options.ProxyProtocol = core.StringPtr(proxyProtocol) + return options +} + +// SetSessionPersistence : Allow user to set SessionPersistence +func (options *CreateLoadBalancerPoolOptions) SetSessionPersistence(sessionPersistence *LoadBalancerPoolSessionPersistencePrototype) *CreateLoadBalancerPoolOptions { + options.SessionPersistence = sessionPersistence + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateLoadBalancerPoolOptions) SetHeaders(param map[string]string) *CreateLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// CreateNetworkACLOptions : The CreateNetworkACL options. +type CreateNetworkACLOptions struct { + // The network ACL prototype object. + NetworkACLPrototype NetworkACLPrototypeIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateNetworkACLOptions : Instantiate CreateNetworkACLOptions +func (*VpcV1) NewCreateNetworkACLOptions() *CreateNetworkACLOptions { + return &CreateNetworkACLOptions{} +} + +// SetNetworkACLPrototype : Allow user to set NetworkACLPrototype +func (options *CreateNetworkACLOptions) SetNetworkACLPrototype(networkACLPrototype NetworkACLPrototypeIntf) *CreateNetworkACLOptions { + options.NetworkACLPrototype = networkACLPrototype + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateNetworkACLOptions) SetHeaders(param map[string]string) *CreateNetworkACLOptions { + options.Headers = param + return options +} + +// CreateNetworkACLRuleOptions : The CreateNetworkACLRule options. +type CreateNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `validate:"required,ne="` + + // The network ACL rule prototype object. + NetworkACLRulePrototype NetworkACLRulePrototypeIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateNetworkACLRuleOptions : Instantiate CreateNetworkACLRuleOptions +func (*VpcV1) NewCreateNetworkACLRuleOptions(networkACLID string, networkACLRulePrototype NetworkACLRulePrototypeIntf) *CreateNetworkACLRuleOptions { + return &CreateNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + NetworkACLRulePrototype: networkACLRulePrototype, + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (options *CreateNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *CreateNetworkACLRuleOptions { + options.NetworkACLID = core.StringPtr(networkACLID) + return options +} + +// SetNetworkACLRulePrototype : Allow user to set NetworkACLRulePrototype +func (options *CreateNetworkACLRuleOptions) SetNetworkACLRulePrototype(networkACLRulePrototype NetworkACLRulePrototypeIntf) *CreateNetworkACLRuleOptions { + options.NetworkACLRulePrototype = networkACLRulePrototype + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateNetworkACLRuleOptions) SetHeaders(param map[string]string) *CreateNetworkACLRuleOptions { + options.Headers = param + return options +} + +// CreatePublicGatewayOptions : The CreatePublicGateway options. +type CreatePublicGatewayOptions struct { + // The VPC this public gateway will serve. + VPC VPCIdentityIntf `validate:"required"` + + // The zone this public gateway will reside in. + Zone ZoneIdentityIntf `validate:"required"` + + FloatingIP PublicGatewayFloatingIPPrototypeIntf + + // The user-defined name for this public gateway. Names must be unique within the VPC the public gateway resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreatePublicGatewayOptions : Instantiate CreatePublicGatewayOptions +func (*VpcV1) NewCreatePublicGatewayOptions(vpc VPCIdentityIntf, zone ZoneIdentityIntf) *CreatePublicGatewayOptions { + return &CreatePublicGatewayOptions{ + VPC: vpc, + Zone: zone, + } +} + +// SetVPC : Allow user to set VPC +func (options *CreatePublicGatewayOptions) SetVPC(vpc VPCIdentityIntf) *CreatePublicGatewayOptions { + options.VPC = vpc + return options +} + +// SetZone : Allow user to set Zone +func (options *CreatePublicGatewayOptions) SetZone(zone ZoneIdentityIntf) *CreatePublicGatewayOptions { + options.Zone = zone + return options +} + +// SetFloatingIP : Allow user to set FloatingIP +func (options *CreatePublicGatewayOptions) SetFloatingIP(floatingIP PublicGatewayFloatingIPPrototypeIntf) *CreatePublicGatewayOptions { + options.FloatingIP = floatingIP + return options +} + +// SetName : Allow user to set Name +func (options *CreatePublicGatewayOptions) SetName(name string) *CreatePublicGatewayOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (options *CreatePublicGatewayOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreatePublicGatewayOptions { + options.ResourceGroup = resourceGroup + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreatePublicGatewayOptions) SetHeaders(param map[string]string) *CreatePublicGatewayOptions { + options.Headers = param + return options +} + +// CreateSecurityGroupOptions : The CreateSecurityGroup options. +type CreateSecurityGroupOptions struct { + // The VPC this security group is to be a part of. + VPC VPCIdentityIntf `validate:"required"` + + // The user-defined name for this security group. If unspecified, the name will be a hyphenated list of + // randomly-selected words. Names must be unique within the VPC the security group resides in. + Name *string + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf + + // Array of rule prototype objects for rules to be created for this security group. If unspecified, no rules will be + // created, resulting in all traffic being denied. + Rules []SecurityGroupRulePrototypeIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSecurityGroupOptions : Instantiate CreateSecurityGroupOptions +func (*VpcV1) NewCreateSecurityGroupOptions(vpc VPCIdentityIntf) *CreateSecurityGroupOptions { + return &CreateSecurityGroupOptions{ + VPC: vpc, + } +} + +// SetVPC : Allow user to set VPC +func (options *CreateSecurityGroupOptions) SetVPC(vpc VPCIdentityIntf) *CreateSecurityGroupOptions { + options.VPC = vpc + return options +} + +// SetName : Allow user to set Name +func (options *CreateSecurityGroupOptions) SetName(name string) *CreateSecurityGroupOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (options *CreateSecurityGroupOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateSecurityGroupOptions { + options.ResourceGroup = resourceGroup + return options +} + +// SetRules : Allow user to set Rules +func (options *CreateSecurityGroupOptions) SetRules(rules []SecurityGroupRulePrototypeIntf) *CreateSecurityGroupOptions { + options.Rules = rules + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSecurityGroupOptions) SetHeaders(param map[string]string) *CreateSecurityGroupOptions { + options.Headers = param + return options +} + +// CreateSecurityGroupRuleOptions : The CreateSecurityGroupRule options. +type CreateSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `validate:"required,ne="` + + // The properties of the security group rule to be created. + SecurityGroupRulePrototype SecurityGroupRulePrototypeIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSecurityGroupRuleOptions : Instantiate CreateSecurityGroupRuleOptions +func (*VpcV1) NewCreateSecurityGroupRuleOptions(securityGroupID string, securityGroupRulePrototype SecurityGroupRulePrototypeIntf) *CreateSecurityGroupRuleOptions { + return &CreateSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + SecurityGroupRulePrototype: securityGroupRulePrototype, + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (options *CreateSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *CreateSecurityGroupRuleOptions { + options.SecurityGroupID = core.StringPtr(securityGroupID) + return options +} + +// SetSecurityGroupRulePrototype : Allow user to set SecurityGroupRulePrototype +func (options *CreateSecurityGroupRuleOptions) SetSecurityGroupRulePrototype(securityGroupRulePrototype SecurityGroupRulePrototypeIntf) *CreateSecurityGroupRuleOptions { + options.SecurityGroupRulePrototype = securityGroupRulePrototype + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSecurityGroupRuleOptions) SetHeaders(param map[string]string) *CreateSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// CreateSecurityGroupTargetBindingOptions : The CreateSecurityGroupTargetBinding options. +type CreateSecurityGroupTargetBindingOptions struct { + // The security group identifier. + SecurityGroupID *string `validate:"required,ne="` + + // The security group target identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSecurityGroupTargetBindingOptions : Instantiate CreateSecurityGroupTargetBindingOptions +func (*VpcV1) NewCreateSecurityGroupTargetBindingOptions(securityGroupID string, id string) *CreateSecurityGroupTargetBindingOptions { + return &CreateSecurityGroupTargetBindingOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (options *CreateSecurityGroupTargetBindingOptions) SetSecurityGroupID(securityGroupID string) *CreateSecurityGroupTargetBindingOptions { + options.SecurityGroupID = core.StringPtr(securityGroupID) + return options +} + +// SetID : Allow user to set ID +func (options *CreateSecurityGroupTargetBindingOptions) SetID(id string) *CreateSecurityGroupTargetBindingOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSecurityGroupTargetBindingOptions) SetHeaders(param map[string]string) *CreateSecurityGroupTargetBindingOptions { + options.Headers = param + return options +} + +// CreateSubnetOptions : The CreateSubnet options. +type CreateSubnetOptions struct { + // The subnet prototype object. + SubnetPrototype SubnetPrototypeIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSubnetOptions : Instantiate CreateSubnetOptions +func (*VpcV1) NewCreateSubnetOptions(subnetPrototype SubnetPrototypeIntf) *CreateSubnetOptions { + return &CreateSubnetOptions{ + SubnetPrototype: subnetPrototype, + } +} + +// SetSubnetPrototype : Allow user to set SubnetPrototype +func (options *CreateSubnetOptions) SetSubnetPrototype(subnetPrototype SubnetPrototypeIntf) *CreateSubnetOptions { + options.SubnetPrototype = subnetPrototype + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSubnetOptions) SetHeaders(param map[string]string) *CreateSubnetOptions { + options.Headers = param + return options +} + +// CreateSubnetReservedIPOptions : The CreateSubnetReservedIP options. +type CreateSubnetReservedIPOptions struct { + // The subnet identifier. + SubnetID *string `validate:"required,ne="` + + // If set to `true`, this reserved IP will be automatically deleted when the target is deleted or when the reserved IP + // is unbound. The value cannot be set to `true` if the reserved IP is unbound. + AutoDelete *bool + + // The user-defined name for this reserved IP. If not specified, the name will be a hyphenated list of + // randomly-selected words. Names must be unique within the subnet the reserved IP resides in. Names beginning with + // `ibm-` are reserved for provider-owned resources. + Name *string + + // The target this reserved IP is to be bound to. + Target ReservedIPTargetPrototypeIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateSubnetReservedIPOptions : Instantiate CreateSubnetReservedIPOptions +func (*VpcV1) NewCreateSubnetReservedIPOptions(subnetID string) *CreateSubnetReservedIPOptions { + return &CreateSubnetReservedIPOptions{ + SubnetID: core.StringPtr(subnetID), + } +} + +// SetSubnetID : Allow user to set SubnetID +func (options *CreateSubnetReservedIPOptions) SetSubnetID(subnetID string) *CreateSubnetReservedIPOptions { + options.SubnetID = core.StringPtr(subnetID) + return options +} + +// SetAutoDelete : Allow user to set AutoDelete +func (options *CreateSubnetReservedIPOptions) SetAutoDelete(autoDelete bool) *CreateSubnetReservedIPOptions { + options.AutoDelete = core.BoolPtr(autoDelete) + return options +} + +// SetName : Allow user to set Name +func (options *CreateSubnetReservedIPOptions) SetName(name string) *CreateSubnetReservedIPOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetTarget : Allow user to set Target +func (options *CreateSubnetReservedIPOptions) SetTarget(target ReservedIPTargetPrototypeIntf) *CreateSubnetReservedIPOptions { + options.Target = target + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateSubnetReservedIPOptions) SetHeaders(param map[string]string) *CreateSubnetReservedIPOptions { + options.Headers = param + return options +} + +// CreateVolumeOptions : The CreateVolume options. +type CreateVolumeOptions struct { + // The volume prototype object. + VolumePrototype VolumePrototypeIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVolumeOptions : Instantiate CreateVolumeOptions +func (*VpcV1) NewCreateVolumeOptions(volumePrototype VolumePrototypeIntf) *CreateVolumeOptions { + return &CreateVolumeOptions{ + VolumePrototype: volumePrototype, + } +} + +// SetVolumePrototype : Allow user to set VolumePrototype +func (options *CreateVolumeOptions) SetVolumePrototype(volumePrototype VolumePrototypeIntf) *CreateVolumeOptions { + options.VolumePrototype = volumePrototype + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVolumeOptions) SetHeaders(param map[string]string) *CreateVolumeOptions { + options.Headers = param + return options +} + +// CreateVPCAddressPrefixOptions : The CreateVPCAddressPrefix options. +type CreateVPCAddressPrefixOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The IPv4 range of the address prefix, expressed in CIDR format. The request must not overlap with any existing + // address prefixes in the VPC or any of the following reserved address ranges: + // - `127.0.0.0/8` (IPv4 loopback addresses) + // - `161.26.0.0/16` (IBM services) + // - `166.8.0.0/14` (Cloud Service Endpoints) + // - `169.254.0.0/16` (IPv4 link-local addresses) + // - `224.0.0.0/4` (IPv4 multicast addresses) + // + // The prefix length of the address prefix's CIDR must be between `/9` (8,388,608 addresses) and `/29` (8 addresses). + CIDR *string `validate:"required"` + + // The zone this address prefix will reside in. + Zone ZoneIdentityIntf `validate:"required"` + + // Indicates whether this is the default prefix for this zone in this VPC. If true, this prefix will become the default + // prefix for this zone in this VPC. This fails if the VPC currently has a default address prefix for this zone. + IsDefault *bool + + // The user-defined name for this address prefix. Names must be unique within the VPC the address prefix resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVPCAddressPrefixOptions : Instantiate CreateVPCAddressPrefixOptions +func (*VpcV1) NewCreateVPCAddressPrefixOptions(vpcID string, cidr string, zone ZoneIdentityIntf) *CreateVPCAddressPrefixOptions { + return &CreateVPCAddressPrefixOptions{ + VPCID: core.StringPtr(vpcID), + CIDR: core.StringPtr(cidr), + Zone: zone, + } +} + +// SetVPCID : Allow user to set VPCID +func (options *CreateVPCAddressPrefixOptions) SetVPCID(vpcID string) *CreateVPCAddressPrefixOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetCIDR : Allow user to set CIDR +func (options *CreateVPCAddressPrefixOptions) SetCIDR(cidr string) *CreateVPCAddressPrefixOptions { + options.CIDR = core.StringPtr(cidr) + return options +} + +// SetZone : Allow user to set Zone +func (options *CreateVPCAddressPrefixOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCAddressPrefixOptions { + options.Zone = zone + return options +} + +// SetIsDefault : Allow user to set IsDefault +func (options *CreateVPCAddressPrefixOptions) SetIsDefault(isDefault bool) *CreateVPCAddressPrefixOptions { + options.IsDefault = core.BoolPtr(isDefault) + return options +} + +// SetName : Allow user to set Name +func (options *CreateVPCAddressPrefixOptions) SetName(name string) *CreateVPCAddressPrefixOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCAddressPrefixOptions) SetHeaders(param map[string]string) *CreateVPCAddressPrefixOptions { + options.Headers = param + return options +} + +// CreateVPCOptions : The CreateVPC options. +type CreateVPCOptions struct { + // Indicates whether a default address prefix should be automatically created for each zone in this VPC. If `manual`, + // this VPC will be created with no default address prefixes. + AddressPrefixManagement *string + + // Indicates whether this VPC should be connected to Classic Infrastructure. If true, this VPC's resources will have + // private network connectivity to the account's Classic Infrastructure resources. Only one VPC, per region, may be + // connected in this way. This value is set at creation and subsequently immutable. + ClassicAccess *bool + + // The unique user-defined name for this VPC. If unspecified, the name will be a hyphenated list of randomly-selected + // words. + Name *string + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPCOptions.AddressPrefixManagement property. +// Indicates whether a default address prefix should be automatically created for each zone in this VPC. If `manual`, +// this VPC will be created with no default address prefixes. +const ( + CreateVPCOptionsAddressPrefixManagementAutoConst = "auto" + CreateVPCOptionsAddressPrefixManagementManualConst = "manual" +) + +// NewCreateVPCOptions : Instantiate CreateVPCOptions +func (*VpcV1) NewCreateVPCOptions() *CreateVPCOptions { + return &CreateVPCOptions{} +} + +// SetAddressPrefixManagement : Allow user to set AddressPrefixManagement +func (options *CreateVPCOptions) SetAddressPrefixManagement(addressPrefixManagement string) *CreateVPCOptions { + options.AddressPrefixManagement = core.StringPtr(addressPrefixManagement) + return options +} + +// SetClassicAccess : Allow user to set ClassicAccess +func (options *CreateVPCOptions) SetClassicAccess(classicAccess bool) *CreateVPCOptions { + options.ClassicAccess = core.BoolPtr(classicAccess) + return options +} + +// SetName : Allow user to set Name +func (options *CreateVPCOptions) SetName(name string) *CreateVPCOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetResourceGroup : Allow user to set ResourceGroup +func (options *CreateVPCOptions) SetResourceGroup(resourceGroup ResourceGroupIdentityIntf) *CreateVPCOptions { + options.ResourceGroup = resourceGroup + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCOptions) SetHeaders(param map[string]string) *CreateVPCOptions { + options.Headers = param + return options +} + +// CreateVPCRouteOptions : The CreateVPCRoute options. +type CreateVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The destination of the route. At most two routes per `zone` in a table can have the same destination, and only if + // both routes have an `action` of `deliver` and the + // `next_hop` is an IP address. + Destination *string `validate:"required"` + + // The zone to apply the route to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone ZoneIdentityIntf `validate:"required"` + + // The action to perform with a packet matching the route: + // - `delegate`: delegate to the system's built-in routes + // - `delegate_vpc`: delegate to the system's built-in routes, ignoring Internet-bound + // routes + // - `deliver`: deliver the packet to the specified `next_hop` + // - `drop`: drop the packet. + Action *string + + // The user-defined name for this route. If unspecified, the name will be a hyphenated list of randomly-selected words. + // Names must be unique within the VPC routing table the route resides in. + Name *string + + // If `action` is `deliver`, the next hop that packets will be delivered to. For + // other `action` values, it must be omitted or specified as `0.0.0.0`. + NextHop RouteNextHopPrototypeIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPCRouteOptions.Action property. +// The action to perform with a packet matching the route: +// - `delegate`: delegate to the system's built-in routes +// - `delegate_vpc`: delegate to the system's built-in routes, ignoring Internet-bound +// routes +// - `deliver`: deliver the packet to the specified `next_hop` +// - `drop`: drop the packet. +const ( + CreateVPCRouteOptionsActionDelegateConst = "delegate" + CreateVPCRouteOptionsActionDelegateVPCConst = "delegate_vpc" + CreateVPCRouteOptionsActionDeliverConst = "deliver" + CreateVPCRouteOptionsActionDropConst = "drop" +) + +// NewCreateVPCRouteOptions : Instantiate CreateVPCRouteOptions +func (*VpcV1) NewCreateVPCRouteOptions(vpcID string, destination string, zone ZoneIdentityIntf) *CreateVPCRouteOptions { + return &CreateVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + Destination: core.StringPtr(destination), + Zone: zone, + } +} + +// SetVPCID : Allow user to set VPCID +func (options *CreateVPCRouteOptions) SetVPCID(vpcID string) *CreateVPCRouteOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetDestination : Allow user to set Destination +func (options *CreateVPCRouteOptions) SetDestination(destination string) *CreateVPCRouteOptions { + options.Destination = core.StringPtr(destination) + return options +} + +// SetZone : Allow user to set Zone +func (options *CreateVPCRouteOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCRouteOptions { + options.Zone = zone + return options +} + +// SetAction : Allow user to set Action +func (options *CreateVPCRouteOptions) SetAction(action string) *CreateVPCRouteOptions { + options.Action = core.StringPtr(action) + return options +} + +// SetName : Allow user to set Name +func (options *CreateVPCRouteOptions) SetName(name string) *CreateVPCRouteOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetNextHop : Allow user to set NextHop +func (options *CreateVPCRouteOptions) SetNextHop(nextHop RouteNextHopPrototypeIntf) *CreateVPCRouteOptions { + options.NextHop = nextHop + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCRouteOptions) SetHeaders(param map[string]string) *CreateVPCRouteOptions { + options.Headers = param + return options +} + +// CreateVPCRoutingTableOptions : The CreateVPCRoutingTable options. +type CreateVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The user-defined name for this routing table. Names must be unique within the VPC the routing table resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string + + // If set to `true`, this routing table will be used to route traffic that originates from [Direct + // Link](https://cloud.ibm.com/docs/dl/) to this VPC. For this to succeed, the VPC must not already have a routing + // table with this property set to `true`. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. + // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. + RouteDirectLinkIngress *bool + + // If set to `true`, this routing table will be used to route traffic that originates from [Transit + // Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. For this to succeed, the VPC must not already + // have a routing table with this property set to `true`. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. + // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. + // + // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled + // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing + // table. + RouteTransitGatewayIngress *bool + + // If set to `true`, this routing table will be used to route traffic that originates from subnets in other zones in + // this VPC. For this to succeed, the VPC must not already have a routing table with this property set to `true`. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. + // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. + RouteVPCZoneIngress *bool + + // Array of route prototype objects for routes to create for this routing table. If unspecified, the routing table will + // be created with no routes. + Routes []RoutePrototype + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVPCRoutingTableOptions : Instantiate CreateVPCRoutingTableOptions +func (*VpcV1) NewCreateVPCRoutingTableOptions(vpcID string) *CreateVPCRoutingTableOptions { + return &CreateVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (options *CreateVPCRoutingTableOptions) SetVPCID(vpcID string) *CreateVPCRoutingTableOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetName : Allow user to set Name +func (options *CreateVPCRoutingTableOptions) SetName(name string) *CreateVPCRoutingTableOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetRouteDirectLinkIngress : Allow user to set RouteDirectLinkIngress +func (options *CreateVPCRoutingTableOptions) SetRouteDirectLinkIngress(routeDirectLinkIngress bool) *CreateVPCRoutingTableOptions { + options.RouteDirectLinkIngress = core.BoolPtr(routeDirectLinkIngress) + return options +} + +// SetRouteTransitGatewayIngress : Allow user to set RouteTransitGatewayIngress +func (options *CreateVPCRoutingTableOptions) SetRouteTransitGatewayIngress(routeTransitGatewayIngress bool) *CreateVPCRoutingTableOptions { + options.RouteTransitGatewayIngress = core.BoolPtr(routeTransitGatewayIngress) + return options +} + +// SetRouteVPCZoneIngress : Allow user to set RouteVPCZoneIngress +func (options *CreateVPCRoutingTableOptions) SetRouteVPCZoneIngress(routeVPCZoneIngress bool) *CreateVPCRoutingTableOptions { + options.RouteVPCZoneIngress = core.BoolPtr(routeVPCZoneIngress) + return options +} + +// SetRoutes : Allow user to set Routes +func (options *CreateVPCRoutingTableOptions) SetRoutes(routes []RoutePrototype) *CreateVPCRoutingTableOptions { + options.Routes = routes + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCRoutingTableOptions) SetHeaders(param map[string]string) *CreateVPCRoutingTableOptions { + options.Headers = param + return options +} + +// CreateVPCRoutingTableRouteOptions : The CreateVPCRoutingTableRoute options. +type CreateVPCRoutingTableRouteOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `validate:"required,ne="` + + // The destination of the route. At most two routes per `zone` in a table can have the same destination, and only if + // both routes have an `action` of `deliver` and the + // `next_hop` is an IP address. + Destination *string `validate:"required"` + + // The zone to apply the route to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone ZoneIdentityIntf `validate:"required"` + + // The action to perform with a packet matching the route: + // - `delegate`: delegate to the system's built-in routes + // - `delegate_vpc`: delegate to the system's built-in routes, ignoring Internet-bound + // routes + // - `deliver`: deliver the packet to the specified `next_hop` + // - `drop`: drop the packet. + Action *string + + // The user-defined name for this route. If unspecified, the name will be a hyphenated list of randomly-selected words. + // Names must be unique within the VPC routing table the route resides in. + Name *string + + // If `action` is `deliver`, the next hop that packets will be delivered to. For + // other `action` values, it must be omitted or specified as `0.0.0.0`. + NextHop RouteNextHopPrototypeIntf + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the CreateVPCRoutingTableRouteOptions.Action property. +// The action to perform with a packet matching the route: +// - `delegate`: delegate to the system's built-in routes +// - `delegate_vpc`: delegate to the system's built-in routes, ignoring Internet-bound +// routes +// - `deliver`: deliver the packet to the specified `next_hop` +// - `drop`: drop the packet. +const ( + CreateVPCRoutingTableRouteOptionsActionDelegateConst = "delegate" + CreateVPCRoutingTableRouteOptionsActionDelegateVPCConst = "delegate_vpc" + CreateVPCRoutingTableRouteOptionsActionDeliverConst = "deliver" + CreateVPCRoutingTableRouteOptionsActionDropConst = "drop" +) + +// NewCreateVPCRoutingTableRouteOptions : Instantiate CreateVPCRoutingTableRouteOptions +func (*VpcV1) NewCreateVPCRoutingTableRouteOptions(vpcID string, routingTableID string, destination string, zone ZoneIdentityIntf) *CreateVPCRoutingTableRouteOptions { + return &CreateVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + Destination: core.StringPtr(destination), + Zone: zone, + } +} + +// SetVPCID : Allow user to set VPCID +func (options *CreateVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *CreateVPCRoutingTableRouteOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (options *CreateVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *CreateVPCRoutingTableRouteOptions { + options.RoutingTableID = core.StringPtr(routingTableID) + return options +} + +// SetDestination : Allow user to set Destination +func (options *CreateVPCRoutingTableRouteOptions) SetDestination(destination string) *CreateVPCRoutingTableRouteOptions { + options.Destination = core.StringPtr(destination) + return options +} + +// SetZone : Allow user to set Zone +func (options *CreateVPCRoutingTableRouteOptions) SetZone(zone ZoneIdentityIntf) *CreateVPCRoutingTableRouteOptions { + options.Zone = zone + return options +} + +// SetAction : Allow user to set Action +func (options *CreateVPCRoutingTableRouteOptions) SetAction(action string) *CreateVPCRoutingTableRouteOptions { + options.Action = core.StringPtr(action) + return options +} + +// SetName : Allow user to set Name +func (options *CreateVPCRoutingTableRouteOptions) SetName(name string) *CreateVPCRoutingTableRouteOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetNextHop : Allow user to set NextHop +func (options *CreateVPCRoutingTableRouteOptions) SetNextHop(nextHop RouteNextHopPrototypeIntf) *CreateVPCRoutingTableRouteOptions { + options.NextHop = nextHop + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *CreateVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// CreateVPNGatewayConnectionOptions : The CreateVPNGatewayConnection options. +type CreateVPNGatewayConnectionOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `validate:"required,ne="` + + // The VPN gateway connection prototype object. + VPNGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVPNGatewayConnectionOptions : Instantiate CreateVPNGatewayConnectionOptions +func (*VpcV1) NewCreateVPNGatewayConnectionOptions(vpnGatewayID string, vpnGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf) *CreateVPNGatewayConnectionOptions { + return &CreateVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + VPNGatewayConnectionPrototype: vpnGatewayConnectionPrototype, + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (options *CreateVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *CreateVPNGatewayConnectionOptions { + options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return options +} + +// SetVPNGatewayConnectionPrototype : Allow user to set VPNGatewayConnectionPrototype +func (options *CreateVPNGatewayConnectionOptions) SetVPNGatewayConnectionPrototype(vpnGatewayConnectionPrototype VPNGatewayConnectionPrototypeIntf) *CreateVPNGatewayConnectionOptions { + options.VPNGatewayConnectionPrototype = vpnGatewayConnectionPrototype + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *CreateVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// CreateVPNGatewayOptions : The CreateVPNGateway options. +type CreateVPNGatewayOptions struct { + // The VPN gateway prototype object. + VPNGatewayPrototype VPNGatewayPrototypeIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewCreateVPNGatewayOptions : Instantiate CreateVPNGatewayOptions +func (*VpcV1) NewCreateVPNGatewayOptions(vpnGatewayPrototype VPNGatewayPrototypeIntf) *CreateVPNGatewayOptions { + return &CreateVPNGatewayOptions{ + VPNGatewayPrototype: vpnGatewayPrototype, + } +} + +// SetVPNGatewayPrototype : Allow user to set VPNGatewayPrototype +func (options *CreateVPNGatewayOptions) SetVPNGatewayPrototype(vpnGatewayPrototype VPNGatewayPrototypeIntf) *CreateVPNGatewayOptions { + options.VPNGatewayPrototype = vpnGatewayPrototype + return options +} + +// SetHeaders : Allow user to set Headers +func (options *CreateVPNGatewayOptions) SetHeaders(param map[string]string) *CreateVPNGatewayOptions { + options.Headers = param + return options +} + +// DedicatedHost : DedicatedHost struct +type DedicatedHost struct { + // The amount of memory in gibibytes that is currently available for instances. + AvailableMemory *int64 `json:"available_memory" validate:"required"` + + // The available VCPU for the dedicated host. + AvailableVcpu *Vcpu `json:"available_vcpu" validate:"required"` + + // The date and time that the dedicated host was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` + + // Collection of the dedicated host's disks. + Disks []DedicatedHostDisk `json:"disks" validate:"required"` + + // The dedicated host group this dedicated host is in. + Group *DedicatedHostGroupReference `json:"group" validate:"required"` + + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` + + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled" validate:"required"` + + // Array of instances that are allocated to this dedicated host. + Instances []InstanceReference `json:"instances" validate:"required"` + + // The lifecycle state of the dedicated host resource. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The total amount of memory in gibibytes for this host. + Memory *int64 `json:"memory" validate:"required"` + + // The unique user-defined name for this dedicated host. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name" validate:"required"` + + // The profile this dedicated host uses. + Profile *DedicatedHostProfileReference `json:"profile" validate:"required"` + + // Indicates whether this dedicated host is available for instance creation. + Provisionable *bool `json:"provisionable" validate:"required"` + + // The resource group for this dedicated host. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The type of resource referenced. + ResourceType *string `json:"resource_type" validate:"required"` + + // The total number of sockets for this host. + SocketCount *int64 `json:"socket_count" validate:"required"` + + // The administrative state of the dedicated host. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the dedicated host on which + // the unexpected property value was encountered. + State *string `json:"state" validate:"required"` + + // Array of instance profiles that can be used by instances placed on this dedicated host. + SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` + + // The total VCPU of the dedicated host. + Vcpu *Vcpu `json:"vcpu" validate:"required"` + + // The zone this dedicated host resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the DedicatedHost.LifecycleState property. +// The lifecycle state of the dedicated host resource. +const ( + DedicatedHostLifecycleStateDeletedConst = "deleted" + DedicatedHostLifecycleStateDeletingConst = "deleting" + DedicatedHostLifecycleStateFailedConst = "failed" + DedicatedHostLifecycleStatePendingConst = "pending" + DedicatedHostLifecycleStateStableConst = "stable" + DedicatedHostLifecycleStateSuspendedConst = "suspended" + DedicatedHostLifecycleStateUpdatingConst = "updating" + DedicatedHostLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the DedicatedHost.ResourceType property. +// The type of resource referenced. +const ( + DedicatedHostResourceTypeDedicatedHostConst = "dedicated_host" +) + +// Constants associated with the DedicatedHost.State property. +// The administrative state of the dedicated host. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the dedicated host on which +// the unexpected property value was encountered. +const ( + DedicatedHostStateAvailableConst = "available" + DedicatedHostStateDegradedConst = "degraded" + DedicatedHostStateMigratingConst = "migrating" + DedicatedHostStateUnavailableConst = "unavailable" +) + +// UnmarshalDedicatedHost unmarshals an instance of DedicatedHost from the specified map of raw messages. +func UnmarshalDedicatedHost(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHost) + err = core.UnmarshalPrimitive(m, "available_memory", &obj.AvailableMemory) + if err != nil { + return + } + err = core.UnmarshalModel(m, "available_vcpu", &obj.AvailableVcpu, UnmarshalVcpu) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "socket_count", &obj.SocketCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "state", &obj.State) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalVcpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostCollection : DedicatedHostCollection struct +type DedicatedHostCollection struct { + // Collection of dedicated hosts. + DedicatedHosts []DedicatedHost `json:"dedicated_hosts" validate:"required"` + + // A link to the first page of resources. + First *DedicatedHostCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *DedicatedHostCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalDedicatedHostCollection unmarshals an instance of DedicatedHostCollection from the specified map of raw messages. +func UnmarshalDedicatedHostCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostCollection) + err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHost) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostCollectionFirst : A link to the first page of resources. +type DedicatedHostCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalDedicatedHostCollectionFirst unmarshals an instance of DedicatedHostCollectionFirst from the specified map of raw messages. +func UnmarshalDedicatedHostCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type DedicatedHostCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalDedicatedHostCollectionNext unmarshals an instance of DedicatedHostCollectionNext from the specified map of raw messages. +func UnmarshalDedicatedHostCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostDisk : DedicatedHostDisk struct +type DedicatedHostDisk struct { + // The remaining space left for instance placement in GB (gigabytes). + Available *int64 `json:"available" validate:"required"` + + // The date and time that the disk was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this disk. + ID *string `json:"id" validate:"required"` + + // Instance disks that are on this dedicated host disk. + InstanceDisks []InstanceDiskReference `json:"instance_disks" validate:"required"` + + // The disk interface used for attaching the disk + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The lifecycle state of this dedicated host disk. + LifecycleState *string `json:"lifecycle_state,omitempty"` + + // The user-defined or system-provided name for this disk. + Name *string `json:"name" validate:"required"` + + // Indicates whether this dedicated host disk is available for instance disk creation. + Provisionable *bool `json:"provisionable" validate:"required"` + + // The type of resource referenced. + ResourceType *string `json:"resource_type" validate:"required"` + + // The size of the disk in GB (gigabytes). + Size *int64 `json:"size" validate:"required"` + + // The instance disk interfaces supported for this dedicated host disk. + SupportedInstanceInterfaceTypes []string `json:"supported_instance_interface_types" validate:"required"` +} + +// Constants associated with the DedicatedHostDisk.InterfaceType property. +// The disk interface used for attaching the disk +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostDiskInterfaceTypeNvmeConst = "nvme" +) + +// Constants associated with the DedicatedHostDisk.LifecycleState property. +// The lifecycle state of this dedicated host disk. +const ( + DedicatedHostDiskLifecycleStateDeletedConst = "deleted" + DedicatedHostDiskLifecycleStateDeletingConst = "deleting" + DedicatedHostDiskLifecycleStateFailedConst = "failed" + DedicatedHostDiskLifecycleStatePendingConst = "pending" + DedicatedHostDiskLifecycleStateStableConst = "stable" + DedicatedHostDiskLifecycleStateSuspendedConst = "suspended" + DedicatedHostDiskLifecycleStateUpdatingConst = "updating" + DedicatedHostDiskLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the DedicatedHostDisk.ResourceType property. +// The type of resource referenced. +const ( + DedicatedHostDiskResourceTypeDedicatedHostDiskConst = "dedicated_host_disk" +) + +// Constants associated with the DedicatedHostDisk.SupportedInstanceInterfaceTypes property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostDiskSupportedInstanceInterfaceTypesNvmeConst = "nvme" + DedicatedHostDiskSupportedInstanceInterfaceTypesVirtioBlkConst = "virtio_blk" +) + +// UnmarshalDedicatedHostDisk unmarshals an instance of DedicatedHostDisk from the specified map of raw messages. +func UnmarshalDedicatedHostDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostDisk) + err = core.UnmarshalPrimitive(m, "available", &obj.Available) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_disks", &obj.InstanceDisks, UnmarshalInstanceDiskReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisionable", &obj.Provisionable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostDiskCollection : DedicatedHostDiskCollection struct +type DedicatedHostDiskCollection struct { + // Collection of the dedicated host's disks. + Disks []DedicatedHostDisk `json:"disks" validate:"required"` +} + +// UnmarshalDedicatedHostDiskCollection unmarshals an instance of DedicatedHostDiskCollection from the specified map of raw messages. +func UnmarshalDedicatedHostDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostDiskCollection) + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostDisk) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostDiskPatch : DedicatedHostDiskPatch struct +type DedicatedHostDiskPatch struct { + // The user-defined name for this disk. + Name *string `json:"name,omitempty"` +} + +// UnmarshalDedicatedHostDiskPatch unmarshals an instance of DedicatedHostDiskPatch from the specified map of raw messages. +func UnmarshalDedicatedHostDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostDiskPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the DedicatedHostDiskPatch +func (dedicatedHostDiskPatch *DedicatedHostDiskPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(dedicatedHostDiskPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// DedicatedHostGroup : DedicatedHostGroup struct +type DedicatedHostGroup struct { + // The dedicated host profile class for hosts in this group. + Class *string `json:"class" validate:"required"` + + // The date and time that the dedicated host group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` + + // The dedicated hosts that are in this dedicated host group. + DedicatedHosts []DedicatedHostReference `json:"dedicated_hosts" validate:"required"` + + // The dedicated host profile family for hosts in this group. + Family *string `json:"family" validate:"required"` + + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this dedicated host group. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name" validate:"required"` + + // The resource group for this dedicated host group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The type of resource referenced. + ResourceType *string `json:"resource_type" validate:"required"` + + // Array of instance profiles that can be used by instances placed on this dedicated host group. + SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` + + // The zone this dedicated host group resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the DedicatedHostGroup.Family property. +// The dedicated host profile family for hosts in this group. +const ( + DedicatedHostGroupFamilyBalancedConst = "balanced" + DedicatedHostGroupFamilyComputeConst = "compute" + DedicatedHostGroupFamilyMemoryConst = "memory" +) + +// Constants associated with the DedicatedHostGroup.ResourceType property. +// The type of resource referenced. +const ( + DedicatedHostGroupResourceTypeDedicatedHostGroupConst = "dedicated_host_group" +) + +// UnmarshalDedicatedHostGroup unmarshals an instance of DedicatedHostGroup from the specified map of raw messages. +func UnmarshalDedicatedHostGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroup) + err = core.UnmarshalPrimitive(m, "class", &obj.Class) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dedicated_hosts", &obj.DedicatedHosts, UnmarshalDedicatedHostReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupCollection : DedicatedHostGroupCollection struct +type DedicatedHostGroupCollection struct { + // A link to the first page of resources. + First *DedicatedHostGroupCollectionFirst `json:"first" validate:"required"` + + // Collection of dedicated host groups. + Groups []DedicatedHostGroup `json:"groups" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *DedicatedHostGroupCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalDedicatedHostGroupCollection unmarshals an instance of DedicatedHostGroupCollection from the specified map of raw messages. +func UnmarshalDedicatedHostGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostGroupCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "groups", &obj.Groups, UnmarshalDedicatedHostGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupCollectionFirst : A link to the first page of resources. +type DedicatedHostGroupCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalDedicatedHostGroupCollectionFirst unmarshals an instance of DedicatedHostGroupCollectionFirst from the specified map of raw messages. +func UnmarshalDedicatedHostGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type DedicatedHostGroupCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalDedicatedHostGroupCollectionNext unmarshals an instance of DedicatedHostGroupCollectionNext from the specified map of raw messages. +func UnmarshalDedicatedHostGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupIdentity : Identifies a dedicated host group by a unique property. +// Models which "extend" this model: +// - DedicatedHostGroupIdentityByID +// - DedicatedHostGroupIdentityByCRN +// - DedicatedHostGroupIdentityByHref +type DedicatedHostGroupIdentity struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id,omitempty"` + + // The CRN for this dedicated host group. + CRN *string `json:"crn,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href,omitempty"` +} + +func (*DedicatedHostGroupIdentity) isaDedicatedHostGroupIdentity() bool { + return true +} + +type DedicatedHostGroupIdentityIntf interface { + isaDedicatedHostGroupIdentity() bool +} + +// UnmarshalDedicatedHostGroupIdentity unmarshals an instance of DedicatedHostGroupIdentity from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupPatch : DedicatedHostGroupPatch struct +type DedicatedHostGroupPatch struct { + // The unique user-defined name for this dedicated host group. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` +} + +// UnmarshalDedicatedHostGroupPatch unmarshals an instance of DedicatedHostGroupPatch from the specified map of raw messages. +func UnmarshalDedicatedHostGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the DedicatedHostGroupPatch +func (dedicatedHostGroupPatch *DedicatedHostGroupPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(dedicatedHostGroupPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// DedicatedHostGroupPrototypeDedicatedHostByZoneContext : DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct +type DedicatedHostGroupPrototypeDedicatedHostByZoneContext struct { + // The unique user-defined name for this dedicated host group. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the host's resource group is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` +} + +// UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext unmarshals an instance of DedicatedHostGroupPrototypeDedicatedHostByZoneContext from the specified map of raw messages. +func UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupPrototypeDedicatedHostByZoneContext) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupReference : DedicatedHostGroupReference struct +type DedicatedHostGroupReference struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *DedicatedHostGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this dedicated host group. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name" validate:"required"` + + // The type of resource referenced. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the DedicatedHostGroupReference.ResourceType property. +// The type of resource referenced. +const ( + DedicatedHostGroupReferenceResourceTypeDedicatedHostGroupConst = "dedicated_host_group" +) + +// UnmarshalDedicatedHostGroupReference unmarshals an instance of DedicatedHostGroupReference from the specified map of raw messages. +func UnmarshalDedicatedHostGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type DedicatedHostGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalDedicatedHostGroupReferenceDeleted unmarshals an instance of DedicatedHostGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalDedicatedHostGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPatch : DedicatedHostPatch struct +type DedicatedHostPatch struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The unique user-defined name for this dedicated host. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` +} + +// UnmarshalDedicatedHostPatch unmarshals an instance of DedicatedHostPatch from the specified map of raw messages. +func UnmarshalDedicatedHostPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPatch) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the DedicatedHostPatch +func (dedicatedHostPatch *DedicatedHostPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(dedicatedHostPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// DedicatedHostProfile : DedicatedHostProfile struct +type DedicatedHostProfile struct { + // The product class this dedicated host profile belongs to. + Class *string `json:"class" validate:"required"` + + // Collection of the dedicated host profile's disks. + Disks []DedicatedHostProfileDisk `json:"disks" validate:"required"` + + // The product family this dedicated host profile belongs to + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + Family *string `json:"family" validate:"required"` + + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + Memory DedicatedHostProfileMemoryIntf `json:"memory" validate:"required"` + + // The globally unique name for this dedicated host profile. + Name *string `json:"name" validate:"required"` + + SocketCount DedicatedHostProfileSocketIntf `json:"socket_count" validate:"required"` + + // Array of instance profiles that can be used by instances placed on dedicated hosts with this profile. + SupportedInstanceProfiles []InstanceProfileReference `json:"supported_instance_profiles" validate:"required"` + + VcpuArchitecture *DedicatedHostProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` + + VcpuCount DedicatedHostProfileVcpuIntf `json:"vcpu_count" validate:"required"` +} + +// Constants associated with the DedicatedHostProfile.Family property. +// The product family this dedicated host profile belongs to +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostProfileFamilyBalancedConst = "balanced" + DedicatedHostProfileFamilyComputeConst = "compute" + DedicatedHostProfileFamilyMemoryConst = "memory" +) + +// UnmarshalDedicatedHostProfile unmarshals an instance of DedicatedHostProfile from the specified map of raw messages. +func UnmarshalDedicatedHostProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfile) + err = core.UnmarshalPrimitive(m, "class", &obj.Class) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalDedicatedHostProfileDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalDedicatedHostProfileMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "socket_count", &obj.SocketCount, UnmarshalDedicatedHostProfileSocket) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_profiles", &obj.SupportedInstanceProfiles, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalDedicatedHostProfileVcpuArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalDedicatedHostProfileVcpu) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileCollection : DedicatedHostProfileCollection struct +type DedicatedHostProfileCollection struct { + // A link to the first page of resources. + First *DedicatedHostProfileCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *DedicatedHostProfileCollectionNext `json:"next,omitempty"` + + // Collection of dedicated host profiles. + Profiles []DedicatedHostProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalDedicatedHostProfileCollection unmarshals an instance of DedicatedHostProfileCollection from the specified map of raw messages. +func UnmarshalDedicatedHostProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalDedicatedHostProfileCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalDedicatedHostProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalDedicatedHostProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileCollectionFirst : A link to the first page of resources. +type DedicatedHostProfileCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalDedicatedHostProfileCollectionFirst unmarshals an instance of DedicatedHostProfileCollectionFirst from the specified map of raw messages. +func UnmarshalDedicatedHostProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type DedicatedHostProfileCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalDedicatedHostProfileCollectionNext unmarshals an instance of DedicatedHostProfileCollectionNext from the specified map of raw messages. +func UnmarshalDedicatedHostProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDisk : Disks provided by this profile. +type DedicatedHostProfileDisk struct { + InterfaceType *DedicatedHostProfileDiskInterface `json:"interface_type" validate:"required"` + + // The number of disks of this type for a dedicated host with this profile. + Quantity *DedicatedHostProfileDiskQuantity `json:"quantity" validate:"required"` + + // The size of the disk in GB (gigabytes). + Size *DedicatedHostProfileDiskSize `json:"size" validate:"required"` + + SupportedInstanceInterfaceTypes *DedicatedHostProfileDiskSupportedInterfaces `json:"supported_instance_interface_types" validate:"required"` +} + +// UnmarshalDedicatedHostProfileDisk unmarshals an instance of DedicatedHostProfileDisk from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDisk) + err = core.UnmarshalModel(m, "interface_type", &obj.InterfaceType, UnmarshalDedicatedHostProfileDiskInterface) + if err != nil { + return + } + err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalDedicatedHostProfileDiskQuantity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalDedicatedHostProfileDiskSize) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_instance_interface_types", &obj.SupportedInstanceInterfaceTypes, UnmarshalDedicatedHostProfileDiskSupportedInterfaces) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskInterface : DedicatedHostProfileDiskInterface struct +type DedicatedHostProfileDiskInterface struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The interface of the disk for a dedicated host with this profile + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskInterface.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskInterfaceTypeFixedConst = "fixed" +) + +// Constants associated with the DedicatedHostProfileDiskInterface.Value property. +// The interface of the disk for a dedicated host with this profile +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostProfileDiskInterfaceValueNvmeConst = "nvme" +) + +// UnmarshalDedicatedHostProfileDiskInterface unmarshals an instance of DedicatedHostProfileDiskInterface from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskInterface) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskQuantity : The number of disks of this type for a dedicated host with this profile. +type DedicatedHostProfileDiskQuantity struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskQuantity.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskQuantityTypeFixedConst = "fixed" +) + +// UnmarshalDedicatedHostProfileDiskQuantity unmarshals an instance of DedicatedHostProfileDiskQuantity from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskQuantity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskSize : The size of the disk in GB (gigabytes). +type DedicatedHostProfileDiskSize struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The size of the disk in GB (gigabytes). + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskSize.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskSizeTypeFixedConst = "fixed" +) + +// UnmarshalDedicatedHostProfileDiskSize unmarshals an instance of DedicatedHostProfileDiskSize from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskSize) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileDiskSupportedInterfaces : DedicatedHostProfileDiskSupportedInterfaces struct +type DedicatedHostProfileDiskSupportedInterfaces struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The instance disk interfaces supported for a dedicated host with this profile. + Value []string `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileDiskSupportedInterfaces.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileDiskSupportedInterfacesTypeFixedConst = "fixed" +) + +// Constants associated with the DedicatedHostProfileDiskSupportedInterfaces.Value property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + DedicatedHostProfileDiskSupportedInterfacesValueNvmeConst = "nvme" + DedicatedHostProfileDiskSupportedInterfacesValueVirtioBlkConst = "virtio_blk" +) + +// UnmarshalDedicatedHostProfileDiskSupportedInterfaces unmarshals an instance of DedicatedHostProfileDiskSupportedInterfaces from the specified map of raw messages. +func UnmarshalDedicatedHostProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileIdentity : Identifies a dedicated host profile by a unique property. +// Models which "extend" this model: +// - DedicatedHostProfileIdentityByName +// - DedicatedHostProfileIdentityByHref +type DedicatedHostProfileIdentity struct { + // The globally unique name for this dedicated host profile. + Name *string `json:"name,omitempty"` + + // The URL for this dedicated host profile. + Href *string `json:"href,omitempty"` +} + +func (*DedicatedHostProfileIdentity) isaDedicatedHostProfileIdentity() bool { + return true +} + +type DedicatedHostProfileIdentityIntf interface { + isaDedicatedHostProfileIdentity() bool +} + +// UnmarshalDedicatedHostProfileIdentity unmarshals an instance of DedicatedHostProfileIdentity from the specified map of raw messages. +func UnmarshalDedicatedHostProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemory : DedicatedHostProfileMemory struct +// Models which "extend" this model: +// - DedicatedHostProfileMemoryFixed +// - DedicatedHostProfileMemoryRange +// - DedicatedHostProfileMemoryEnum +// - DedicatedHostProfileMemoryDependent +type DedicatedHostProfileMemory struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the DedicatedHostProfileMemory.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileMemory) isaDedicatedHostProfileMemory() bool { + return true +} + +type DedicatedHostProfileMemoryIntf interface { + isaDedicatedHostProfileMemory() bool +} + +// UnmarshalDedicatedHostProfileMemory unmarshals an instance of DedicatedHostProfileMemory from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemory) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileReference : DedicatedHostProfileReference struct +type DedicatedHostProfileReference struct { + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this dedicated host profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalDedicatedHostProfileReference unmarshals an instance of DedicatedHostProfileReference from the specified map of raw messages. +func UnmarshalDedicatedHostProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocket : DedicatedHostProfileSocket struct +// Models which "extend" this model: +// - DedicatedHostProfileSocketFixed +// - DedicatedHostProfileSocketRange +// - DedicatedHostProfileSocketEnum +// - DedicatedHostProfileSocketDependent +type DedicatedHostProfileSocket struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the DedicatedHostProfileSocket.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileSocket) isaDedicatedHostProfileSocket() bool { + return true +} + +type DedicatedHostProfileSocketIntf interface { + isaDedicatedHostProfileSocket() bool +} + +// UnmarshalDedicatedHostProfileSocket unmarshals an instance of DedicatedHostProfileSocket from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocket(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocket) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpu : DedicatedHostProfileVcpu struct +// Models which "extend" this model: +// - DedicatedHostProfileVcpuFixed +// - DedicatedHostProfileVcpuRange +// - DedicatedHostProfileVcpuEnum +// - DedicatedHostProfileVcpuDependent +type DedicatedHostProfileVcpu struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the DedicatedHostProfileVcpu.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileVcpu) isaDedicatedHostProfileVcpu() bool { + return true +} + +type DedicatedHostProfileVcpuIntf interface { + isaDedicatedHostProfileVcpu() bool +} + +// UnmarshalDedicatedHostProfileVcpu unmarshals an instance of DedicatedHostProfileVcpu from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpu) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuArchitecture : DedicatedHostProfileVcpuArchitecture struct +type DedicatedHostProfileVcpuArchitecture struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The VCPU architecture for a dedicated host with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuArchitecture.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuArchitectureTypeFixedConst = "fixed" +) + +// UnmarshalDedicatedHostProfileVcpuArchitecture unmarshals an instance of DedicatedHostProfileVcpuArchitecture from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuArchitecture) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPrototype : DedicatedHostPrototype struct +// Models which "extend" this model: +// - DedicatedHostPrototypeDedicatedHostByGroup +// - DedicatedHostPrototypeDedicatedHostByZone +type DedicatedHostPrototype struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The unique user-defined name for this dedicated host. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The profile to use for this dedicated host. + Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The dedicated host group for this dedicated host. + Group DedicatedHostGroupIdentityIntf `json:"group,omitempty"` + + // The zone this dedicated host will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +func (*DedicatedHostPrototype) isaDedicatedHostPrototype() bool { + return true +} + +type DedicatedHostPrototypeIntf interface { + isaDedicatedHostPrototype() bool +} + +// UnmarshalDedicatedHostPrototype unmarshals an instance of DedicatedHostPrototype from the specified map of raw messages. +func UnmarshalDedicatedHostPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPrototype) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostReference : DedicatedHostReference struct +type DedicatedHostReference struct { + // The CRN for this dedicated host. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *DedicatedHostReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this dedicated host. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this dedicated host. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this dedicated host. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name" validate:"required"` + + // The type of resource referenced. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the DedicatedHostReference.ResourceType property. +// The type of resource referenced. +const ( + DedicatedHostReferenceResourceTypeDedicatedHostConst = "dedicated_host" +) + +// UnmarshalDedicatedHostReference unmarshals an instance of DedicatedHostReference from the specified map of raw messages. +func UnmarshalDedicatedHostReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalDedicatedHostReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type DedicatedHostReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalDedicatedHostReferenceDeleted unmarshals an instance of DedicatedHostReferenceDeleted from the specified map of raw messages. +func UnmarshalDedicatedHostReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DefaultNetworkACL : DefaultNetworkACL struct +type DefaultNetworkACL struct { + // The date and time that the network ACL was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` + + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` + + // The name of the default network ACL created for a VPC. The name will be a hyphenated list of randomly-selected words + // at creation, but may be user-specified with a subsequent request. + Name *string `json:"name" validate:"required"` + + // The resource group for the default network ACL for a VPC. Set to the VPC's + // resource group at creation. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The ordered rules for the default network ACL for a VPC. Defaults to two rules which allow all inbound and outbound + // traffic, respectively. Rules for the default network ACL may be changed, added, or removed. + Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` + + // The subnets to which this network ACL is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The VPC this network ACL is a part of. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalDefaultNetworkACL unmarshals an instance of DefaultNetworkACL from the specified map of raw messages. +func UnmarshalDefaultNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DefaultNetworkACL) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DefaultRoutingTable : DefaultRoutingTable struct +type DefaultRoutingTable struct { + // The date and time that this routing table was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this routing table. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` + + // Indicates whether this is the default routing table for this VPC. + IsDefault *bool `json:"is_default" validate:"required"` + + // The lifecycle state of the routing table. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The name of the default routing table created for this VPC. The name will be a hyphenated list of randomly-selected + // words at creation, but may be user-specified with a subsequent request. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. + // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from from [Transit + // Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. + // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this + // VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. + // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` + + // The routes for the default routing table for this VPC. The table is created with no routes, but routes may be added, + // changed, or removed with a subsequent request. + Routes []RouteReference `json:"routes" validate:"required"` + + // The subnets to which this routing table is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` +} + +// Constants associated with the DefaultRoutingTable.LifecycleState property. +// The lifecycle state of the routing table. +const ( + DefaultRoutingTableLifecycleStateDeletedConst = "deleted" + DefaultRoutingTableLifecycleStateDeletingConst = "deleting" + DefaultRoutingTableLifecycleStateFailedConst = "failed" + DefaultRoutingTableLifecycleStatePendingConst = "pending" + DefaultRoutingTableLifecycleStateStableConst = "stable" + DefaultRoutingTableLifecycleStateSuspendedConst = "suspended" + DefaultRoutingTableLifecycleStateUpdatingConst = "updating" + DefaultRoutingTableLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the DefaultRoutingTable.ResourceType property. +// The resource type. +const ( + DefaultRoutingTableResourceTypeRoutingTableConst = "routing_table" +) + +// UnmarshalDefaultRoutingTable unmarshals an instance of DefaultRoutingTable from the specified map of raw messages. +func UnmarshalDefaultRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DefaultRoutingTable) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DefaultSecurityGroup : DefaultSecurityGroup struct +type DefaultSecurityGroup struct { + // The date and time that this security group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The name of the default security group created for a VPC. The name will be a hyphenated list of randomly-selected + // words at creation, but may be user-specified with a subsequent request. + Name *string `json:"name" validate:"required"` + + // The resource group for this security group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // Array of rules for the default security group for a VPC. Defaults to allowing all outbound traffic, and allowing all + // inbound traffic from other interfaces in the VPC's default security group. Rules in the default security group may + // be changed, added or removed. + Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` + + // The VPC this security group is a part of. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalDefaultSecurityGroup unmarshals an instance of DefaultSecurityGroup from the specified map of raw messages. +func UnmarshalDefaultSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DefaultSecurityGroup) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DeleteDedicatedHostGroupOptions : The DeleteDedicatedHostGroup options. +type DeleteDedicatedHostGroupOptions struct { + // The dedicated host group identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteDedicatedHostGroupOptions : Instantiate DeleteDedicatedHostGroupOptions +func (*VpcV1) NewDeleteDedicatedHostGroupOptions(id string) *DeleteDedicatedHostGroupOptions { + return &DeleteDedicatedHostGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteDedicatedHostGroupOptions) SetID(id string) *DeleteDedicatedHostGroupOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteDedicatedHostGroupOptions) SetHeaders(param map[string]string) *DeleteDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// DeleteDedicatedHostOptions : The DeleteDedicatedHost options. +type DeleteDedicatedHostOptions struct { + // The dedicated host identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteDedicatedHostOptions : Instantiate DeleteDedicatedHostOptions +func (*VpcV1) NewDeleteDedicatedHostOptions(id string) *DeleteDedicatedHostOptions { + return &DeleteDedicatedHostOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteDedicatedHostOptions) SetID(id string) *DeleteDedicatedHostOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteDedicatedHostOptions) SetHeaders(param map[string]string) *DeleteDedicatedHostOptions { + options.Headers = param + return options +} + +// DeleteEndpointGatewayOptions : The DeleteEndpointGateway options. +type DeleteEndpointGatewayOptions struct { + // The endpoint gateway identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteEndpointGatewayOptions : Instantiate DeleteEndpointGatewayOptions +func (*VpcV1) NewDeleteEndpointGatewayOptions(id string) *DeleteEndpointGatewayOptions { + return &DeleteEndpointGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteEndpointGatewayOptions) SetID(id string) *DeleteEndpointGatewayOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteEndpointGatewayOptions) SetHeaders(param map[string]string) *DeleteEndpointGatewayOptions { + options.Headers = param + return options +} + +// DeleteFloatingIPOptions : The DeleteFloatingIP options. +type DeleteFloatingIPOptions struct { + // The floating IP identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteFloatingIPOptions : Instantiate DeleteFloatingIPOptions +func (*VpcV1) NewDeleteFloatingIPOptions(id string) *DeleteFloatingIPOptions { + return &DeleteFloatingIPOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteFloatingIPOptions) SetID(id string) *DeleteFloatingIPOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteFloatingIPOptions) SetHeaders(param map[string]string) *DeleteFloatingIPOptions { + options.Headers = param + return options +} + +// DeleteFlowLogCollectorOptions : The DeleteFlowLogCollector options. +type DeleteFlowLogCollectorOptions struct { + // The flow log collector identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteFlowLogCollectorOptions : Instantiate DeleteFlowLogCollectorOptions +func (*VpcV1) NewDeleteFlowLogCollectorOptions(id string) *DeleteFlowLogCollectorOptions { + return &DeleteFlowLogCollectorOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteFlowLogCollectorOptions) SetID(id string) *DeleteFlowLogCollectorOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteFlowLogCollectorOptions) SetHeaders(param map[string]string) *DeleteFlowLogCollectorOptions { + options.Headers = param + return options +} + +// DeleteIkePolicyOptions : The DeleteIkePolicy options. +type DeleteIkePolicyOptions struct { + // The IKE policy identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteIkePolicyOptions : Instantiate DeleteIkePolicyOptions +func (*VpcV1) NewDeleteIkePolicyOptions(id string) *DeleteIkePolicyOptions { + return &DeleteIkePolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteIkePolicyOptions) SetID(id string) *DeleteIkePolicyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteIkePolicyOptions) SetHeaders(param map[string]string) *DeleteIkePolicyOptions { + options.Headers = param + return options +} + +// DeleteImageOptions : The DeleteImage options. +type DeleteImageOptions struct { + // The image identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteImageOptions : Instantiate DeleteImageOptions +func (*VpcV1) NewDeleteImageOptions(id string) *DeleteImageOptions { + return &DeleteImageOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteImageOptions) SetID(id string) *DeleteImageOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteImageOptions) SetHeaders(param map[string]string) *DeleteImageOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupLoadBalancerOptions : The DeleteInstanceGroupLoadBalancer options. +type DeleteInstanceGroupLoadBalancerOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupLoadBalancerOptions : Instantiate DeleteInstanceGroupLoadBalancerOptions +func (*VpcV1) NewDeleteInstanceGroupLoadBalancerOptions(instanceGroupID string) *DeleteInstanceGroupLoadBalancerOptions { + return &DeleteInstanceGroupLoadBalancerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *DeleteInstanceGroupLoadBalancerOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupLoadBalancerOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupLoadBalancerOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupLoadBalancerOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupManagerOptions : The DeleteInstanceGroupManager options. +type DeleteInstanceGroupManagerOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // The instance group manager identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupManagerOptions : Instantiate DeleteInstanceGroupManagerOptions +func (*VpcV1) NewDeleteInstanceGroupManagerOptions(instanceGroupID string, id string) *DeleteInstanceGroupManagerOptions { + return &DeleteInstanceGroupManagerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *DeleteInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteInstanceGroupManagerOptions) SetID(id string) *DeleteInstanceGroupManagerOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupManagerOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupManagerPolicyOptions : The DeleteInstanceGroupManagerPolicy options. +type DeleteInstanceGroupManagerPolicyOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `validate:"required,ne="` + + // The instance group manager policy identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupManagerPolicyOptions : Instantiate DeleteInstanceGroupManagerPolicyOptions +func (*VpcV1) NewDeleteInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string) *DeleteInstanceGroupManagerPolicyOptions { + return &DeleteInstanceGroupManagerPolicyOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *DeleteInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupManagerPolicyOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (options *DeleteInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *DeleteInstanceGroupManagerPolicyOptions { + options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteInstanceGroupManagerPolicyOptions) SetID(id string) *DeleteInstanceGroupManagerPolicyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupManagerPolicyOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupMembershipOptions : The DeleteInstanceGroupMembership options. +type DeleteInstanceGroupMembershipOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // The instance group membership identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupMembershipOptions : Instantiate DeleteInstanceGroupMembershipOptions +func (*VpcV1) NewDeleteInstanceGroupMembershipOptions(instanceGroupID string, id string) *DeleteInstanceGroupMembershipOptions { + return &DeleteInstanceGroupMembershipOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *DeleteInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupMembershipOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteInstanceGroupMembershipOptions) SetID(id string) *DeleteInstanceGroupMembershipOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupMembershipOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupMembershipsOptions : The DeleteInstanceGroupMemberships options. +type DeleteInstanceGroupMembershipsOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupMembershipsOptions : Instantiate DeleteInstanceGroupMembershipsOptions +func (*VpcV1) NewDeleteInstanceGroupMembershipsOptions(instanceGroupID string) *DeleteInstanceGroupMembershipsOptions { + return &DeleteInstanceGroupMembershipsOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *DeleteInstanceGroupMembershipsOptions) SetInstanceGroupID(instanceGroupID string) *DeleteInstanceGroupMembershipsOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupMembershipsOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupMembershipsOptions { + options.Headers = param + return options +} + +// DeleteInstanceGroupOptions : The DeleteInstanceGroup options. +type DeleteInstanceGroupOptions struct { + // The instance group identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceGroupOptions : Instantiate DeleteInstanceGroupOptions +func (*VpcV1) NewDeleteInstanceGroupOptions(id string) *DeleteInstanceGroupOptions { + return &DeleteInstanceGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteInstanceGroupOptions) SetID(id string) *DeleteInstanceGroupOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceGroupOptions) SetHeaders(param map[string]string) *DeleteInstanceGroupOptions { + options.Headers = param + return options +} + +// DeleteInstanceNetworkInterfaceOptions : The DeleteInstanceNetworkInterface options. +type DeleteInstanceNetworkInterfaceOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The network interface identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceNetworkInterfaceOptions : Instantiate DeleteInstanceNetworkInterfaceOptions +func (*VpcV1) NewDeleteInstanceNetworkInterfaceOptions(instanceID string, id string) *DeleteInstanceNetworkInterfaceOptions { + return &DeleteInstanceNetworkInterfaceOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *DeleteInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *DeleteInstanceNetworkInterfaceOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteInstanceNetworkInterfaceOptions) SetID(id string) *DeleteInstanceNetworkInterfaceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *DeleteInstanceNetworkInterfaceOptions { + options.Headers = param + return options +} + +// DeleteInstanceOptions : The DeleteInstance options. +type DeleteInstanceOptions struct { + // The instance identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceOptions : Instantiate DeleteInstanceOptions +func (*VpcV1) NewDeleteInstanceOptions(id string) *DeleteInstanceOptions { + return &DeleteInstanceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteInstanceOptions) SetID(id string) *DeleteInstanceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceOptions) SetHeaders(param map[string]string) *DeleteInstanceOptions { + options.Headers = param + return options +} + +// DeleteInstanceTemplateOptions : The DeleteInstanceTemplate options. +type DeleteInstanceTemplateOptions struct { + // The instance template identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceTemplateOptions : Instantiate DeleteInstanceTemplateOptions +func (*VpcV1) NewDeleteInstanceTemplateOptions(id string) *DeleteInstanceTemplateOptions { + return &DeleteInstanceTemplateOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteInstanceTemplateOptions) SetID(id string) *DeleteInstanceTemplateOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceTemplateOptions) SetHeaders(param map[string]string) *DeleteInstanceTemplateOptions { + options.Headers = param + return options +} + +// DeleteInstanceVolumeAttachmentOptions : The DeleteInstanceVolumeAttachment options. +type DeleteInstanceVolumeAttachmentOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The volume attachment identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteInstanceVolumeAttachmentOptions : Instantiate DeleteInstanceVolumeAttachmentOptions +func (*VpcV1) NewDeleteInstanceVolumeAttachmentOptions(instanceID string, id string) *DeleteInstanceVolumeAttachmentOptions { + return &DeleteInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *DeleteInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *DeleteInstanceVolumeAttachmentOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteInstanceVolumeAttachmentOptions) SetID(id string) *DeleteInstanceVolumeAttachmentOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *DeleteInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// DeleteIpsecPolicyOptions : The DeleteIpsecPolicy options. +type DeleteIpsecPolicyOptions struct { + // The IPsec policy identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteIpsecPolicyOptions : Instantiate DeleteIpsecPolicyOptions +func (*VpcV1) NewDeleteIpsecPolicyOptions(id string) *DeleteIpsecPolicyOptions { + return &DeleteIpsecPolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteIpsecPolicyOptions) SetID(id string) *DeleteIpsecPolicyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteIpsecPolicyOptions) SetHeaders(param map[string]string) *DeleteIpsecPolicyOptions { + options.Headers = param + return options +} + +// DeleteKeyOptions : The DeleteKey options. +type DeleteKeyOptions struct { + // The key identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteKeyOptions : Instantiate DeleteKeyOptions +func (*VpcV1) NewDeleteKeyOptions(id string) *DeleteKeyOptions { + return &DeleteKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteKeyOptions) SetID(id string) *DeleteKeyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteKeyOptions) SetHeaders(param map[string]string) *DeleteKeyOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerListenerOptions : The DeleteLoadBalancerListener options. +type DeleteLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The listener identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerListenerOptions : Instantiate DeleteLoadBalancerListenerOptions +func (*VpcV1) NewDeleteLoadBalancerListenerOptions(loadBalancerID string, id string) *DeleteLoadBalancerListenerOptions { + return &DeleteLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *DeleteLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteLoadBalancerListenerOptions) SetID(id string) *DeleteLoadBalancerListenerOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerListenerOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerListenerPolicyOptions : The DeleteLoadBalancerListenerPolicy options. +type DeleteLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The listener identifier. + ListenerID *string `validate:"required,ne="` + + // The policy identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerListenerPolicyOptions : Instantiate DeleteLoadBalancerListenerPolicyOptions +func (*VpcV1) NewDeleteLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string) *DeleteLoadBalancerListenerPolicyOptions { + return &DeleteLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *DeleteLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerPolicyOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetListenerID : Allow user to set ListenerID +func (options *DeleteLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *DeleteLoadBalancerListenerPolicyOptions { + options.ListenerID = core.StringPtr(listenerID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteLoadBalancerListenerPolicyOptions) SetID(id string) *DeleteLoadBalancerListenerPolicyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerListenerPolicyRuleOptions : The DeleteLoadBalancerListenerPolicyRule options. +type DeleteLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The listener identifier. + ListenerID *string `validate:"required,ne="` + + // The policy identifier. + PolicyID *string `validate:"required,ne="` + + // The rule identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerListenerPolicyRuleOptions : Instantiate DeleteLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewDeleteLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string) *DeleteLoadBalancerListenerPolicyRuleOptions { + return &DeleteLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *DeleteLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerListenerPolicyRuleOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetListenerID : Allow user to set ListenerID +func (options *DeleteLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *DeleteLoadBalancerListenerPolicyRuleOptions { + options.ListenerID = core.StringPtr(listenerID) + return options +} + +// SetPolicyID : Allow user to set PolicyID +func (options *DeleteLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *DeleteLoadBalancerListenerPolicyRuleOptions { + options.PolicyID = core.StringPtr(policyID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteLoadBalancerListenerPolicyRuleOptions) SetID(id string) *DeleteLoadBalancerListenerPolicyRuleOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerOptions : The DeleteLoadBalancer options. +type DeleteLoadBalancerOptions struct { + // The load balancer identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerOptions : Instantiate DeleteLoadBalancerOptions +func (*VpcV1) NewDeleteLoadBalancerOptions(id string) *DeleteLoadBalancerOptions { + return &DeleteLoadBalancerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteLoadBalancerOptions) SetID(id string) *DeleteLoadBalancerOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerPoolMemberOptions : The DeleteLoadBalancerPoolMember options. +type DeleteLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The pool identifier. + PoolID *string `validate:"required,ne="` + + // The member identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerPoolMemberOptions : Instantiate DeleteLoadBalancerPoolMemberOptions +func (*VpcV1) NewDeleteLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string) *DeleteLoadBalancerPoolMemberOptions { + return &DeleteLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *DeleteLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerPoolMemberOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetPoolID : Allow user to set PoolID +func (options *DeleteLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *DeleteLoadBalancerPoolMemberOptions { + options.PoolID = core.StringPtr(poolID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteLoadBalancerPoolMemberOptions) SetID(id string) *DeleteLoadBalancerPoolMemberOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// DeleteLoadBalancerPoolOptions : The DeleteLoadBalancerPool options. +type DeleteLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The pool identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteLoadBalancerPoolOptions : Instantiate DeleteLoadBalancerPoolOptions +func (*VpcV1) NewDeleteLoadBalancerPoolOptions(loadBalancerID string, id string) *DeleteLoadBalancerPoolOptions { + return &DeleteLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *DeleteLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *DeleteLoadBalancerPoolOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteLoadBalancerPoolOptions) SetID(id string) *DeleteLoadBalancerPoolOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteLoadBalancerPoolOptions) SetHeaders(param map[string]string) *DeleteLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// DeleteNetworkACLOptions : The DeleteNetworkACL options. +type DeleteNetworkACLOptions struct { + // The network ACL identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteNetworkACLOptions : Instantiate DeleteNetworkACLOptions +func (*VpcV1) NewDeleteNetworkACLOptions(id string) *DeleteNetworkACLOptions { + return &DeleteNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteNetworkACLOptions) SetID(id string) *DeleteNetworkACLOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteNetworkACLOptions) SetHeaders(param map[string]string) *DeleteNetworkACLOptions { + options.Headers = param + return options +} + +// DeleteNetworkACLRuleOptions : The DeleteNetworkACLRule options. +type DeleteNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `validate:"required,ne="` + + // The rule identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteNetworkACLRuleOptions : Instantiate DeleteNetworkACLRuleOptions +func (*VpcV1) NewDeleteNetworkACLRuleOptions(networkACLID string, id string) *DeleteNetworkACLRuleOptions { + return &DeleteNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + ID: core.StringPtr(id), + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (options *DeleteNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *DeleteNetworkACLRuleOptions { + options.NetworkACLID = core.StringPtr(networkACLID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteNetworkACLRuleOptions) SetID(id string) *DeleteNetworkACLRuleOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteNetworkACLRuleOptions) SetHeaders(param map[string]string) *DeleteNetworkACLRuleOptions { + options.Headers = param + return options +} + +// DeletePublicGatewayOptions : The DeletePublicGateway options. +type DeletePublicGatewayOptions struct { + // The public gateway identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeletePublicGatewayOptions : Instantiate DeletePublicGatewayOptions +func (*VpcV1) NewDeletePublicGatewayOptions(id string) *DeletePublicGatewayOptions { + return &DeletePublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeletePublicGatewayOptions) SetID(id string) *DeletePublicGatewayOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeletePublicGatewayOptions) SetHeaders(param map[string]string) *DeletePublicGatewayOptions { + options.Headers = param + return options +} + +// DeleteSecurityGroupOptions : The DeleteSecurityGroup options. +type DeleteSecurityGroupOptions struct { + // The security group identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSecurityGroupOptions : Instantiate DeleteSecurityGroupOptions +func (*VpcV1) NewDeleteSecurityGroupOptions(id string) *DeleteSecurityGroupOptions { + return &DeleteSecurityGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteSecurityGroupOptions) SetID(id string) *DeleteSecurityGroupOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSecurityGroupOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupOptions { + options.Headers = param + return options +} + +// DeleteSecurityGroupRuleOptions : The DeleteSecurityGroupRule options. +type DeleteSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `validate:"required,ne="` + + // The rule identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSecurityGroupRuleOptions : Instantiate DeleteSecurityGroupRuleOptions +func (*VpcV1) NewDeleteSecurityGroupRuleOptions(securityGroupID string, id string) *DeleteSecurityGroupRuleOptions { + return &DeleteSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (options *DeleteSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *DeleteSecurityGroupRuleOptions { + options.SecurityGroupID = core.StringPtr(securityGroupID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteSecurityGroupRuleOptions) SetID(id string) *DeleteSecurityGroupRuleOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSecurityGroupRuleOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// DeleteSecurityGroupTargetBindingOptions : The DeleteSecurityGroupTargetBinding options. +type DeleteSecurityGroupTargetBindingOptions struct { + // The security group identifier. + SecurityGroupID *string `validate:"required,ne="` + + // The security group target identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSecurityGroupTargetBindingOptions : Instantiate DeleteSecurityGroupTargetBindingOptions +func (*VpcV1) NewDeleteSecurityGroupTargetBindingOptions(securityGroupID string, id string) *DeleteSecurityGroupTargetBindingOptions { + return &DeleteSecurityGroupTargetBindingOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (options *DeleteSecurityGroupTargetBindingOptions) SetSecurityGroupID(securityGroupID string) *DeleteSecurityGroupTargetBindingOptions { + options.SecurityGroupID = core.StringPtr(securityGroupID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteSecurityGroupTargetBindingOptions) SetID(id string) *DeleteSecurityGroupTargetBindingOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSecurityGroupTargetBindingOptions) SetHeaders(param map[string]string) *DeleteSecurityGroupTargetBindingOptions { + options.Headers = param + return options +} + +// DeleteSubnetOptions : The DeleteSubnet options. +type DeleteSubnetOptions struct { + // The subnet identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSubnetOptions : Instantiate DeleteSubnetOptions +func (*VpcV1) NewDeleteSubnetOptions(id string) *DeleteSubnetOptions { + return &DeleteSubnetOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteSubnetOptions) SetID(id string) *DeleteSubnetOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSubnetOptions) SetHeaders(param map[string]string) *DeleteSubnetOptions { + options.Headers = param + return options +} + +// DeleteSubnetReservedIPOptions : The DeleteSubnetReservedIP options. +type DeleteSubnetReservedIPOptions struct { + // The subnet identifier. + SubnetID *string `validate:"required,ne="` + + // The reserved IP identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteSubnetReservedIPOptions : Instantiate DeleteSubnetReservedIPOptions +func (*VpcV1) NewDeleteSubnetReservedIPOptions(subnetID string, id string) *DeleteSubnetReservedIPOptions { + return &DeleteSubnetReservedIPOptions{ + SubnetID: core.StringPtr(subnetID), + ID: core.StringPtr(id), + } +} + +// SetSubnetID : Allow user to set SubnetID +func (options *DeleteSubnetReservedIPOptions) SetSubnetID(subnetID string) *DeleteSubnetReservedIPOptions { + options.SubnetID = core.StringPtr(subnetID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteSubnetReservedIPOptions) SetID(id string) *DeleteSubnetReservedIPOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteSubnetReservedIPOptions) SetHeaders(param map[string]string) *DeleteSubnetReservedIPOptions { + options.Headers = param + return options +} + +// DeleteVolumeOptions : The DeleteVolume options. +type DeleteVolumeOptions struct { + // The volume identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVolumeOptions : Instantiate DeleteVolumeOptions +func (*VpcV1) NewDeleteVolumeOptions(id string) *DeleteVolumeOptions { + return &DeleteVolumeOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteVolumeOptions) SetID(id string) *DeleteVolumeOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVolumeOptions) SetHeaders(param map[string]string) *DeleteVolumeOptions { + options.Headers = param + return options +} + +// DeleteVPCAddressPrefixOptions : The DeleteVPCAddressPrefix options. +type DeleteVPCAddressPrefixOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The prefix identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCAddressPrefixOptions : Instantiate DeleteVPCAddressPrefixOptions +func (*VpcV1) NewDeleteVPCAddressPrefixOptions(vpcID string, id string) *DeleteVPCAddressPrefixOptions { + return &DeleteVPCAddressPrefixOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (options *DeleteVPCAddressPrefixOptions) SetVPCID(vpcID string) *DeleteVPCAddressPrefixOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteVPCAddressPrefixOptions) SetID(id string) *DeleteVPCAddressPrefixOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCAddressPrefixOptions) SetHeaders(param map[string]string) *DeleteVPCAddressPrefixOptions { + options.Headers = param + return options +} + +// DeleteVPCOptions : The DeleteVPC options. +type DeleteVPCOptions struct { + // The VPC identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCOptions : Instantiate DeleteVPCOptions +func (*VpcV1) NewDeleteVPCOptions(id string) *DeleteVPCOptions { + return &DeleteVPCOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteVPCOptions) SetID(id string) *DeleteVPCOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCOptions) SetHeaders(param map[string]string) *DeleteVPCOptions { + options.Headers = param + return options +} + +// DeleteVPCRouteOptions : The DeleteVPCRoute options. +type DeleteVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The route identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCRouteOptions : Instantiate DeleteVPCRouteOptions +func (*VpcV1) NewDeleteVPCRouteOptions(vpcID string, id string) *DeleteVPCRouteOptions { + return &DeleteVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (options *DeleteVPCRouteOptions) SetVPCID(vpcID string) *DeleteVPCRouteOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteVPCRouteOptions) SetID(id string) *DeleteVPCRouteOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCRouteOptions) SetHeaders(param map[string]string) *DeleteVPCRouteOptions { + options.Headers = param + return options +} + +// DeleteVPCRoutingTableOptions : The DeleteVPCRoutingTable options. +type DeleteVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The routing table identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCRoutingTableOptions : Instantiate DeleteVPCRoutingTableOptions +func (*VpcV1) NewDeleteVPCRoutingTableOptions(vpcID string, id string) *DeleteVPCRoutingTableOptions { + return &DeleteVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (options *DeleteVPCRoutingTableOptions) SetVPCID(vpcID string) *DeleteVPCRoutingTableOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteVPCRoutingTableOptions) SetID(id string) *DeleteVPCRoutingTableOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCRoutingTableOptions) SetHeaders(param map[string]string) *DeleteVPCRoutingTableOptions { + options.Headers = param + return options +} + +// DeleteVPCRoutingTableRouteOptions : The DeleteVPCRoutingTableRoute options. +type DeleteVPCRoutingTableRouteOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `validate:"required,ne="` + + // The VPC routing table route identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPCRoutingTableRouteOptions : Instantiate DeleteVPCRoutingTableRouteOptions +func (*VpcV1) NewDeleteVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string) *DeleteVPCRoutingTableRouteOptions { + return &DeleteVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (options *DeleteVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *DeleteVPCRoutingTableRouteOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (options *DeleteVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *DeleteVPCRoutingTableRouteOptions { + options.RoutingTableID = core.StringPtr(routingTableID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteVPCRoutingTableRouteOptions) SetID(id string) *DeleteVPCRoutingTableRouteOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *DeleteVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// DeleteVPNGatewayConnectionOptions : The DeleteVPNGatewayConnection options. +type DeleteVPNGatewayConnectionOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNGatewayConnectionOptions : Instantiate DeleteVPNGatewayConnectionOptions +func (*VpcV1) NewDeleteVPNGatewayConnectionOptions(vpnGatewayID string, id string) *DeleteVPNGatewayConnectionOptions { + return &DeleteVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (options *DeleteVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *DeleteVPNGatewayConnectionOptions { + options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return options +} + +// SetID : Allow user to set ID +func (options *DeleteVPNGatewayConnectionOptions) SetID(id string) *DeleteVPNGatewayConnectionOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *DeleteVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// DeleteVPNGatewayOptions : The DeleteVPNGateway options. +type DeleteVPNGatewayOptions struct { + // The VPN gateway identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewDeleteVPNGatewayOptions : Instantiate DeleteVPNGatewayOptions +func (*VpcV1) NewDeleteVPNGatewayOptions(id string) *DeleteVPNGatewayOptions { + return &DeleteVPNGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *DeleteVPNGatewayOptions) SetID(id string) *DeleteVPNGatewayOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *DeleteVPNGatewayOptions) SetHeaders(param map[string]string) *DeleteVPNGatewayOptions { + options.Headers = param + return options +} + +// EncryptionKeyIdentity : Identifies an encryption key by a unique property. +// Models which "extend" this model: +// - EncryptionKeyIdentityByCRN +type EncryptionKeyIdentity struct { + // The CRN of the [Key Protect Root + // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto + // Service Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. + CRN *string `json:"crn,omitempty"` +} + +func (*EncryptionKeyIdentity) isaEncryptionKeyIdentity() bool { + return true +} + +type EncryptionKeyIdentityIntf interface { + isaEncryptionKeyIdentity() bool +} + +// UnmarshalEncryptionKeyIdentity unmarshals an instance of EncryptionKeyIdentity from the specified map of raw messages. +func UnmarshalEncryptionKeyIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EncryptionKeyIdentity) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EncryptionKeyReference : EncryptionKeyReference struct +type EncryptionKeyReference struct { + // The CRN of the [Key Protect Root + // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto + // Service Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. + CRN *string `json:"crn" validate:"required"` +} + +// UnmarshalEncryptionKeyReference unmarshals an instance of EncryptionKeyReference from the specified map of raw messages. +func UnmarshalEncryptionKeyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EncryptionKeyReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGateway : EndpointGateway struct +type EndpointGateway struct { + // The date and time that the endpoint gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` + + // The health of this resource. + // - `ok`: Healthy + // - `degraded`: Suffering from compromised performance, capacity, or connectivity + // - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated + // - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a + // lifecycle state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also + // have this state. + HealthState *string `json:"health_state" validate:"required"` + + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` + + // Collection of reserved IPs bound to an endpoint gateway. + Ips []ReservedIPReference `json:"ips" validate:"required"` + + // The lifecycle state of the endpoint gateway. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The unique user-defined name for this endpoint gateway. + Name *string `json:"name" validate:"required"` + + // The resource group for this endpoint gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The type of resource referenced. + ResourceType *string `json:"resource_type" validate:"required"` + + // The fully qualified domain name for the target service. + ServiceEndpoint *string `json:"service_endpoint,omitempty"` + + // Collection of fully qualified domain names for the target service. + ServiceEndpoints []string `json:"service_endpoints" validate:"required"` + + // The target for this endpoint gateway. + Target EndpointGatewayTargetIntf `json:"target" validate:"required"` + + // The VPC this endpoint gateway is serving. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the EndpointGateway.HealthState property. +// The health of this resource. +// - `ok`: Healthy +// - `degraded`: Suffering from compromised performance, capacity, or connectivity +// - `faulted`: Completely unreachable, inoperative, or otherwise entirely incapacitated +// - `inapplicable`: The health state does not apply because of the current lifecycle state. A resource with a lifecycle +// state of `failed` or `deleting` will have a health state of `inapplicable`. A `pending` resource may also have this +// state. +const ( + EndpointGatewayHealthStateDegradedConst = "degraded" + EndpointGatewayHealthStateFaultedConst = "faulted" + EndpointGatewayHealthStateInapplicableConst = "inapplicable" + EndpointGatewayHealthStateOkConst = "ok" +) + +// Constants associated with the EndpointGateway.LifecycleState property. +// The lifecycle state of the endpoint gateway. +const ( + EndpointGatewayLifecycleStateDeletedConst = "deleted" + EndpointGatewayLifecycleStateDeletingConst = "deleting" + EndpointGatewayLifecycleStateFailedConst = "failed" + EndpointGatewayLifecycleStatePendingConst = "pending" + EndpointGatewayLifecycleStateStableConst = "stable" + EndpointGatewayLifecycleStateSuspendedConst = "suspended" + EndpointGatewayLifecycleStateUpdatingConst = "updating" + EndpointGatewayLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the EndpointGateway.ResourceType property. +// The type of resource referenced. +const ( + EndpointGatewayResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +// UnmarshalEndpointGateway unmarshals an instance of EndpointGateway from the specified map of raw messages. +func UnmarshalEndpointGateway(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGateway) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health_state", &obj.HealthState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_endpoint", &obj.ServiceEndpoint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "service_endpoints", &obj.ServiceEndpoints) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalEndpointGatewayTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayCollection : EndpointGatewayCollection struct +type EndpointGatewayCollection struct { + // Collection of endpoint gateways. + EndpointGateways []EndpointGateway `json:"endpoint_gateways" validate:"required"` + + // A link to the first page of resources. + First *EndpointGatewayCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *EndpointGatewayCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalEndpointGatewayCollection unmarshals an instance of EndpointGatewayCollection from the specified map of raw messages. +func UnmarshalEndpointGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayCollection) + err = core.UnmarshalModel(m, "endpoint_gateways", &obj.EndpointGateways, UnmarshalEndpointGateway) + if err != nil { + return + } + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalEndpointGatewayCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalEndpointGatewayCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayCollectionFirst : A link to the first page of resources. +type EndpointGatewayCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalEndpointGatewayCollectionFirst unmarshals an instance of EndpointGatewayCollectionFirst from the specified map of raw messages. +func UnmarshalEndpointGatewayCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type EndpointGatewayCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalEndpointGatewayCollectionNext unmarshals an instance of EndpointGatewayCollectionNext from the specified map of raw messages. +func UnmarshalEndpointGatewayCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayPatch : EndpointGatewayPatch struct +type EndpointGatewayPatch struct { + // The user-defined name for this endpoint gateway. Names must be unique within the VPC this endpoint gateway is + // serving. + Name *string `json:"name,omitempty"` +} + +// UnmarshalEndpointGatewayPatch unmarshals an instance of EndpointGatewayPatch from the specified map of raw messages. +func UnmarshalEndpointGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the EndpointGatewayPatch +func (endpointGatewayPatch *EndpointGatewayPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(endpointGatewayPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// EndpointGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type EndpointGatewayReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalEndpointGatewayReferenceDeleted unmarshals an instance of EndpointGatewayReferenceDeleted from the specified map of raw messages. +func UnmarshalEndpointGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIP : A reserved IP to bind to the endpoint gateway. This can be an existing reserved IP, or a prototype used to allocate a +// reserved IP. The reserved IP will be bound to the endpoint gateway to function as a virtual private endpoint for the +// service. +// Models which "extend" this model: +// - EndpointGatewayReservedIPReservedIPIdentity +// - EndpointGatewayReservedIPReservedIPPrototypeTargetContext +type EndpointGatewayReservedIP struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` + + // If set to `true`, this reserved IP will be automatically deleted when the target is deleted or when the reserved IP + // is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The user-defined name for this reserved IP. If not specified, the name will be a hyphenated list of + // randomly-selected words. Names must be unique within the subnet the reserved IP resides in. Names beginning with + // `ibm-` are reserved for provider-owned resources. + Name *string `json:"name,omitempty"` + + // The subnet in which to create this reserved IP. + Subnet SubnetIdentityIntf `json:"subnet,omitempty"` +} + +func (*EndpointGatewayReservedIP) isaEndpointGatewayReservedIP() bool { + return true +} + +type EndpointGatewayReservedIPIntf interface { + isaEndpointGatewayReservedIP() bool +} + +// UnmarshalEndpointGatewayReservedIP unmarshals an instance of EndpointGatewayReservedIP from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIP) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTarget : The target for this endpoint gateway. +// Models which "extend" this model: +// - EndpointGatewayTargetProviderCloudServiceReference +// - EndpointGatewayTargetProviderInfrastructureServiceReference +type EndpointGatewayTarget struct { + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn,omitempty"` + + // The type of target. + ResourceType *string `json:"resource_type,omitempty"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the EndpointGatewayTarget.ResourceType property. +// The type of target. +const ( + EndpointGatewayTargetResourceTypeProviderCloudServiceConst = "provider_cloud_service" +) + +func (*EndpointGatewayTarget) isaEndpointGatewayTarget() bool { + return true +} + +type EndpointGatewayTargetIntf interface { + isaEndpointGatewayTarget() bool +} + +// UnmarshalEndpointGatewayTarget unmarshals an instance of EndpointGatewayTarget from the specified map of raw messages. +func UnmarshalEndpointGatewayTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTarget) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototype : The target for this endpoint gateway. +// Models which "extend" this model: +// - EndpointGatewayTargetPrototypeProviderCloudServiceIdentity +// - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity +type EndpointGatewayTargetPrototype struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn,omitempty"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the EndpointGatewayTargetPrototype.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetPrototype) isaEndpointGatewayTargetPrototype() bool { + return true +} + +type EndpointGatewayTargetPrototypeIntf interface { + isaEndpointGatewayTargetPrototype() bool +} + +// UnmarshalEndpointGatewayTargetPrototype unmarshals an instance of EndpointGatewayTargetPrototype from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "resource_type", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'resource_type': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'resource_type' not found in JSON object") + return + } + if discValue == "provider_cloud_service" { + err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity) + } else if discValue == "provider_infrastructure_service" { + err = core.UnmarshalModel(m, "", result, UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'resource_type': %s", discValue) + } + return +} + +// FloatingIP : FloatingIP struct +type FloatingIP struct { + // The globally unique IP address. + Address *string `json:"address" validate:"required"` + + // The date and time that the floating IP was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` + + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this floating IP. + Name *string `json:"name" validate:"required"` + + // The resource group for this floating IP. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The status of the floating IP. + Status *string `json:"status" validate:"required"` + + // The target of this floating IP. + Target FloatingIPTargetIntf `json:"target,omitempty"` + + // The zone this floating IP resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the FloatingIP.Status property. +// The status of the floating IP. +const ( + FloatingIPStatusAvailableConst = "available" + FloatingIPStatusDeletingConst = "deleting" + FloatingIPStatusFailedConst = "failed" + FloatingIPStatusPendingConst = "pending" +) + +// UnmarshalFloatingIP unmarshals an instance of FloatingIP from the specified map of raw messages. +func UnmarshalFloatingIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPByTargetNetworkInterfaceIdentity : The network interface this floating IP is to be bound to. +// Models which "extend" this model: +// - FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID +// - FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref +type FloatingIPByTargetNetworkInterfaceIdentity struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` +} + +func (*FloatingIPByTargetNetworkInterfaceIdentity) isaFloatingIPByTargetNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPByTargetNetworkInterfaceIdentityIntf interface { + isaFloatingIPByTargetNetworkInterfaceIdentity() bool +} + +// UnmarshalFloatingIPByTargetNetworkInterfaceIdentity unmarshals an instance of FloatingIPByTargetNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPByTargetNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPByTargetNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPCollection : FloatingIPCollection struct +type FloatingIPCollection struct { + // A link to the first page of resources. + First *FloatingIPCollectionFirst `json:"first" validate:"required"` + + // Collection of floating IPs. + FloatingIps []FloatingIP `json:"floating_ips" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *FloatingIPCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalFloatingIPCollection unmarshals an instance of FloatingIPCollection from the specified map of raw messages. +func UnmarshalFloatingIPCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFloatingIPCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFloatingIPCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPCollectionFirst : A link to the first page of resources. +type FloatingIPCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalFloatingIPCollectionFirst unmarshals an instance of FloatingIPCollectionFirst from the specified map of raw messages. +func UnmarshalFloatingIPCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type FloatingIPCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalFloatingIPCollectionNext unmarshals an instance of FloatingIPCollectionNext from the specified map of raw messages. +func UnmarshalFloatingIPCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPPatch : FloatingIPPatch struct +type FloatingIPPatch struct { + // The unique user-defined name for this floating IP. + Name *string `json:"name,omitempty"` + + // A new network interface to bind this floating IP to, replacing any existing binding. + // For this request to succeed, the existing floating IP must not be required by another + // resource, such as a public gateway. + Target FloatingIPPatchTargetNetworkInterfaceIdentityIntf `json:"target,omitempty"` +} + +// UnmarshalFloatingIPPatch unmarshals an instance of FloatingIPPatch from the specified map of raw messages. +func UnmarshalFloatingIPPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPPatchTargetNetworkInterfaceIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the FloatingIPPatch +func (floatingIPPatch *FloatingIPPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(floatingIPPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// FloatingIPPatchTargetNetworkInterfaceIdentity : A new network interface to bind this floating IP to, replacing any existing binding. For this request to succeed, the +// existing floating IP must not be required by another resource, such as a public gateway. +// Models which "extend" this model: +// - FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID +// - FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref +type FloatingIPPatchTargetNetworkInterfaceIdentity struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` +} + +func (*FloatingIPPatchTargetNetworkInterfaceIdentity) isaFloatingIPPatchTargetNetworkInterfaceIdentity() bool { + return true +} + +type FloatingIPPatchTargetNetworkInterfaceIdentityIntf interface { + isaFloatingIPPatchTargetNetworkInterfaceIdentity() bool +} + +// UnmarshalFloatingIPPatchTargetNetworkInterfaceIdentity unmarshals an instance of FloatingIPPatchTargetNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFloatingIPPatchTargetNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPatchTargetNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPPrototype : FloatingIPPrototype struct +// Models which "extend" this model: +// - FloatingIPPrototypeFloatingIPByZone +// - FloatingIPPrototypeFloatingIPByTarget +type FloatingIPPrototype struct { + // The unique user-defined name for this floating IP. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The zone this floating IP will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // The network interface this floating IP is to be bound to. + Target FloatingIPByTargetNetworkInterfaceIdentityIntf `json:"target,omitempty"` +} + +func (*FloatingIPPrototype) isaFloatingIPPrototype() bool { + return true +} + +type FloatingIPPrototypeIntf interface { + isaFloatingIPPrototype() bool +} + +// UnmarshalFloatingIPPrototype unmarshals an instance of FloatingIPPrototype from the specified map of raw messages. +func UnmarshalFloatingIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPByTargetNetworkInterfaceIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPReference : FloatingIPReference struct +type FloatingIPReference struct { + // The globally unique IP address. + Address *string `json:"address" validate:"required"` + + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this floating IP. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalFloatingIPReference unmarshals an instance of FloatingIPReference from the specified map of raw messages. +func UnmarshalFloatingIPReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPReference) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type FloatingIPReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalFloatingIPReferenceDeleted unmarshals an instance of FloatingIPReferenceDeleted from the specified map of raw messages. +func UnmarshalFloatingIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTarget : The target of this floating IP. +// Models which "extend" this model: +// - FloatingIPTargetNetworkInterfaceReference +// - FloatingIPTargetPublicGatewayReference +type FloatingIPTarget struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` + + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The user-defined name for this network interface. + Name *string `json:"name,omitempty"` + + // The primary IPv4 address. + PrimaryIpv4Address *string `json:"primary_ipv4_address,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The CRN for this public gateway. + CRN *string `json:"crn,omitempty"` +} + +// Constants associated with the FloatingIPTarget.ResourceType property. +// The resource type. +const ( + FloatingIPTargetResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FloatingIPTarget) isaFloatingIPTarget() bool { + return true +} + +type FloatingIPTargetIntf interface { + isaFloatingIPTarget() bool +} + +// UnmarshalFloatingIPTarget unmarshals an instance of FloatingIPTarget from the specified map of raw messages. +func UnmarshalFloatingIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "primary_ipv4_address", &obj.PrimaryIpv4Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPUnpaginatedCollection : FloatingIPUnpaginatedCollection struct +type FloatingIPUnpaginatedCollection struct { + // Collection of floating IPs. + FloatingIps []FloatingIP `json:"floating_ips" validate:"required"` +} + +// UnmarshalFloatingIPUnpaginatedCollection unmarshals an instance of FloatingIPUnpaginatedCollection from the specified map of raw messages. +func UnmarshalFloatingIPUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPUnpaginatedCollection) + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIP) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollector : FlowLogCollector struct +type FlowLogCollector struct { + // Indicates whether this collector is active. + Active *bool `json:"active" validate:"required"` + + // If set to `true`, this flow log collector will be automatically deleted when the target is deleted. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // The date and time that the flow log collector was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this flow log collector. + CRN *string `json:"crn" validate:"required"` + + // The URL for this flow log collector. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this flow log collector. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the flow log collector. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The unique user-defined name for this flow log collector. + Name *string `json:"name" validate:"required"` + + // The resource group for this flow log collector. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The Cloud Object Storage bucket where the collected flows are logged. + StorageBucket *CloudObjectStorageBucketReference `json:"storage_bucket" validate:"required"` + + // The target this collector is collecting flow logs for. If the target is an instance, + // subnet, or VPC, flow logs will not be collected for any network interfaces within the + // target that are themselves the target of a more specific flow log collector. + Target FlowLogCollectorTargetIntf `json:"target" validate:"required"` + + // The VPC this flow log collector is associated with. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the FlowLogCollector.LifecycleState property. +// The lifecycle state of the flow log collector. +const ( + FlowLogCollectorLifecycleStateDeletedConst = "deleted" + FlowLogCollectorLifecycleStateDeletingConst = "deleting" + FlowLogCollectorLifecycleStateFailedConst = "failed" + FlowLogCollectorLifecycleStatePendingConst = "pending" + FlowLogCollectorLifecycleStateStableConst = "stable" + FlowLogCollectorLifecycleStateSuspendedConst = "suspended" + FlowLogCollectorLifecycleStateUpdatingConst = "updating" + FlowLogCollectorLifecycleStateWaitingConst = "waiting" +) + +// UnmarshalFlowLogCollector unmarshals an instance of FlowLogCollector from the specified map of raw messages. +func UnmarshalFlowLogCollector(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollector) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "storage_bucket", &obj.StorageBucket, UnmarshalCloudObjectStorageBucketReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFlowLogCollectorTarget) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorCollection : FlowLogCollectorCollection struct +type FlowLogCollectorCollection struct { + // A link to the first page of resources. + First *FlowLogCollectorCollectionFirst `json:"first" validate:"required"` + + // Collection of flow log collectors. + FlowLogCollectors []FlowLogCollector `json:"flow_log_collectors" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *FlowLogCollectorCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalFlowLogCollectorCollection unmarshals an instance of FlowLogCollectorCollection from the specified map of raw messages. +func UnmarshalFlowLogCollectorCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalFlowLogCollectorCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "flow_log_collectors", &obj.FlowLogCollectors, UnmarshalFlowLogCollector) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalFlowLogCollectorCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorCollectionFirst : A link to the first page of resources. +type FlowLogCollectorCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalFlowLogCollectorCollectionFirst unmarshals an instance of FlowLogCollectorCollectionFirst from the specified map of raw messages. +func UnmarshalFlowLogCollectorCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type FlowLogCollectorCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalFlowLogCollectorCollectionNext unmarshals an instance of FlowLogCollectorCollectionNext from the specified map of raw messages. +func UnmarshalFlowLogCollectorCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorPatch : FlowLogCollectorPatch struct +type FlowLogCollectorPatch struct { + // Indicates whether this collector is active. Updating to false deactivates the collector and updating to true + // activates the collector. + Active *bool `json:"active,omitempty"` + + // The unique user-defined name for this flow log collector. + Name *string `json:"name,omitempty"` +} + +// UnmarshalFlowLogCollectorPatch unmarshals an instance of FlowLogCollectorPatch from the specified map of raw messages. +func UnmarshalFlowLogCollectorPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorPatch) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the FlowLogCollectorPatch +func (flowLogCollectorPatch *FlowLogCollectorPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(flowLogCollectorPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// FlowLogCollectorTarget : The target this collector is collecting flow logs for. If the target is an instance, subnet, or VPC, flow logs will +// not be collected for any network interfaces within the target that are themselves the target of a more specific flow +// log collector. +// Models which "extend" this model: +// - FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext +// - FlowLogCollectorTargetInstanceReference +// - FlowLogCollectorTargetSubnetReference +// - FlowLogCollectorTargetVPCReference +type FlowLogCollectorTarget struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` + + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The user-defined name for this network interface. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` +} + +// Constants associated with the FlowLogCollectorTarget.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FlowLogCollectorTarget) isaFlowLogCollectorTarget() bool { + return true +} + +type FlowLogCollectorTargetIntf interface { + isaFlowLogCollectorTarget() bool +} + +// UnmarshalFlowLogCollectorTarget unmarshals an instance of FlowLogCollectorTarget from the specified map of raw messages. +func UnmarshalFlowLogCollectorTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototype : The target this collector will collect flow logs for. If the target is an instance, subnet, or VPC, flow logs will +// not be collected for any network interfaces within the target that are themselves the target of a more specific flow +// log collector. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity +// - FlowLogCollectorTargetPrototypeInstanceIdentity +// - FlowLogCollectorTargetPrototypeSubnetIdentity +// - FlowLogCollectorTargetPrototypeVPCIdentity +type FlowLogCollectorTargetPrototype struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` +} + +func (*FlowLogCollectorTargetPrototype) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +type FlowLogCollectorTargetPrototypeIntf interface { + isaFlowLogCollectorTargetPrototype() bool +} + +// UnmarshalFlowLogCollectorTargetPrototype unmarshals an instance of FlowLogCollectorTargetPrototype from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// GetDedicatedHostDiskOptions : The GetDedicatedHostDisk options. +type GetDedicatedHostDiskOptions struct { + // The dedicated host identifier. + DedicatedHostID *string `validate:"required,ne="` + + // The dedicated host disk identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostDiskOptions : Instantiate GetDedicatedHostDiskOptions +func (*VpcV1) NewGetDedicatedHostDiskOptions(dedicatedHostID string, id string) *GetDedicatedHostDiskOptions { + return &GetDedicatedHostDiskOptions{ + DedicatedHostID: core.StringPtr(dedicatedHostID), + ID: core.StringPtr(id), + } +} + +// SetDedicatedHostID : Allow user to set DedicatedHostID +func (options *GetDedicatedHostDiskOptions) SetDedicatedHostID(dedicatedHostID string) *GetDedicatedHostDiskOptions { + options.DedicatedHostID = core.StringPtr(dedicatedHostID) + return options +} + +// SetID : Allow user to set ID +func (options *GetDedicatedHostDiskOptions) SetID(id string) *GetDedicatedHostDiskOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostDiskOptions) SetHeaders(param map[string]string) *GetDedicatedHostDiskOptions { + options.Headers = param + return options +} + +// GetDedicatedHostGroupOptions : The GetDedicatedHostGroup options. +type GetDedicatedHostGroupOptions struct { + // The dedicated host group identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostGroupOptions : Instantiate GetDedicatedHostGroupOptions +func (*VpcV1) NewGetDedicatedHostGroupOptions(id string) *GetDedicatedHostGroupOptions { + return &GetDedicatedHostGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetDedicatedHostGroupOptions) SetID(id string) *GetDedicatedHostGroupOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostGroupOptions) SetHeaders(param map[string]string) *GetDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// GetDedicatedHostOptions : The GetDedicatedHost options. +type GetDedicatedHostOptions struct { + // The dedicated host identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostOptions : Instantiate GetDedicatedHostOptions +func (*VpcV1) NewGetDedicatedHostOptions(id string) *GetDedicatedHostOptions { + return &GetDedicatedHostOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetDedicatedHostOptions) SetID(id string) *GetDedicatedHostOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostOptions) SetHeaders(param map[string]string) *GetDedicatedHostOptions { + options.Headers = param + return options +} + +// GetDedicatedHostProfileOptions : The GetDedicatedHostProfile options. +type GetDedicatedHostProfileOptions struct { + // The dedicated host profile name. + Name *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetDedicatedHostProfileOptions : Instantiate GetDedicatedHostProfileOptions +func (*VpcV1) NewGetDedicatedHostProfileOptions(name string) *GetDedicatedHostProfileOptions { + return &GetDedicatedHostProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (options *GetDedicatedHostProfileOptions) SetName(name string) *GetDedicatedHostProfileOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetDedicatedHostProfileOptions) SetHeaders(param map[string]string) *GetDedicatedHostProfileOptions { + options.Headers = param + return options +} + +// GetEndpointGatewayIPOptions : The GetEndpointGatewayIP options. +type GetEndpointGatewayIPOptions struct { + // The endpoint gateway identifier. + EndpointGatewayID *string `validate:"required,ne="` + + // The reserved IP identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetEndpointGatewayIPOptions : Instantiate GetEndpointGatewayIPOptions +func (*VpcV1) NewGetEndpointGatewayIPOptions(endpointGatewayID string, id string) *GetEndpointGatewayIPOptions { + return &GetEndpointGatewayIPOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + ID: core.StringPtr(id), + } +} + +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (options *GetEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *GetEndpointGatewayIPOptions { + options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return options +} + +// SetID : Allow user to set ID +func (options *GetEndpointGatewayIPOptions) SetID(id string) *GetEndpointGatewayIPOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetEndpointGatewayIPOptions) SetHeaders(param map[string]string) *GetEndpointGatewayIPOptions { + options.Headers = param + return options +} + +// GetEndpointGatewayOptions : The GetEndpointGateway options. +type GetEndpointGatewayOptions struct { + // The endpoint gateway identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetEndpointGatewayOptions : Instantiate GetEndpointGatewayOptions +func (*VpcV1) NewGetEndpointGatewayOptions(id string) *GetEndpointGatewayOptions { + return &GetEndpointGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetEndpointGatewayOptions) SetID(id string) *GetEndpointGatewayOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetEndpointGatewayOptions) SetHeaders(param map[string]string) *GetEndpointGatewayOptions { + options.Headers = param + return options +} + +// GetFloatingIPOptions : The GetFloatingIP options. +type GetFloatingIPOptions struct { + // The floating IP identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetFloatingIPOptions : Instantiate GetFloatingIPOptions +func (*VpcV1) NewGetFloatingIPOptions(id string) *GetFloatingIPOptions { + return &GetFloatingIPOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetFloatingIPOptions) SetID(id string) *GetFloatingIPOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetFloatingIPOptions) SetHeaders(param map[string]string) *GetFloatingIPOptions { + options.Headers = param + return options +} + +// GetFlowLogCollectorOptions : The GetFlowLogCollector options. +type GetFlowLogCollectorOptions struct { + // The flow log collector identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetFlowLogCollectorOptions : Instantiate GetFlowLogCollectorOptions +func (*VpcV1) NewGetFlowLogCollectorOptions(id string) *GetFlowLogCollectorOptions { + return &GetFlowLogCollectorOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetFlowLogCollectorOptions) SetID(id string) *GetFlowLogCollectorOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetFlowLogCollectorOptions) SetHeaders(param map[string]string) *GetFlowLogCollectorOptions { + options.Headers = param + return options +} + +// GetIkePolicyOptions : The GetIkePolicy options. +type GetIkePolicyOptions struct { + // The IKE policy identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetIkePolicyOptions : Instantiate GetIkePolicyOptions +func (*VpcV1) NewGetIkePolicyOptions(id string) *GetIkePolicyOptions { + return &GetIkePolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetIkePolicyOptions) SetID(id string) *GetIkePolicyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetIkePolicyOptions) SetHeaders(param map[string]string) *GetIkePolicyOptions { + options.Headers = param + return options +} + +// GetImageOptions : The GetImage options. +type GetImageOptions struct { + // The image identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetImageOptions : Instantiate GetImageOptions +func (*VpcV1) NewGetImageOptions(id string) *GetImageOptions { + return &GetImageOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetImageOptions) SetID(id string) *GetImageOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetImageOptions) SetHeaders(param map[string]string) *GetImageOptions { + options.Headers = param + return options +} + +// GetInstanceDiskOptions : The GetInstanceDisk options. +type GetInstanceDiskOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The instance disk identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceDiskOptions : Instantiate GetInstanceDiskOptions +func (*VpcV1) NewGetInstanceDiskOptions(instanceID string, id string) *GetInstanceDiskOptions { + return &GetInstanceDiskOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *GetInstanceDiskOptions) SetInstanceID(instanceID string) *GetInstanceDiskOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetID : Allow user to set ID +func (options *GetInstanceDiskOptions) SetID(id string) *GetInstanceDiskOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceDiskOptions) SetHeaders(param map[string]string) *GetInstanceDiskOptions { + options.Headers = param + return options +} + +// GetInstanceGroupManagerOptions : The GetInstanceGroupManager options. +type GetInstanceGroupManagerOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // The instance group manager identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupManagerOptions : Instantiate GetInstanceGroupManagerOptions +func (*VpcV1) NewGetInstanceGroupManagerOptions(instanceGroupID string, id string) *GetInstanceGroupManagerOptions { + return &GetInstanceGroupManagerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *GetInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetID : Allow user to set ID +func (options *GetInstanceGroupManagerOptions) SetID(id string) *GetInstanceGroupManagerOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupManagerOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerOptions { + options.Headers = param + return options +} + +// GetInstanceGroupManagerPolicyOptions : The GetInstanceGroupManagerPolicy options. +type GetInstanceGroupManagerPolicyOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `validate:"required,ne="` + + // The instance group manager policy identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupManagerPolicyOptions : Instantiate GetInstanceGroupManagerPolicyOptions +func (*VpcV1) NewGetInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string) *GetInstanceGroupManagerPolicyOptions { + return &GetInstanceGroupManagerPolicyOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *GetInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupManagerPolicyOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (options *GetInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *GetInstanceGroupManagerPolicyOptions { + options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return options +} + +// SetID : Allow user to set ID +func (options *GetInstanceGroupManagerPolicyOptions) SetID(id string) *GetInstanceGroupManagerPolicyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *GetInstanceGroupManagerPolicyOptions { + options.Headers = param + return options +} + +// GetInstanceGroupMembershipOptions : The GetInstanceGroupMembership options. +type GetInstanceGroupMembershipOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // The instance group membership identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupMembershipOptions : Instantiate GetInstanceGroupMembershipOptions +func (*VpcV1) NewGetInstanceGroupMembershipOptions(instanceGroupID string, id string) *GetInstanceGroupMembershipOptions { + return &GetInstanceGroupMembershipOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *GetInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *GetInstanceGroupMembershipOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetID : Allow user to set ID +func (options *GetInstanceGroupMembershipOptions) SetID(id string) *GetInstanceGroupMembershipOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *GetInstanceGroupMembershipOptions { + options.Headers = param + return options +} + +// GetInstanceGroupOptions : The GetInstanceGroup options. +type GetInstanceGroupOptions struct { + // The instance group identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceGroupOptions : Instantiate GetInstanceGroupOptions +func (*VpcV1) NewGetInstanceGroupOptions(id string) *GetInstanceGroupOptions { + return &GetInstanceGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetInstanceGroupOptions) SetID(id string) *GetInstanceGroupOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceGroupOptions) SetHeaders(param map[string]string) *GetInstanceGroupOptions { + options.Headers = param + return options +} + +// GetInstanceInitializationOptions : The GetInstanceInitialization options. +type GetInstanceInitializationOptions struct { + // The instance identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceInitializationOptions : Instantiate GetInstanceInitializationOptions +func (*VpcV1) NewGetInstanceInitializationOptions(id string) *GetInstanceInitializationOptions { + return &GetInstanceInitializationOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetInstanceInitializationOptions) SetID(id string) *GetInstanceInitializationOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceInitializationOptions) SetHeaders(param map[string]string) *GetInstanceInitializationOptions { + options.Headers = param + return options +} + +// GetInstanceNetworkInterfaceFloatingIPOptions : The GetInstanceNetworkInterfaceFloatingIP options. +type GetInstanceNetworkInterfaceFloatingIPOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The network interface identifier. + NetworkInterfaceID *string `validate:"required,ne="` + + // The floating IP identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceNetworkInterfaceFloatingIPOptions : Instantiate GetInstanceNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewGetInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *GetInstanceNetworkInterfaceFloatingIPOptions { + return &GetInstanceNetworkInterfaceFloatingIPOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *GetInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceFloatingIPOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (options *GetInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *GetInstanceNetworkInterfaceFloatingIPOptions { + options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return options +} + +// SetID : Allow user to set ID +func (options *GetInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *GetInstanceNetworkInterfaceFloatingIPOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// GetInstanceNetworkInterfaceOptions : The GetInstanceNetworkInterface options. +type GetInstanceNetworkInterfaceOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The network interface identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceNetworkInterfaceOptions : Instantiate GetInstanceNetworkInterfaceOptions +func (*VpcV1) NewGetInstanceNetworkInterfaceOptions(instanceID string, id string) *GetInstanceNetworkInterfaceOptions { + return &GetInstanceNetworkInterfaceOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *GetInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *GetInstanceNetworkInterfaceOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetID : Allow user to set ID +func (options *GetInstanceNetworkInterfaceOptions) SetID(id string) *GetInstanceNetworkInterfaceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetInstanceNetworkInterfaceOptions { + options.Headers = param + return options +} + +// GetInstanceOptions : The GetInstance options. +type GetInstanceOptions struct { + // The instance identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceOptions : Instantiate GetInstanceOptions +func (*VpcV1) NewGetInstanceOptions(id string) *GetInstanceOptions { + return &GetInstanceOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetInstanceOptions) SetID(id string) *GetInstanceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceOptions) SetHeaders(param map[string]string) *GetInstanceOptions { + options.Headers = param + return options +} + +// GetInstanceProfileOptions : The GetInstanceProfile options. +type GetInstanceProfileOptions struct { + // The instance profile name. + Name *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceProfileOptions : Instantiate GetInstanceProfileOptions +func (*VpcV1) NewGetInstanceProfileOptions(name string) *GetInstanceProfileOptions { + return &GetInstanceProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (options *GetInstanceProfileOptions) SetName(name string) *GetInstanceProfileOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceProfileOptions) SetHeaders(param map[string]string) *GetInstanceProfileOptions { + options.Headers = param + return options +} + +// GetInstanceTemplateOptions : The GetInstanceTemplate options. +type GetInstanceTemplateOptions struct { + // The instance template identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceTemplateOptions : Instantiate GetInstanceTemplateOptions +func (*VpcV1) NewGetInstanceTemplateOptions(id string) *GetInstanceTemplateOptions { + return &GetInstanceTemplateOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetInstanceTemplateOptions) SetID(id string) *GetInstanceTemplateOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceTemplateOptions) SetHeaders(param map[string]string) *GetInstanceTemplateOptions { + options.Headers = param + return options +} + +// GetInstanceVolumeAttachmentOptions : The GetInstanceVolumeAttachment options. +type GetInstanceVolumeAttachmentOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The volume attachment identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetInstanceVolumeAttachmentOptions : Instantiate GetInstanceVolumeAttachmentOptions +func (*VpcV1) NewGetInstanceVolumeAttachmentOptions(instanceID string, id string) *GetInstanceVolumeAttachmentOptions { + return &GetInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *GetInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *GetInstanceVolumeAttachmentOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetID : Allow user to set ID +func (options *GetInstanceVolumeAttachmentOptions) SetID(id string) *GetInstanceVolumeAttachmentOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *GetInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// GetIpsecPolicyOptions : The GetIpsecPolicy options. +type GetIpsecPolicyOptions struct { + // The IPsec policy identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetIpsecPolicyOptions : Instantiate GetIpsecPolicyOptions +func (*VpcV1) NewGetIpsecPolicyOptions(id string) *GetIpsecPolicyOptions { + return &GetIpsecPolicyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetIpsecPolicyOptions) SetID(id string) *GetIpsecPolicyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetIpsecPolicyOptions) SetHeaders(param map[string]string) *GetIpsecPolicyOptions { + options.Headers = param + return options +} + +// GetKeyOptions : The GetKey options. +type GetKeyOptions struct { + // The key identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetKeyOptions : Instantiate GetKeyOptions +func (*VpcV1) NewGetKeyOptions(id string) *GetKeyOptions { + return &GetKeyOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetKeyOptions) SetID(id string) *GetKeyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetKeyOptions) SetHeaders(param map[string]string) *GetKeyOptions { + options.Headers = param + return options +} + +// GetLoadBalancerListenerOptions : The GetLoadBalancerListener options. +type GetLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The listener identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerListenerOptions : Instantiate GetLoadBalancerListenerOptions +func (*VpcV1) NewGetLoadBalancerListenerOptions(loadBalancerID string, id string) *GetLoadBalancerListenerOptions { + return &GetLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *GetLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetID : Allow user to set ID +func (options *GetLoadBalancerListenerOptions) SetID(id string) *GetLoadBalancerListenerOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerListenerOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// GetLoadBalancerListenerPolicyOptions : The GetLoadBalancerListenerPolicy options. +type GetLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The listener identifier. + ListenerID *string `validate:"required,ne="` + + // The policy identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerListenerPolicyOptions : Instantiate GetLoadBalancerListenerPolicyOptions +func (*VpcV1) NewGetLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string) *GetLoadBalancerListenerPolicyOptions { + return &GetLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *GetLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerPolicyOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetListenerID : Allow user to set ListenerID +func (options *GetLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *GetLoadBalancerListenerPolicyOptions { + options.ListenerID = core.StringPtr(listenerID) + return options +} + +// SetID : Allow user to set ID +func (options *GetLoadBalancerListenerPolicyOptions) SetID(id string) *GetLoadBalancerListenerPolicyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// GetLoadBalancerListenerPolicyRuleOptions : The GetLoadBalancerListenerPolicyRule options. +type GetLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The listener identifier. + ListenerID *string `validate:"required,ne="` + + // The policy identifier. + PolicyID *string `validate:"required,ne="` + + // The rule identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerListenerPolicyRuleOptions : Instantiate GetLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewGetLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string) *GetLoadBalancerListenerPolicyRuleOptions { + return &GetLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *GetLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerListenerPolicyRuleOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetListenerID : Allow user to set ListenerID +func (options *GetLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *GetLoadBalancerListenerPolicyRuleOptions { + options.ListenerID = core.StringPtr(listenerID) + return options +} + +// SetPolicyID : Allow user to set PolicyID +func (options *GetLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *GetLoadBalancerListenerPolicyRuleOptions { + options.PolicyID = core.StringPtr(policyID) + return options +} + +// SetID : Allow user to set ID +func (options *GetLoadBalancerListenerPolicyRuleOptions) SetID(id string) *GetLoadBalancerListenerPolicyRuleOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *GetLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// GetLoadBalancerOptions : The GetLoadBalancer options. +type GetLoadBalancerOptions struct { + // The load balancer identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerOptions : Instantiate GetLoadBalancerOptions +func (*VpcV1) NewGetLoadBalancerOptions(id string) *GetLoadBalancerOptions { + return &GetLoadBalancerOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetLoadBalancerOptions) SetID(id string) *GetLoadBalancerOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerOptions) SetHeaders(param map[string]string) *GetLoadBalancerOptions { + options.Headers = param + return options +} + +// GetLoadBalancerPoolMemberOptions : The GetLoadBalancerPoolMember options. +type GetLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The pool identifier. + PoolID *string `validate:"required,ne="` + + // The member identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerPoolMemberOptions : Instantiate GetLoadBalancerPoolMemberOptions +func (*VpcV1) NewGetLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string) *GetLoadBalancerPoolMemberOptions { + return &GetLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *GetLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerPoolMemberOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetPoolID : Allow user to set PoolID +func (options *GetLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *GetLoadBalancerPoolMemberOptions { + options.PoolID = core.StringPtr(poolID) + return options +} + +// SetID : Allow user to set ID +func (options *GetLoadBalancerPoolMemberOptions) SetID(id string) *GetLoadBalancerPoolMemberOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *GetLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// GetLoadBalancerPoolOptions : The GetLoadBalancerPool options. +type GetLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The pool identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerPoolOptions : Instantiate GetLoadBalancerPoolOptions +func (*VpcV1) NewGetLoadBalancerPoolOptions(loadBalancerID string, id string) *GetLoadBalancerPoolOptions { + return &GetLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *GetLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *GetLoadBalancerPoolOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetID : Allow user to set ID +func (options *GetLoadBalancerPoolOptions) SetID(id string) *GetLoadBalancerPoolOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerPoolOptions) SetHeaders(param map[string]string) *GetLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// GetLoadBalancerProfileOptions : The GetLoadBalancerProfile options. +type GetLoadBalancerProfileOptions struct { + // The load balancer profile name. + Name *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerProfileOptions : Instantiate GetLoadBalancerProfileOptions +func (*VpcV1) NewGetLoadBalancerProfileOptions(name string) *GetLoadBalancerProfileOptions { + return &GetLoadBalancerProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (options *GetLoadBalancerProfileOptions) SetName(name string) *GetLoadBalancerProfileOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerProfileOptions) SetHeaders(param map[string]string) *GetLoadBalancerProfileOptions { + options.Headers = param + return options +} + +// GetLoadBalancerStatisticsOptions : The GetLoadBalancerStatistics options. +type GetLoadBalancerStatisticsOptions struct { + // The load balancer identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetLoadBalancerStatisticsOptions : Instantiate GetLoadBalancerStatisticsOptions +func (*VpcV1) NewGetLoadBalancerStatisticsOptions(id string) *GetLoadBalancerStatisticsOptions { + return &GetLoadBalancerStatisticsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetLoadBalancerStatisticsOptions) SetID(id string) *GetLoadBalancerStatisticsOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetLoadBalancerStatisticsOptions) SetHeaders(param map[string]string) *GetLoadBalancerStatisticsOptions { + options.Headers = param + return options +} + +// GetNetworkACLOptions : The GetNetworkACL options. +type GetNetworkACLOptions struct { + // The network ACL identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetNetworkACLOptions : Instantiate GetNetworkACLOptions +func (*VpcV1) NewGetNetworkACLOptions(id string) *GetNetworkACLOptions { + return &GetNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetNetworkACLOptions) SetID(id string) *GetNetworkACLOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetNetworkACLOptions) SetHeaders(param map[string]string) *GetNetworkACLOptions { + options.Headers = param + return options +} + +// GetNetworkACLRuleOptions : The GetNetworkACLRule options. +type GetNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `validate:"required,ne="` + + // The rule identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetNetworkACLRuleOptions : Instantiate GetNetworkACLRuleOptions +func (*VpcV1) NewGetNetworkACLRuleOptions(networkACLID string, id string) *GetNetworkACLRuleOptions { + return &GetNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + ID: core.StringPtr(id), + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (options *GetNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *GetNetworkACLRuleOptions { + options.NetworkACLID = core.StringPtr(networkACLID) + return options +} + +// SetID : Allow user to set ID +func (options *GetNetworkACLRuleOptions) SetID(id string) *GetNetworkACLRuleOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetNetworkACLRuleOptions) SetHeaders(param map[string]string) *GetNetworkACLRuleOptions { + options.Headers = param + return options +} + +// GetOperatingSystemOptions : The GetOperatingSystem options. +type GetOperatingSystemOptions struct { + // The operating system name. + Name *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetOperatingSystemOptions : Instantiate GetOperatingSystemOptions +func (*VpcV1) NewGetOperatingSystemOptions(name string) *GetOperatingSystemOptions { + return &GetOperatingSystemOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (options *GetOperatingSystemOptions) SetName(name string) *GetOperatingSystemOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetOperatingSystemOptions) SetHeaders(param map[string]string) *GetOperatingSystemOptions { + options.Headers = param + return options +} + +// GetPublicGatewayOptions : The GetPublicGateway options. +type GetPublicGatewayOptions struct { + // The public gateway identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetPublicGatewayOptions : Instantiate GetPublicGatewayOptions +func (*VpcV1) NewGetPublicGatewayOptions(id string) *GetPublicGatewayOptions { + return &GetPublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetPublicGatewayOptions) SetID(id string) *GetPublicGatewayOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetPublicGatewayOptions) SetHeaders(param map[string]string) *GetPublicGatewayOptions { + options.Headers = param + return options +} + +// GetRegionOptions : The GetRegion options. +type GetRegionOptions struct { + // The region name. + Name *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetRegionOptions : Instantiate GetRegionOptions +func (*VpcV1) NewGetRegionOptions(name string) *GetRegionOptions { + return &GetRegionOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (options *GetRegionOptions) SetName(name string) *GetRegionOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetRegionOptions) SetHeaders(param map[string]string) *GetRegionOptions { + options.Headers = param + return options +} + +// GetRegionZoneOptions : The GetRegionZone options. +type GetRegionZoneOptions struct { + // The region name. + RegionName *string `validate:"required,ne="` + + // The zone name. + Name *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetRegionZoneOptions : Instantiate GetRegionZoneOptions +func (*VpcV1) NewGetRegionZoneOptions(regionName string, name string) *GetRegionZoneOptions { + return &GetRegionZoneOptions{ + RegionName: core.StringPtr(regionName), + Name: core.StringPtr(name), + } +} + +// SetRegionName : Allow user to set RegionName +func (options *GetRegionZoneOptions) SetRegionName(regionName string) *GetRegionZoneOptions { + options.RegionName = core.StringPtr(regionName) + return options +} + +// SetName : Allow user to set Name +func (options *GetRegionZoneOptions) SetName(name string) *GetRegionZoneOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetRegionZoneOptions) SetHeaders(param map[string]string) *GetRegionZoneOptions { + options.Headers = param + return options +} + +// GetSecurityGroupNetworkInterfaceOptions : The GetSecurityGroupNetworkInterface options. +type GetSecurityGroupNetworkInterfaceOptions struct { + // The security group identifier. + SecurityGroupID *string `validate:"required,ne="` + + // The network interface identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSecurityGroupNetworkInterfaceOptions : Instantiate GetSecurityGroupNetworkInterfaceOptions +func (*VpcV1) NewGetSecurityGroupNetworkInterfaceOptions(securityGroupID string, id string) *GetSecurityGroupNetworkInterfaceOptions { + return &GetSecurityGroupNetworkInterfaceOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (options *GetSecurityGroupNetworkInterfaceOptions) SetSecurityGroupID(securityGroupID string) *GetSecurityGroupNetworkInterfaceOptions { + options.SecurityGroupID = core.StringPtr(securityGroupID) + return options +} + +// SetID : Allow user to set ID +func (options *GetSecurityGroupNetworkInterfaceOptions) SetID(id string) *GetSecurityGroupNetworkInterfaceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSecurityGroupNetworkInterfaceOptions) SetHeaders(param map[string]string) *GetSecurityGroupNetworkInterfaceOptions { + options.Headers = param + return options +} + +// GetSecurityGroupOptions : The GetSecurityGroup options. +type GetSecurityGroupOptions struct { + // The security group identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSecurityGroupOptions : Instantiate GetSecurityGroupOptions +func (*VpcV1) NewGetSecurityGroupOptions(id string) *GetSecurityGroupOptions { + return &GetSecurityGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetSecurityGroupOptions) SetID(id string) *GetSecurityGroupOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSecurityGroupOptions) SetHeaders(param map[string]string) *GetSecurityGroupOptions { + options.Headers = param + return options +} + +// GetSecurityGroupRuleOptions : The GetSecurityGroupRule options. +type GetSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `validate:"required,ne="` + + // The rule identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSecurityGroupRuleOptions : Instantiate GetSecurityGroupRuleOptions +func (*VpcV1) NewGetSecurityGroupRuleOptions(securityGroupID string, id string) *GetSecurityGroupRuleOptions { + return &GetSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (options *GetSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *GetSecurityGroupRuleOptions { + options.SecurityGroupID = core.StringPtr(securityGroupID) + return options +} + +// SetID : Allow user to set ID +func (options *GetSecurityGroupRuleOptions) SetID(id string) *GetSecurityGroupRuleOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSecurityGroupRuleOptions) SetHeaders(param map[string]string) *GetSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// GetSecurityGroupTargetOptions : The GetSecurityGroupTarget options. +type GetSecurityGroupTargetOptions struct { + // The security group identifier. + SecurityGroupID *string `validate:"required,ne="` + + // The security group target identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSecurityGroupTargetOptions : Instantiate GetSecurityGroupTargetOptions +func (*VpcV1) NewGetSecurityGroupTargetOptions(securityGroupID string, id string) *GetSecurityGroupTargetOptions { + return &GetSecurityGroupTargetOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (options *GetSecurityGroupTargetOptions) SetSecurityGroupID(securityGroupID string) *GetSecurityGroupTargetOptions { + options.SecurityGroupID = core.StringPtr(securityGroupID) + return options +} + +// SetID : Allow user to set ID +func (options *GetSecurityGroupTargetOptions) SetID(id string) *GetSecurityGroupTargetOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSecurityGroupTargetOptions) SetHeaders(param map[string]string) *GetSecurityGroupTargetOptions { + options.Headers = param + return options +} + +// GetSubnetNetworkACLOptions : The GetSubnetNetworkACL options. +type GetSubnetNetworkACLOptions struct { + // The subnet identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetNetworkACLOptions : Instantiate GetSubnetNetworkACLOptions +func (*VpcV1) NewGetSubnetNetworkACLOptions(id string) *GetSubnetNetworkACLOptions { + return &GetSubnetNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetSubnetNetworkACLOptions) SetID(id string) *GetSubnetNetworkACLOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetNetworkACLOptions) SetHeaders(param map[string]string) *GetSubnetNetworkACLOptions { + options.Headers = param + return options +} + +// GetSubnetOptions : The GetSubnet options. +type GetSubnetOptions struct { + // The subnet identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetOptions : Instantiate GetSubnetOptions +func (*VpcV1) NewGetSubnetOptions(id string) *GetSubnetOptions { + return &GetSubnetOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetSubnetOptions) SetID(id string) *GetSubnetOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetOptions) SetHeaders(param map[string]string) *GetSubnetOptions { + options.Headers = param + return options +} + +// GetSubnetPublicGatewayOptions : The GetSubnetPublicGateway options. +type GetSubnetPublicGatewayOptions struct { + // The subnet identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetPublicGatewayOptions : Instantiate GetSubnetPublicGatewayOptions +func (*VpcV1) NewGetSubnetPublicGatewayOptions(id string) *GetSubnetPublicGatewayOptions { + return &GetSubnetPublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetSubnetPublicGatewayOptions) SetID(id string) *GetSubnetPublicGatewayOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *GetSubnetPublicGatewayOptions { + options.Headers = param + return options +} + +// GetSubnetReservedIPOptions : The GetSubnetReservedIP options. +type GetSubnetReservedIPOptions struct { + // The subnet identifier. + SubnetID *string `validate:"required,ne="` + + // The reserved IP identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetReservedIPOptions : Instantiate GetSubnetReservedIPOptions +func (*VpcV1) NewGetSubnetReservedIPOptions(subnetID string, id string) *GetSubnetReservedIPOptions { + return &GetSubnetReservedIPOptions{ + SubnetID: core.StringPtr(subnetID), + ID: core.StringPtr(id), + } +} + +// SetSubnetID : Allow user to set SubnetID +func (options *GetSubnetReservedIPOptions) SetSubnetID(subnetID string) *GetSubnetReservedIPOptions { + options.SubnetID = core.StringPtr(subnetID) + return options +} + +// SetID : Allow user to set ID +func (options *GetSubnetReservedIPOptions) SetID(id string) *GetSubnetReservedIPOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetReservedIPOptions) SetHeaders(param map[string]string) *GetSubnetReservedIPOptions { + options.Headers = param + return options +} + +// GetSubnetRoutingTableOptions : The GetSubnetRoutingTable options. +type GetSubnetRoutingTableOptions struct { + // The subnet identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetSubnetRoutingTableOptions : Instantiate GetSubnetRoutingTableOptions +func (*VpcV1) NewGetSubnetRoutingTableOptions(id string) *GetSubnetRoutingTableOptions { + return &GetSubnetRoutingTableOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetSubnetRoutingTableOptions) SetID(id string) *GetSubnetRoutingTableOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetSubnetRoutingTableOptions) SetHeaders(param map[string]string) *GetSubnetRoutingTableOptions { + options.Headers = param + return options +} + +// GetVolumeOptions : The GetVolume options. +type GetVolumeOptions struct { + // The volume identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVolumeOptions : Instantiate GetVolumeOptions +func (*VpcV1) NewGetVolumeOptions(id string) *GetVolumeOptions { + return &GetVolumeOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetVolumeOptions) SetID(id string) *GetVolumeOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVolumeOptions) SetHeaders(param map[string]string) *GetVolumeOptions { + options.Headers = param + return options +} + +// GetVolumeProfileOptions : The GetVolumeProfile options. +type GetVolumeProfileOptions struct { + // The volume profile name. + Name *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVolumeProfileOptions : Instantiate GetVolumeProfileOptions +func (*VpcV1) NewGetVolumeProfileOptions(name string) *GetVolumeProfileOptions { + return &GetVolumeProfileOptions{ + Name: core.StringPtr(name), + } +} + +// SetName : Allow user to set Name +func (options *GetVolumeProfileOptions) SetName(name string) *GetVolumeProfileOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVolumeProfileOptions) SetHeaders(param map[string]string) *GetVolumeProfileOptions { + options.Headers = param + return options +} + +// GetVPCAddressPrefixOptions : The GetVPCAddressPrefix options. +type GetVPCAddressPrefixOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The prefix identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCAddressPrefixOptions : Instantiate GetVPCAddressPrefixOptions +func (*VpcV1) NewGetVPCAddressPrefixOptions(vpcID string, id string) *GetVPCAddressPrefixOptions { + return &GetVPCAddressPrefixOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (options *GetVPCAddressPrefixOptions) SetVPCID(vpcID string) *GetVPCAddressPrefixOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetID : Allow user to set ID +func (options *GetVPCAddressPrefixOptions) SetID(id string) *GetVPCAddressPrefixOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCAddressPrefixOptions) SetHeaders(param map[string]string) *GetVPCAddressPrefixOptions { + options.Headers = param + return options +} + +// GetVPCDefaultNetworkACLOptions : The GetVPCDefaultNetworkACL options. +type GetVPCDefaultNetworkACLOptions struct { + // The VPC identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCDefaultNetworkACLOptions : Instantiate GetVPCDefaultNetworkACLOptions +func (*VpcV1) NewGetVPCDefaultNetworkACLOptions(id string) *GetVPCDefaultNetworkACLOptions { + return &GetVPCDefaultNetworkACLOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetVPCDefaultNetworkACLOptions) SetID(id string) *GetVPCDefaultNetworkACLOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCDefaultNetworkACLOptions) SetHeaders(param map[string]string) *GetVPCDefaultNetworkACLOptions { + options.Headers = param + return options +} + +// GetVPCDefaultRoutingTableOptions : The GetVPCDefaultRoutingTable options. +type GetVPCDefaultRoutingTableOptions struct { + // The VPC identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCDefaultRoutingTableOptions : Instantiate GetVPCDefaultRoutingTableOptions +func (*VpcV1) NewGetVPCDefaultRoutingTableOptions(id string) *GetVPCDefaultRoutingTableOptions { + return &GetVPCDefaultRoutingTableOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetVPCDefaultRoutingTableOptions) SetID(id string) *GetVPCDefaultRoutingTableOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCDefaultRoutingTableOptions) SetHeaders(param map[string]string) *GetVPCDefaultRoutingTableOptions { + options.Headers = param + return options +} + +// GetVPCDefaultSecurityGroupOptions : The GetVPCDefaultSecurityGroup options. +type GetVPCDefaultSecurityGroupOptions struct { + // The VPC identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCDefaultSecurityGroupOptions : Instantiate GetVPCDefaultSecurityGroupOptions +func (*VpcV1) NewGetVPCDefaultSecurityGroupOptions(id string) *GetVPCDefaultSecurityGroupOptions { + return &GetVPCDefaultSecurityGroupOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetVPCDefaultSecurityGroupOptions) SetID(id string) *GetVPCDefaultSecurityGroupOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCDefaultSecurityGroupOptions) SetHeaders(param map[string]string) *GetVPCDefaultSecurityGroupOptions { + options.Headers = param + return options +} + +// GetVPCOptions : The GetVPC options. +type GetVPCOptions struct { + // The VPC identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCOptions : Instantiate GetVPCOptions +func (*VpcV1) NewGetVPCOptions(id string) *GetVPCOptions { + return &GetVPCOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetVPCOptions) SetID(id string) *GetVPCOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCOptions) SetHeaders(param map[string]string) *GetVPCOptions { + options.Headers = param + return options +} + +// GetVPCRouteOptions : The GetVPCRoute options. +type GetVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The route identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCRouteOptions : Instantiate GetVPCRouteOptions +func (*VpcV1) NewGetVPCRouteOptions(vpcID string, id string) *GetVPCRouteOptions { + return &GetVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (options *GetVPCRouteOptions) SetVPCID(vpcID string) *GetVPCRouteOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetID : Allow user to set ID +func (options *GetVPCRouteOptions) SetID(id string) *GetVPCRouteOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCRouteOptions) SetHeaders(param map[string]string) *GetVPCRouteOptions { + options.Headers = param + return options +} + +// GetVPCRoutingTableOptions : The GetVPCRoutingTable options. +type GetVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The routing table identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCRoutingTableOptions : Instantiate GetVPCRoutingTableOptions +func (*VpcV1) NewGetVPCRoutingTableOptions(vpcID string, id string) *GetVPCRoutingTableOptions { + return &GetVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (options *GetVPCRoutingTableOptions) SetVPCID(vpcID string) *GetVPCRoutingTableOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetID : Allow user to set ID +func (options *GetVPCRoutingTableOptions) SetID(id string) *GetVPCRoutingTableOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCRoutingTableOptions) SetHeaders(param map[string]string) *GetVPCRoutingTableOptions { + options.Headers = param + return options +} + +// GetVPCRoutingTableRouteOptions : The GetVPCRoutingTableRoute options. +type GetVPCRoutingTableRouteOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `validate:"required,ne="` + + // The VPC routing table route identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPCRoutingTableRouteOptions : Instantiate GetVPCRoutingTableRouteOptions +func (*VpcV1) NewGetVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string) *GetVPCRoutingTableRouteOptions { + return &GetVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + ID: core.StringPtr(id), + } +} + +// SetVPCID : Allow user to set VPCID +func (options *GetVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *GetVPCRoutingTableRouteOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (options *GetVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *GetVPCRoutingTableRouteOptions { + options.RoutingTableID = core.StringPtr(routingTableID) + return options +} + +// SetID : Allow user to set ID +func (options *GetVPCRoutingTableRouteOptions) SetID(id string) *GetVPCRoutingTableRouteOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *GetVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// GetVPNGatewayConnectionOptions : The GetVPNGatewayConnection options. +type GetVPNGatewayConnectionOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNGatewayConnectionOptions : Instantiate GetVPNGatewayConnectionOptions +func (*VpcV1) NewGetVPNGatewayConnectionOptions(vpnGatewayID string, id string) *GetVPNGatewayConnectionOptions { + return &GetVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (options *GetVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *GetVPNGatewayConnectionOptions { + options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return options +} + +// SetID : Allow user to set ID +func (options *GetVPNGatewayConnectionOptions) SetID(id string) *GetVPNGatewayConnectionOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *GetVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// GetVPNGatewayOptions : The GetVPNGateway options. +type GetVPNGatewayOptions struct { + // The VPN gateway identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewGetVPNGatewayOptions : Instantiate GetVPNGatewayOptions +func (*VpcV1) NewGetVPNGatewayOptions(id string) *GetVPNGatewayOptions { + return &GetVPNGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *GetVPNGatewayOptions) SetID(id string) *GetVPNGatewayOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *GetVPNGatewayOptions) SetHeaders(param map[string]string) *GetVPNGatewayOptions { + options.Headers = param + return options +} + +// IkePolicy : IkePolicy struct +type IkePolicy struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` + + // Collection of references to VPN gateway connections that use this IKE policy. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this IKE policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The Diffie-Hellman group. + DhGroup *int64 `json:"dh_group" validate:"required"` + + // The encryption algorithm. + EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` + + // The IKE policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IKE policy. + ID *string `json:"id" validate:"required"` + + // The IKE protocol version. + IkeVersion *int64 `json:"ike_version" validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime" validate:"required"` + + // The user-defined name for this IKE policy. + Name *string `json:"name" validate:"required"` + + // The IKE negotiation mode. Only `main` is supported. + NegotiationMode *string `json:"negotiation_mode" validate:"required"` + + // The resource group for this IKE policy. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the IkePolicy.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + IkePolicyAuthenticationAlgorithmMd5Const = "md5" + IkePolicyAuthenticationAlgorithmSha1Const = "sha1" + IkePolicyAuthenticationAlgorithmSha256Const = "sha256" + IkePolicyAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IkePolicy.EncryptionAlgorithm property. +// The encryption algorithm. +const ( + IkePolicyEncryptionAlgorithmAes128Const = "aes128" + IkePolicyEncryptionAlgorithmAes256Const = "aes256" + IkePolicyEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// Constants associated with the IkePolicy.NegotiationMode property. +// The IKE negotiation mode. Only `main` is supported. +const ( + IkePolicyNegotiationModeMainConst = "main" +) + +// Constants associated with the IkePolicy.ResourceType property. +// The resource type. +const ( + IkePolicyResourceTypeIkePolicyConst = "ike_policy" +) + +// UnmarshalIkePolicy unmarshals an instance of IkePolicy from the specified map of raw messages. +func UnmarshalIkePolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicy) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dh_group", &obj.DhGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ike_version", &obj.IkeVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "negotiation_mode", &obj.NegotiationMode) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyCollection : IkePolicyCollection struct +type IkePolicyCollection struct { + // A link to the first page of resources. + First *IkePolicyCollectionFirst `json:"first" validate:"required"` + + // Collection of IKE policies. + IkePolicies []IkePolicy `json:"ike_policies" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *IkePolicyCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalIkePolicyCollection unmarshals an instance of IkePolicyCollection from the specified map of raw messages. +func UnmarshalIkePolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIkePolicyCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policies", &obj.IkePolicies, UnmarshalIkePolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalIkePolicyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyIdentity : Identifies an IKE policy by a unique property. +// Models which "extend" this model: +// - IkePolicyIdentityByID +// - IkePolicyIdentityByHref +type IkePolicyIdentity struct { + // The unique identifier for this IKE policy. + ID *string `json:"id,omitempty"` + + // The IKE policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*IkePolicyIdentity) isaIkePolicyIdentity() bool { + return true +} + +type IkePolicyIdentityIntf interface { + isaIkePolicyIdentity() bool +} + +// UnmarshalIkePolicyIdentity unmarshals an instance of IkePolicyIdentity from the specified map of raw messages. +func UnmarshalIkePolicyIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyPatch : IkePolicyPatch struct +type IkePolicyPatch struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` + + // The Diffie-Hellman group. + DhGroup *int64 `json:"dh_group,omitempty"` + + // The encryption algorithm. + EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` + + // The IKE protocol version. + IkeVersion *int64 `json:"ike_version,omitempty"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime,omitempty"` + + // The user-defined name for this IKE policy. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the IkePolicyPatch.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + IkePolicyPatchAuthenticationAlgorithmMd5Const = "md5" + IkePolicyPatchAuthenticationAlgorithmSha1Const = "sha1" + IkePolicyPatchAuthenticationAlgorithmSha256Const = "sha256" + IkePolicyPatchAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IkePolicyPatch.EncryptionAlgorithm property. +// The encryption algorithm. +const ( + IkePolicyPatchEncryptionAlgorithmAes128Const = "aes128" + IkePolicyPatchEncryptionAlgorithmAes256Const = "aes256" + IkePolicyPatchEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// UnmarshalIkePolicyPatch unmarshals an instance of IkePolicyPatch from the specified map of raw messages. +func UnmarshalIkePolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyPatch) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dh_group", &obj.DhGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ike_version", &obj.IkeVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the IkePolicyPatch +func (ikePolicyPatch *IkePolicyPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(ikePolicyPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// IkePolicyReference : IkePolicyReference struct +type IkePolicyReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *IkePolicyReferenceDeleted `json:"deleted,omitempty"` + + // The IKE policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IKE policy. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this IKE policy. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the IkePolicyReference.ResourceType property. +// The resource type. +const ( + IkePolicyReferenceResourceTypeIkePolicyConst = "ike_policy" +) + +// UnmarshalIkePolicyReference unmarshals an instance of IkePolicyReference from the specified map of raw messages. +func UnmarshalIkePolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIkePolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IP : IP struct +type IP struct { + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// UnmarshalIP unmarshals an instance of IP from the specified map of raw messages. +func UnmarshalIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicy : IPsecPolicy struct +type IPsecPolicy struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `json:"authentication_algorithm" validate:"required"` + + // Collection of references to VPN gateway connections that use this IPsec policy. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this IPsec policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The encapsulation mode used. Only `tunnel` is supported. + EncapsulationMode *string `json:"encapsulation_mode" validate:"required"` + + // The encryption algorithm. + EncryptionAlgorithm *string `json:"encryption_algorithm" validate:"required"` + + // The IPsec policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IPsec policy. + ID *string `json:"id" validate:"required"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime" validate:"required"` + + // The user-defined name for this IPsec policy. + Name *string `json:"name" validate:"required"` + + // Perfect Forward Secrecy. + Pfs *string `json:"pfs" validate:"required"` + + // The resource group for this IPsec policy. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The transform protocol used. Only `esp` is supported. + TransformProtocol *string `json:"transform_protocol" validate:"required"` +} + +// Constants associated with the IPsecPolicy.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + IPsecPolicyAuthenticationAlgorithmMd5Const = "md5" + IPsecPolicyAuthenticationAlgorithmSha1Const = "sha1" + IPsecPolicyAuthenticationAlgorithmSha256Const = "sha256" + IPsecPolicyAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IPsecPolicy.EncapsulationMode property. +// The encapsulation mode used. Only `tunnel` is supported. +const ( + IPsecPolicyEncapsulationModeTunnelConst = "tunnel" +) + +// Constants associated with the IPsecPolicy.EncryptionAlgorithm property. +// The encryption algorithm. +const ( + IPsecPolicyEncryptionAlgorithmAes128Const = "aes128" + IPsecPolicyEncryptionAlgorithmAes256Const = "aes256" + IPsecPolicyEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// Constants associated with the IPsecPolicy.Pfs property. +// Perfect Forward Secrecy. +const ( + IPsecPolicyPfsDisabledConst = "disabled" + IPsecPolicyPfsGroup14Const = "group_14" + IPsecPolicyPfsGroup19Const = "group_19" + IPsecPolicyPfsGroup2Const = "group_2" + IPsecPolicyPfsGroup5Const = "group_5" +) + +// Constants associated with the IPsecPolicy.ResourceType property. +// The resource type. +const ( + IPsecPolicyResourceTypeIpsecPolicyConst = "ipsec_policy" +) + +// Constants associated with the IPsecPolicy.TransformProtocol property. +// The transform protocol used. Only `esp` is supported. +const ( + IPsecPolicyTransformProtocolEspConst = "esp" +) + +// UnmarshalIPsecPolicy unmarshals an instance of IPsecPolicy from the specified map of raw messages. +func UnmarshalIPsecPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicy) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encapsulation_mode", &obj.EncapsulationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "pfs", &obj.Pfs) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "transform_protocol", &obj.TransformProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyCollection : IPsecPolicyCollection struct +type IPsecPolicyCollection struct { + // A link to the first page of resources. + First *IPsecPolicyCollectionFirst `json:"first" validate:"required"` + + // Collection of IPsec policies. + IpsecPolicies []IPsecPolicy `json:"ipsec_policies" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *IPsecPolicyCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalIPsecPolicyCollection unmarshals an instance of IPsecPolicyCollection from the specified map of raw messages. +func UnmarshalIPsecPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalIPsecPolicyCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policies", &obj.IpsecPolicies, UnmarshalIPsecPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalIPsecPolicyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyCollectionFirst : A link to the first page of resources. +type IPsecPolicyCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalIPsecPolicyCollectionFirst unmarshals an instance of IPsecPolicyCollectionFirst from the specified map of raw messages. +func UnmarshalIPsecPolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type IPsecPolicyCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalIPsecPolicyCollectionNext unmarshals an instance of IPsecPolicyCollectionNext from the specified map of raw messages. +func UnmarshalIPsecPolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyIdentity : Identifies an IPsec policy by a unique property. +// Models which "extend" this model: +// - IPsecPolicyIdentityByID +// - IPsecPolicyIdentityByHref +type IPsecPolicyIdentity struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id,omitempty"` + + // The IPsec policy's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*IPsecPolicyIdentity) isaIPsecPolicyIdentity() bool { + return true +} + +type IPsecPolicyIdentityIntf interface { + isaIPsecPolicyIdentity() bool +} + +// UnmarshalIPsecPolicyIdentity unmarshals an instance of IPsecPolicyIdentity from the specified map of raw messages. +func UnmarshalIPsecPolicyIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyPatch : IPsecPolicyPatch struct +type IPsecPolicyPatch struct { + // The authentication algorithm. + AuthenticationAlgorithm *string `json:"authentication_algorithm,omitempty"` + + // The encryption algorithm. + EncryptionAlgorithm *string `json:"encryption_algorithm,omitempty"` + + // The key lifetime in seconds. + KeyLifetime *int64 `json:"key_lifetime,omitempty"` + + // The user-defined name for this IPsec policy. + Name *string `json:"name,omitempty"` + + // Perfect Forward Secrecy. + Pfs *string `json:"pfs,omitempty"` +} + +// Constants associated with the IPsecPolicyPatch.AuthenticationAlgorithm property. +// The authentication algorithm. +const ( + IPsecPolicyPatchAuthenticationAlgorithmMd5Const = "md5" + IPsecPolicyPatchAuthenticationAlgorithmSha1Const = "sha1" + IPsecPolicyPatchAuthenticationAlgorithmSha256Const = "sha256" + IPsecPolicyPatchAuthenticationAlgorithmSha512Const = "sha512" +) + +// Constants associated with the IPsecPolicyPatch.EncryptionAlgorithm property. +// The encryption algorithm. +const ( + IPsecPolicyPatchEncryptionAlgorithmAes128Const = "aes128" + IPsecPolicyPatchEncryptionAlgorithmAes256Const = "aes256" + IPsecPolicyPatchEncryptionAlgorithmTripleDesConst = "triple_des" +) + +// Constants associated with the IPsecPolicyPatch.Pfs property. +// Perfect Forward Secrecy. +const ( + IPsecPolicyPatchPfsDisabledConst = "disabled" + IPsecPolicyPatchPfsGroup14Const = "group_14" + IPsecPolicyPatchPfsGroup19Const = "group_19" + IPsecPolicyPatchPfsGroup2Const = "group_2" + IPsecPolicyPatchPfsGroup5Const = "group_5" +) + +// UnmarshalIPsecPolicyPatch unmarshals an instance of IPsecPolicyPatch from the specified map of raw messages. +func UnmarshalIPsecPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyPatch) + err = core.UnmarshalPrimitive(m, "authentication_algorithm", &obj.AuthenticationAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption_algorithm", &obj.EncryptionAlgorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "key_lifetime", &obj.KeyLifetime) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "pfs", &obj.Pfs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the IPsecPolicyPatch +func (iPsecPolicyPatch *IPsecPolicyPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(iPsecPolicyPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// IPsecPolicyReference : IPsecPolicyReference struct +type IPsecPolicyReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *IPsecPolicyReferenceDeleted `json:"deleted,omitempty"` + + // The IPsec policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this IPsec policy. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this IPsec policy. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the IPsecPolicyReference.ResourceType property. +// The resource type. +const ( + IPsecPolicyReferenceResourceTypeIpsecPolicyConst = "ipsec_policy" +) + +// UnmarshalIPsecPolicyReference unmarshals an instance of IPsecPolicyReference from the specified map of raw messages. +func UnmarshalIPsecPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalIPsecPolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type IPsecPolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalIPsecPolicyReferenceDeleted unmarshals an instance of IPsecPolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalIPsecPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyCollectionFirst : A link to the first page of resources. +type IkePolicyCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalIkePolicyCollectionFirst unmarshals an instance of IkePolicyCollectionFirst from the specified map of raw messages. +func UnmarshalIkePolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type IkePolicyCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalIkePolicyCollectionNext unmarshals an instance of IkePolicyCollectionNext from the specified map of raw messages. +func UnmarshalIkePolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type IkePolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalIkePolicyReferenceDeleted unmarshals an instance of IkePolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalIkePolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Image : Image struct +type Image struct { + // The date and time that the image was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this image. + CRN *string `json:"crn" validate:"required"` + + // The type of encryption used on the image. + Encryption *string `json:"encryption" validate:"required"` + + // The key that will be used to encrypt volumes created from this image (unless an + // alternate `encryption_key` is provided at volume creation). + // + // This property will be present for images with an `encryption` type of `user_managed`. + EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` + + // Details for the stored image file. + File *ImageFile `json:"file" validate:"required"` + + // The URL for this image. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this image. + ID *string `json:"id" validate:"required"` + + // The minimum size (in gigabytes) of a volume onto which this image may be provisioned. + // + // This property may be absent if the image has a `status` of `pending`, `tentative`, or + // `failed`. + MinimumProvisionedSize *int64 `json:"minimum_provisioned_size,omitempty"` + + // The user-defined or system-provided name for this image. + Name *string `json:"name" validate:"required"` + + // The operating system included in this image. + OperatingSystem *OperatingSystem `json:"operating_system,omitempty"` + + // The resource group for this image. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The status of this image + // - available: image can be used (provisionable) + // - deleting: image is being deleted, and can no longer be used to provision new + // resources + // - deprecated: image can be used, but is slated to become `obsolete` (provisionable) + // - failed: image is corrupt or did not pass validation + // - obsolete: image can no longer be used to provision new resources + // - pending: image is being imported and is not yet `available` + // - tentative: image import has timed out (contact support) + // - unusable: image cannot be used (see `status_reasons[]` for possible remediation) + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the image on which the + // unexpected property value was encountered. + Status *string `json:"status" validate:"required"` + + // Array of reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []ImageStatusReason `json:"status_reasons" validate:"required"` + + // Whether the image is publicly visible or private to the account. + Visibility *string `json:"visibility" validate:"required"` +} + +// Constants associated with the Image.Encryption property. +// The type of encryption used on the image. +const ( + ImageEncryptionNoneConst = "none" + ImageEncryptionUserManagedConst = "user_managed" +) + +// Constants associated with the Image.Status property. +// The status of this image +// - available: image can be used (provisionable) +// - deleting: image is being deleted, and can no longer be used to provision new +// resources +// - deprecated: image can be used, but is slated to become `obsolete` (provisionable) +// - failed: image is corrupt or did not pass validation +// - obsolete: image can no longer be used to provision new resources +// - pending: image is being imported and is not yet `available` +// - tentative: image import has timed out (contact support) +// - unusable: image cannot be used (see `status_reasons[]` for possible remediation) +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the image on which the +// unexpected property value was encountered. +const ( + ImageStatusAvailableConst = "available" + ImageStatusDeletingConst = "deleting" + ImageStatusDeprecatedConst = "deprecated" + ImageStatusFailedConst = "failed" + ImageStatusPendingConst = "pending" + ImageStatusTentativeConst = "tentative" + ImageStatusUnusableConst = "unusable" +) + +// Constants associated with the Image.Visibility property. +// Whether the image is publicly visible or private to the account. +const ( + ImageVisibilityPrivateConst = "private" + ImageVisibilityPublicConst = "public" +) + +// UnmarshalImage unmarshals an instance of Image from the specified map of raw messages. +func UnmarshalImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Image) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "minimum_provisioned_size", &obj.MinimumProvisionedSize) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalImageStatusReason) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "visibility", &obj.Visibility) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageCollection : ImageCollection struct +type ImageCollection struct { + // A link to the first page of resources. + First *ImageCollectionFirst `json:"first" validate:"required"` + + // Collection of images. + Images []Image `json:"images" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *ImageCollectionNext `json:"next,omitempty"` +} + +// UnmarshalImageCollection unmarshals an instance of ImageCollection from the specified map of raw messages. +func UnmarshalImageCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalImageCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "images", &obj.Images, UnmarshalImage) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalImageCollectionNext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageCollectionFirst : A link to the first page of resources. +type ImageCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalImageCollectionFirst unmarshals an instance of ImageCollectionFirst from the specified map of raw messages. +func UnmarshalImageCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type ImageCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalImageCollectionNext unmarshals an instance of ImageCollectionNext from the specified map of raw messages. +func UnmarshalImageCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageFile : ImageFile struct +type ImageFile struct { + // Checksums for this image file. + // + // This property may be absent if the associated image has a `status` of `pending` or + // `failed`. + Checksums *ImageFileChecksums `json:"checksums,omitempty"` + + // The size of the stored image file rounded up to the next gigabyte. + // + // This property may be absent if the associated image has a `status` of `pending` or + // `failed`. + Size *int64 `json:"size,omitempty"` +} + +// UnmarshalImageFile unmarshals an instance of ImageFile from the specified map of raw messages. +func UnmarshalImageFile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageFile) + err = core.UnmarshalModel(m, "checksums", &obj.Checksums, UnmarshalImageFileChecksums) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageFileChecksums : ImageFileChecksums struct +type ImageFileChecksums struct { + // The SHA256 fingerprint of the image file. + Sha256 *string `json:"sha256,omitempty"` +} + +// UnmarshalImageFileChecksums unmarshals an instance of ImageFileChecksums from the specified map of raw messages. +func UnmarshalImageFileChecksums(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageFileChecksums) + err = core.UnmarshalPrimitive(m, "sha256", &obj.Sha256) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageFilePrototype : ImageFilePrototype struct +type ImageFilePrototype struct { + // The Cloud Object Store (COS) location of the image file. + Href *string `json:"href" validate:"required"` +} + +// NewImageFilePrototype : Instantiate ImageFilePrototype (Generic Model Constructor) +func (*VpcV1) NewImageFilePrototype(href string) (model *ImageFilePrototype, err error) { + model = &ImageFilePrototype{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalImageFilePrototype unmarshals an instance of ImageFilePrototype from the specified map of raw messages. +func UnmarshalImageFilePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageFilePrototype) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentity : Identifies an image by a unique property. +// Models which "extend" this model: +// - ImageIdentityByID +// - ImageIdentityByCRN +// - ImageIdentityByHref +type ImageIdentity struct { + // The unique identifier for this image. + ID *string `json:"id,omitempty"` + + // The CRN for this image. + CRN *string `json:"crn,omitempty"` + + // The URL for this image. + Href *string `json:"href,omitempty"` +} + +func (*ImageIdentity) isaImageIdentity() bool { + return true +} + +type ImageIdentityIntf interface { + isaImageIdentity() bool +} + +// UnmarshalImageIdentity unmarshals an instance of ImageIdentity from the specified map of raw messages. +func UnmarshalImageIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImagePatch : ImagePatch struct +type ImagePatch struct { + // The unique user-defined name for this image. Names starting with "ibm-" are not allowed. + Name *string `json:"name,omitempty"` +} + +// UnmarshalImagePatch unmarshals an instance of ImagePatch from the specified map of raw messages. +func UnmarshalImagePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImagePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the ImagePatch +func (imagePatch *ImagePatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(imagePatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// ImagePrototype : ImagePrototype struct +// Models which "extend" this model: +// - ImagePrototypeImageByFile +type ImagePrototype struct { + // The unique user-defined name for this image. Names starting with "ibm-" are not allowed. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. + // + // That representation is created by wrapping the key's value with the `encryption_key` root key (which must also be + // provided), using either [Key Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-wrap-keys) or the + // [Hyper Protect Crypto Service](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). + // + // If this property is not provided, the imported image is treated as unencrypted. + EncryptedDataKey *string `json:"encrypted_data_key,omitempty"` + + // The identity of the root key that was used to wrap the data key (which is ultimately + // represented as `encrypted_data_key`). Additionally, the root key will be used to encrypt + // volumes created from this image (unless an alternate `encryption_key` is provided at + // volume creation). + // + // If this property is not provided, the imported image is treated as unencrypted. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The file from which to create the image. + File *ImageFilePrototype `json:"file,omitempty"` + + // The identity of the [supported operating + // system](https://cloud.ibm.com/apidocs/vpc#list-operating-systems) included in + // this image. + OperatingSystem OperatingSystemIdentityIntf `json:"operating_system,omitempty"` +} + +func (*ImagePrototype) isaImagePrototype() bool { + return true +} + +type ImagePrototypeIntf interface { + isaImagePrototype() bool +} + +// UnmarshalImagePrototype unmarshals an instance of ImagePrototype from the specified map of raw messages. +func UnmarshalImagePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImagePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageReference : ImageReference struct +type ImageReference struct { + // The CRN for this image. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *ImageReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this image. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this image. + ID *string `json:"id" validate:"required"` + + // The user-defined or system-provided name for this image. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalImageReference unmarshals an instance of ImageReference from the specified map of raw messages. +func UnmarshalImageReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalImageReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type ImageReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalImageReferenceDeleted unmarshals an instance of ImageReferenceDeleted from the specified map of raw messages. +func UnmarshalImageReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageStatusReason : ImageStatusReason struct +type ImageStatusReason struct { + // A snake case string succinctly identifying the status reason. + Code *string `json:"code" validate:"required"` + + // An explanation of the status reason. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the ImageStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + ImageStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" + ImageStatusReasonCodeEncryptionKeyDisabledConst = "encryption_key_disabled" +) + +// UnmarshalImageStatusReason unmarshals an instance of ImageStatusReason from the specified map of raw messages. +func UnmarshalImageStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Instance : Instance struct +type Instance struct { + // The total bandwidth (in megabits per second) shared across the virtual server instance's network interfaces. + Bandwidth *int64 `json:"bandwidth" validate:"required"` + + // Boot volume attachment. + BootVolumeAttachment *VolumeAttachmentReferenceInstanceContext `json:"boot_volume_attachment" validate:"required"` + + // The date and time that the virtual server instance was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // Collection of the instance's disks. + Disks []InstanceDisk `json:"disks" validate:"required"` + + // The virtual server instance GPU configuration. + Gpu *InstanceGpu `json:"gpu,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The image the virtual server instance was provisioned from. + Image *ImageReference `json:"image,omitempty"` + + // The amount of memory, truncated to whole gibibytes. + Memory *int64 `json:"memory" validate:"required"` + + // The user-defined name for this virtual server instance (and default system hostname). + Name *string `json:"name" validate:"required"` + + // Collection of the virtual server instance's network interfaces, including the primary network interface. + NetworkInterfaces []NetworkInterfaceInstanceContextReference `json:"network_interfaces" validate:"required"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfaceInstanceContextReference `json:"primary_network_interface" validate:"required"` + + // The profile for this virtual server instance. + Profile *InstanceProfileReference `json:"profile" validate:"required"` + + // The resource group for this instance. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The status of the virtual server instance. + Status *string `json:"status" validate:"required"` + + // The virtual server instance VCPU configuration. + Vcpu *InstanceVcpu `json:"vcpu" validate:"required"` + + // Collection of the virtual server instance's volume attachments, including the boot volume attachment. + VolumeAttachments []VolumeAttachmentReferenceInstanceContext `json:"volume_attachments" validate:"required"` + + // The VPC this virtual server instance resides in. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this virtual server instance resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Instance.Status property. +// The status of the virtual server instance. +const ( + InstanceStatusDeletingConst = "deleting" + InstanceStatusFailedConst = "failed" + InstanceStatusPausedConst = "paused" + InstanceStatusPausingConst = "pausing" + InstanceStatusPendingConst = "pending" + InstanceStatusRestartingConst = "restarting" + InstanceStatusResumingConst = "resuming" + InstanceStatusRunningConst = "running" + InstanceStatusStartingConst = "starting" + InstanceStatusStoppedConst = "stopped" + InstanceStatusStoppingConst = "stopping" +) + +// UnmarshalInstance unmarshals an instance of Instance from the specified map of raw messages. +func UnmarshalInstance(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Instance) + err = core.UnmarshalPrimitive(m, "bandwidth", &obj.Bandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentReferenceInstanceContext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) + if err != nil { + return + } + err = core.UnmarshalModel(m, "gpu", &obj.Gpu, UnmarshalInstanceGpu) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceInstanceContextReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfaceInstanceContextReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu", &obj.Vcpu, UnmarshalInstanceVcpu) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceAction : InstanceAction struct +type InstanceAction struct { + // The date and time that the action was completed. + CompletedAt *strfmt.DateTime `json:"completed_at,omitempty"` + + // The date and time that the action was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If set to true, the action will be forced immediately, and all queued actions deleted. Ignored for the start action. + Force *bool `json:"force,omitempty"` + + // The URL for this instance action. + Href *string `json:"href" validate:"required"` + + // The identifier for this instance action. + ID *string `json:"id" validate:"required"` + + // The date and time that the action was started. + StartedAt *strfmt.DateTime `json:"started_at,omitempty"` + + // The current status of this action. + Status *string `json:"status" validate:"required"` + + // The type of action. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceAction.Status property. +// The current status of this action. +const ( + InstanceActionStatusCompletedConst = "completed" + InstanceActionStatusFailedConst = "failed" + InstanceActionStatusPendingConst = "pending" + InstanceActionStatusRunningConst = "running" +) + +// Constants associated with the InstanceAction.Type property. +// The type of action. +const ( + InstanceActionTypeRebootConst = "reboot" + InstanceActionTypeStartConst = "start" + InstanceActionTypeStopConst = "stop" +) + +// UnmarshalInstanceAction unmarshals an instance of InstanceAction from the specified map of raw messages. +func UnmarshalInstanceAction(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceAction) + err = core.UnmarshalPrimitive(m, "completed_at", &obj.CompletedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "force", &obj.Force) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "started_at", &obj.StartedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceCollection : InstanceCollection struct +type InstanceCollection struct { + // A link to the first page of resources. + First *InstanceCollectionFirst `json:"first" validate:"required"` + + // Collection of virtual server instances. + Instances []Instance `json:"instances" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceCollection unmarshals an instance of InstanceCollection from the specified map of raw messages. +func UnmarshalInstanceCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instances", &obj.Instances, UnmarshalInstance) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceCollectionFirst : A link to the first page of resources. +type InstanceCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceCollectionFirst unmarshals an instance of InstanceCollectionFirst from the specified map of raw messages. +func UnmarshalInstanceCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type InstanceCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceCollectionNext unmarshals an instance of InstanceCollectionNext from the specified map of raw messages. +func UnmarshalInstanceCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceConsoleAccessToken : The instance console access token information. +type InstanceConsoleAccessToken struct { + // A URL safe single-use token used to access the console WebSocket. + AccessToken *string `json:"access_token" validate:"required"` + + // The instance console type for which this token may be used. + ConsoleType *string `json:"console_type" validate:"required"` + + // The date and time that the access token was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The date and time that the access token will expire. + ExpiresAt *strfmt.DateTime `json:"expires_at" validate:"required"` + + // Indicates whether to disconnect an existing serial console session as the serial console cannot be shared. This has + // no effect on VNC consoles. + Force *bool `json:"force" validate:"required"` + + // The URL to access this instance console. + Href *string `json:"href" validate:"required"` +} + +// Constants associated with the InstanceConsoleAccessToken.ConsoleType property. +// The instance console type for which this token may be used. +const ( + InstanceConsoleAccessTokenConsoleTypeSerialConst = "serial" + InstanceConsoleAccessTokenConsoleTypeVncConst = "vnc" +) + +// UnmarshalInstanceConsoleAccessToken unmarshals an instance of InstanceConsoleAccessToken from the specified map of raw messages. +func UnmarshalInstanceConsoleAccessToken(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceConsoleAccessToken) + err = core.UnmarshalPrimitive(m, "access_token", &obj.AccessToken) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "console_type", &obj.ConsoleType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "expires_at", &obj.ExpiresAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "force", &obj.Force) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDisk : InstanceDisk struct +type InstanceDisk struct { + // The date and time that the disk was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this instance disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance disk. + ID *string `json:"id" validate:"required"` + + // The disk interface used for attaching the disk. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + InterfaceType *string `json:"interface_type" validate:"required"` + + // The user-defined name for this disk. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The size of the disk in GB (gigabytes). + Size *int64 `json:"size" validate:"required"` +} + +// Constants associated with the InstanceDisk.InterfaceType property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + InstanceDiskInterfaceTypeNvmeConst = "nvme" + InstanceDiskInterfaceTypeVirtioBlkConst = "virtio_blk" +) + +// Constants associated with the InstanceDisk.ResourceType property. +// The resource type. +const ( + InstanceDiskResourceTypeInstanceDiskConst = "instance_disk" +) + +// UnmarshalInstanceDisk unmarshals an instance of InstanceDisk from the specified map of raw messages. +func UnmarshalInstanceDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDisk) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interface_type", &obj.InterfaceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "size", &obj.Size) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDiskCollection : InstanceDiskCollection struct +type InstanceDiskCollection struct { + // Collection of the instance's disks. + Disks []InstanceDisk `json:"disks" validate:"required"` +} + +// UnmarshalInstanceDiskCollection unmarshals an instance of InstanceDiskCollection from the specified map of raw messages. +func UnmarshalInstanceDiskCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskCollection) + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceDisk) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDiskPatch : InstanceDiskPatch struct +type InstanceDiskPatch struct { + // The user-defined name for this disk. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceDiskPatch unmarshals an instance of InstanceDiskPatch from the specified map of raw messages. +func UnmarshalInstanceDiskPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceDiskPatch +func (instanceDiskPatch *InstanceDiskPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instanceDiskPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// InstanceDiskReference : InstanceDiskReference struct +type InstanceDiskReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *InstanceDiskReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance disk. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance disk. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this disk. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the InstanceDiskReference.ResourceType property. +// The resource type. +const ( + InstanceDiskReferenceResourceTypeInstanceDiskConst = "instance_disk" +) + +// UnmarshalInstanceDiskReference unmarshals an instance of InstanceDiskReference from the specified map of raw messages. +func UnmarshalInstanceDiskReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceDiskReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceDiskReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type InstanceDiskReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceDiskReferenceDeleted unmarshals an instance of InstanceDiskReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceDiskReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceDiskReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGpu : The virtual server instance GPU configuration. +type InstanceGpu struct { + // The number of GPUs assigned to the instance. + Count *int64 `json:"count" validate:"required"` + + // The GPU manufacturer. + Manufacturer *string `json:"manufacturer" validate:"required"` + + // The overall amount of GPU memory in GiB (gibibytes). + Memory *int64 `json:"memory" validate:"required"` + + // The GPU model. + Model *string `json:"model" validate:"required"` +} + +// UnmarshalInstanceGpu unmarshals an instance of InstanceGpu from the specified map of raw messages. +func UnmarshalInstanceGpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGpu) + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manufacturer", &obj.Manufacturer) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "memory", &obj.Memory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "model", &obj.Model) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroup : InstanceGroup struct +type InstanceGroup struct { + // Required if specifying a load balancer pool only. Used by the instance group when scaling up instances to supply the + // port for the load balancer pool member. + ApplicationPort *int64 `json:"application_port,omitempty"` + + // The date and time that the instance group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance group. + CRN *string `json:"crn" validate:"required"` + + // The URL for this instance group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group. + ID *string `json:"id" validate:"required"` + + // The template used to create new instances for this group. + InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` + + // The load balancer pool managed by this group. Instances created + // by this group will have a new load balancer pool member in that + // pool created. + LoadBalancerPool *LoadBalancerPoolReference `json:"load_balancer_pool,omitempty"` + + // Array of references to managers for the instance group. + Managers []InstanceGroupManagerReference `json:"managers" validate:"required"` + + // The number of instances in the instance group. + MembershipCount *int64 `json:"membership_count" validate:"required"` + + // The user-defined name for this instance group. + Name *string `json:"name" validate:"required"` + + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The status of the instance group + // - `deleting`: Group is being deleted + // - `healthy`: Group has `membership_count` instances + // - `scaling`: Instances in the group are being created or deleted to reach + // `membership_count` + // - `unhealthy`: Group is unable to reach `membership_count` instances. + Status *string `json:"status" validate:"required"` + + // Array of references to subnets to use when creating new instances. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The VPC the instance group resides in. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// Constants associated with the InstanceGroup.Status property. +// The status of the instance group +// - `deleting`: Group is being deleted +// - `healthy`: Group has `membership_count` instances +// - `scaling`: Instances in the group are being created or deleted to reach +// `membership_count` +// - `unhealthy`: Group is unable to reach `membership_count` instances. +const ( + InstanceGroupStatusDeletingConst = "deleting" + InstanceGroupStatusHealthyConst = "healthy" + InstanceGroupStatusScalingConst = "scaling" + InstanceGroupStatusUnhealthyConst = "unhealthy" +) + +// UnmarshalInstanceGroup unmarshals an instance of InstanceGroup from the specified map of raw messages. +func UnmarshalInstanceGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroup) + err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "managers", &obj.Managers, UnmarshalInstanceGroupManagerReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupCollection : InstanceGroupCollection struct +type InstanceGroupCollection struct { + // A link to the first page of resources. + First *InstanceGroupCollectionFirst `json:"first" validate:"required"` + + // Collection of instance groups. + InstanceGroups []InstanceGroup `json:"instance_groups" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceGroupCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceGroupCollection unmarshals an instance of InstanceGroupCollection from the specified map of raw messages. +func UnmarshalInstanceGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_groups", &obj.InstanceGroups, UnmarshalInstanceGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupCollectionFirst : A link to the first page of resources. +type InstanceGroupCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupCollectionFirst unmarshals an instance of InstanceGroupCollectionFirst from the specified map of raw messages. +func UnmarshalInstanceGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type InstanceGroupCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupCollectionNext unmarshals an instance of InstanceGroupCollectionNext from the specified map of raw messages. +func UnmarshalInstanceGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManager : InstanceGroupManager struct +// Models which "extend" this model: +// - InstanceGroupManagerAutoScale +type InstanceGroupManager struct { + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // If set to `true`, this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled" validate:"required"` + + // The user-defined name for this instance group manager. Names must be unique within the instance group. + Name *string `json:"name" validate:"required"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type,omitempty"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The policies of the instance group manager. + Policies []InstanceGroupManagerPolicyReference `json:"policies,omitempty"` +} + +// Constants associated with the InstanceGroupManager.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerManagerTypeAutoscaleConst = "autoscale" +) + +func (*InstanceGroupManager) isaInstanceGroupManager() bool { + return true +} + +type InstanceGroupManagerIntf interface { + isaInstanceGroupManager() bool +} + +// UnmarshalInstanceGroupManager unmarshals an instance of InstanceGroupManager from the specified map of raw messages. +func UnmarshalInstanceGroupManager(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManager) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerCollection : InstanceGroupManagerCollection struct +type InstanceGroupManagerCollection struct { + // A link to the first page of resources. + First *InstanceGroupManagerCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of instance group managers. + Managers []InstanceGroupManagerIntf `json:"managers" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceGroupManagerCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceGroupManagerCollection unmarshals an instance of InstanceGroupManagerCollection from the specified map of raw messages. +func UnmarshalInstanceGroupManagerCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "managers", &obj.Managers, UnmarshalInstanceGroupManager) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerCollectionFirst : A link to the first page of resources. +type InstanceGroupManagerCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupManagerCollectionFirst unmarshals an instance of InstanceGroupManagerCollectionFirst from the specified map of raw messages. +func UnmarshalInstanceGroupManagerCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type InstanceGroupManagerCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupManagerCollectionNext unmarshals an instance of InstanceGroupManagerCollectionNext from the specified map of raw messages. +func UnmarshalInstanceGroupManagerCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPatch : InstanceGroupManagerPatch struct +type InstanceGroupManagerPatch struct { + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // If set to `true`, this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled,omitempty"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` + + // The user-defined name for this instance group manager. Names must be unique within the instance group. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceGroupManagerPatch unmarshals an instance of InstanceGroupManagerPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPatch) + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceGroupManagerPatch +func (instanceGroupManagerPatch *InstanceGroupManagerPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instanceGroupManagerPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// InstanceGroupManagerPolicy : InstanceGroupManagerPolicy struct +// Models which "extend" this model: +// - InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy +type InstanceGroupManagerPolicy struct { + // The URL for this instance group manager policy. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager policy. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group manager policy. Names must be unique within the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type,omitempty"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value,omitempty"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPolicy.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicy.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyPolicyTypeTargetConst = "target" +) + +func (*InstanceGroupManagerPolicy) isaInstanceGroupManagerPolicy() bool { + return true +} + +type InstanceGroupManagerPolicyIntf interface { + isaInstanceGroupManagerPolicy() bool +} + +// UnmarshalInstanceGroupManagerPolicy unmarshals an instance of InstanceGroupManagerPolicy from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicy) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyCollection : InstanceGroupManagerPolicyCollection struct +type InstanceGroupManagerPolicyCollection struct { + // A link to the first page of resources. + First *InstanceGroupManagerPolicyCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceGroupManagerPolicyCollectionNext `json:"next,omitempty"` + + // Collection of instance group manager policies. + Policies []InstanceGroupManagerPolicyIntf `json:"policies" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceGroupManagerPolicyCollection unmarshals an instance of InstanceGroupManagerPolicyCollection from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupManagerPolicyCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupManagerPolicyCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicy) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyCollectionFirst : A link to the first page of resources. +type InstanceGroupManagerPolicyCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupManagerPolicyCollectionFirst unmarshals an instance of InstanceGroupManagerPolicyCollectionFirst from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type InstanceGroupManagerPolicyCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupManagerPolicyCollectionNext unmarshals an instance of InstanceGroupManagerPolicyCollectionNext from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyPatch : InstanceGroupManagerPolicyPatch struct +type InstanceGroupManagerPolicyPatch struct { + // The type of metric to be evaluated. + MetricType *string `json:"metric_type,omitempty"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value,omitempty"` + + // The user-defined name for this instance group manager policy. Names must be unique within the instance group + // manager. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPolicyPatch.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyPatchMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyPatchMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyPatchMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyPatchMetricTypeNetworkOutConst = "network_out" +) + +// UnmarshalInstanceGroupManagerPolicyPatch unmarshals an instance of InstanceGroupManagerPolicyPatch from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyPatch) + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceGroupManagerPolicyPatch +func (instanceGroupManagerPolicyPatch *InstanceGroupManagerPolicyPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instanceGroupManagerPolicyPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// InstanceGroupManagerPolicyPrototype : InstanceGroupManagerPolicyPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype +type InstanceGroupManagerPolicyPrototype struct { + // The user-defined name for this instance group manager policy. Names must be unique within the instance group + // manager. + Name *string `json:"name,omitempty"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type,omitempty"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value,omitempty"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPolicyPrototype.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyPrototypeMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyPrototypeMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyPrototypeMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyPrototypeMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicyPrototype.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyPrototypePolicyTypeTargetConst = "target" +) + +func (*InstanceGroupManagerPolicyPrototype) isaInstanceGroupManagerPolicyPrototype() bool { + return true +} + +type InstanceGroupManagerPolicyPrototypeIntf interface { + isaInstanceGroupManagerPolicyPrototype() bool +} + +// UnmarshalInstanceGroupManagerPolicyPrototype unmarshals an instance of InstanceGroupManagerPolicyPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyReference : InstanceGroupManagerPolicyReference struct +type InstanceGroupManagerPolicyReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *InstanceGroupManagerPolicyReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager policy. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager policy. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group manager policy. Names must be unique within the instance group + // manager. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceGroupManagerPolicyReference unmarshals an instance of InstanceGroupManagerPolicyReference from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerPolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type InstanceGroupManagerPolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceGroupManagerPolicyReferenceDeleted unmarshals an instance of InstanceGroupManagerPolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPrototype : InstanceGroupManagerPrototype struct +// Models which "extend" this model: +// - InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype +type InstanceGroupManagerPrototype struct { + // If set to `true`, this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled,omitempty"` + + // The user-defined name for this instance group manager. Names must be unique within the instance group. + Name *string `json:"name,omitempty"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type,omitempty"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count,omitempty"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPrototype.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerPrototypeManagerTypeAutoscaleConst = "autoscale" +) + +func (*InstanceGroupManagerPrototype) isaInstanceGroupManagerPrototype() bool { + return true +} + +type InstanceGroupManagerPrototypeIntf interface { + isaInstanceGroupManagerPrototype() bool +} + +// UnmarshalInstanceGroupManagerPrototype unmarshals an instance of InstanceGroupManagerPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPrototype) + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerReference : InstanceGroupManagerReference struct +type InstanceGroupManagerReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *InstanceGroupManagerReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group manager. Names must be unique within the instance group. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceGroupManagerReference unmarshals an instance of InstanceGroupManagerReference from the specified map of raw messages. +func UnmarshalInstanceGroupManagerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupManagerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type InstanceGroupManagerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceGroupManagerReferenceDeleted unmarshals an instance of InstanceGroupManagerReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceGroupManagerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupMembership : InstanceGroupMembership struct +type InstanceGroupMembership struct { + // If set to true, when deleting the membership the instance will also be deleted. + DeleteInstanceOnMembershipDelete *bool `json:"delete_instance_on_membership_delete" validate:"required"` + + // The URL for this instance group membership. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group membership. + ID *string `json:"id" validate:"required"` + + Instance *InstanceReference `json:"instance" validate:"required"` + + InstanceTemplate *InstanceTemplateReference `json:"instance_template" validate:"required"` + + // The user-defined name for this instance group membership. Names must be unique within the instance group. + Name *string `json:"name" validate:"required"` + + PoolMember *LoadBalancerPoolMemberReference `json:"pool_member,omitempty"` + + // The status of the instance group membership + // - `deleting`: Membership is deleting dependent resources + // - `failed`: Membership was unable to maintain dependent resources + // - `healthy`: Membership is active and serving in the group + // - `pending`: Membership is waiting for dependent resources + // - `unhealthy`: Membership has unhealthy dependent resources. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the InstanceGroupMembership.Status property. +// The status of the instance group membership +// - `deleting`: Membership is deleting dependent resources +// - `failed`: Membership was unable to maintain dependent resources +// - `healthy`: Membership is active and serving in the group +// - `pending`: Membership is waiting for dependent resources +// - `unhealthy`: Membership has unhealthy dependent resources. +const ( + InstanceGroupMembershipStatusDeletingConst = "deleting" + InstanceGroupMembershipStatusFailedConst = "failed" + InstanceGroupMembershipStatusHealthyConst = "healthy" + InstanceGroupMembershipStatusPendingConst = "pending" + InstanceGroupMembershipStatusUnhealthyConst = "unhealthy" +) + +// UnmarshalInstanceGroupMembership unmarshals an instance of InstanceGroupMembership from the specified map of raw messages. +func UnmarshalInstanceGroupMembership(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupMembership) + err = core.UnmarshalPrimitive(m, "delete_instance_on_membership_delete", &obj.DeleteInstanceOnMembershipDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalInstanceReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pool_member", &obj.PoolMember, UnmarshalLoadBalancerPoolMemberReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupMembershipCollection : InstanceGroupMembershipCollection struct +type InstanceGroupMembershipCollection struct { + // A link to the first page of resources. + First *InstanceGroupMembershipCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of instance group memberships. + Memberships []InstanceGroupMembership `json:"memberships" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceGroupMembershipCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceGroupMembershipCollection unmarshals an instance of InstanceGroupMembershipCollection from the specified map of raw messages. +func UnmarshalInstanceGroupMembershipCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupMembershipCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceGroupMembershipCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memberships", &obj.Memberships, UnmarshalInstanceGroupMembership) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceGroupMembershipCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupMembershipCollectionFirst : A link to the first page of resources. +type InstanceGroupMembershipCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupMembershipCollectionFirst unmarshals an instance of InstanceGroupMembershipCollectionFirst from the specified map of raw messages. +func UnmarshalInstanceGroupMembershipCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupMembershipCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupMembershipCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type InstanceGroupMembershipCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceGroupMembershipCollectionNext unmarshals an instance of InstanceGroupMembershipCollectionNext from the specified map of raw messages. +func UnmarshalInstanceGroupMembershipCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupMembershipCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupMembershipPatch : InstanceGroupMembershipPatch struct +type InstanceGroupMembershipPatch struct { + // The user-defined name for this instance group membership. Names must be unique within the instance group. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceGroupMembershipPatch unmarshals an instance of InstanceGroupMembershipPatch from the specified map of raw messages. +func UnmarshalInstanceGroupMembershipPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupMembershipPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceGroupMembershipPatch +func (instanceGroupMembershipPatch *InstanceGroupMembershipPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instanceGroupMembershipPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// InstanceGroupPatch : To add or update load balancer specification for an instance group the `membership_count` must first be set to 0. +type InstanceGroupPatch struct { + // Required if specifying a load balancer pool only. Used by the instance group when scaling up instances to supply the + // port for the load balancer pool member. + ApplicationPort *int64 `json:"application_port,omitempty"` + + // Instance template to use when creating new instances. + InstanceTemplate InstanceTemplateIdentityIntf `json:"instance_template,omitempty"` + + // The load balancer that the load balancer pool used by this group + // is in. Must be supplied when using a load balancer pool. + LoadBalancer LoadBalancerIdentityIntf `json:"load_balancer,omitempty"` + + // When specified, the load balancer pool will be managed by this + // group. Instances created by this group will have a new load + // balancer pool member in that pool created. Must be used with + // `application_port`. + LoadBalancerPool LoadBalancerPoolIdentityIntf `json:"load_balancer_pool,omitempty"` + + // The number of instances in the instance group. + MembershipCount *int64 `json:"membership_count,omitempty"` + + // The user-defined name for this instance group. + Name *string `json:"name,omitempty"` + + // Array of identities to subnets to use when creating new instances. + Subnets []SubnetIdentityIntf `json:"subnets,omitempty"` +} + +// UnmarshalInstanceGroupPatch unmarshals an instance of InstanceGroupPatch from the specified map of raw messages. +func UnmarshalInstanceGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupPatch) + err = core.UnmarshalPrimitive(m, "application_port", &obj.ApplicationPort) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_template", &obj.InstanceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "load_balancer", &obj.LoadBalancer, UnmarshalLoadBalancerIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "load_balancer_pool", &obj.LoadBalancerPool, UnmarshalLoadBalancerPoolIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "membership_count", &obj.MembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceGroupPatch +func (instanceGroupPatch *InstanceGroupPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instanceGroupPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// InstanceGroupReference : InstanceGroupReference struct +type InstanceGroupReference struct { + // The CRN for this instance group. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *InstanceGroupReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceGroupReference unmarshals an instance of InstanceGroupReference from the specified map of raw messages. +func UnmarshalInstanceGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type InstanceGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceGroupReferenceDeleted unmarshals an instance of InstanceGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceInitialization : InstanceInitialization struct +type InstanceInitialization struct { + // Collection of references to public SSH keys used at instance initialization. + Keys []KeyReferenceInstanceInitializationContextIntf `json:"keys" validate:"required"` + + Password *InstanceInitializationPassword `json:"password,omitempty"` +} + +// UnmarshalInstanceInitialization unmarshals an instance of InstanceInitialization from the specified map of raw messages. +func UnmarshalInstanceInitialization(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceInitialization) + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyReferenceInstanceInitializationContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "password", &obj.Password, UnmarshalInstanceInitializationPassword) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceInitializationPassword : InstanceInitializationPassword struct +type InstanceInitializationPassword struct { + // The administrator password at initialization, encrypted using `encryption_key`, and returned base64-encoded. + EncryptedPassword *[]byte `json:"encrypted_password" validate:"required"` + + // The reference to the public SSH key used to encrypt the administrator password. + EncryptionKey KeyReferenceInstanceInitializationContextIntf `json:"encryption_key" validate:"required"` +} + +// UnmarshalInstanceInitializationPassword unmarshals an instance of InstanceInitializationPassword from the specified map of raw messages. +func UnmarshalInstanceInitializationPassword(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceInitializationPassword) + err = core.UnmarshalPrimitive(m, "encrypted_password", &obj.EncryptedPassword) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalKeyReferenceInstanceInitializationContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePatch : InstancePatch struct +type InstancePatch struct { + // The user-defined name for this virtual server instance (and default system hostname). + Name *string `json:"name,omitempty"` + + // The profile to use for this virtual server instance. For the profile to be changed, + // the instance `status` must be `stopping` or `stopped`. In addition, the requested + // profile must: + // - Match the current profile's instance disk support. (Note: If the current profile + // supports instance storage disks, the requested profile can have a different + // instance storage disk configuration.) + // - Be compatible with any `placement_target` constraints. For example, if the + // instance is placed on a dedicated host, the requested profile `family` must be + // the same as the dedicated host `family`. + Profile InstancePatchProfileIntf `json:"profile,omitempty"` +} + +// UnmarshalInstancePatch unmarshals an instance of InstancePatch from the specified map of raw messages. +func UnmarshalInstancePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstancePatchProfile) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstancePatch +func (instancePatch *InstancePatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instancePatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// InstancePatchProfile : The profile to use for this virtual server instance. For the profile to be changed, the instance `status` must be +// `stopping` or `stopped`. In addition, the requested profile must: +// - Match the current profile's instance disk support. (Note: If the current profile +// supports instance storage disks, the requested profile can have a different +// instance storage disk configuration.) +// - Be compatible with any `placement_target` constraints. For example, if the +// instance is placed on a dedicated host, the requested profile `family` must be +// the same as the dedicated host `family`. +// Models which "extend" this model: +// - InstancePatchProfileInstanceProfileIdentityByName +// - InstancePatchProfileInstanceProfileIdentityByHref +type InstancePatchProfile struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name,omitempty"` + + // The URL for this virtual server instance profile. + Href *string `json:"href,omitempty"` +} + +func (*InstancePatchProfile) isaInstancePatchProfile() bool { + return true +} + +type InstancePatchProfileIntf interface { + isaInstancePatchProfile() bool +} + +// UnmarshalInstancePatchProfile unmarshals an instance of InstancePatchProfile from the specified map of raw messages. +func UnmarshalInstancePatchProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatchProfile) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfile : InstanceProfile struct +type InstanceProfile struct { + Bandwidth InstanceProfileBandwidthIntf `json:"bandwidth" validate:"required"` + + // Collection of the instance profile's disks. + Disks []InstanceProfileDisk `json:"disks" validate:"required"` + + // The product family this virtual server instance profile belongs to. + Family *string `json:"family,omitempty"` + + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` + + Memory InstanceProfileMemoryIntf `json:"memory" validate:"required"` + + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` + + OsArchitecture *InstanceProfileOsArchitecture `json:"os_architecture" validate:"required"` + + PortSpeed InstanceProfilePortSpeedIntf `json:"port_speed" validate:"required"` + + VcpuArchitecture *InstanceProfileVcpuArchitecture `json:"vcpu_architecture" validate:"required"` + + VcpuCount InstanceProfileVcpuIntf `json:"vcpu_count" validate:"required"` +} + +// UnmarshalInstanceProfile unmarshals an instance of InstanceProfile from the specified map of raw messages. +func UnmarshalInstanceProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfile) + err = core.UnmarshalModel(m, "bandwidth", &obj.Bandwidth, UnmarshalInstanceProfileBandwidth) + if err != nil { + return + } + err = core.UnmarshalModel(m, "disks", &obj.Disks, UnmarshalInstanceProfileDisk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "memory", &obj.Memory, UnmarshalInstanceProfileMemory) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "os_architecture", &obj.OsArchitecture, UnmarshalInstanceProfileOsArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "port_speed", &obj.PortSpeed, UnmarshalInstanceProfilePortSpeed) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_architecture", &obj.VcpuArchitecture, UnmarshalInstanceProfileVcpuArchitecture) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vcpu_count", &obj.VcpuCount, UnmarshalInstanceProfileVcpu) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidth : InstanceProfileBandwidth struct +// Models which "extend" this model: +// - InstanceProfileBandwidthFixed +// - InstanceProfileBandwidthRange +// - InstanceProfileBandwidthEnum +// - InstanceProfileBandwidthDependent +type InstanceProfileBandwidth struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the InstanceProfileBandwidth.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthTypeFixedConst = "fixed" +) + +func (*InstanceProfileBandwidth) isaInstanceProfileBandwidth() bool { + return true +} + +type InstanceProfileBandwidthIntf interface { + isaInstanceProfileBandwidth() bool +} + +// UnmarshalInstanceProfileBandwidth unmarshals an instance of InstanceProfileBandwidth from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidth(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidth) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileCollection : InstanceProfileCollection struct +type InstanceProfileCollection struct { + // Collection of virtual server instance profiles. + Profiles []InstanceProfile `json:"profiles" validate:"required"` +} + +// UnmarshalInstanceProfileCollection unmarshals an instance of InstanceProfileCollection from the specified map of raw messages. +func UnmarshalInstanceProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileCollection) + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalInstanceProfile) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDisk : Disks provided by this profile. +type InstanceProfileDisk struct { + Quantity InstanceProfileDiskQuantityIntf `json:"quantity" validate:"required"` + + Size InstanceProfileDiskSizeIntf `json:"size" validate:"required"` + + SupportedInterfaceTypes *InstanceProfileDiskSupportedInterfaces `json:"supported_interface_types" validate:"required"` +} + +// UnmarshalInstanceProfileDisk unmarshals an instance of InstanceProfileDisk from the specified map of raw messages. +func UnmarshalInstanceProfileDisk(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDisk) + err = core.UnmarshalModel(m, "quantity", &obj.Quantity, UnmarshalInstanceProfileDiskQuantity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "size", &obj.Size, UnmarshalInstanceProfileDiskSize) + if err != nil { + return + } + err = core.UnmarshalModel(m, "supported_interface_types", &obj.SupportedInterfaceTypes, UnmarshalInstanceProfileDiskSupportedInterfaces) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantity : InstanceProfileDiskQuantity struct +// Models which "extend" this model: +// - InstanceProfileDiskQuantityFixed +// - InstanceProfileDiskQuantityRange +// - InstanceProfileDiskQuantityEnum +// - InstanceProfileDiskQuantityDependent +type InstanceProfileDiskQuantity struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the InstanceProfileDiskQuantity.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskQuantity) isaInstanceProfileDiskQuantity() bool { + return true +} + +type InstanceProfileDiskQuantityIntf interface { + isaInstanceProfileDiskQuantity() bool +} + +// UnmarshalInstanceProfileDiskQuantity unmarshals an instance of InstanceProfileDiskQuantity from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantity) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSize : InstanceProfileDiskSize struct +// Models which "extend" this model: +// - InstanceProfileDiskSizeFixed +// - InstanceProfileDiskSizeRange +// - InstanceProfileDiskSizeEnum +// - InstanceProfileDiskSizeDependent +type InstanceProfileDiskSize struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the InstanceProfileDiskSize.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskSize) isaInstanceProfileDiskSize() bool { + return true +} + +type InstanceProfileDiskSizeIntf interface { + isaInstanceProfileDiskSize() bool +} + +// UnmarshalInstanceProfileDiskSize unmarshals an instance of InstanceProfileDiskSize from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSize(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSize) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSupportedInterfaces : InstanceProfileDiskSupportedInterfaces struct +type InstanceProfileDiskSupportedInterfaces struct { + // The disk interface used for attaching the disk. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected property value was encountered. + Default *string `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported disk interfaces used for attaching the disk. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSupportedInterfaces.Default property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + InstanceProfileDiskSupportedInterfacesDefaultNvmeConst = "nvme" + InstanceProfileDiskSupportedInterfacesDefaultVirtioBlkConst = "virtio_blk" +) + +// Constants associated with the InstanceProfileDiskSupportedInterfaces.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSupportedInterfacesTypeEnumConst = "enum" +) + +// Constants associated with the InstanceProfileDiskSupportedInterfaces.Values property. +// The disk interface used for attaching the disk. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the +// unexpected property value was encountered. +const ( + InstanceProfileDiskSupportedInterfacesValuesNvmeConst = "nvme" + InstanceProfileDiskSupportedInterfacesValuesVirtioBlkConst = "virtio_blk" +) + +// UnmarshalInstanceProfileDiskSupportedInterfaces unmarshals an instance of InstanceProfileDiskSupportedInterfaces from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSupportedInterfaces(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSupportedInterfaces) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileIdentity : Identifies an instance profile by a unique property. +// Models which "extend" this model: +// - InstanceProfileIdentityByName +// - InstanceProfileIdentityByHref +type InstanceProfileIdentity struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name,omitempty"` + + // The URL for this virtual server instance profile. + Href *string `json:"href,omitempty"` +} + +func (*InstanceProfileIdentity) isaInstanceProfileIdentity() bool { + return true +} + +type InstanceProfileIdentityIntf interface { + isaInstanceProfileIdentity() bool +} + +// UnmarshalInstanceProfileIdentity unmarshals an instance of InstanceProfileIdentity from the specified map of raw messages. +func UnmarshalInstanceProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemory : InstanceProfileMemory struct +// Models which "extend" this model: +// - InstanceProfileMemoryFixed +// - InstanceProfileMemoryRange +// - InstanceProfileMemoryEnum +// - InstanceProfileMemoryDependent +type InstanceProfileMemory struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the InstanceProfileMemory.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryTypeFixedConst = "fixed" +) + +func (*InstanceProfileMemory) isaInstanceProfileMemory() bool { + return true +} + +type InstanceProfileMemoryIntf interface { + isaInstanceProfileMemory() bool +} + +// UnmarshalInstanceProfileMemory unmarshals an instance of InstanceProfileMemory from the specified map of raw messages. +func UnmarshalInstanceProfileMemory(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemory) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileOsArchitecture : InstanceProfileOsArchitecture struct +type InstanceProfileOsArchitecture struct { + // The default OS architecture for an instance with this profile. + Default *string `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported OS architecture(s) for an instance with this profile. + Values []string `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileOsArchitecture.Type property. +// The type for this profile field. +const ( + InstanceProfileOsArchitectureTypeEnumConst = "enum" +) + +// UnmarshalInstanceProfileOsArchitecture unmarshals an instance of InstanceProfileOsArchitecture from the specified map of raw messages. +func UnmarshalInstanceProfileOsArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileOsArchitecture) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfilePortSpeed : InstanceProfilePortSpeed struct +// Models which "extend" this model: +// - InstanceProfilePortSpeedFixed +// - InstanceProfilePortSpeedDependent +type InstanceProfilePortSpeed struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` +} + +// Constants associated with the InstanceProfilePortSpeed.Type property. +// The type for this profile field. +const ( + InstanceProfilePortSpeedTypeFixedConst = "fixed" +) + +func (*InstanceProfilePortSpeed) isaInstanceProfilePortSpeed() bool { + return true +} + +type InstanceProfilePortSpeedIntf interface { + isaInstanceProfilePortSpeed() bool +} + +// UnmarshalInstanceProfilePortSpeed unmarshals an instance of InstanceProfilePortSpeed from the specified map of raw messages. +func UnmarshalInstanceProfilePortSpeed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfilePortSpeed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileReference : InstanceProfileReference struct +type InstanceProfileReference struct { + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceProfileReference unmarshals an instance of InstanceProfileReference from the specified map of raw messages. +func UnmarshalInstanceProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpu : InstanceProfileVcpu struct +// Models which "extend" this model: +// - InstanceProfileVcpuFixed +// - InstanceProfileVcpuRange +// - InstanceProfileVcpuEnum +// - InstanceProfileVcpuDependent +type InstanceProfileVcpu struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *int64 `json:"value,omitempty"` + + // The default value for this profile field. + Default *int64 `json:"default,omitempty"` + + // The maximum value for this profile field. + Max *int64 `json:"max,omitempty"` + + // The minimum value for this profile field. + Min *int64 `json:"min,omitempty"` + + // The increment step value for this profile field. + Step *int64 `json:"step,omitempty"` + + // The permitted values for this profile field. + Values []int64 `json:"values,omitempty"` +} + +// Constants associated with the InstanceProfileVcpu.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuTypeFixedConst = "fixed" +) + +func (*InstanceProfileVcpu) isaInstanceProfileVcpu() bool { + return true +} + +type InstanceProfileVcpuIntf interface { + isaInstanceProfileVcpu() bool +} + +// UnmarshalInstanceProfileVcpu unmarshals an instance of InstanceProfileVcpu from the specified map of raw messages. +func UnmarshalInstanceProfileVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpu) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuArchitecture : InstanceProfileVcpuArchitecture struct +type InstanceProfileVcpuArchitecture struct { + // The default VCPU architecture for an instance with this profile. + Default *string `json:"default,omitempty"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The VCPU architecture for an instance with this profile. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuArchitecture.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuArchitectureTypeFixedConst = "fixed" +) + +// UnmarshalInstanceProfileVcpuArchitecture unmarshals an instance of InstanceProfileVcpuArchitecture from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuArchitecture(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuArchitecture) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototype : InstancePrototype struct +// Models which "extend" this model: +// - InstancePrototypeInstanceByImage +// - InstancePrototypeInstanceBySourceTemplate +type InstancePrototype struct { + // The public SSH keys for the administrative user of the virtual server instance. Up to 10 keys may be provided; if no + // keys are provided the instance will be inaccessible unless the image used provides another means of access. For + // Windows instances, one of the keys will be used to encrypt the administrator password. + // + // Keys will be made available to the virtual server instance as cloud-init vendor data. For cloud-init enabled images, + // these keys will also be added as SSH authorized keys for the administrative user. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // Collection of additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The profile to use for this virtual server instance. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // User data to be made available when setting up the virtual server instance. + UserData *string `json:"user_data,omitempty"` + + // Collection of volume attachments. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If provided, must match the + // VPC tied to the subnets of the instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The identity of the image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // Identifies an instance template by a unique property. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` +} + +func (*InstancePrototype) isaInstancePrototype() bool { + return true +} + +type InstancePrototypeIntf interface { + isaInstancePrototype() bool +} + +// UnmarshalInstancePrototype unmarshals an instance of InstancePrototype from the specified map of raw messages. +func UnmarshalInstancePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototype) + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceReference : InstanceReference struct +type InstanceReference struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this virtual server instance (and default system hostname). + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceReference unmarshals an instance of InstanceReference from the specified map of raw messages. +func UnmarshalInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type InstanceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceReferenceDeleted unmarshals an instance of InstanceReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplate : InstanceTemplate struct +// Models which "extend" this model: +// - InstanceTemplateInstanceByImage +// - InstanceTemplateInstanceBySourceTemplate +type InstanceTemplate struct { + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Up to 10 keys may be provided; if no + // keys are provided the instance will be inaccessible unless the image used provides another means of access. For + // Windows instances, one of the keys will be used to encrypt the administrator password. + // + // Keys will be made available to the virtual server instance as cloud-init vendor data. For cloud-init enabled images, + // these keys will also be added as SSH authorized keys for the administrative user. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The unique user-defined name for this instance template. + Name *string `json:"name" validate:"required"` + + // Collection of additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The profile to use for this virtual server instance. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // User data to be made available when setting up the virtual server instance. + UserData *string `json:"user_data,omitempty"` + + // Collection of volume attachments. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If provided, must match the + // VPC tied to the subnets of the instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The identity of the image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // Identifies an instance template by a unique property. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` +} + +func (*InstanceTemplate) isaInstanceTemplate() bool { + return true +} + +type InstanceTemplateIntf interface { + isaInstanceTemplate() bool +} + +// UnmarshalInstanceTemplate unmarshals an instance of InstanceTemplate from the specified map of raw messages. +func UnmarshalInstanceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplate) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateCollection : InstanceTemplateCollection struct +type InstanceTemplateCollection struct { + // A link to the first page of resources. + First *InstanceTemplateCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *InstanceTemplateCollectionNext `json:"next,omitempty"` + + // Collection of instance templates. + Templates []InstanceTemplateIntf `json:"templates" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalInstanceTemplateCollection unmarshals an instance of InstanceTemplateCollection from the specified map of raw messages. +func UnmarshalInstanceTemplateCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalInstanceTemplateCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalInstanceTemplateCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "templates", &obj.Templates, UnmarshalInstanceTemplate) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateCollectionFirst : A link to the first page of resources. +type InstanceTemplateCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceTemplateCollectionFirst unmarshals an instance of InstanceTemplateCollectionFirst from the specified map of raw messages. +func UnmarshalInstanceTemplateCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type InstanceTemplateCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalInstanceTemplateCollectionNext unmarshals an instance of InstanceTemplateCollectionNext from the specified map of raw messages. +func UnmarshalInstanceTemplateCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentity : Identifies an instance template by a unique property. +// Models which "extend" this model: +// - InstanceTemplateIdentityByID +// - InstanceTemplateIdentityByHref +// - InstanceTemplateIdentityByCRN +type InstanceTemplateIdentity struct { + // The unique identifier for this instance template. + ID *string `json:"id,omitempty"` + + // The URL for this instance template. + Href *string `json:"href,omitempty"` + + // The CRN for this instance template. + CRN *string `json:"crn,omitempty"` +} + +func (*InstanceTemplateIdentity) isaInstanceTemplateIdentity() bool { + return true +} + +type InstanceTemplateIdentityIntf interface { + isaInstanceTemplateIdentity() bool +} + +// UnmarshalInstanceTemplateIdentity unmarshals an instance of InstanceTemplateIdentity from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePatch : InstanceTemplatePatch struct +type InstanceTemplatePatch struct { + // The unique user-defined name for this instance template. + Name *string `json:"name,omitempty"` +} + +// UnmarshalInstanceTemplatePatch unmarshals an instance of InstanceTemplatePatch from the specified map of raw messages. +func UnmarshalInstanceTemplatePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the InstanceTemplatePatch +func (instanceTemplatePatch *InstanceTemplatePatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(instanceTemplatePatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// InstanceTemplatePrototype : InstanceTemplatePrototype struct +// Models which "extend" this model: +// - InstanceTemplatePrototypeInstanceByImage +// - InstanceTemplatePrototypeInstanceBySourceTemplate +type InstanceTemplatePrototype struct { + // The public SSH keys for the administrative user of the virtual server instance. Up to 10 keys may be provided; if no + // keys are provided the instance will be inaccessible unless the image used provides another means of access. For + // Windows instances, one of the keys will be used to encrypt the administrator password. + // + // Keys will be made available to the virtual server instance as cloud-init vendor data. For cloud-init enabled images, + // these keys will also be added as SSH authorized keys for the administrative user. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // Collection of additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The profile to use for this virtual server instance. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // User data to be made available when setting up the virtual server instance. + UserData *string `json:"user_data,omitempty"` + + // Collection of volume attachments. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If provided, must match the + // VPC tied to the subnets of the instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The identity of the image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // Identifies an instance template by a unique property. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template,omitempty"` +} + +func (*InstanceTemplatePrototype) isaInstanceTemplatePrototype() bool { + return true +} + +type InstanceTemplatePrototypeIntf interface { + isaInstanceTemplatePrototype() bool +} + +// UnmarshalInstanceTemplatePrototype unmarshals an instance of InstanceTemplatePrototype from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototype) + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateReference : InstanceTemplateReference struct +type InstanceTemplateReference struct { + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *InstanceTemplateReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this instance template. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalInstanceTemplateReference unmarshals an instance of InstanceTemplateReference from the specified map of raw messages. +func UnmarshalInstanceTemplateReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceTemplateReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type InstanceTemplateReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalInstanceTemplateReferenceDeleted unmarshals an instance of InstanceTemplateReferenceDeleted from the specified map of raw messages. +func UnmarshalInstanceTemplateReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceVcpu : The virtual server instance VCPU configuration. +type InstanceVcpu struct { + // The VCPU architecture. + Architecture *string `json:"architecture" validate:"required"` + + // The number of VCPUs assigned. + Count *int64 `json:"count" validate:"required"` +} + +// UnmarshalInstanceVcpu unmarshals an instance of InstanceVcpu from the specified map of raw messages. +func UnmarshalInstanceVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceVcpu) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Key : Key struct +type Key struct { + // The date and time that the key was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this key. + CRN *string `json:"crn" validate:"required"` + + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint" validate:"required"` + + // The URL for this key. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this key. + ID *string `json:"id" validate:"required"` + + // The length of this key (in bits). + Length *int64 `json:"length" validate:"required"` + + // The unique user-defined name for this key. If unspecified, the name will be a hyphenated list of randomly-selected + // words. + Name *string `json:"name" validate:"required"` + + // The public SSH key. + PublicKey *string `json:"public_key" validate:"required"` + + // The resource group for this key. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The crypto-system used by this key. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the Key.Type property. +// The crypto-system used by this key. +const ( + KeyTypeRsaConst = "rsa" +) + +// UnmarshalKey unmarshals an instance of Key from the specified map of raw messages. +func UnmarshalKey(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Key) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "length", &obj.Length) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "public_key", &obj.PublicKey) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyCollection : KeyCollection struct +type KeyCollection struct { + // Collection of keys. + Keys []Key `json:"keys" validate:"required"` +} + +// UnmarshalKeyCollection unmarshals an instance of KeyCollection from the specified map of raw messages. +func UnmarshalKeyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyCollection) + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKey) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentity : Identifies a key by a unique property. +// Models which "extend" this model: +// - KeyIdentityByID +// - KeyIdentityByCRN +// - KeyIdentityByHref +// - KeyIdentityKeyIdentityByFingerprint +type KeyIdentity struct { + // The unique identifier for this key. + ID *string `json:"id,omitempty"` + + // The CRN for this key. + CRN *string `json:"crn,omitempty"` + + // The URL for this key. + Href *string `json:"href,omitempty"` + + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint,omitempty"` +} + +func (*KeyIdentity) isaKeyIdentity() bool { + return true +} + +type KeyIdentityIntf interface { + isaKeyIdentity() bool +} + +// UnmarshalKeyIdentity unmarshals an instance of KeyIdentity from the specified map of raw messages. +func UnmarshalKeyIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyPatch : KeyPatch struct +type KeyPatch struct { + // The user-defined name for this key. + Name *string `json:"name,omitempty"` +} + +// UnmarshalKeyPatch unmarshals an instance of KeyPatch from the specified map of raw messages. +func UnmarshalKeyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the KeyPatch +func (keyPatch *KeyPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(keyPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// KeyReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type KeyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalKeyReferenceDeleted unmarshals an instance of KeyReferenceDeleted from the specified map of raw messages. +func UnmarshalKeyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyReferenceInstanceInitializationContext : KeyReferenceInstanceInitializationContext struct +// Models which "extend" this model: +// - KeyReferenceInstanceInitializationContextKeyReference +// - KeyReferenceInstanceInitializationContextKeyIdentityByFingerprint +type KeyReferenceInstanceInitializationContext struct { + // The CRN for this key. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *KeyReferenceDeleted `json:"deleted,omitempty"` + + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint,omitempty"` + + // The URL for this key. + Href *string `json:"href,omitempty"` + + // The unique identifier for this key. + ID *string `json:"id,omitempty"` + + // The user-defined name for this key. + Name *string `json:"name,omitempty"` +} + +func (*KeyReferenceInstanceInitializationContext) isaKeyReferenceInstanceInitializationContext() bool { + return true +} + +type KeyReferenceInstanceInitializationContextIntf interface { + isaKeyReferenceInstanceInitializationContext() bool +} + +// UnmarshalKeyReferenceInstanceInitializationContext unmarshals an instance of KeyReferenceInstanceInitializationContext from the specified map of raw messages. +func UnmarshalKeyReferenceInstanceInitializationContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyReferenceInstanceInitializationContext) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalKeyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ListDedicatedHostDisksOptions : The ListDedicatedHostDisks options. +type ListDedicatedHostDisksOptions struct { + // The dedicated host identifier. + DedicatedHostID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListDedicatedHostDisksOptions : Instantiate ListDedicatedHostDisksOptions +func (*VpcV1) NewListDedicatedHostDisksOptions(dedicatedHostID string) *ListDedicatedHostDisksOptions { + return &ListDedicatedHostDisksOptions{ + DedicatedHostID: core.StringPtr(dedicatedHostID), + } +} + +// SetDedicatedHostID : Allow user to set DedicatedHostID +func (options *ListDedicatedHostDisksOptions) SetDedicatedHostID(dedicatedHostID string) *ListDedicatedHostDisksOptions { + options.DedicatedHostID = core.StringPtr(dedicatedHostID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostDisksOptions) SetHeaders(param map[string]string) *ListDedicatedHostDisksOptions { + options.Headers = param + return options +} + +// ListDedicatedHostGroupsOptions : The ListDedicatedHostGroups options. +type ListDedicatedHostGroupsOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Filters the collection to resources within one of the resource groups identified in a comma-separated list of + // resource group identifiers. + ResourceGroupID *string + + // Filters the collection to resources in the zone with the exact specified name. + ZoneName *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListDedicatedHostGroupsOptions : Instantiate ListDedicatedHostGroupsOptions +func (*VpcV1) NewListDedicatedHostGroupsOptions() *ListDedicatedHostGroupsOptions { + return &ListDedicatedHostGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListDedicatedHostGroupsOptions) SetStart(start string) *ListDedicatedHostGroupsOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListDedicatedHostGroupsOptions) SetLimit(limit int64) *ListDedicatedHostGroupsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListDedicatedHostGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListDedicatedHostGroupsOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetZoneName : Allow user to set ZoneName +func (options *ListDedicatedHostGroupsOptions) SetZoneName(zoneName string) *ListDedicatedHostGroupsOptions { + options.ZoneName = core.StringPtr(zoneName) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostGroupsOptions) SetHeaders(param map[string]string) *ListDedicatedHostGroupsOptions { + options.Headers = param + return options +} + +// ListDedicatedHostProfilesOptions : The ListDedicatedHostProfiles options. +type ListDedicatedHostProfilesOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListDedicatedHostProfilesOptions : Instantiate ListDedicatedHostProfilesOptions +func (*VpcV1) NewListDedicatedHostProfilesOptions() *ListDedicatedHostProfilesOptions { + return &ListDedicatedHostProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListDedicatedHostProfilesOptions) SetStart(start string) *ListDedicatedHostProfilesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListDedicatedHostProfilesOptions) SetLimit(limit int64) *ListDedicatedHostProfilesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostProfilesOptions) SetHeaders(param map[string]string) *ListDedicatedHostProfilesOptions { + options.Headers = param + return options +} + +// ListDedicatedHostsOptions : The ListDedicatedHosts options. +type ListDedicatedHostsOptions struct { + // Filters the collection to dedicated host groups with the specified identifier. + DedicatedHostGroupID *string + + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Filters the collection to resources within one of the resource groups identified in a comma-separated list of + // resource group identifiers. + ResourceGroupID *string + + // Filters the collection to resources in the zone with the exact specified name. + ZoneName *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListDedicatedHostsOptions : Instantiate ListDedicatedHostsOptions +func (*VpcV1) NewListDedicatedHostsOptions() *ListDedicatedHostsOptions { + return &ListDedicatedHostsOptions{} +} + +// SetDedicatedHostGroupID : Allow user to set DedicatedHostGroupID +func (options *ListDedicatedHostsOptions) SetDedicatedHostGroupID(dedicatedHostGroupID string) *ListDedicatedHostsOptions { + options.DedicatedHostGroupID = core.StringPtr(dedicatedHostGroupID) + return options +} + +// SetStart : Allow user to set Start +func (options *ListDedicatedHostsOptions) SetStart(start string) *ListDedicatedHostsOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListDedicatedHostsOptions) SetLimit(limit int64) *ListDedicatedHostsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListDedicatedHostsOptions) SetResourceGroupID(resourceGroupID string) *ListDedicatedHostsOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetZoneName : Allow user to set ZoneName +func (options *ListDedicatedHostsOptions) SetZoneName(zoneName string) *ListDedicatedHostsOptions { + options.ZoneName = core.StringPtr(zoneName) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListDedicatedHostsOptions) SetHeaders(param map[string]string) *ListDedicatedHostsOptions { + options.Headers = param + return options +} + +// ListEndpointGatewayIpsOptions : The ListEndpointGatewayIps options. +type ListEndpointGatewayIpsOptions struct { + // The endpoint gateway identifier. + EndpointGatewayID *string `validate:"required,ne="` + + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Sorts the returned collection by the specified field name in ascending order. A `-` may be prepended to the field + // name to sort in descending order. For example, the value + // `-created_at` sorts the collection by the `created_at` field in descending order, and the value `name` sorts it by + // the `name` field in ascending order. + Sort *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListEndpointGatewayIpsOptions.Sort property. +// Sorts the returned collection by the specified field name in ascending order. A `-` may be prepended to the field +// name to sort in descending order. For example, the value +// `-created_at` sorts the collection by the `created_at` field in descending order, and the value `name` sorts it by +// the `name` field in ascending order. +const ( + ListEndpointGatewayIpsOptionsSortAddressConst = "address" + ListEndpointGatewayIpsOptionsSortCreatedAtConst = "created_at" + ListEndpointGatewayIpsOptionsSortNameConst = "name" +) + +// NewListEndpointGatewayIpsOptions : Instantiate ListEndpointGatewayIpsOptions +func (*VpcV1) NewListEndpointGatewayIpsOptions(endpointGatewayID string) *ListEndpointGatewayIpsOptions { + return &ListEndpointGatewayIpsOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + } +} + +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (options *ListEndpointGatewayIpsOptions) SetEndpointGatewayID(endpointGatewayID string) *ListEndpointGatewayIpsOptions { + options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return options +} + +// SetStart : Allow user to set Start +func (options *ListEndpointGatewayIpsOptions) SetStart(start string) *ListEndpointGatewayIpsOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListEndpointGatewayIpsOptions) SetLimit(limit int64) *ListEndpointGatewayIpsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetSort : Allow user to set Sort +func (options *ListEndpointGatewayIpsOptions) SetSort(sort string) *ListEndpointGatewayIpsOptions { + options.Sort = core.StringPtr(sort) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListEndpointGatewayIpsOptions) SetHeaders(param map[string]string) *ListEndpointGatewayIpsOptions { + options.Headers = param + return options +} + +// ListEndpointGatewaysOptions : The ListEndpointGateways options. +type ListEndpointGatewaysOptions struct { + // Filters the collection to resources with the exact specified name. + Name *string + + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Filters the collection to resources within one of the resource groups identified in a comma-separated list of + // resource group identifiers. + ResourceGroupID *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListEndpointGatewaysOptions : Instantiate ListEndpointGatewaysOptions +func (*VpcV1) NewListEndpointGatewaysOptions() *ListEndpointGatewaysOptions { + return &ListEndpointGatewaysOptions{} +} + +// SetName : Allow user to set Name +func (options *ListEndpointGatewaysOptions) SetName(name string) *ListEndpointGatewaysOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetStart : Allow user to set Start +func (options *ListEndpointGatewaysOptions) SetStart(start string) *ListEndpointGatewaysOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListEndpointGatewaysOptions) SetLimit(limit int64) *ListEndpointGatewaysOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListEndpointGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListEndpointGatewaysOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListEndpointGatewaysOptions) SetHeaders(param map[string]string) *ListEndpointGatewaysOptions { + options.Headers = param + return options +} + +// ListFloatingIpsOptions : The ListFloatingIps options. +type ListFloatingIpsOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Filters the collection to resources within one of the resource groups identified in a comma-separated list of + // resource group identifiers. + ResourceGroupID *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListFloatingIpsOptions : Instantiate ListFloatingIpsOptions +func (*VpcV1) NewListFloatingIpsOptions() *ListFloatingIpsOptions { + return &ListFloatingIpsOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListFloatingIpsOptions) SetStart(start string) *ListFloatingIpsOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListFloatingIpsOptions) SetLimit(limit int64) *ListFloatingIpsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListFloatingIpsOptions) SetResourceGroupID(resourceGroupID string) *ListFloatingIpsOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListFloatingIpsOptions) SetHeaders(param map[string]string) *ListFloatingIpsOptions { + options.Headers = param + return options +} + +// ListFlowLogCollectorsOptions : The ListFlowLogCollectors options. +type ListFlowLogCollectorsOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Filters the collection to resources within one of the resource groups identified in a comma-separated list of + // resource group identifiers. + ResourceGroupID *string + + // Filters the collection to resources with the exact specified name. + Name *string + + // Filters the collection to resources in the VPC with the specified identifier. + VPCID *string + + // Filters the collection to resources in the VPC with the specified CRN. + VPCCRN *string + + // Filters the collection to resources in the VPC with the exact specified name. + VPCName *string + + // Filters the collection to flow log collectors that target the specified resource. + TargetID *string + + // Filters the collection to flow log collectors that target the specified resource type. + TargetResourceType *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListFlowLogCollectorsOptions.TargetResourceType property. +// Filters the collection to flow log collectors that target the specified resource type. +const ( + ListFlowLogCollectorsOptionsTargetResourceTypeInstanceConst = "instance" + ListFlowLogCollectorsOptionsTargetResourceTypeNetworkInterfaceConst = "network_interface" + ListFlowLogCollectorsOptionsTargetResourceTypeSubnetConst = "subnet" + ListFlowLogCollectorsOptionsTargetResourceTypeVPCConst = "vpc" +) + +// NewListFlowLogCollectorsOptions : Instantiate ListFlowLogCollectorsOptions +func (*VpcV1) NewListFlowLogCollectorsOptions() *ListFlowLogCollectorsOptions { + return &ListFlowLogCollectorsOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListFlowLogCollectorsOptions) SetStart(start string) *ListFlowLogCollectorsOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListFlowLogCollectorsOptions) SetLimit(limit int64) *ListFlowLogCollectorsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListFlowLogCollectorsOptions) SetResourceGroupID(resourceGroupID string) *ListFlowLogCollectorsOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetName : Allow user to set Name +func (options *ListFlowLogCollectorsOptions) SetName(name string) *ListFlowLogCollectorsOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetVPCID : Allow user to set VPCID +func (options *ListFlowLogCollectorsOptions) SetVPCID(vpcID string) *ListFlowLogCollectorsOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (options *ListFlowLogCollectorsOptions) SetVPCCRN(vpcCRN string) *ListFlowLogCollectorsOptions { + options.VPCCRN = core.StringPtr(vpcCRN) + return options +} + +// SetVPCName : Allow user to set VPCName +func (options *ListFlowLogCollectorsOptions) SetVPCName(vpcName string) *ListFlowLogCollectorsOptions { + options.VPCName = core.StringPtr(vpcName) + return options +} + +// SetTargetID : Allow user to set TargetID +func (options *ListFlowLogCollectorsOptions) SetTargetID(targetID string) *ListFlowLogCollectorsOptions { + options.TargetID = core.StringPtr(targetID) + return options +} + +// SetTargetResourceType : Allow user to set TargetResourceType +func (options *ListFlowLogCollectorsOptions) SetTargetResourceType(targetResourceType string) *ListFlowLogCollectorsOptions { + options.TargetResourceType = core.StringPtr(targetResourceType) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListFlowLogCollectorsOptions) SetHeaders(param map[string]string) *ListFlowLogCollectorsOptions { + options.Headers = param + return options +} + +// ListIkePoliciesOptions : The ListIkePolicies options. +type ListIkePoliciesOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListIkePoliciesOptions : Instantiate ListIkePoliciesOptions +func (*VpcV1) NewListIkePoliciesOptions() *ListIkePoliciesOptions { + return &ListIkePoliciesOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListIkePoliciesOptions) SetStart(start string) *ListIkePoliciesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListIkePoliciesOptions) SetLimit(limit int64) *ListIkePoliciesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIkePoliciesOptions) SetHeaders(param map[string]string) *ListIkePoliciesOptions { + options.Headers = param + return options +} + +// ListIkePolicyConnectionsOptions : The ListIkePolicyConnections options. +type ListIkePolicyConnectionsOptions struct { + // The IKE policy identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListIkePolicyConnectionsOptions : Instantiate ListIkePolicyConnectionsOptions +func (*VpcV1) NewListIkePolicyConnectionsOptions(id string) *ListIkePolicyConnectionsOptions { + return &ListIkePolicyConnectionsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *ListIkePolicyConnectionsOptions) SetID(id string) *ListIkePolicyConnectionsOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIkePolicyConnectionsOptions) SetHeaders(param map[string]string) *ListIkePolicyConnectionsOptions { + options.Headers = param + return options +} + +// ListImagesOptions : The ListImages options. +type ListImagesOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Filters the collection to resources within one of the resource groups identified in a comma-separated list of + // resource group identifiers. + ResourceGroupID *string + + // Filters the collection to resources with the exact specified name. + Name *string + + // Filters the collection to images with the specified `visibility`. + Visibility *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListImagesOptions.Visibility property. +// Filters the collection to images with the specified `visibility`. +const ( + ListImagesOptionsVisibilityPrivateConst = "private" + ListImagesOptionsVisibilityPublicConst = "public" +) + +// NewListImagesOptions : Instantiate ListImagesOptions +func (*VpcV1) NewListImagesOptions() *ListImagesOptions { + return &ListImagesOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListImagesOptions) SetStart(start string) *ListImagesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListImagesOptions) SetLimit(limit int64) *ListImagesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListImagesOptions) SetResourceGroupID(resourceGroupID string) *ListImagesOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetName : Allow user to set Name +func (options *ListImagesOptions) SetName(name string) *ListImagesOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetVisibility : Allow user to set Visibility +func (options *ListImagesOptions) SetVisibility(visibility string) *ListImagesOptions { + options.Visibility = core.StringPtr(visibility) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListImagesOptions) SetHeaders(param map[string]string) *ListImagesOptions { + options.Headers = param + return options +} + +// ListInstanceDisksOptions : The ListInstanceDisks options. +type ListInstanceDisksOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceDisksOptions : Instantiate ListInstanceDisksOptions +func (*VpcV1) NewListInstanceDisksOptions(instanceID string) *ListInstanceDisksOptions { + return &ListInstanceDisksOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *ListInstanceDisksOptions) SetInstanceID(instanceID string) *ListInstanceDisksOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceDisksOptions) SetHeaders(param map[string]string) *ListInstanceDisksOptions { + options.Headers = param + return options +} + +// ListInstanceGroupManagerPoliciesOptions : The ListInstanceGroupManagerPolicies options. +type ListInstanceGroupManagerPoliciesOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `validate:"required,ne="` + + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceGroupManagerPoliciesOptions : Instantiate ListInstanceGroupManagerPoliciesOptions +func (*VpcV1) NewListInstanceGroupManagerPoliciesOptions(instanceGroupID string, instanceGroupManagerID string) *ListInstanceGroupManagerPoliciesOptions { + return &ListInstanceGroupManagerPoliciesOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *ListInstanceGroupManagerPoliciesOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagerPoliciesOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (options *ListInstanceGroupManagerPoliciesOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *ListInstanceGroupManagerPoliciesOptions { + options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return options +} + +// SetStart : Allow user to set Start +func (options *ListInstanceGroupManagerPoliciesOptions) SetStart(start string) *ListInstanceGroupManagerPoliciesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListInstanceGroupManagerPoliciesOptions) SetLimit(limit int64) *ListInstanceGroupManagerPoliciesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupManagerPoliciesOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagerPoliciesOptions { + options.Headers = param + return options +} + +// ListInstanceGroupManagersOptions : The ListInstanceGroupManagers options. +type ListInstanceGroupManagersOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceGroupManagersOptions : Instantiate ListInstanceGroupManagersOptions +func (*VpcV1) NewListInstanceGroupManagersOptions(instanceGroupID string) *ListInstanceGroupManagersOptions { + return &ListInstanceGroupManagersOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *ListInstanceGroupManagersOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupManagersOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetStart : Allow user to set Start +func (options *ListInstanceGroupManagersOptions) SetStart(start string) *ListInstanceGroupManagersOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListInstanceGroupManagersOptions) SetLimit(limit int64) *ListInstanceGroupManagersOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupManagersOptions) SetHeaders(param map[string]string) *ListInstanceGroupManagersOptions { + options.Headers = param + return options +} + +// ListInstanceGroupMembershipsOptions : The ListInstanceGroupMemberships options. +type ListInstanceGroupMembershipsOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceGroupMembershipsOptions : Instantiate ListInstanceGroupMembershipsOptions +func (*VpcV1) NewListInstanceGroupMembershipsOptions(instanceGroupID string) *ListInstanceGroupMembershipsOptions { + return &ListInstanceGroupMembershipsOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *ListInstanceGroupMembershipsOptions) SetInstanceGroupID(instanceGroupID string) *ListInstanceGroupMembershipsOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetStart : Allow user to set Start +func (options *ListInstanceGroupMembershipsOptions) SetStart(start string) *ListInstanceGroupMembershipsOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListInstanceGroupMembershipsOptions) SetLimit(limit int64) *ListInstanceGroupMembershipsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupMembershipsOptions) SetHeaders(param map[string]string) *ListInstanceGroupMembershipsOptions { + options.Headers = param + return options +} + +// ListInstanceGroupsOptions : The ListInstanceGroups options. +type ListInstanceGroupsOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceGroupsOptions : Instantiate ListInstanceGroupsOptions +func (*VpcV1) NewListInstanceGroupsOptions() *ListInstanceGroupsOptions { + return &ListInstanceGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListInstanceGroupsOptions) SetStart(start string) *ListInstanceGroupsOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListInstanceGroupsOptions) SetLimit(limit int64) *ListInstanceGroupsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceGroupsOptions) SetHeaders(param map[string]string) *ListInstanceGroupsOptions { + options.Headers = param + return options +} + +// ListInstanceNetworkInterfaceFloatingIpsOptions : The ListInstanceNetworkInterfaceFloatingIps options. +type ListInstanceNetworkInterfaceFloatingIpsOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The network interface identifier. + NetworkInterfaceID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceNetworkInterfaceFloatingIpsOptions : Instantiate ListInstanceNetworkInterfaceFloatingIpsOptions +func (*VpcV1) NewListInstanceNetworkInterfaceFloatingIpsOptions(instanceID string, networkInterfaceID string) *ListInstanceNetworkInterfaceFloatingIpsOptions { + return &ListInstanceNetworkInterfaceFloatingIpsOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfaceFloatingIpsOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetNetworkInterfaceID(networkInterfaceID string) *ListInstanceNetworkInterfaceFloatingIpsOptions { + options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceNetworkInterfaceFloatingIpsOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfaceFloatingIpsOptions { + options.Headers = param + return options +} + +// ListInstanceNetworkInterfacesOptions : The ListInstanceNetworkInterfaces options. +type ListInstanceNetworkInterfacesOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceNetworkInterfacesOptions : Instantiate ListInstanceNetworkInterfacesOptions +func (*VpcV1) NewListInstanceNetworkInterfacesOptions(instanceID string) *ListInstanceNetworkInterfacesOptions { + return &ListInstanceNetworkInterfacesOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *ListInstanceNetworkInterfacesOptions) SetInstanceID(instanceID string) *ListInstanceNetworkInterfacesOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListInstanceNetworkInterfacesOptions { + options.Headers = param + return options +} + +// ListInstanceProfilesOptions : The ListInstanceProfiles options. +type ListInstanceProfilesOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceProfilesOptions : Instantiate ListInstanceProfilesOptions +func (*VpcV1) NewListInstanceProfilesOptions() *ListInstanceProfilesOptions { + return &ListInstanceProfilesOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceProfilesOptions) SetHeaders(param map[string]string) *ListInstanceProfilesOptions { + options.Headers = param + return options +} + +// ListInstanceTemplatesOptions : The ListInstanceTemplates options. +type ListInstanceTemplatesOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceTemplatesOptions : Instantiate ListInstanceTemplatesOptions +func (*VpcV1) NewListInstanceTemplatesOptions() *ListInstanceTemplatesOptions { + return &ListInstanceTemplatesOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceTemplatesOptions) SetHeaders(param map[string]string) *ListInstanceTemplatesOptions { + options.Headers = param + return options +} + +// ListInstanceVolumeAttachmentsOptions : The ListInstanceVolumeAttachments options. +type ListInstanceVolumeAttachmentsOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstanceVolumeAttachmentsOptions : Instantiate ListInstanceVolumeAttachmentsOptions +func (*VpcV1) NewListInstanceVolumeAttachmentsOptions(instanceID string) *ListInstanceVolumeAttachmentsOptions { + return &ListInstanceVolumeAttachmentsOptions{ + InstanceID: core.StringPtr(instanceID), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *ListInstanceVolumeAttachmentsOptions) SetInstanceID(instanceID string) *ListInstanceVolumeAttachmentsOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstanceVolumeAttachmentsOptions) SetHeaders(param map[string]string) *ListInstanceVolumeAttachmentsOptions { + options.Headers = param + return options +} + +// ListInstancesOptions : The ListInstances options. +type ListInstancesOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Filters the collection to resources within one of the resource groups identified in a comma-separated list of + // resource group identifiers. + ResourceGroupID *string + + // Filters the collection to resources with the exact specified name. + Name *string + + // Filters the collection to resources in the VPC with the specified identifier. + VPCID *string + + // Filters the collection to resources in the VPC with the specified CRN. + VPCCRN *string + + // Filters the collection to resources in the VPC with the exact specified name. + VPCName *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListInstancesOptions : Instantiate ListInstancesOptions +func (*VpcV1) NewListInstancesOptions() *ListInstancesOptions { + return &ListInstancesOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListInstancesOptions) SetStart(start string) *ListInstancesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListInstancesOptions) SetLimit(limit int64) *ListInstancesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListInstancesOptions) SetResourceGroupID(resourceGroupID string) *ListInstancesOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetName : Allow user to set Name +func (options *ListInstancesOptions) SetName(name string) *ListInstancesOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetVPCID : Allow user to set VPCID +func (options *ListInstancesOptions) SetVPCID(vpcID string) *ListInstancesOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (options *ListInstancesOptions) SetVPCCRN(vpcCRN string) *ListInstancesOptions { + options.VPCCRN = core.StringPtr(vpcCRN) + return options +} + +// SetVPCName : Allow user to set VPCName +func (options *ListInstancesOptions) SetVPCName(vpcName string) *ListInstancesOptions { + options.VPCName = core.StringPtr(vpcName) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListInstancesOptions) SetHeaders(param map[string]string) *ListInstancesOptions { + options.Headers = param + return options +} + +// ListIpsecPoliciesOptions : The ListIpsecPolicies options. +type ListIpsecPoliciesOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListIpsecPoliciesOptions : Instantiate ListIpsecPoliciesOptions +func (*VpcV1) NewListIpsecPoliciesOptions() *ListIpsecPoliciesOptions { + return &ListIpsecPoliciesOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListIpsecPoliciesOptions) SetStart(start string) *ListIpsecPoliciesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListIpsecPoliciesOptions) SetLimit(limit int64) *ListIpsecPoliciesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIpsecPoliciesOptions) SetHeaders(param map[string]string) *ListIpsecPoliciesOptions { + options.Headers = param + return options +} + +// ListIpsecPolicyConnectionsOptions : The ListIpsecPolicyConnections options. +type ListIpsecPolicyConnectionsOptions struct { + // The IPsec policy identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListIpsecPolicyConnectionsOptions : Instantiate ListIpsecPolicyConnectionsOptions +func (*VpcV1) NewListIpsecPolicyConnectionsOptions(id string) *ListIpsecPolicyConnectionsOptions { + return &ListIpsecPolicyConnectionsOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *ListIpsecPolicyConnectionsOptions) SetID(id string) *ListIpsecPolicyConnectionsOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListIpsecPolicyConnectionsOptions) SetHeaders(param map[string]string) *ListIpsecPolicyConnectionsOptions { + options.Headers = param + return options +} + +// ListKeysOptions : The ListKeys options. +type ListKeysOptions struct { + // Filters the collection to resources within one of the resource groups identified in a comma-separated list of + // resource group identifiers. + ResourceGroupID *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListKeysOptions : Instantiate ListKeysOptions +func (*VpcV1) NewListKeysOptions() *ListKeysOptions { + return &ListKeysOptions{} +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListKeysOptions) SetResourceGroupID(resourceGroupID string) *ListKeysOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListKeysOptions) SetHeaders(param map[string]string) *ListKeysOptions { + options.Headers = param + return options +} + +// ListLoadBalancerListenerPoliciesOptions : The ListLoadBalancerListenerPolicies options. +type ListLoadBalancerListenerPoliciesOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The listener identifier. + ListenerID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerListenerPoliciesOptions : Instantiate ListLoadBalancerListenerPoliciesOptions +func (*VpcV1) NewListLoadBalancerListenerPoliciesOptions(loadBalancerID string, listenerID string) *ListLoadBalancerListenerPoliciesOptions { + return &ListLoadBalancerListenerPoliciesOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *ListLoadBalancerListenerPoliciesOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenerPoliciesOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetListenerID : Allow user to set ListenerID +func (options *ListLoadBalancerListenerPoliciesOptions) SetListenerID(listenerID string) *ListLoadBalancerListenerPoliciesOptions { + options.ListenerID = core.StringPtr(listenerID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerListenerPoliciesOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenerPoliciesOptions { + options.Headers = param + return options +} + +// ListLoadBalancerListenerPolicyRulesOptions : The ListLoadBalancerListenerPolicyRules options. +type ListLoadBalancerListenerPolicyRulesOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The listener identifier. + ListenerID *string `validate:"required,ne="` + + // The policy identifier. + PolicyID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerListenerPolicyRulesOptions : Instantiate ListLoadBalancerListenerPolicyRulesOptions +func (*VpcV1) NewListLoadBalancerListenerPolicyRulesOptions(loadBalancerID string, listenerID string, policyID string) *ListLoadBalancerListenerPolicyRulesOptions { + return &ListLoadBalancerListenerPolicyRulesOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *ListLoadBalancerListenerPolicyRulesOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenerPolicyRulesOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetListenerID : Allow user to set ListenerID +func (options *ListLoadBalancerListenerPolicyRulesOptions) SetListenerID(listenerID string) *ListLoadBalancerListenerPolicyRulesOptions { + options.ListenerID = core.StringPtr(listenerID) + return options +} + +// SetPolicyID : Allow user to set PolicyID +func (options *ListLoadBalancerListenerPolicyRulesOptions) SetPolicyID(policyID string) *ListLoadBalancerListenerPolicyRulesOptions { + options.PolicyID = core.StringPtr(policyID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerListenerPolicyRulesOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenerPolicyRulesOptions { + options.Headers = param + return options +} + +// ListLoadBalancerListenersOptions : The ListLoadBalancerListeners options. +type ListLoadBalancerListenersOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerListenersOptions : Instantiate ListLoadBalancerListenersOptions +func (*VpcV1) NewListLoadBalancerListenersOptions(loadBalancerID string) *ListLoadBalancerListenersOptions { + return &ListLoadBalancerListenersOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *ListLoadBalancerListenersOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerListenersOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerListenersOptions) SetHeaders(param map[string]string) *ListLoadBalancerListenersOptions { + options.Headers = param + return options +} + +// ListLoadBalancerPoolMembersOptions : The ListLoadBalancerPoolMembers options. +type ListLoadBalancerPoolMembersOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The pool identifier. + PoolID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerPoolMembersOptions : Instantiate ListLoadBalancerPoolMembersOptions +func (*VpcV1) NewListLoadBalancerPoolMembersOptions(loadBalancerID string, poolID string) *ListLoadBalancerPoolMembersOptions { + return &ListLoadBalancerPoolMembersOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *ListLoadBalancerPoolMembersOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerPoolMembersOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetPoolID : Allow user to set PoolID +func (options *ListLoadBalancerPoolMembersOptions) SetPoolID(poolID string) *ListLoadBalancerPoolMembersOptions { + options.PoolID = core.StringPtr(poolID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerPoolMembersOptions) SetHeaders(param map[string]string) *ListLoadBalancerPoolMembersOptions { + options.Headers = param + return options +} + +// ListLoadBalancerPoolsOptions : The ListLoadBalancerPools options. +type ListLoadBalancerPoolsOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerPoolsOptions : Instantiate ListLoadBalancerPoolsOptions +func (*VpcV1) NewListLoadBalancerPoolsOptions(loadBalancerID string) *ListLoadBalancerPoolsOptions { + return &ListLoadBalancerPoolsOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *ListLoadBalancerPoolsOptions) SetLoadBalancerID(loadBalancerID string) *ListLoadBalancerPoolsOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerPoolsOptions) SetHeaders(param map[string]string) *ListLoadBalancerPoolsOptions { + options.Headers = param + return options +} + +// ListLoadBalancerProfilesOptions : The ListLoadBalancerProfiles options. +type ListLoadBalancerProfilesOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancerProfilesOptions : Instantiate ListLoadBalancerProfilesOptions +func (*VpcV1) NewListLoadBalancerProfilesOptions() *ListLoadBalancerProfilesOptions { + return &ListLoadBalancerProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListLoadBalancerProfilesOptions) SetStart(start string) *ListLoadBalancerProfilesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListLoadBalancerProfilesOptions) SetLimit(limit int64) *ListLoadBalancerProfilesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancerProfilesOptions) SetHeaders(param map[string]string) *ListLoadBalancerProfilesOptions { + options.Headers = param + return options +} + +// ListLoadBalancersOptions : The ListLoadBalancers options. +type ListLoadBalancersOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListLoadBalancersOptions : Instantiate ListLoadBalancersOptions +func (*VpcV1) NewListLoadBalancersOptions() *ListLoadBalancersOptions { + return &ListLoadBalancersOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListLoadBalancersOptions) SetHeaders(param map[string]string) *ListLoadBalancersOptions { + options.Headers = param + return options +} + +// ListNetworkACLRulesOptions : The ListNetworkACLRules options. +type ListNetworkACLRulesOptions struct { + // The network ACL identifier. + NetworkACLID *string `validate:"required,ne="` + + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Filters the collection to rules with the specified direction. + Direction *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListNetworkACLRulesOptions.Direction property. +// Filters the collection to rules with the specified direction. +const ( + ListNetworkACLRulesOptionsDirectionInboundConst = "inbound" + ListNetworkACLRulesOptionsDirectionOutboundConst = "outbound" +) + +// NewListNetworkACLRulesOptions : Instantiate ListNetworkACLRulesOptions +func (*VpcV1) NewListNetworkACLRulesOptions(networkACLID string) *ListNetworkACLRulesOptions { + return &ListNetworkACLRulesOptions{ + NetworkACLID: core.StringPtr(networkACLID), + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (options *ListNetworkACLRulesOptions) SetNetworkACLID(networkACLID string) *ListNetworkACLRulesOptions { + options.NetworkACLID = core.StringPtr(networkACLID) + return options +} + +// SetStart : Allow user to set Start +func (options *ListNetworkACLRulesOptions) SetStart(start string) *ListNetworkACLRulesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListNetworkACLRulesOptions) SetLimit(limit int64) *ListNetworkACLRulesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetDirection : Allow user to set Direction +func (options *ListNetworkACLRulesOptions) SetDirection(direction string) *ListNetworkACLRulesOptions { + options.Direction = core.StringPtr(direction) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListNetworkACLRulesOptions) SetHeaders(param map[string]string) *ListNetworkACLRulesOptions { + options.Headers = param + return options +} + +// ListNetworkAclsOptions : The ListNetworkAcls options. +type ListNetworkAclsOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Filters the collection to resources within one of the resource groups identified in a comma-separated list of + // resource group identifiers. + ResourceGroupID *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListNetworkAclsOptions : Instantiate ListNetworkAclsOptions +func (*VpcV1) NewListNetworkAclsOptions() *ListNetworkAclsOptions { + return &ListNetworkAclsOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListNetworkAclsOptions) SetStart(start string) *ListNetworkAclsOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListNetworkAclsOptions) SetLimit(limit int64) *ListNetworkAclsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListNetworkAclsOptions) SetResourceGroupID(resourceGroupID string) *ListNetworkAclsOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListNetworkAclsOptions) SetHeaders(param map[string]string) *ListNetworkAclsOptions { + options.Headers = param + return options +} + +// ListOperatingSystemsOptions : The ListOperatingSystems options. +type ListOperatingSystemsOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListOperatingSystemsOptions : Instantiate ListOperatingSystemsOptions +func (*VpcV1) NewListOperatingSystemsOptions() *ListOperatingSystemsOptions { + return &ListOperatingSystemsOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListOperatingSystemsOptions) SetStart(start string) *ListOperatingSystemsOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListOperatingSystemsOptions) SetLimit(limit int64) *ListOperatingSystemsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListOperatingSystemsOptions) SetHeaders(param map[string]string) *ListOperatingSystemsOptions { + options.Headers = param + return options +} + +// ListPublicGatewaysOptions : The ListPublicGateways options. +type ListPublicGatewaysOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Filters the collection to resources within one of the resource groups identified in a comma-separated list of + // resource group identifiers. + ResourceGroupID *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListPublicGatewaysOptions : Instantiate ListPublicGatewaysOptions +func (*VpcV1) NewListPublicGatewaysOptions() *ListPublicGatewaysOptions { + return &ListPublicGatewaysOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListPublicGatewaysOptions) SetStart(start string) *ListPublicGatewaysOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListPublicGatewaysOptions) SetLimit(limit int64) *ListPublicGatewaysOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListPublicGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListPublicGatewaysOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListPublicGatewaysOptions) SetHeaders(param map[string]string) *ListPublicGatewaysOptions { + options.Headers = param + return options +} + +// ListRegionZonesOptions : The ListRegionZones options. +type ListRegionZonesOptions struct { + // The region name. + RegionName *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListRegionZonesOptions : Instantiate ListRegionZonesOptions +func (*VpcV1) NewListRegionZonesOptions(regionName string) *ListRegionZonesOptions { + return &ListRegionZonesOptions{ + RegionName: core.StringPtr(regionName), + } +} + +// SetRegionName : Allow user to set RegionName +func (options *ListRegionZonesOptions) SetRegionName(regionName string) *ListRegionZonesOptions { + options.RegionName = core.StringPtr(regionName) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListRegionZonesOptions) SetHeaders(param map[string]string) *ListRegionZonesOptions { + options.Headers = param + return options +} + +// ListRegionsOptions : The ListRegions options. +type ListRegionsOptions struct { + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListRegionsOptions : Instantiate ListRegionsOptions +func (*VpcV1) NewListRegionsOptions() *ListRegionsOptions { + return &ListRegionsOptions{} +} + +// SetHeaders : Allow user to set Headers +func (options *ListRegionsOptions) SetHeaders(param map[string]string) *ListRegionsOptions { + options.Headers = param + return options +} + +// ListSecurityGroupNetworkInterfacesOptions : The ListSecurityGroupNetworkInterfaces options. +type ListSecurityGroupNetworkInterfacesOptions struct { + // The security group identifier. + SecurityGroupID *string `validate:"required,ne="` + + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListSecurityGroupNetworkInterfacesOptions : Instantiate ListSecurityGroupNetworkInterfacesOptions +func (*VpcV1) NewListSecurityGroupNetworkInterfacesOptions(securityGroupID string) *ListSecurityGroupNetworkInterfacesOptions { + return &ListSecurityGroupNetworkInterfacesOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (options *ListSecurityGroupNetworkInterfacesOptions) SetSecurityGroupID(securityGroupID string) *ListSecurityGroupNetworkInterfacesOptions { + options.SecurityGroupID = core.StringPtr(securityGroupID) + return options +} + +// SetStart : Allow user to set Start +func (options *ListSecurityGroupNetworkInterfacesOptions) SetStart(start string) *ListSecurityGroupNetworkInterfacesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListSecurityGroupNetworkInterfacesOptions) SetLimit(limit int64) *ListSecurityGroupNetworkInterfacesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSecurityGroupNetworkInterfacesOptions) SetHeaders(param map[string]string) *ListSecurityGroupNetworkInterfacesOptions { + options.Headers = param + return options +} + +// ListSecurityGroupRulesOptions : The ListSecurityGroupRules options. +type ListSecurityGroupRulesOptions struct { + // The security group identifier. + SecurityGroupID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListSecurityGroupRulesOptions : Instantiate ListSecurityGroupRulesOptions +func (*VpcV1) NewListSecurityGroupRulesOptions(securityGroupID string) *ListSecurityGroupRulesOptions { + return &ListSecurityGroupRulesOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (options *ListSecurityGroupRulesOptions) SetSecurityGroupID(securityGroupID string) *ListSecurityGroupRulesOptions { + options.SecurityGroupID = core.StringPtr(securityGroupID) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSecurityGroupRulesOptions) SetHeaders(param map[string]string) *ListSecurityGroupRulesOptions { + options.Headers = param + return options +} + +// ListSecurityGroupTargetsOptions : The ListSecurityGroupTargets options. +type ListSecurityGroupTargetsOptions struct { + // The security group identifier. + SecurityGroupID *string `validate:"required,ne="` + + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListSecurityGroupTargetsOptions : Instantiate ListSecurityGroupTargetsOptions +func (*VpcV1) NewListSecurityGroupTargetsOptions(securityGroupID string) *ListSecurityGroupTargetsOptions { + return &ListSecurityGroupTargetsOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (options *ListSecurityGroupTargetsOptions) SetSecurityGroupID(securityGroupID string) *ListSecurityGroupTargetsOptions { + options.SecurityGroupID = core.StringPtr(securityGroupID) + return options +} + +// SetStart : Allow user to set Start +func (options *ListSecurityGroupTargetsOptions) SetStart(start string) *ListSecurityGroupTargetsOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListSecurityGroupTargetsOptions) SetLimit(limit int64) *ListSecurityGroupTargetsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSecurityGroupTargetsOptions) SetHeaders(param map[string]string) *ListSecurityGroupTargetsOptions { + options.Headers = param + return options +} + +// ListSecurityGroupsOptions : The ListSecurityGroups options. +type ListSecurityGroupsOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Filters the collection to resources within one of the resource groups identified in a comma-separated list of + // resource group identifiers. + ResourceGroupID *string + + // Filters the collection to resources in the VPC with the specified identifier. + VPCID *string + + // Filters the collection to resources in the VPC with the specified CRN. + VPCCRN *string + + // Filters the collection to resources in the VPC with the exact specified name. + VPCName *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListSecurityGroupsOptions : Instantiate ListSecurityGroupsOptions +func (*VpcV1) NewListSecurityGroupsOptions() *ListSecurityGroupsOptions { + return &ListSecurityGroupsOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListSecurityGroupsOptions) SetStart(start string) *ListSecurityGroupsOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListSecurityGroupsOptions) SetLimit(limit int64) *ListSecurityGroupsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListSecurityGroupsOptions) SetResourceGroupID(resourceGroupID string) *ListSecurityGroupsOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetVPCID : Allow user to set VPCID +func (options *ListSecurityGroupsOptions) SetVPCID(vpcID string) *ListSecurityGroupsOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetVPCCRN : Allow user to set VPCCRN +func (options *ListSecurityGroupsOptions) SetVPCCRN(vpcCRN string) *ListSecurityGroupsOptions { + options.VPCCRN = core.StringPtr(vpcCRN) + return options +} + +// SetVPCName : Allow user to set VPCName +func (options *ListSecurityGroupsOptions) SetVPCName(vpcName string) *ListSecurityGroupsOptions { + options.VPCName = core.StringPtr(vpcName) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSecurityGroupsOptions) SetHeaders(param map[string]string) *ListSecurityGroupsOptions { + options.Headers = param + return options +} + +// ListSubnetReservedIpsOptions : The ListSubnetReservedIps options. +type ListSubnetReservedIpsOptions struct { + // The subnet identifier. + SubnetID *string `validate:"required,ne="` + + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Sorts the returned collection by the specified field name in ascending order. A `-` may be prepended to the field + // name to sort in descending order. For example, the value + // `-created_at` sorts the collection by the `created_at` field in descending order, and the value `name` sorts it by + // the `name` field in ascending order. + Sort *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListSubnetReservedIpsOptions.Sort property. +// Sorts the returned collection by the specified field name in ascending order. A `-` may be prepended to the field +// name to sort in descending order. For example, the value +// `-created_at` sorts the collection by the `created_at` field in descending order, and the value `name` sorts it by +// the `name` field in ascending order. +const ( + ListSubnetReservedIpsOptionsSortAddressConst = "address" + ListSubnetReservedIpsOptionsSortCreatedAtConst = "created_at" + ListSubnetReservedIpsOptionsSortNameConst = "name" +) + +// NewListSubnetReservedIpsOptions : Instantiate ListSubnetReservedIpsOptions +func (*VpcV1) NewListSubnetReservedIpsOptions(subnetID string) *ListSubnetReservedIpsOptions { + return &ListSubnetReservedIpsOptions{ + SubnetID: core.StringPtr(subnetID), + } +} + +// SetSubnetID : Allow user to set SubnetID +func (options *ListSubnetReservedIpsOptions) SetSubnetID(subnetID string) *ListSubnetReservedIpsOptions { + options.SubnetID = core.StringPtr(subnetID) + return options +} + +// SetStart : Allow user to set Start +func (options *ListSubnetReservedIpsOptions) SetStart(start string) *ListSubnetReservedIpsOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListSubnetReservedIpsOptions) SetLimit(limit int64) *ListSubnetReservedIpsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetSort : Allow user to set Sort +func (options *ListSubnetReservedIpsOptions) SetSort(sort string) *ListSubnetReservedIpsOptions { + options.Sort = core.StringPtr(sort) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSubnetReservedIpsOptions) SetHeaders(param map[string]string) *ListSubnetReservedIpsOptions { + options.Headers = param + return options +} + +// ListSubnetsOptions : The ListSubnets options. +type ListSubnetsOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Filters the collection to resources within one of the resource groups identified in a comma-separated list of + // resource group identifiers. + ResourceGroupID *string + + // Filters the collection to subnets attached to the routing table with the specified identifier. + RoutingTableID *string + + // Filters the collection to subnets attached to the routing table with the specified name. + RoutingTableName *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListSubnetsOptions : Instantiate ListSubnetsOptions +func (*VpcV1) NewListSubnetsOptions() *ListSubnetsOptions { + return &ListSubnetsOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListSubnetsOptions) SetStart(start string) *ListSubnetsOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListSubnetsOptions) SetLimit(limit int64) *ListSubnetsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListSubnetsOptions) SetResourceGroupID(resourceGroupID string) *ListSubnetsOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (options *ListSubnetsOptions) SetRoutingTableID(routingTableID string) *ListSubnetsOptions { + options.RoutingTableID = core.StringPtr(routingTableID) + return options +} + +// SetRoutingTableName : Allow user to set RoutingTableName +func (options *ListSubnetsOptions) SetRoutingTableName(routingTableName string) *ListSubnetsOptions { + options.RoutingTableName = core.StringPtr(routingTableName) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListSubnetsOptions) SetHeaders(param map[string]string) *ListSubnetsOptions { + options.Headers = param + return options +} + +// ListVolumeProfilesOptions : The ListVolumeProfiles options. +type ListVolumeProfilesOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVolumeProfilesOptions : Instantiate ListVolumeProfilesOptions +func (*VpcV1) NewListVolumeProfilesOptions() *ListVolumeProfilesOptions { + return &ListVolumeProfilesOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListVolumeProfilesOptions) SetStart(start string) *ListVolumeProfilesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListVolumeProfilesOptions) SetLimit(limit int64) *ListVolumeProfilesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVolumeProfilesOptions) SetHeaders(param map[string]string) *ListVolumeProfilesOptions { + options.Headers = param + return options +} + +// ListVolumesOptions : The ListVolumes options. +type ListVolumesOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Filters the collection to resources with the exact specified name. + Name *string + + // Filters the collection to resources in the zone with the exact specified name. + ZoneName *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVolumesOptions : Instantiate ListVolumesOptions +func (*VpcV1) NewListVolumesOptions() *ListVolumesOptions { + return &ListVolumesOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListVolumesOptions) SetStart(start string) *ListVolumesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListVolumesOptions) SetLimit(limit int64) *ListVolumesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetName : Allow user to set Name +func (options *ListVolumesOptions) SetName(name string) *ListVolumesOptions { + options.Name = core.StringPtr(name) + return options +} + +// SetZoneName : Allow user to set ZoneName +func (options *ListVolumesOptions) SetZoneName(zoneName string) *ListVolumesOptions { + options.ZoneName = core.StringPtr(zoneName) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVolumesOptions) SetHeaders(param map[string]string) *ListVolumesOptions { + options.Headers = param + return options +} + +// ListVPCAddressPrefixesOptions : The ListVPCAddressPrefixes options. +type ListVPCAddressPrefixesOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPCAddressPrefixesOptions : Instantiate ListVPCAddressPrefixesOptions +func (*VpcV1) NewListVPCAddressPrefixesOptions(vpcID string) *ListVPCAddressPrefixesOptions { + return &ListVPCAddressPrefixesOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (options *ListVPCAddressPrefixesOptions) SetVPCID(vpcID string) *ListVPCAddressPrefixesOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetStart : Allow user to set Start +func (options *ListVPCAddressPrefixesOptions) SetStart(start string) *ListVPCAddressPrefixesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListVPCAddressPrefixesOptions) SetLimit(limit int64) *ListVPCAddressPrefixesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCAddressPrefixesOptions) SetHeaders(param map[string]string) *ListVPCAddressPrefixesOptions { + options.Headers = param + return options +} + +// ListVPCRoutesOptions : The ListVPCRoutes options. +type ListVPCRoutesOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // Filters the collection to resources in the zone with the exact specified name. + ZoneName *string + + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPCRoutesOptions : Instantiate ListVPCRoutesOptions +func (*VpcV1) NewListVPCRoutesOptions(vpcID string) *ListVPCRoutesOptions { + return &ListVPCRoutesOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (options *ListVPCRoutesOptions) SetVPCID(vpcID string) *ListVPCRoutesOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetZoneName : Allow user to set ZoneName +func (options *ListVPCRoutesOptions) SetZoneName(zoneName string) *ListVPCRoutesOptions { + options.ZoneName = core.StringPtr(zoneName) + return options +} + +// SetStart : Allow user to set Start +func (options *ListVPCRoutesOptions) SetStart(start string) *ListVPCRoutesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListVPCRoutesOptions) SetLimit(limit int64) *ListVPCRoutesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCRoutesOptions) SetHeaders(param map[string]string) *ListVPCRoutesOptions { + options.Headers = param + return options +} + +// ListVPCRoutingTableRoutesOptions : The ListVPCRoutingTableRoutes options. +type ListVPCRoutingTableRoutesOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `validate:"required,ne="` + + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPCRoutingTableRoutesOptions : Instantiate ListVPCRoutingTableRoutesOptions +func (*VpcV1) NewListVPCRoutingTableRoutesOptions(vpcID string, routingTableID string) *ListVPCRoutingTableRoutesOptions { + return &ListVPCRoutingTableRoutesOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + } +} + +// SetVPCID : Allow user to set VPCID +func (options *ListVPCRoutingTableRoutesOptions) SetVPCID(vpcID string) *ListVPCRoutingTableRoutesOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (options *ListVPCRoutingTableRoutesOptions) SetRoutingTableID(routingTableID string) *ListVPCRoutingTableRoutesOptions { + options.RoutingTableID = core.StringPtr(routingTableID) + return options +} + +// SetStart : Allow user to set Start +func (options *ListVPCRoutingTableRoutesOptions) SetStart(start string) *ListVPCRoutingTableRoutesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListVPCRoutingTableRoutesOptions) SetLimit(limit int64) *ListVPCRoutingTableRoutesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCRoutingTableRoutesOptions) SetHeaders(param map[string]string) *ListVPCRoutingTableRoutesOptions { + options.Headers = param + return options +} + +// ListVPCRoutingTablesOptions : The ListVPCRoutingTables options. +type ListVPCRoutingTablesOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // If the supplied value is `true`, filters the routing table collection to only the default routing table. If the + // supplied value is `false`, filters the routing table collection to exclude the default routing table. + IsDefault *bool + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPCRoutingTablesOptions : Instantiate ListVPCRoutingTablesOptions +func (*VpcV1) NewListVPCRoutingTablesOptions(vpcID string) *ListVPCRoutingTablesOptions { + return &ListVPCRoutingTablesOptions{ + VPCID: core.StringPtr(vpcID), + } +} + +// SetVPCID : Allow user to set VPCID +func (options *ListVPCRoutingTablesOptions) SetVPCID(vpcID string) *ListVPCRoutingTablesOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetStart : Allow user to set Start +func (options *ListVPCRoutingTablesOptions) SetStart(start string) *ListVPCRoutingTablesOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListVPCRoutingTablesOptions) SetLimit(limit int64) *ListVPCRoutingTablesOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetIsDefault : Allow user to set IsDefault +func (options *ListVPCRoutingTablesOptions) SetIsDefault(isDefault bool) *ListVPCRoutingTablesOptions { + options.IsDefault = core.BoolPtr(isDefault) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPCRoutingTablesOptions) SetHeaders(param map[string]string) *ListVPCRoutingTablesOptions { + options.Headers = param + return options +} + +// ListVpcsOptions : The ListVpcs options. +type ListVpcsOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Filters the collection to resources within one of the resource groups identified in a comma-separated list of + // resource group identifiers. + ResourceGroupID *string + + // The `classic_access` parameter filters the returned collection by the supplied field. If the supplied field is + // `true`, only Classic Access VPCs will be returned. If the supplied field is `false`, only VPCs without Classic + // Access will be returned. + ClassicAccess *bool + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVpcsOptions : Instantiate ListVpcsOptions +func (*VpcV1) NewListVpcsOptions() *ListVpcsOptions { + return &ListVpcsOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListVpcsOptions) SetStart(start string) *ListVpcsOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListVpcsOptions) SetLimit(limit int64) *ListVpcsOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListVpcsOptions) SetResourceGroupID(resourceGroupID string) *ListVpcsOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetClassicAccess : Allow user to set ClassicAccess +func (options *ListVpcsOptions) SetClassicAccess(classicAccess bool) *ListVpcsOptions { + options.ClassicAccess = core.BoolPtr(classicAccess) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVpcsOptions) SetHeaders(param map[string]string) *ListVpcsOptions { + options.Headers = param + return options +} + +// ListVPNGatewayConnectionLocalCIDRsOptions : The ListVPNGatewayConnectionLocalCIDRs options. +type ListVPNGatewayConnectionLocalCIDRsOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPNGatewayConnectionLocalCIDRsOptions : Instantiate ListVPNGatewayConnectionLocalCIDRsOptions +func (*VpcV1) NewListVPNGatewayConnectionLocalCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionLocalCIDRsOptions { + return &ListVPNGatewayConnectionLocalCIDRsOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (options *ListVPNGatewayConnectionLocalCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionLocalCIDRsOptions { + options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return options +} + +// SetID : Allow user to set ID +func (options *ListVPNGatewayConnectionLocalCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionLocalCIDRsOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewayConnectionLocalCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionLocalCIDRsOptions { + options.Headers = param + return options +} + +// ListVPNGatewayConnectionPeerCIDRsOptions : The ListVPNGatewayConnectionPeerCIDRs options. +type ListVPNGatewayConnectionPeerCIDRsOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPNGatewayConnectionPeerCIDRsOptions : Instantiate ListVPNGatewayConnectionPeerCIDRsOptions +func (*VpcV1) NewListVPNGatewayConnectionPeerCIDRsOptions(vpnGatewayID string, id string) *ListVPNGatewayConnectionPeerCIDRsOptions { + return &ListVPNGatewayConnectionPeerCIDRsOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (options *ListVPNGatewayConnectionPeerCIDRsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionPeerCIDRsOptions { + options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return options +} + +// SetID : Allow user to set ID +func (options *ListVPNGatewayConnectionPeerCIDRsOptions) SetID(id string) *ListVPNGatewayConnectionPeerCIDRsOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewayConnectionPeerCIDRsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionPeerCIDRsOptions { + options.Headers = param + return options +} + +// ListVPNGatewayConnectionsOptions : The ListVPNGatewayConnections options. +type ListVPNGatewayConnectionsOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `validate:"required,ne="` + + // Filters the collection to VPN gateway connections with the specified status. + Status *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewListVPNGatewayConnectionsOptions : Instantiate ListVPNGatewayConnectionsOptions +func (*VpcV1) NewListVPNGatewayConnectionsOptions(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { + return &ListVPNGatewayConnectionsOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (options *ListVPNGatewayConnectionsOptions) SetVPNGatewayID(vpnGatewayID string) *ListVPNGatewayConnectionsOptions { + options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return options +} + +// SetStatus : Allow user to set Status +func (options *ListVPNGatewayConnectionsOptions) SetStatus(status string) *ListVPNGatewayConnectionsOptions { + options.Status = core.StringPtr(status) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewayConnectionsOptions) SetHeaders(param map[string]string) *ListVPNGatewayConnectionsOptions { + options.Headers = param + return options +} + +// ListVPNGatewaysOptions : The ListVPNGateways options. +type ListVPNGatewaysOptions struct { + // A server-supplied token determining what resource to start the page on. + Start *string + + // The number of resources to return on a page. + Limit *int64 + + // Filters the collection to resources within one of the resource groups identified in a comma-separated list of + // resource group identifiers. + ResourceGroupID *string + + // Filters the collection to VPN gateways with the specified mode. + Mode *string + + // Allows users to set headers on API requests + Headers map[string]string +} + +// Constants associated with the ListVPNGatewaysOptions.Mode property. +// Filters the collection to VPN gateways with the specified mode. +const ( + ListVPNGatewaysOptionsModePolicyConst = "policy" + ListVPNGatewaysOptionsModeRouteConst = "route" +) + +// NewListVPNGatewaysOptions : Instantiate ListVPNGatewaysOptions +func (*VpcV1) NewListVPNGatewaysOptions() *ListVPNGatewaysOptions { + return &ListVPNGatewaysOptions{} +} + +// SetStart : Allow user to set Start +func (options *ListVPNGatewaysOptions) SetStart(start string) *ListVPNGatewaysOptions { + options.Start = core.StringPtr(start) + return options +} + +// SetLimit : Allow user to set Limit +func (options *ListVPNGatewaysOptions) SetLimit(limit int64) *ListVPNGatewaysOptions { + options.Limit = core.Int64Ptr(limit) + return options +} + +// SetResourceGroupID : Allow user to set ResourceGroupID +func (options *ListVPNGatewaysOptions) SetResourceGroupID(resourceGroupID string) *ListVPNGatewaysOptions { + options.ResourceGroupID = core.StringPtr(resourceGroupID) + return options +} + +// SetMode : Allow user to set Mode +func (options *ListVPNGatewaysOptions) SetMode(mode string) *ListVPNGatewaysOptions { + options.Mode = core.StringPtr(mode) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ListVPNGatewaysOptions) SetHeaders(param map[string]string) *ListVPNGatewaysOptions { + options.Headers = param + return options +} + +// LoadBalancer : LoadBalancer struct +type LoadBalancer struct { + // The date and time that this load balancer was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` + + // Fully qualified domain name assigned to this load balancer. + Hostname *string `json:"hostname" validate:"required"` + + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` + + // The type of this load balancer, public or private. + IsPublic *bool `json:"is_public" validate:"required"` + + // The listeners of this load balancer. + Listeners []LoadBalancerListenerReference `json:"listeners" validate:"required"` + + // The logging configuration for this load balancer. + Logging *LoadBalancerLogging `json:"logging" validate:"required"` + + // The unique user-defined name for this load balancer. + Name *string `json:"name" validate:"required"` + + // The operating status of this load balancer. + OperatingStatus *string `json:"operating_status" validate:"required"` + + // The pools of this load balancer. + Pools []LoadBalancerPoolReference `json:"pools" validate:"required"` + + // The private IP addresses assigned to this load balancer. + PrivateIps []IP `json:"private_ips" validate:"required"` + + // The profile to use for this load balancer. + Profile *LoadBalancerProfileReference `json:"profile" validate:"required"` + + // The provisioning status of this load balancer. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The public IP addresses assigned to this load balancer. + // + // Applicable only for public load balancers. + PublicIps []IP `json:"public_ips" validate:"required"` + + // The resource group for this load balancer. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The security groups targeting this load balancer. + // + // Applicable only for load balancers that support security groups. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // Indicates whether this load balancer supports security groups. + SecurityGroupsSupported *bool `json:"security_groups_supported" validate:"required"` + + // The subnets this load balancer is part of. + Subnets []SubnetReference `json:"subnets" validate:"required"` +} + +// Constants associated with the LoadBalancer.OperatingStatus property. +// The operating status of this load balancer. +const ( + LoadBalancerOperatingStatusOfflineConst = "offline" + LoadBalancerOperatingStatusOnlineConst = "online" +) + +// Constants associated with the LoadBalancer.ProvisioningStatus property. +// The provisioning status of this load balancer. +const ( + LoadBalancerProvisioningStatusActiveConst = "active" + LoadBalancerProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerProvisioningStatusFailedConst = "failed" + LoadBalancerProvisioningStatusMaintenancePendingConst = "maintenance_pending" + LoadBalancerProvisioningStatusUpdatePendingConst = "update_pending" +) + +// UnmarshalLoadBalancer unmarshals an instance of LoadBalancer from the specified map of raw messages. +func UnmarshalLoadBalancer(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancer) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "hostname", &obj.Hostname) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_public", &obj.IsPublic) + if err != nil { + return + } + err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListenerReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLogging) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "operating_status", &obj.OperatingStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPoolReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "private_ips", &obj.PrivateIps, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalLoadBalancerProfileReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_ips", &obj.PublicIps, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "security_groups_supported", &obj.SecurityGroupsSupported) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerCollection : LoadBalancerCollection struct +type LoadBalancerCollection struct { + // Collection of load balancers. + LoadBalancers []LoadBalancer `json:"load_balancers" validate:"required"` +} + +// UnmarshalLoadBalancerCollection unmarshals an instance of LoadBalancerCollection from the specified map of raw messages. +func UnmarshalLoadBalancerCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerCollection) + err = core.UnmarshalModel(m, "load_balancers", &obj.LoadBalancers, UnmarshalLoadBalancer) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentity : Identifies a load balancer by a unique property. +// Models which "extend" this model: +// - LoadBalancerIdentityByID +// - LoadBalancerIdentityByCRN +// - LoadBalancerIdentityByHref +type LoadBalancerIdentity struct { + // The unique identifier for this load balancer. + ID *string `json:"id,omitempty"` + + // The load balancer's CRN. + CRN *string `json:"crn,omitempty"` + + // The load balancer's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerIdentity) isaLoadBalancerIdentity() bool { + return true +} + +type LoadBalancerIdentityIntf interface { + isaLoadBalancerIdentity() bool +} + +// UnmarshalLoadBalancerIdentity unmarshals an instance of LoadBalancerIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListener : LoadBalancerListener struct +type LoadBalancerListener struct { + // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in + // the `application` family (otherwise always `false`). + AcceptProxyProtocol *bool `json:"accept_proxy_protocol" validate:"required"` + + // The certificate instance used for SSL termination. It is applicable only to `https` + // protocol. + CertificateInstance *CertificateInstanceReference `json:"certificate_instance,omitempty"` + + // The connection limit of the listener. + ConnectionLimit *int64 `json:"connection_limit,omitempty"` + + // The date and time that this listener was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The default pool associated with the listener. + DefaultPool *LoadBalancerPoolReference `json:"default_pool,omitempty"` + + // The listener's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer listener. + ID *string `json:"id" validate:"required"` + + // An array of policies for this listener. + Policies []LoadBalancerListenerPolicyReference `json:"policies,omitempty"` + + // The listener port number. Each listener in the load balancer must have a unique + // `port` and `protocol` combination. + Port *int64 `json:"port" validate:"required"` + + // The listener protocol. Load balancers in the `network` family support `tcp`. Load balancers in the `application` + // family support `tcp`, `http`, and `https`. Each listener in the load balancer must have a unique `port` and + // `protocol` combination. + Protocol *string `json:"protocol" validate:"required"` + + // The provisioning status of this listener. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` +} + +// Constants associated with the LoadBalancerListener.Protocol property. +// The listener protocol. Load balancers in the `network` family support `tcp`. Load balancers in the `application` +// family support `tcp`, `http`, and `https`. Each listener in the load balancer must have a unique `port` and +// `protocol` combination. +const ( + LoadBalancerListenerProtocolHTTPConst = "http" + LoadBalancerListenerProtocolHTTPSConst = "https" + LoadBalancerListenerProtocolTCPConst = "tcp" +) + +// Constants associated with the LoadBalancerListener.ProvisioningStatus property. +// The provisioning status of this listener. +const ( + LoadBalancerListenerProvisioningStatusActiveConst = "active" + LoadBalancerListenerProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerListenerProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerListenerProvisioningStatusFailedConst = "failed" + LoadBalancerListenerProvisioningStatusMaintenancePendingConst = "maintenance_pending" + LoadBalancerListenerProvisioningStatusUpdatePendingConst = "update_pending" +) + +// UnmarshalLoadBalancerListener unmarshals an instance of LoadBalancerListener from the specified map of raw messages. +func UnmarshalLoadBalancerListener(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListener) + err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerCollection : LoadBalancerListenerCollection struct +type LoadBalancerListenerCollection struct { + // Collection of listeners. + Listeners []LoadBalancerListener `json:"listeners" validate:"required"` +} + +// UnmarshalLoadBalancerListenerCollection unmarshals an instance of LoadBalancerListenerCollection from the specified map of raw messages. +func UnmarshalLoadBalancerListenerCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerCollection) + err = core.UnmarshalModel(m, "listeners", &obj.Listeners, UnmarshalLoadBalancerListener) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPatch : LoadBalancerListenerPatch struct +type LoadBalancerListenerPatch struct { + // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in + // the `application` family (otherwise always `false`). + AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` + + // The certificate instance used for SSL termination. It is applicable only to `https` + // protocol. + CertificateInstance CertificateInstanceIdentityIntf `json:"certificate_instance,omitempty"` + + // The connection limit of the listener. + ConnectionLimit *int64 `json:"connection_limit,omitempty"` + + // The default pool associated with the listener. The specified pool must: + // + // - Belong to this load balancer + // - Have the same `protocol` as this listener + // - Not already be the default pool for another listener. + DefaultPool LoadBalancerPoolIdentityIntf `json:"default_pool,omitempty"` + + // The listener port number. Each listener in the load balancer must have a unique + // `port` and `protocol` combination. + Port *int64 `json:"port,omitempty"` + + // The listener protocol. Load balancers in the `network` family support `tcp`. Load balancers in the `application` + // family support `tcp`, `http`, and `https`. Each listener in the load balancer must have a unique `port` and + // `protocol` combination. + Protocol *string `json:"protocol,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPatch.Protocol property. +// The listener protocol. Load balancers in the `network` family support `tcp`. Load balancers in the `application` +// family support `tcp`, `http`, and `https`. Each listener in the load balancer must have a unique `port` and +// `protocol` combination. +const ( + LoadBalancerListenerPatchProtocolHTTPConst = "http" + LoadBalancerListenerPatchProtocolHTTPSConst = "https" + LoadBalancerListenerPatchProtocolTCPConst = "tcp" +) + +// UnmarshalLoadBalancerListenerPatch unmarshals an instance of LoadBalancerListenerPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPatch) + err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "certificate_instance", &obj.CertificateInstance, UnmarshalCertificateInstanceIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the LoadBalancerListenerPatch +func (loadBalancerListenerPatch *LoadBalancerListenerPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(loadBalancerListenerPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// LoadBalancerListenerPolicy : LoadBalancerListenerPolicy struct +type LoadBalancerListenerPolicy struct { + // The policy action. + Action *string `json:"action" validate:"required"` + + // The date and time that this policy was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The listener policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The policy's unique identifier. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this policy. + Name *string `json:"name" validate:"required"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `json:"priority" validate:"required"` + + // The provisioning status of this policy. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The rules of this policy. + Rules []LoadBalancerListenerPolicyRuleReference `json:"rules" validate:"required"` + + // `LoadBalancerPoolReference` is in the response if `action` is `forward`. + // `LoadBalancerListenerPolicyRedirectURL` is in the response if `action` is `redirect`. + Target LoadBalancerListenerPolicyTargetIntf `json:"target,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPolicy.Action property. +// The policy action. +const ( + LoadBalancerListenerPolicyActionForwardConst = "forward" + LoadBalancerListenerPolicyActionRedirectConst = "redirect" + LoadBalancerListenerPolicyActionRejectConst = "reject" +) + +// Constants associated with the LoadBalancerListenerPolicy.ProvisioningStatus property. +// The provisioning status of this policy. +const ( + LoadBalancerListenerPolicyProvisioningStatusActiveConst = "active" + LoadBalancerListenerPolicyProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerListenerPolicyProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerListenerPolicyProvisioningStatusFailedConst = "failed" + LoadBalancerListenerPolicyProvisioningStatusMaintenancePendingConst = "maintenance_pending" + LoadBalancerListenerPolicyProvisioningStatusUpdatePendingConst = "update_pending" +) + +// UnmarshalLoadBalancerListenerPolicy unmarshals an instance of LoadBalancerListenerPolicy from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicy) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRuleReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTarget) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyCollection : LoadBalancerListenerPolicyCollection struct +type LoadBalancerListenerPolicyCollection struct { + // Collection of policies. + Policies []LoadBalancerListenerPolicy `json:"policies" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyCollection unmarshals an instance of LoadBalancerListenerPolicyCollection from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyCollection) + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalLoadBalancerListenerPolicy) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyPatch : LoadBalancerListenerPolicyPatch struct +type LoadBalancerListenerPolicyPatch struct { + // The user-defined name for this policy. Names must be unique within the load balancer listener the policy resides in. + Name *string `json:"name,omitempty"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `json:"priority,omitempty"` + + // When `action` is `forward`, `LoadBalancerPoolIdentity` specifies which pool the load + // balancer forwards the traffic to. When `action` is `redirect`, + // `LoadBalancerListenerPolicyRedirectURLPatch` specifies the url and http + // status code used in the redirect response. + Target LoadBalancerListenerPolicyTargetPatchIntf `json:"target,omitempty"` +} + +// UnmarshalLoadBalancerListenerPolicyPatch unmarshals an instance of LoadBalancerListenerPolicyPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the LoadBalancerListenerPolicyPatch +func (loadBalancerListenerPolicyPatch *LoadBalancerListenerPolicyPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(loadBalancerListenerPolicyPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// LoadBalancerListenerPolicyPrototype : LoadBalancerListenerPolicyPrototype struct +type LoadBalancerListenerPolicyPrototype struct { + // The policy action. + Action *string `json:"action" validate:"required"` + + // The user-defined name for this policy. Names must be unique within the load balancer listener the policy resides in. + Name *string `json:"name,omitempty"` + + // Priority of the policy. Lower value indicates higher priority. + Priority *int64 `json:"priority" validate:"required"` + + // An array of rules for this policy. + Rules []LoadBalancerListenerPolicyRulePrototype `json:"rules,omitempty"` + + // When `action` is `forward`, `LoadBalancerPoolIdentity` is required to specify which + // pool the load balancer forwards the traffic to. When `action` is `redirect`, + // `LoadBalancerListenerPolicyRedirectURLPrototype` is required to specify the url and + // http status code used in the redirect response. + Target LoadBalancerListenerPolicyTargetPrototypeIntf `json:"target,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPolicyPrototype.Action property. +// The policy action. +const ( + LoadBalancerListenerPolicyPrototypeActionForwardConst = "forward" + LoadBalancerListenerPolicyPrototypeActionRedirectConst = "redirect" + LoadBalancerListenerPolicyPrototypeActionRejectConst = "reject" +) + +// NewLoadBalancerListenerPolicyPrototype : Instantiate LoadBalancerListenerPolicyPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyPrototype(action string, priority int64) (model *LoadBalancerListenerPolicyPrototype, err error) { + model = &LoadBalancerListenerPolicyPrototype{ + Action: core.StringPtr(action), + Priority: core.Int64Ptr(priority), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalLoadBalancerListenerPolicyPrototype unmarshals an instance of LoadBalancerListenerPolicyPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "priority", &obj.Priority) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRulePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerListenerPolicyTargetPrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyReference : LoadBalancerListenerPolicyReference struct +type LoadBalancerListenerPolicyReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *LoadBalancerListenerPolicyReferenceDeleted `json:"deleted,omitempty"` + + // The listener policy's canonical URL. + Href *string `json:"href" validate:"required"` + + // The policy's unique identifier. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyReference unmarshals an instance of LoadBalancerListenerPolicyReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type LoadBalancerListenerPolicyReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyReferenceDeleted unmarshals an instance of LoadBalancerListenerPolicyReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRule : LoadBalancerListenerPolicyRule struct +type LoadBalancerListenerPolicyRule struct { + // The condition of the rule. + Condition *string `json:"condition" validate:"required"` + + // The date and time that this rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this field is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string `json:"field,omitempty"` + + // The rule's canonical URL. + Href *string `json:"href" validate:"required"` + + // The rule's unique identifier. + ID *string `json:"id" validate:"required"` + + // The provisioning status of this rule. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `json:"type" validate:"required"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerListenerPolicyRule.Condition property. +// The condition of the rule. +const ( + LoadBalancerListenerPolicyRuleConditionContainsConst = "contains" + LoadBalancerListenerPolicyRuleConditionEqualsConst = "equals" + LoadBalancerListenerPolicyRuleConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the LoadBalancerListenerPolicyRule.ProvisioningStatus property. +// The provisioning status of this rule. +const ( + LoadBalancerListenerPolicyRuleProvisioningStatusActiveConst = "active" + LoadBalancerListenerPolicyRuleProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerListenerPolicyRuleProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerListenerPolicyRuleProvisioningStatusFailedConst = "failed" + LoadBalancerListenerPolicyRuleProvisioningStatusMaintenancePendingConst = "maintenance_pending" + LoadBalancerListenerPolicyRuleProvisioningStatusUpdatePendingConst = "update_pending" +) + +// Constants associated with the LoadBalancerListenerPolicyRule.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + LoadBalancerListenerPolicyRuleTypeBodyConst = "body" + LoadBalancerListenerPolicyRuleTypeHeaderConst = "header" + LoadBalancerListenerPolicyRuleTypeHostnameConst = "hostname" + LoadBalancerListenerPolicyRuleTypePathConst = "path" + LoadBalancerListenerPolicyRuleTypeQueryConst = "query" +) + +// UnmarshalLoadBalancerListenerPolicyRule unmarshals an instance of LoadBalancerListenerPolicyRule from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRule(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRule) + err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "field", &obj.Field) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRuleCollection : LoadBalancerListenerPolicyRuleCollection struct +type LoadBalancerListenerPolicyRuleCollection struct { + // Collection of rules. + Rules []LoadBalancerListenerPolicyRule `json:"rules" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyRuleCollection unmarshals an instance of LoadBalancerListenerPolicyRuleCollection from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRuleCollection) + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalLoadBalancerListenerPolicyRule) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRulePatch : LoadBalancerListenerPolicyRulePatch struct +type LoadBalancerListenerPolicyRulePatch struct { + // The condition of the rule. + Condition *string `json:"condition,omitempty"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this field is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string `json:"field,omitempty"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `json:"type,omitempty"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerListenerPolicyRulePatch.Condition property. +// The condition of the rule. +const ( + LoadBalancerListenerPolicyRulePatchConditionContainsConst = "contains" + LoadBalancerListenerPolicyRulePatchConditionEqualsConst = "equals" + LoadBalancerListenerPolicyRulePatchConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the LoadBalancerListenerPolicyRulePatch.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + LoadBalancerListenerPolicyRulePatchTypeBodyConst = "body" + LoadBalancerListenerPolicyRulePatchTypeHeaderConst = "header" + LoadBalancerListenerPolicyRulePatchTypeHostnameConst = "hostname" + LoadBalancerListenerPolicyRulePatchTypePathConst = "path" + LoadBalancerListenerPolicyRulePatchTypeQueryConst = "query" +) + +// UnmarshalLoadBalancerListenerPolicyRulePatch unmarshals an instance of LoadBalancerListenerPolicyRulePatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRulePatch) + err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "field", &obj.Field) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the LoadBalancerListenerPolicyRulePatch +func (loadBalancerListenerPolicyRulePatch *LoadBalancerListenerPolicyRulePatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(loadBalancerListenerPolicyRulePatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// LoadBalancerListenerPolicyRulePrototype : LoadBalancerListenerPolicyRulePrototype struct +type LoadBalancerListenerPolicyRulePrototype struct { + // The condition of the rule. + Condition *string `json:"condition" validate:"required"` + + // The field. This is applicable to `header`, `query`, and `body` rule types. + // + // If the rule type is `header`, this field is required. + // + // If the rule type is `query`, this is optional. If specified and the rule condition is not + // `matches_regex`, the value must be percent-encoded. + // + // If the rule type is `body`, this is optional. + Field *string `json:"field,omitempty"` + + // The type of the rule. + // + // Body rules are applied to form-encoded request bodies using the `UTF-8` character set. + Type *string `json:"type" validate:"required"` + + // Value to be matched for rule condition. + // + // If the rule type is `query` and the rule condition is not `matches_regex`, the value must be percent-encoded. + Value *string `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Condition property. +// The condition of the rule. +const ( + LoadBalancerListenerPolicyRulePrototypeConditionContainsConst = "contains" + LoadBalancerListenerPolicyRulePrototypeConditionEqualsConst = "equals" + LoadBalancerListenerPolicyRulePrototypeConditionMatchesRegexConst = "matches_regex" +) + +// Constants associated with the LoadBalancerListenerPolicyRulePrototype.Type property. +// The type of the rule. +// +// Body rules are applied to form-encoded request bodies using the `UTF-8` character set. +const ( + LoadBalancerListenerPolicyRulePrototypeTypeBodyConst = "body" + LoadBalancerListenerPolicyRulePrototypeTypeHeaderConst = "header" + LoadBalancerListenerPolicyRulePrototypeTypeHostnameConst = "hostname" + LoadBalancerListenerPolicyRulePrototypeTypePathConst = "path" + LoadBalancerListenerPolicyRulePrototypeTypeQueryConst = "query" +) + +// NewLoadBalancerListenerPolicyRulePrototype : Instantiate LoadBalancerListenerPolicyRulePrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyRulePrototype(condition string, typeVar string, value string) (model *LoadBalancerListenerPolicyRulePrototype, err error) { + model = &LoadBalancerListenerPolicyRulePrototype{ + Condition: core.StringPtr(condition), + Type: core.StringPtr(typeVar), + Value: core.StringPtr(value), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalLoadBalancerListenerPolicyRulePrototype unmarshals an instance of LoadBalancerListenerPolicyRulePrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRulePrototype) + err = core.UnmarshalPrimitive(m, "condition", &obj.Condition) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "field", &obj.Field) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRuleReference : LoadBalancerListenerPolicyRuleReference struct +type LoadBalancerListenerPolicyRuleReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *LoadBalancerListenerPolicyRuleReferenceDeleted `json:"deleted,omitempty"` + + // The rule's canonical URL. + Href *string `json:"href" validate:"required"` + + // The rule's unique identifier. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyRuleReference unmarshals an instance of LoadBalancerListenerPolicyRuleReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRuleReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type LoadBalancerListenerPolicyRuleReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted unmarshals an instance of LoadBalancerListenerPolicyRuleReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyRuleReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTarget : `LoadBalancerPoolReference` is in the response if `action` is `forward`. +// `LoadBalancerListenerPolicyRedirectURL` is in the response if `action` is `redirect`. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetLoadBalancerPoolReference +// - LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL +type LoadBalancerListenerPolicyTarget struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The user-defined name for this load balancer pool. + Name *string `json:"name,omitempty"` + + // The http status code in the redirect response. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` +} + +func (*LoadBalancerListenerPolicyTarget) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +type LoadBalancerListenerPolicyTargetIntf interface { + isaLoadBalancerListenerPolicyTarget() bool +} + +// UnmarshalLoadBalancerListenerPolicyTarget unmarshals an instance of LoadBalancerListenerPolicyTarget from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTarget) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatch : When `action` is `forward`, `LoadBalancerPoolIdentity` specifies which pool the load balancer forwards the traffic +// to. When `action` is `redirect`, +// `LoadBalancerListenerPolicyRedirectURLPatch` specifies the url and http status code used in the redirect response. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch +type LoadBalancerListenerPolicyTargetPatch struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` + + // The http status code in the redirect response. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPatchIntf interface { + isaLoadBalancerListenerPolicyTargetPatch() bool +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototype : When `action` is `forward`, `LoadBalancerPoolIdentity` is required to specify which pool the load balancer forwards +// the traffic to. When `action` is `redirect`, +// `LoadBalancerListenerPolicyRedirectURLPrototype` is required to specify the url and http status code used in the +// redirect response. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype +type LoadBalancerListenerPolicyTargetPrototype struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` + + // The http status code in the redirect response. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPrototypeIntf interface { + isaLoadBalancerListenerPolicyTargetPrototype() bool +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPrototypeLoadBalancerContext : LoadBalancerListenerPrototypeLoadBalancerContext struct +type LoadBalancerListenerPrototypeLoadBalancerContext struct { + // If set to `true`, this listener will accept and forward PROXY protocol information. Supported by load balancers in + // the `application` family (otherwise always `false`). + AcceptProxyProtocol *bool `json:"accept_proxy_protocol,omitempty"` + + // The connection limit of the listener. + ConnectionLimit *int64 `json:"connection_limit,omitempty"` + + // The default pool associated with the listener. + DefaultPool *LoadBalancerPoolIdentityByName `json:"default_pool,omitempty"` + + // The listener port number. Each listener in the load balancer must have a unique + // `port` and `protocol` combination. + Port *int64 `json:"port" validate:"required"` + + // The listener protocol. Load balancers in the `network` family support `tcp`. Load balancers in the `application` + // family support `tcp`, `http`, and `https`. Each listener in the load balancer must have a unique `port` and + // `protocol` combination. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the LoadBalancerListenerPrototypeLoadBalancerContext.Protocol property. +// The listener protocol. Load balancers in the `network` family support `tcp`. Load balancers in the `application` +// family support `tcp`, `http`, and `https`. Each listener in the load balancer must have a unique `port` and +// `protocol` combination. +const ( + LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPConst = "http" + LoadBalancerListenerPrototypeLoadBalancerContextProtocolHTTPSConst = "https" + LoadBalancerListenerPrototypeLoadBalancerContextProtocolTCPConst = "tcp" +) + +// NewLoadBalancerListenerPrototypeLoadBalancerContext : Instantiate LoadBalancerListenerPrototypeLoadBalancerContext (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPrototypeLoadBalancerContext(port int64, protocol string) (model *LoadBalancerListenerPrototypeLoadBalancerContext, err error) { + model = &LoadBalancerListenerPrototypeLoadBalancerContext{ + Port: core.Int64Ptr(port), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext unmarshals an instance of LoadBalancerListenerPrototypeLoadBalancerContext from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPrototypeLoadBalancerContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPrototypeLoadBalancerContext) + err = core.UnmarshalPrimitive(m, "accept_proxy_protocol", &obj.AcceptProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_limit", &obj.ConnectionLimit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_pool", &obj.DefaultPool, UnmarshalLoadBalancerPoolIdentityByName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerReference : LoadBalancerListenerReference struct +type LoadBalancerListenerReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *LoadBalancerListenerReferenceDeleted `json:"deleted,omitempty"` + + // The listener's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer listener. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalLoadBalancerListenerReference unmarshals an instance of LoadBalancerListenerReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerListenerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type LoadBalancerListenerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerListenerReferenceDeleted unmarshals an instance of LoadBalancerListenerReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerListenerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLogging : The logging configuration for this load balancer. +type LoadBalancerLogging struct { + // The datapath logging configuration for this load balancer. + Datapath *LoadBalancerLoggingDatapath `json:"datapath,omitempty"` +} + +// UnmarshalLoadBalancerLogging unmarshals an instance of LoadBalancerLogging from the specified map of raw messages. +func UnmarshalLoadBalancerLogging(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLogging) + err = core.UnmarshalModel(m, "datapath", &obj.Datapath, UnmarshalLoadBalancerLoggingDatapath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerLoggingDatapath : The datapath logging configuration for this load balancer. +type LoadBalancerLoggingDatapath struct { + // If set to `true`, datapath logging is active for this load balancer. + Active *bool `json:"active" validate:"required"` +} + +// NewLoadBalancerLoggingDatapath : Instantiate LoadBalancerLoggingDatapath (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerLoggingDatapath(active bool) (model *LoadBalancerLoggingDatapath, err error) { + model = &LoadBalancerLoggingDatapath{ + Active: core.BoolPtr(active), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalLoadBalancerLoggingDatapath unmarshals an instance of LoadBalancerLoggingDatapath from the specified map of raw messages. +func UnmarshalLoadBalancerLoggingDatapath(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerLoggingDatapath) + err = core.UnmarshalPrimitive(m, "active", &obj.Active) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPatch : LoadBalancerPatch struct +type LoadBalancerPatch struct { + // The logging configuration to use for this load balancer. + // + // To activate logging, the load balancer profile must support the specified logging type. + Logging *LoadBalancerLogging `json:"logging,omitempty"` + + // The unique user-defined name for this load balancer. + Name *string `json:"name,omitempty"` +} + +// UnmarshalLoadBalancerPatch unmarshals an instance of LoadBalancerPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPatch) + err = core.UnmarshalModel(m, "logging", &obj.Logging, UnmarshalLoadBalancerLogging) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the LoadBalancerPatch +func (loadBalancerPatch *LoadBalancerPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(loadBalancerPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// LoadBalancerPool : LoadBalancerPool struct +type LoadBalancerPool struct { + // The load balancing algorithm. + Algorithm *string `json:"algorithm" validate:"required"` + + // The date and time that this pool was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitor `json:"health_monitor" validate:"required"` + + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` + + // The instance group that is managing this pool. + InstanceGroup *InstanceGroupReference `json:"instance_group,omitempty"` + + // The backend server members of the pool. + Members []LoadBalancerPoolMemberReference `json:"members,omitempty"` + + // The user-defined name for this load balancer pool. + Name *string `json:"name" validate:"required"` + + // The protocol used for this load balancer pool. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the + // unexpected property value was encountered. + Protocol *string `json:"protocol" validate:"required"` + + // The provisioning status of this pool. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string `json:"proxy_protocol" validate:"required"` + + // The session persistence of this pool. + // + // The enumerated values for this property are expected to expand in the future. When + // processing this property, check for and log unknown values. Optionally halt + // processing and surface the error, or bypass the pool on which the unexpected + // property value was encountered. + SessionPersistence *LoadBalancerPoolSessionPersistence `json:"session_persistence,omitempty"` +} + +// Constants associated with the LoadBalancerPool.Algorithm property. +// The load balancing algorithm. +const ( + LoadBalancerPoolAlgorithmLeastConnectionsConst = "least_connections" + LoadBalancerPoolAlgorithmRoundRobinConst = "round_robin" + LoadBalancerPoolAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the LoadBalancerPool.Protocol property. +// The protocol used for this load balancer pool. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the +// unexpected property value was encountered. +const ( + LoadBalancerPoolProtocolHTTPConst = "http" + LoadBalancerPoolProtocolHTTPSConst = "https" + LoadBalancerPoolProtocolTCPConst = "tcp" +) + +// Constants associated with the LoadBalancerPool.ProvisioningStatus property. +// The provisioning status of this pool. +const ( + LoadBalancerPoolProvisioningStatusActiveConst = "active" + LoadBalancerPoolProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerPoolProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerPoolProvisioningStatusFailedConst = "failed" + LoadBalancerPoolProvisioningStatusMaintenancePendingConst = "maintenance_pending" + LoadBalancerPoolProvisioningStatusUpdatePendingConst = "update_pending" +) + +// Constants associated with the LoadBalancerPool.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + LoadBalancerPoolProxyProtocolDisabledConst = "disabled" + LoadBalancerPoolProxyProtocolV1Const = "v1" + LoadBalancerPoolProxyProtocolV2Const = "v2" +) + +// UnmarshalLoadBalancerPool unmarshals an instance of LoadBalancerPool from the specified map of raw messages. +func UnmarshalLoadBalancerPool(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPool) + err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitor) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance_group", &obj.InstanceGroup, UnmarshalInstanceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistence) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolCollection : LoadBalancerPoolCollection struct +type LoadBalancerPoolCollection struct { + // Collection of pools. + Pools []LoadBalancerPool `json:"pools" validate:"required"` +} + +// UnmarshalLoadBalancerPoolCollection unmarshals an instance of LoadBalancerPoolCollection from the specified map of raw messages. +func UnmarshalLoadBalancerPoolCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolCollection) + err = core.UnmarshalModel(m, "pools", &obj.Pools, UnmarshalLoadBalancerPool) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolHealthMonitor : LoadBalancerPoolHealthMonitor struct +type LoadBalancerPoolHealthMonitor struct { + // The health check interval in seconds. Interval must be greater than timeout value. + Delay *int64 `json:"delay" validate:"required"` + + // The health check max retries. + MaxRetries *int64 `json:"max_retries" validate:"required"` + + // The health check port number. If specified, this overrides the ports specified in the server member resources. + Port *int64 `json:"port,omitempty"` + + // The health check timeout in seconds. + Timeout *int64 `json:"timeout" validate:"required"` + + // The protocol type of this load balancer pool health monitor. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which + // the unexpected property value was encountered. + Type *string `json:"type" validate:"required"` + + // The health check URL path. Applicable only if the health monitor `type` is `http` or + // `https`. This value must be in the format of an [origin-form request + // target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + URLPath *string `json:"url_path,omitempty"` +} + +// Constants associated with the LoadBalancerPoolHealthMonitor.Type property. +// The protocol type of this load balancer pool health monitor. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the health monitor on which +// the unexpected property value was encountered. +const ( + LoadBalancerPoolHealthMonitorTypeHTTPConst = "http" + LoadBalancerPoolHealthMonitorTypeHTTPSConst = "https" + LoadBalancerPoolHealthMonitorTypeTCPConst = "tcp" +) + +// UnmarshalLoadBalancerPoolHealthMonitor unmarshals an instance of LoadBalancerPoolHealthMonitor from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitor(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitor) + err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolHealthMonitorPatch : LoadBalancerPoolHealthMonitorPatch struct +type LoadBalancerPoolHealthMonitorPatch struct { + // The health check interval in seconds. Interval must be greater than timeout value. + Delay *int64 `json:"delay" validate:"required"` + + // The health check max retries. + MaxRetries *int64 `json:"max_retries" validate:"required"` + + // The health check port number. If specified, this overrides the ports specified in the server member resources. + // Specify `null` to remove an existing port value. + Port *int64 `json:"port,omitempty"` + + // The health check timeout in seconds. + Timeout *int64 `json:"timeout" validate:"required"` + + // The protocol type of this load balancer pool health monitor. + Type *string `json:"type" validate:"required"` + + // The health check URL path. Applicable only if the health monitor `type` is `http` or + // `https`. This value must be in the format of an [origin-form request + // target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + URLPath *string `json:"url_path,omitempty"` +} + +// Constants associated with the LoadBalancerPoolHealthMonitorPatch.Type property. +// The protocol type of this load balancer pool health monitor. +const ( + LoadBalancerPoolHealthMonitorPatchTypeHTTPConst = "http" + LoadBalancerPoolHealthMonitorPatchTypeHTTPSConst = "https" + LoadBalancerPoolHealthMonitorPatchTypeTCPConst = "tcp" +) + +// NewLoadBalancerPoolHealthMonitorPatch : Instantiate LoadBalancerPoolHealthMonitorPatch (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolHealthMonitorPatch(delay int64, maxRetries int64, timeout int64, typeVar string) (model *LoadBalancerPoolHealthMonitorPatch, err error) { + model = &LoadBalancerPoolHealthMonitorPatch{ + Delay: core.Int64Ptr(delay), + MaxRetries: core.Int64Ptr(maxRetries), + Timeout: core.Int64Ptr(timeout), + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolHealthMonitorPatch unmarshals an instance of LoadBalancerPoolHealthMonitorPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitorPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitorPatch) + err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolHealthMonitorPrototype : LoadBalancerPoolHealthMonitorPrototype struct +type LoadBalancerPoolHealthMonitorPrototype struct { + // The health check interval in seconds. Interval must be greater than timeout value. + Delay *int64 `json:"delay" validate:"required"` + + // The health check max retries. + MaxRetries *int64 `json:"max_retries" validate:"required"` + + // The health check port number. If specified, this overrides the ports specified in the server member resources. + Port *int64 `json:"port,omitempty"` + + // The health check timeout in seconds. + Timeout *int64 `json:"timeout" validate:"required"` + + // The protocol type of this load balancer pool health monitor. + Type *string `json:"type" validate:"required"` + + // The health check URL path. Applicable only if the health monitor `type` is `http` or + // `https`. This value must be in the format of an [origin-form request + // target](https://tools.ietf.org/html/rfc7230#section-5.3.1). + URLPath *string `json:"url_path,omitempty"` +} + +// Constants associated with the LoadBalancerPoolHealthMonitorPrototype.Type property. +// The protocol type of this load balancer pool health monitor. +const ( + LoadBalancerPoolHealthMonitorPrototypeTypeHTTPConst = "http" + LoadBalancerPoolHealthMonitorPrototypeTypeHTTPSConst = "https" + LoadBalancerPoolHealthMonitorPrototypeTypeTCPConst = "tcp" +) + +// NewLoadBalancerPoolHealthMonitorPrototype : Instantiate LoadBalancerPoolHealthMonitorPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolHealthMonitorPrototype(delay int64, maxRetries int64, timeout int64, typeVar string) (model *LoadBalancerPoolHealthMonitorPrototype, err error) { + model = &LoadBalancerPoolHealthMonitorPrototype{ + Delay: core.Int64Ptr(delay), + MaxRetries: core.Int64Ptr(maxRetries), + Timeout: core.Int64Ptr(timeout), + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolHealthMonitorPrototype unmarshals an instance of LoadBalancerPoolHealthMonitorPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolHealthMonitorPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolHealthMonitorPrototype) + err = core.UnmarshalPrimitive(m, "delay", &obj.Delay) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_retries", &obj.MaxRetries) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url_path", &obj.URLPath) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. +// Models which "extend" this model: +// - LoadBalancerPoolIdentityByID +// - LoadBalancerPoolIdentityByHref +type LoadBalancerPoolIdentity struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerPoolIdentity) isaLoadBalancerPoolIdentity() bool { + return true +} + +type LoadBalancerPoolIdentityIntf interface { + isaLoadBalancerPoolIdentity() bool +} + +// UnmarshalLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerPoolIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentityByName : LoadBalancerPoolIdentityByName struct +type LoadBalancerPoolIdentityByName struct { + // The user-defined name for this load balancer pool. + Name *string `json:"name" validate:"required"` +} + +// NewLoadBalancerPoolIdentityByName : Instantiate LoadBalancerPoolIdentityByName (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityByName(name string) (model *LoadBalancerPoolIdentityByName, err error) { + model = &LoadBalancerPoolIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolIdentityByName unmarshals an instance of LoadBalancerPoolIdentityByName from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMember : LoadBalancerPoolMember struct +type LoadBalancerPoolMember struct { + // The date and time that this member was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // Health of the server member in the pool. + Health *string `json:"health" validate:"required"` + + // The member's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool member. + ID *string `json:"id" validate:"required"` + + // The port number of the application running in the server member. + Port *int64 `json:"port" validate:"required"` + + // The provisioning status of this member. + ProvisioningStatus *string `json:"provisioning_status" validate:"required"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. + Target LoadBalancerPoolMemberTargetIntf `json:"target" validate:"required"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 `json:"weight,omitempty"` +} + +// Constants associated with the LoadBalancerPoolMember.Health property. +// Health of the server member in the pool. +const ( + LoadBalancerPoolMemberHealthFaultedConst = "faulted" + LoadBalancerPoolMemberHealthOkConst = "ok" + LoadBalancerPoolMemberHealthUnknownConst = "unknown" +) + +// Constants associated with the LoadBalancerPoolMember.ProvisioningStatus property. +// The provisioning status of this member. +const ( + LoadBalancerPoolMemberProvisioningStatusActiveConst = "active" + LoadBalancerPoolMemberProvisioningStatusCreatePendingConst = "create_pending" + LoadBalancerPoolMemberProvisioningStatusDeletePendingConst = "delete_pending" + LoadBalancerPoolMemberProvisioningStatusFailedConst = "failed" + LoadBalancerPoolMemberProvisioningStatusMaintenancePendingConst = "maintenance_pending" + LoadBalancerPoolMemberProvisioningStatusUpdatePendingConst = "update_pending" +) + +// UnmarshalLoadBalancerPoolMember unmarshals an instance of LoadBalancerPoolMember from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMember(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMember) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "health", &obj.Health) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "provisioning_status", &obj.ProvisioningStatus) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTarget) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberCollection : LoadBalancerPoolMemberCollection struct +type LoadBalancerPoolMemberCollection struct { + // Collection of members. + Members []LoadBalancerPoolMember `json:"members" validate:"required"` +} + +// UnmarshalLoadBalancerPoolMemberCollection unmarshals an instance of LoadBalancerPoolMemberCollection from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberCollection) + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMember) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberPatch : LoadBalancerPoolMemberPatch struct +type LoadBalancerPoolMemberPatch struct { + // The port number of the application running in the server member. + Port *int64 `json:"port,omitempty"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. + Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target,omitempty"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 `json:"weight,omitempty"` +} + +// UnmarshalLoadBalancerPoolMemberPatch unmarshals an instance of LoadBalancerPoolMemberPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberPatch) + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the LoadBalancerPoolMemberPatch +func (loadBalancerPoolMemberPatch *LoadBalancerPoolMemberPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(loadBalancerPoolMemberPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// LoadBalancerPoolMemberPrototype : LoadBalancerPoolMemberPrototype struct +type LoadBalancerPoolMemberPrototype struct { + // The port number of the application running in the server member. + Port *int64 `json:"port" validate:"required"` + + // The pool member target. Load balancers in the `network` family support virtual server + // instances. Load balancers in the `application` family support IP addresses. + Target LoadBalancerPoolMemberTargetPrototypeIntf `json:"target" validate:"required"` + + // Weight of the server member. Applicable only if the pool algorithm is + // `weighted_round_robin`. + Weight *int64 `json:"weight,omitempty"` +} + +// NewLoadBalancerPoolMemberPrototype : Instantiate LoadBalancerPoolMemberPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberPrototype(port int64, target LoadBalancerPoolMemberTargetPrototypeIntf) (model *LoadBalancerPoolMemberPrototype, err error) { + model = &LoadBalancerPoolMemberPrototype{ + Port: core.Int64Ptr(port), + Target: target, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolMemberPrototype unmarshals an instance of LoadBalancerPoolMemberPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberPrototype) + err = core.UnmarshalPrimitive(m, "port", &obj.Port) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalLoadBalancerPoolMemberTargetPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "weight", &obj.Weight) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberReference : LoadBalancerPoolMemberReference struct +type LoadBalancerPoolMemberReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *LoadBalancerPoolMemberReferenceDeleted `json:"deleted,omitempty"` + + // The member's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool member. + ID *string `json:"id" validate:"required"` +} + +// UnmarshalLoadBalancerPoolMemberReference unmarshals an instance of LoadBalancerPoolMemberReference from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolMemberReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type LoadBalancerPoolMemberReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerPoolMemberReferenceDeleted unmarshals an instance of LoadBalancerPoolMemberReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTarget : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in +// the `application` family support IP addresses. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetInstanceReference +// - LoadBalancerPoolMemberTargetIP +type LoadBalancerPoolMemberTarget struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The user-defined name for this virtual server instance (and default system hostname). + Name *string `json:"name,omitempty"` + + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` +} + +func (*LoadBalancerPoolMemberTarget) isaLoadBalancerPoolMemberTarget() bool { + return true +} + +type LoadBalancerPoolMemberTargetIntf interface { + isaLoadBalancerPoolMemberTarget() bool +} + +// UnmarshalLoadBalancerPoolMemberTarget unmarshals an instance of LoadBalancerPoolMemberTarget from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTarget) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototype : The pool member target. Load balancers in the `network` family support virtual server instances. Load balancers in +// the `application` family support IP addresses. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +// - LoadBalancerPoolMemberTargetPrototypeIP +type LoadBalancerPoolMemberTargetPrototype struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` + + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` +} + +func (*LoadBalancerPoolMemberTargetPrototype) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +type LoadBalancerPoolMemberTargetPrototypeIntf interface { + isaLoadBalancerPoolMemberTargetPrototype() bool +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototype unmarshals an instance of LoadBalancerPoolMemberTargetPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolPatch : LoadBalancerPoolPatch struct +type LoadBalancerPoolPatch struct { + // The load balancing algorithm. + Algorithm *string `json:"algorithm,omitempty"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitorPatch `json:"health_monitor,omitempty"` + + // The user-defined name for this load balancer pool. + Name *string `json:"name,omitempty"` + + // The protocol used for this load balancer pool. + // + // The enumerated values for this property are expected to expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the + // unexpected property value was encountered. + Protocol *string `json:"protocol,omitempty"` + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string `json:"proxy_protocol,omitempty"` + + // The session persistence of this pool. + SessionPersistence *LoadBalancerPoolSessionPersistencePatch `json:"session_persistence,omitempty"` +} + +// Constants associated with the LoadBalancerPoolPatch.Algorithm property. +// The load balancing algorithm. +const ( + LoadBalancerPoolPatchAlgorithmLeastConnectionsConst = "least_connections" + LoadBalancerPoolPatchAlgorithmRoundRobinConst = "round_robin" + LoadBalancerPoolPatchAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the LoadBalancerPoolPatch.Protocol property. +// The protocol used for this load balancer pool. +// +// The enumerated values for this property are expected to expand in the future. When processing this property, check +// for and log unknown values. Optionally halt processing and surface the error, or bypass the pool on which the +// unexpected property value was encountered. +const ( + LoadBalancerPoolPatchProtocolHTTPConst = "http" + LoadBalancerPoolPatchProtocolHTTPSConst = "https" + LoadBalancerPoolPatchProtocolTCPConst = "tcp" +) + +// Constants associated with the LoadBalancerPoolPatch.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + LoadBalancerPoolPatchProxyProtocolDisabledConst = "disabled" + LoadBalancerPoolPatchProxyProtocolV1Const = "v1" + LoadBalancerPoolPatchProxyProtocolV2Const = "v2" +) + +// UnmarshalLoadBalancerPoolPatch unmarshals an instance of LoadBalancerPoolPatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolPatch) + err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePatch) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the LoadBalancerPoolPatch +func (loadBalancerPoolPatch *LoadBalancerPoolPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(loadBalancerPoolPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// LoadBalancerPoolPrototype : LoadBalancerPoolPrototype struct +type LoadBalancerPoolPrototype struct { + // The load balancing algorithm. + Algorithm *string `json:"algorithm" validate:"required"` + + // The health monitor of this pool. + HealthMonitor *LoadBalancerPoolHealthMonitorPrototype `json:"health_monitor" validate:"required"` + + // The members for this load balancer pool. For load balancers in the `network` family, the same `port` and `target` + // tuple cannot be shared by a pool member of any other load balancer in the same VPC. + Members []LoadBalancerPoolMemberPrototype `json:"members,omitempty"` + + // The user-defined name for this load balancer pool. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp`. Load balancers + // in the `application` family support `tcp`, `http`, and + // `https`. + Protocol *string `json:"protocol" validate:"required"` + + // The PROXY protocol setting for this pool: + // - `v1`: Enabled with version 1 (human-readable header format) + // - `v2`: Enabled with version 2 (binary header format) + // - `disabled`: Disabled + // + // Supported by load balancers in the `application` family (otherwise always `disabled`). + ProxyProtocol *string `json:"proxy_protocol,omitempty"` + + // The session persistence of this pool. + SessionPersistence *LoadBalancerPoolSessionPersistencePrototype `json:"session_persistence,omitempty"` +} + +// Constants associated with the LoadBalancerPoolPrototype.Algorithm property. +// The load balancing algorithm. +const ( + LoadBalancerPoolPrototypeAlgorithmLeastConnectionsConst = "least_connections" + LoadBalancerPoolPrototypeAlgorithmRoundRobinConst = "round_robin" + LoadBalancerPoolPrototypeAlgorithmWeightedRoundRobinConst = "weighted_round_robin" +) + +// Constants associated with the LoadBalancerPoolPrototype.Protocol property. +// The protocol used for this load balancer pool. Load balancers in the `network` family support `tcp`. Load balancers +// in the `application` family support `tcp`, `http`, and +// `https`. +const ( + LoadBalancerPoolPrototypeProtocolHTTPConst = "http" + LoadBalancerPoolPrototypeProtocolHTTPSConst = "https" + LoadBalancerPoolPrototypeProtocolTCPConst = "tcp" +) + +// Constants associated with the LoadBalancerPoolPrototype.ProxyProtocol property. +// The PROXY protocol setting for this pool: +// - `v1`: Enabled with version 1 (human-readable header format) +// - `v2`: Enabled with version 2 (binary header format) +// - `disabled`: Disabled +// +// Supported by load balancers in the `application` family (otherwise always `disabled`). +const ( + LoadBalancerPoolPrototypeProxyProtocolDisabledConst = "disabled" + LoadBalancerPoolPrototypeProxyProtocolV1Const = "v1" + LoadBalancerPoolPrototypeProxyProtocolV2Const = "v2" +) + +// NewLoadBalancerPoolPrototype : Instantiate LoadBalancerPoolPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolPrototype(algorithm string, healthMonitor *LoadBalancerPoolHealthMonitorPrototype, protocol string) (model *LoadBalancerPoolPrototype, err error) { + model = &LoadBalancerPoolPrototype{ + Algorithm: core.StringPtr(algorithm), + HealthMonitor: healthMonitor, + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolPrototype unmarshals an instance of LoadBalancerPoolPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolPrototype) + err = core.UnmarshalPrimitive(m, "algorithm", &obj.Algorithm) + if err != nil { + return + } + err = core.UnmarshalModel(m, "health_monitor", &obj.HealthMonitor, UnmarshalLoadBalancerPoolHealthMonitorPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalLoadBalancerPoolMemberPrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "proxy_protocol", &obj.ProxyProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "session_persistence", &obj.SessionPersistence, UnmarshalLoadBalancerPoolSessionPersistencePrototype) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolReference : LoadBalancerPoolReference struct +type LoadBalancerPoolReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this load balancer pool. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalLoadBalancerPoolReference unmarshals an instance of LoadBalancerPoolReference from the specified map of raw messages. +func UnmarshalLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type LoadBalancerPoolReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerPoolReferenceDeleted unmarshals an instance of LoadBalancerPoolReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerPoolReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolSessionPersistence : LoadBalancerPoolSessionPersistence struct +type LoadBalancerPoolSessionPersistence struct { + // The session persistence type. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerPoolSessionPersistence.Type property. +// The session persistence type. +const ( + LoadBalancerPoolSessionPersistenceTypeSourceIPConst = "source_ip" +) + +// UnmarshalLoadBalancerPoolSessionPersistence unmarshals an instance of LoadBalancerPoolSessionPersistence from the specified map of raw messages. +func UnmarshalLoadBalancerPoolSessionPersistence(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolSessionPersistence) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolSessionPersistencePatch : LoadBalancerPoolSessionPersistencePatch struct +type LoadBalancerPoolSessionPersistencePatch struct { + // The session persistence type. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerPoolSessionPersistencePatch.Type property. +// The session persistence type. +const ( + LoadBalancerPoolSessionPersistencePatchTypeSourceIPConst = "source_ip" +) + +// NewLoadBalancerPoolSessionPersistencePatch : Instantiate LoadBalancerPoolSessionPersistencePatch (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolSessionPersistencePatch(typeVar string) (model *LoadBalancerPoolSessionPersistencePatch, err error) { + model = &LoadBalancerPoolSessionPersistencePatch{ + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolSessionPersistencePatch unmarshals an instance of LoadBalancerPoolSessionPersistencePatch from the specified map of raw messages. +func UnmarshalLoadBalancerPoolSessionPersistencePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolSessionPersistencePatch) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolSessionPersistencePrototype : LoadBalancerPoolSessionPersistencePrototype struct +type LoadBalancerPoolSessionPersistencePrototype struct { + // The session persistence type. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerPoolSessionPersistencePrototype.Type property. +// The session persistence type. +const ( + LoadBalancerPoolSessionPersistencePrototypeTypeSourceIPConst = "source_ip" +) + +// NewLoadBalancerPoolSessionPersistencePrototype : Instantiate LoadBalancerPoolSessionPersistencePrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolSessionPersistencePrototype(typeVar string) (model *LoadBalancerPoolSessionPersistencePrototype, err error) { + model = &LoadBalancerPoolSessionPersistencePrototype{ + Type: core.StringPtr(typeVar), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalLoadBalancerPoolSessionPersistencePrototype unmarshals an instance of LoadBalancerPoolSessionPersistencePrototype from the specified map of raw messages. +func UnmarshalLoadBalancerPoolSessionPersistencePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolSessionPersistencePrototype) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfile : LoadBalancerProfile struct +type LoadBalancerProfile struct { + // The product family this load balancer profile belongs to. + Family *string `json:"family" validate:"required"` + + // The URL for this load balancer profile. + Href *string `json:"href" validate:"required"` + + // Indicates which logging type(s) are supported for a load balancer with this profile. + LoggingSupported *LoadBalancerProfileLoggingSupported `json:"logging_supported" validate:"required"` + + // The globally unique name for this load balancer profile. + Name *string `json:"name" validate:"required"` + + SecurityGroupsSupported LoadBalancerProfileSecurityGroupsSupportedIntf `json:"security_groups_supported" validate:"required"` +} + +// UnmarshalLoadBalancerProfile unmarshals an instance of LoadBalancerProfile from the specified map of raw messages. +func UnmarshalLoadBalancerProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfile) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "logging_supported", &obj.LoggingSupported, UnmarshalLoadBalancerProfileLoggingSupported) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups_supported", &obj.SecurityGroupsSupported, UnmarshalLoadBalancerProfileSecurityGroupsSupported) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileCollection : LoadBalancerProfileCollection struct +type LoadBalancerProfileCollection struct { + // A link to the first page of resources. + First *LoadBalancerProfileCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *LoadBalancerProfileCollectionNext `json:"next,omitempty"` + + // Collection of load balancer profiles. + Profiles []LoadBalancerProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalLoadBalancerProfileCollection unmarshals an instance of LoadBalancerProfileCollection from the specified map of raw messages. +func UnmarshalLoadBalancerProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalLoadBalancerProfileCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalLoadBalancerProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalLoadBalancerProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileCollectionFirst : A link to the first page of resources. +type LoadBalancerProfileCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalLoadBalancerProfileCollectionFirst unmarshals an instance of LoadBalancerProfileCollectionFirst from the specified map of raw messages. +func UnmarshalLoadBalancerProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type LoadBalancerProfileCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalLoadBalancerProfileCollectionNext unmarshals an instance of LoadBalancerProfileCollectionNext from the specified map of raw messages. +func UnmarshalLoadBalancerProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileIdentity : Identifies a load balancer profile by a unique property. +// Models which "extend" this model: +// - LoadBalancerProfileIdentityByName +// - LoadBalancerProfileIdentityByHref +type LoadBalancerProfileIdentity struct { + // The globally unique name for this load balancer profile. + Name *string `json:"name,omitempty"` + + // The URL for this load balancer profile. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerProfileIdentity) isaLoadBalancerProfileIdentity() bool { + return true +} + +type LoadBalancerProfileIdentityIntf interface { + isaLoadBalancerProfileIdentity() bool +} + +// UnmarshalLoadBalancerProfileIdentity unmarshals an instance of LoadBalancerProfileIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileLoggingSupported : Indicates which logging type(s) are supported for a load balancer with this profile. +type LoadBalancerProfileLoggingSupported struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The supported logging type(s) for a load balancer with this profile. + Value []string `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileLoggingSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileLoggingSupportedTypeFixedConst = "fixed" +) + +// UnmarshalLoadBalancerProfileLoggingSupported unmarshals an instance of LoadBalancerProfileLoggingSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileLoggingSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileLoggingSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileReference : LoadBalancerProfileReference struct +type LoadBalancerProfileReference struct { + // The product family this load balancer profile belongs to. + Family *string `json:"family" validate:"required"` + + // The URL for this load balancer profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this load balancer profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalLoadBalancerProfileReference unmarshals an instance of LoadBalancerProfileReference from the specified map of raw messages. +func UnmarshalLoadBalancerProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileReference) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileSecurityGroupsSupported : LoadBalancerProfileSecurityGroupsSupported struct +// Models which "extend" this model: +// - LoadBalancerProfileSecurityGroupsSupportedFixed +// - LoadBalancerProfileSecurityGroupsSupportedDependent +type LoadBalancerProfileSecurityGroupsSupported struct { + // The type for this profile field. + Type *string `json:"type,omitempty"` + + // The value for this profile field. + Value *bool `json:"value,omitempty"` +} + +// Constants associated with the LoadBalancerProfileSecurityGroupsSupported.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSecurityGroupsSupportedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileSecurityGroupsSupported) isaLoadBalancerProfileSecurityGroupsSupported() bool { + return true +} + +type LoadBalancerProfileSecurityGroupsSupportedIntf interface { + isaLoadBalancerProfileSecurityGroupsSupported() bool +} + +// UnmarshalLoadBalancerProfileSecurityGroupsSupported unmarshals an instance of LoadBalancerProfileSecurityGroupsSupported from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSecurityGroupsSupported(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSecurityGroupsSupported) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type LoadBalancerReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalLoadBalancerReferenceDeleted unmarshals an instance of LoadBalancerReferenceDeleted from the specified map of raw messages. +func UnmarshalLoadBalancerReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerStatistics : LoadBalancerStatistics struct +type LoadBalancerStatistics struct { + // Number of active connections of this load balancer. + ActiveConnections *int64 `json:"active_connections" validate:"required"` + + // Current connection rate (connections per second) of this load balancer. + ConnectionRate *float32 `json:"connection_rate" validate:"required"` + + // Total number of data processed (bytes) of this load balancer within current calendar month. + DataProcessedThisMonth *int64 `json:"data_processed_this_month" validate:"required"` + + // Current throughput (Mbps) of this load balancer. + Throughput *float32 `json:"throughput" validate:"required"` +} + +// UnmarshalLoadBalancerStatistics unmarshals an instance of LoadBalancerStatistics from the specified map of raw messages. +func UnmarshalLoadBalancerStatistics(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerStatistics) + err = core.UnmarshalPrimitive(m, "active_connections", &obj.ActiveConnections) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "connection_rate", &obj.ConnectionRate) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "data_processed_this_month", &obj.DataProcessedThisMonth) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "throughput", &obj.Throughput) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACL : NetworkACL struct +type NetworkACL struct { + // The date and time that the network ACL was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` + + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network ACL. + Name *string `json:"name" validate:"required"` + + // The resource group for this network ACL. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The ordered rules for this network ACL. If no rules exist, all traffic will be denied. + Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` + + // The subnets to which this network ACL is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` + + // The VPC this network ACL is a part of. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalNetworkACL unmarshals an instance of NetworkACL from the specified map of raw messages. +func UnmarshalNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACL) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLCollection : NetworkACLCollection struct +type NetworkACLCollection struct { + // A link to the first page of resources. + First *NetworkACLCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of network ACLs. + NetworkAcls []NetworkACL `json:"network_acls" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *NetworkACLCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalNetworkACLCollection unmarshals an instance of NetworkACLCollection from the specified map of raw messages. +func UnmarshalNetworkACLCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalNetworkACLCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acls", &obj.NetworkAcls, UnmarshalNetworkACL) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLCollectionFirst : A link to the first page of resources. +type NetworkACLCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalNetworkACLCollectionFirst unmarshals an instance of NetworkACLCollectionFirst from the specified map of raw messages. +func UnmarshalNetworkACLCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type NetworkACLCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalNetworkACLCollectionNext unmarshals an instance of NetworkACLCollectionNext from the specified map of raw messages. +func UnmarshalNetworkACLCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLIdentity : Identifies a network ACL by a unique property. +// Models which "extend" this model: +// - NetworkACLIdentityByID +// - NetworkACLIdentityByCRN +// - NetworkACLIdentityByHref +type NetworkACLIdentity struct { + // The unique identifier for this network ACL. + ID *string `json:"id,omitempty"` + + // The CRN for this network ACL. + CRN *string `json:"crn,omitempty"` + + // The URL for this network ACL. + Href *string `json:"href,omitempty"` +} + +func (*NetworkACLIdentity) isaNetworkACLIdentity() bool { + return true +} + +type NetworkACLIdentityIntf interface { + isaNetworkACLIdentity() bool +} + +// UnmarshalNetworkACLIdentity unmarshals an instance of NetworkACLIdentity from the specified map of raw messages. +func UnmarshalNetworkACLIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLPatch : NetworkACLPatch struct +type NetworkACLPatch struct { + // The user-defined name for this network ACL. Names must be unique within the VPC the network ACL resides in. + Name *string `json:"name,omitempty"` +} + +// UnmarshalNetworkACLPatch unmarshals an instance of NetworkACLPatch from the specified map of raw messages. +func UnmarshalNetworkACLPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the NetworkACLPatch +func (networkACLPatch *NetworkACLPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(networkACLPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// NetworkACLPrototype : NetworkACLPrototype struct +// Models which "extend" this model: +// - NetworkACLPrototypeNetworkACLByRules +// - NetworkACLPrototypeNetworkACLBySourceNetworkACL +type NetworkACLPrototype struct { + // The user-defined name for this network ACL. Names must be unique within the VPC the network ACL resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The VPC this network ACL is to be a part of. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // Array of prototype objects for rules to create along with this network ACL. If unspecified, no rules will be + // created, resulting in all traffic being denied. + Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` + + // Network ACL to copy rules from. + SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl,omitempty"` +} + +func (*NetworkACLPrototype) isaNetworkACLPrototype() bool { + return true +} + +type NetworkACLPrototypeIntf interface { + isaNetworkACLPrototype() bool +} + +// UnmarshalNetworkACLPrototype unmarshals an instance of NetworkACLPrototype from the specified map of raw messages. +func UnmarshalNetworkACLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLReference : NetworkACLReference struct +type NetworkACLReference struct { + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *NetworkACLReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network ACL. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalNetworkACLReference unmarshals an instance of NetworkACLReference from the specified map of raw messages. +func UnmarshalNetworkACLReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type NetworkACLReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkACLReferenceDeleted unmarshals an instance of NetworkACLReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkACLReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRule : NetworkACLRule struct +// Models which "extend" this model: +// - NetworkACLRuleNetworkACLRuleProtocolTcpudp +// - NetworkACLRuleNetworkACLRuleProtocolIcmp +// - NetworkACLRuleNetworkACLRuleProtocolAll +type NetworkACLRule struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to allow. If unspecified, all codes are allowed. This can only be specified if type is also + // specified. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to allow. If unspecified, all types are allowed by this rule. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRule.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRuleActionAllowConst = "allow" + NetworkACLRuleActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRule.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRuleDirectionInboundConst = "inbound" + NetworkACLRuleDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRule.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleIPVersionIpv4Const = "ipv4" + NetworkACLRuleIPVersionIpv6Const = "ipv6" +) + +func (*NetworkACLRule) isaNetworkACLRule() bool { + return true +} + +type NetworkACLRuleIntf interface { + isaNetworkACLRule() bool +} + +// UnmarshalNetworkACLRule unmarshals an instance of NetworkACLRule from the specified map of raw messages. +func UnmarshalNetworkACLRule(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "protocol", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRuleBeforePatch : The rule to move this rule immediately before. Specify `null` to move this rule after all existing rules. +// Models which "extend" this model: +// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID +// - NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref +type NetworkACLRuleBeforePatch struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id,omitempty"` + + // The URL for this network ACL rule. + Href *string `json:"href,omitempty"` +} + +func (*NetworkACLRuleBeforePatch) isaNetworkACLRuleBeforePatch() bool { + return true +} + +type NetworkACLRuleBeforePatchIntf interface { + isaNetworkACLRuleBeforePatch() bool +} + +// UnmarshalNetworkACLRuleBeforePatch unmarshals an instance of NetworkACLRuleBeforePatch from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePatch) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePrototype : The rule to insert this rule immediately before. If omitted, this rule will be inserted after all existing rules. +// Models which "extend" this model: +// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID +// - NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref +type NetworkACLRuleBeforePrototype struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id,omitempty"` + + // The URL for this network ACL rule. + Href *string `json:"href,omitempty"` +} + +func (*NetworkACLRuleBeforePrototype) isaNetworkACLRuleBeforePrototype() bool { + return true +} + +type NetworkACLRuleBeforePrototypeIntf interface { + isaNetworkACLRuleBeforePrototype() bool +} + +// UnmarshalNetworkACLRuleBeforePrototype unmarshals an instance of NetworkACLRuleBeforePrototype from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleCollection : NetworkACLRuleCollection struct +type NetworkACLRuleCollection struct { + // A link to the first page of resources. + First *NetworkACLRuleCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *NetworkACLRuleCollectionNext `json:"next,omitempty"` + + // Ordered collection of network ACL rules. + Rules []NetworkACLRuleItemIntf `json:"rules" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalNetworkACLRuleCollection unmarshals an instance of NetworkACLRuleCollection from the specified map of raw messages. +func UnmarshalNetworkACLRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalNetworkACLRuleCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkACLRuleCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRuleItem) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleCollectionFirst : A link to the first page of resources. +type NetworkACLRuleCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalNetworkACLRuleCollectionFirst unmarshals an instance of NetworkACLRuleCollectionFirst from the specified map of raw messages. +func UnmarshalNetworkACLRuleCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type NetworkACLRuleCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalNetworkACLRuleCollectionNext unmarshals an instance of NetworkACLRuleCollectionNext from the specified map of raw messages. +func UnmarshalNetworkACLRuleCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItem : NetworkACLRuleItem struct +// Models which "extend" this model: +// - NetworkACLRuleItemNetworkACLRuleProtocolTcpudp +// - NetworkACLRuleItemNetworkACLRuleProtocolIcmp +// - NetworkACLRuleItemNetworkACLRuleProtocolAll +type NetworkACLRuleItem struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always + // refers to the next item in the collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to allow. If unspecified, all codes are allowed. This can only be specified if type is also + // specified. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to allow. If unspecified, all types are allowed by this rule. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRuleItem.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRuleItemActionAllowConst = "allow" + NetworkACLRuleItemActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItem.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRuleItemDirectionInboundConst = "inbound" + NetworkACLRuleItemDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItem.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemIPVersionIpv4Const = "ipv4" + NetworkACLRuleItemIPVersionIpv6Const = "ipv6" +) + +func (*NetworkACLRuleItem) isaNetworkACLRuleItem() bool { + return true +} + +type NetworkACLRuleItemIntf interface { + isaNetworkACLRuleItem() bool +} + +// UnmarshalNetworkACLRuleItem unmarshals an instance of NetworkACLRuleItem from the specified map of raw messages. +func UnmarshalNetworkACLRuleItem(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "protocol", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRulePatch : NetworkACLRulePatch struct +type NetworkACLRulePatch struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action,omitempty"` + + // The rule to move this rule immediately before. Specify `null` to move this rule after + // all existing rules. + Before NetworkACLRuleBeforePatchIntf `json:"before,omitempty"` + + // The ICMP traffic code to allow. + Code *int64 `json:"code,omitempty"` + + // The destination IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination,omitempty"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction,omitempty"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic type to allow. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePatch.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRulePatchActionAllowConst = "allow" + NetworkACLRulePatchActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePatch.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRulePatchDirectionInboundConst = "inbound" + NetworkACLRulePatchDirectionOutboundConst = "outbound" +) + +// UnmarshalNetworkACLRulePatch unmarshals an instance of NetworkACLRulePatch from the specified map of raw messages. +func UnmarshalNetworkACLRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePatch) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the NetworkACLRulePatch +func (networkACLRulePatch *NetworkACLRulePatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(networkACLRulePatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// NetworkACLRulePrototype : NetworkACLRulePrototype struct +// Models which "extend" this model: +// - NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp +// - NetworkACLRulePrototypeNetworkACLRuleProtocolIcmp +// - NetworkACLRulePrototypeNetworkACLRuleProtocolAll +type NetworkACLRulePrototype struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + // The rule to insert this rule immediately before. If omitted, this rule will be + // inserted after all existing rules. + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to allow. If unspecified, all codes are allowed. This can only be specified if type is also + // specified. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to allow. If unspecified, all types are allowed by this rule. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototype.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRulePrototypeActionAllowConst = "allow" + NetworkACLRulePrototypeActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototype.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRulePrototypeDirectionInboundConst = "inbound" + NetworkACLRulePrototypeDirectionOutboundConst = "outbound" +) + +func (*NetworkACLRulePrototype) isaNetworkACLRulePrototype() bool { + return true +} + +type NetworkACLRulePrototypeIntf interface { + isaNetworkACLRulePrototype() bool +} + +// UnmarshalNetworkACLRulePrototype unmarshals an instance of NetworkACLRulePrototype from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "protocol", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRulePrototypeNetworkACLContext : NetworkACLRulePrototypeNetworkACLContext struct +// Models which "extend" this model: +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp +// - NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll +type NetworkACLRulePrototypeNetworkACLContext struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The source IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` + + // The ICMP traffic code to allow. If unspecified, all codes are allowed. This can only be specified if type is also + // specified. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to allow. If unspecified, all types are allowed by this rule. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRulePrototypeNetworkACLContextActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContext.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRulePrototypeNetworkACLContextDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextDirectionOutboundConst = "outbound" +) + +func (*NetworkACLRulePrototypeNetworkACLContext) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +type NetworkACLRulePrototypeNetworkACLContextIntf interface { + isaNetworkACLRulePrototypeNetworkACLContext() bool +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContext unmarshals an instance of NetworkACLRulePrototypeNetworkACLContext from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContext(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "protocol", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// NetworkACLRuleReference : NetworkACLRuleReference struct +type NetworkACLRuleReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *NetworkACLRuleReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network ACL rule. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalNetworkACLRuleReference unmarshals an instance of NetworkACLRuleReference from the specified map of raw messages. +func UnmarshalNetworkACLRuleReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkACLRuleReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type NetworkACLRuleReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkACLRuleReferenceDeleted unmarshals an instance of NetworkACLRuleReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkACLRuleReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterface : NetworkInterface struct +type NetworkInterface struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing" validate:"required"` + + // The date and time that the network interface was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // Array of references to floating IPs associated with this network interface. + FloatingIps []FloatingIPReference `json:"floating_ips,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + // The network interface port speed in Mbps. + PortSpeed *int64 `json:"port_speed" validate:"required"` + + // The primary IPv4 address. + PrimaryIpv4Address *string `json:"primary_ipv4_address" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Collection of security groups. + SecurityGroups []SecurityGroupReference `json:"security_groups" validate:"required"` + + // The status of the network interface. + Status *string `json:"status" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // The type of this network interface as it relates to an instance. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the NetworkInterface.ResourceType property. +// The resource type. +const ( + NetworkInterfaceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// Constants associated with the NetworkInterface.Status property. +// The status of the network interface. +const ( + NetworkInterfaceStatusAvailableConst = "available" + NetworkInterfaceStatusDeletingConst = "deleting" + NetworkInterfaceStatusFailedConst = "failed" + NetworkInterfaceStatusPendingConst = "pending" +) + +// Constants associated with the NetworkInterface.Type property. +// The type of this network interface as it relates to an instance. +const ( + NetworkInterfaceTypePrimaryConst = "primary" + NetworkInterfaceTypeSecondaryConst = "secondary" +) + +// UnmarshalNetworkInterface unmarshals an instance of NetworkInterface from the specified map of raw messages. +func UnmarshalNetworkInterface(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterface) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ips", &obj.FloatingIps, UnmarshalFloatingIPReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_speed", &obj.PortSpeed) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "primary_ipv4_address", &obj.PrimaryIpv4Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceCollection : NetworkInterfaceCollection struct +type NetworkInterfaceCollection struct { + // A link to the first page of resources. + First *NetworkInterfaceCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // Collection of network interfaces. + NetworkInterfaces []NetworkInterface `json:"network_interfaces" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *NetworkInterfaceCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalNetworkInterfaceCollection unmarshals an instance of NetworkInterfaceCollection from the specified map of raw messages. +func UnmarshalNetworkInterfaceCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalNetworkInterfaceCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterface) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalNetworkInterfaceCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceCollectionFirst : A link to the first page of resources. +type NetworkInterfaceCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalNetworkInterfaceCollectionFirst unmarshals an instance of NetworkInterfaceCollectionFirst from the specified map of raw messages. +func UnmarshalNetworkInterfaceCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type NetworkInterfaceCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalNetworkInterfaceCollectionNext unmarshals an instance of NetworkInterfaceCollectionNext from the specified map of raw messages. +func UnmarshalNetworkInterfaceCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceInstanceContextReference : NetworkInterfaceInstanceContextReference struct +type NetworkInterfaceInstanceContextReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *NetworkInterfaceInstanceContextReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + // The primary IPv4 address. + PrimaryIpv4Address *string `json:"primary_ipv4_address" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The associated subnet. + Subnet *SubnetReference `json:"subnet" validate:"required"` +} + +// Constants associated with the NetworkInterfaceInstanceContextReference.ResourceType property. +// The resource type. +const ( + NetworkInterfaceInstanceContextReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// UnmarshalNetworkInterfaceInstanceContextReference unmarshals an instance of NetworkInterfaceInstanceContextReference from the specified map of raw messages. +func UnmarshalNetworkInterfaceInstanceContextReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceInstanceContextReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceInstanceContextReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "primary_ipv4_address", &obj.PrimaryIpv4Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceInstanceContextReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type NetworkInterfaceInstanceContextReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkInterfaceInstanceContextReferenceDeleted unmarshals an instance of NetworkInterfaceInstanceContextReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceInstanceContextReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceInstanceContextReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfacePatch : NetworkInterfacePatch struct +type NetworkInterfacePatch struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // The user-defined name for this network interface. + Name *string `json:"name,omitempty"` +} + +// UnmarshalNetworkInterfacePatch unmarshals an instance of NetworkInterfacePatch from the specified map of raw messages. +func UnmarshalNetworkInterfacePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfacePatch) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the NetworkInterfacePatch +func (networkInterfacePatch *NetworkInterfacePatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(networkInterfacePatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// NetworkInterfacePrototype : NetworkInterfacePrototype struct +type NetworkInterfacePrototype struct { + // Indicates whether source IP spoofing is allowed on this interface. If false, source IP spoofing is prevented on this + // interface. If true, source IP spoofing is allowed on this interface. + AllowIPSpoofing *bool `json:"allow_ip_spoofing,omitempty"` + + // The user-defined name for this network interface. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The primary IPv4 address. If specified, it must be an available address on the network interface's subnet. If + // unspecified, an available address on the subnet will be automatically selected. + PrimaryIpv4Address *string `json:"primary_ipv4_address,omitempty"` + + // Collection of security groups. + SecurityGroups []SecurityGroupIdentityIntf `json:"security_groups,omitempty"` + + // The associated subnet. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` +} + +// NewNetworkInterfacePrototype : Instantiate NetworkInterfacePrototype (Generic Model Constructor) +func (*VpcV1) NewNetworkInterfacePrototype(subnet SubnetIdentityIntf) (model *NetworkInterfacePrototype, err error) { + model = &NetworkInterfacePrototype{ + Subnet: subnet, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalNetworkInterfacePrototype unmarshals an instance of NetworkInterfacePrototype from the specified map of raw messages. +func UnmarshalNetworkInterfacePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfacePrototype) + err = core.UnmarshalPrimitive(m, "allow_ip_spoofing", &obj.AllowIPSpoofing) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "primary_ipv4_address", &obj.PrimaryIpv4Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceReference : NetworkInterfaceReference struct +type NetworkInterfaceReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + // The primary IPv4 address. + PrimaryIpv4Address *string `json:"primary_ipv4_address" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the NetworkInterfaceReference.ResourceType property. +// The resource type. +const ( + NetworkInterfaceReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +// UnmarshalNetworkInterfaceReference unmarshals an instance of NetworkInterfaceReference from the specified map of raw messages. +func UnmarshalNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "primary_ipv4_address", &obj.PrimaryIpv4Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type NetworkInterfaceReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkInterfaceReferenceDeleted unmarshals an instance of NetworkInterfaceReferenceDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceReferenceTargetContextDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type NetworkInterfaceReferenceTargetContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalNetworkInterfaceReferenceTargetContextDeleted unmarshals an instance of NetworkInterfaceReferenceTargetContextDeleted from the specified map of raw messages. +func UnmarshalNetworkInterfaceReferenceTargetContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceReferenceTargetContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkInterfaceUnpaginatedCollection : NetworkInterfaceUnpaginatedCollection struct +type NetworkInterfaceUnpaginatedCollection struct { + // Collection of network interfaces. + NetworkInterfaces []NetworkInterface `json:"network_interfaces" validate:"required"` +} + +// UnmarshalNetworkInterfaceUnpaginatedCollection unmarshals an instance of NetworkInterfaceUnpaginatedCollection from the specified map of raw messages. +func UnmarshalNetworkInterfaceUnpaginatedCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkInterfaceUnpaginatedCollection) + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterface) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystem : OperatingSystem struct +type OperatingSystem struct { + // The operating system architecture. + Architecture *string `json:"architecture" validate:"required"` + + // Images with this operating system can only be used on dedicated hosts or dedicated host groups. + DedicatedHostOnly *bool `json:"dedicated_host_only" validate:"required"` + + // A unique, display-friendly name for the operating system. + DisplayName *string `json:"display_name" validate:"required"` + + // The name of the software family this operating system belongs to. + Family *string `json:"family" validate:"required"` + + // The URL for this operating system. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this operating system. + Name *string `json:"name" validate:"required"` + + // The vendor of the operating system. + Vendor *string `json:"vendor" validate:"required"` + + // The major release version of this operating system. + Version *string `json:"version" validate:"required"` +} + +// UnmarshalOperatingSystem unmarshals an instance of OperatingSystem from the specified map of raw messages. +func UnmarshalOperatingSystem(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystem) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "dedicated_host_only", &obj.DedicatedHostOnly) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "display_name", &obj.DisplayName) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "vendor", &obj.Vendor) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "version", &obj.Version) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemCollection : OperatingSystemCollection struct +type OperatingSystemCollection struct { + // A link to the first page of resources. + First *OperatingSystemCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *OperatingSystemCollectionNext `json:"next,omitempty"` + + // Collection of operating systems. + OperatingSystems []OperatingSystem `json:"operating_systems" validate:"required"` +} + +// UnmarshalOperatingSystemCollection unmarshals an instance of OperatingSystemCollection from the specified map of raw messages. +func UnmarshalOperatingSystemCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalOperatingSystemCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalOperatingSystemCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_systems", &obj.OperatingSystems, UnmarshalOperatingSystem) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemCollectionFirst : A link to the first page of resources. +type OperatingSystemCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalOperatingSystemCollectionFirst unmarshals an instance of OperatingSystemCollectionFirst from the specified map of raw messages. +func UnmarshalOperatingSystemCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type OperatingSystemCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalOperatingSystemCollectionNext unmarshals an instance of OperatingSystemCollectionNext from the specified map of raw messages. +func UnmarshalOperatingSystemCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemIdentity : Identifies an operating system by a unique property. +// Models which "extend" this model: +// - OperatingSystemIdentityByName +// - OperatingSystemIdentityByHref +type OperatingSystemIdentity struct { + // The globally unique name for this operating system. + Name *string `json:"name,omitempty"` + + // The URL for this operating system. + Href *string `json:"href,omitempty"` +} + +func (*OperatingSystemIdentity) isaOperatingSystemIdentity() bool { + return true +} + +type OperatingSystemIdentityIntf interface { + isaOperatingSystemIdentity() bool +} + +// UnmarshalOperatingSystemIdentity unmarshals an instance of OperatingSystemIdentity from the specified map of raw messages. +func UnmarshalOperatingSystemIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGateway : PublicGateway struct +type PublicGateway struct { + // The date and time that the public gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` + + // Reference to the floating IP which is bound to this public gateway. + FloatingIP *PublicGatewayFloatingIP `json:"floating_ip" validate:"required"` + + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this public gateway. + Name *string `json:"name" validate:"required"` + + // The resource group for this public gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the volume. + Status *string `json:"status" validate:"required"` + + // The VPC this public gateway serves. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this public gateway resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the PublicGateway.ResourceType property. +// The resource type. +const ( + PublicGatewayResourceTypePublicGatewayConst = "public_gateway" +) + +// Constants associated with the PublicGateway.Status property. +// The status of the volume. +const ( + PublicGatewayStatusAvailableConst = "available" + PublicGatewayStatusDeletingConst = "deleting" + PublicGatewayStatusFailedConst = "failed" + PublicGatewayStatusPendingConst = "pending" +) + +// UnmarshalPublicGateway unmarshals an instance of PublicGateway from the specified map of raw messages. +func UnmarshalPublicGateway(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGateway) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "floating_ip", &obj.FloatingIP, UnmarshalPublicGatewayFloatingIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayCollection : PublicGatewayCollection struct +type PublicGatewayCollection struct { + // A link to the first page of resources. + First *PublicGatewayCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *PublicGatewayCollectionNext `json:"next,omitempty"` + + // Collection of public gateways. + PublicGateways []PublicGateway `json:"public_gateways" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalPublicGatewayCollection unmarshals an instance of PublicGatewayCollection from the specified map of raw messages. +func UnmarshalPublicGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalPublicGatewayCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalPublicGatewayCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateways", &obj.PublicGateways, UnmarshalPublicGateway) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayCollectionFirst : A link to the first page of resources. +type PublicGatewayCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalPublicGatewayCollectionFirst unmarshals an instance of PublicGatewayCollectionFirst from the specified map of raw messages. +func UnmarshalPublicGatewayCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type PublicGatewayCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalPublicGatewayCollectionNext unmarshals an instance of PublicGatewayCollectionNext from the specified map of raw messages. +func UnmarshalPublicGatewayCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIP : Reference to the floating IP which is bound to this public gateway. +type PublicGatewayFloatingIP struct { + // The globally unique IP address. + Address *string `json:"address" validate:"required"` + + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *FloatingIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this floating IP. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalPublicGatewayFloatingIP unmarshals an instance of PublicGatewayFloatingIP from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalFloatingIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototype : PublicGatewayFloatingIPPrototype struct +// Models which "extend" this model: +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentity +// - PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext +type PublicGatewayFloatingIPPrototype struct { + // The unique identifier for this floating IP. + ID *string `json:"id,omitempty"` + + // The CRN for this floating IP. + CRN *string `json:"crn,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href,omitempty"` + + // The globally unique IP address. + Address *string `json:"address,omitempty"` + + // The unique user-defined name for this floating IP. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` +} + +func (*PublicGatewayFloatingIPPrototype) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +type PublicGatewayFloatingIPPrototypeIntf interface { + isaPublicGatewayFloatingIPPrototype() bool +} + +// UnmarshalPublicGatewayFloatingIPPrototype unmarshals an instance of PublicGatewayFloatingIPPrototype from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentity : Identifies a public gateway by a unique property. +// Models which "extend" this model: +// - PublicGatewayIdentityByID +// - PublicGatewayIdentityByCRN +// - PublicGatewayIdentityByHref +type PublicGatewayIdentity struct { + // The unique identifier for this public gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this public gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href,omitempty"` +} + +func (*PublicGatewayIdentity) isaPublicGatewayIdentity() bool { + return true +} + +type PublicGatewayIdentityIntf interface { + isaPublicGatewayIdentity() bool +} + +// UnmarshalPublicGatewayIdentity unmarshals an instance of PublicGatewayIdentity from the specified map of raw messages. +func UnmarshalPublicGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayPatch : PublicGatewayPatch struct +type PublicGatewayPatch struct { + // The user-defined name for this public gateway. Names must be unique within the VPC the public gateway resides in. + Name *string `json:"name,omitempty"` +} + +// UnmarshalPublicGatewayPatch unmarshals an instance of PublicGatewayPatch from the specified map of raw messages. +func UnmarshalPublicGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the PublicGatewayPatch +func (publicGatewayPatch *PublicGatewayPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(publicGatewayPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// PublicGatewayReference : PublicGatewayReference struct +type PublicGatewayReference struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this public gateway. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the PublicGatewayReference.ResourceType property. +// The resource type. +const ( + PublicGatewayReferenceResourceTypePublicGatewayConst = "public_gateway" +) + +// UnmarshalPublicGatewayReference unmarshals an instance of PublicGatewayReference from the specified map of raw messages. +func UnmarshalPublicGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPublicGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type PublicGatewayReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalPublicGatewayReferenceDeleted unmarshals an instance of PublicGatewayReferenceDeleted from the specified map of raw messages. +func UnmarshalPublicGatewayReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Region : Region struct +type Region struct { + // The API endpoint for this region. + Endpoint *string `json:"endpoint" validate:"required"` + + // The URL for this region. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this region. + Name *string `json:"name" validate:"required"` + + // The availability status of this region. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the Region.Status property. +// The availability status of this region. +const ( + RegionStatusAvailableConst = "available" + RegionStatusUnavailableConst = "unavailable" +) + +// UnmarshalRegion unmarshals an instance of Region from the specified map of raw messages. +func UnmarshalRegion(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Region) + err = core.UnmarshalPrimitive(m, "endpoint", &obj.Endpoint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionCollection : RegionCollection struct +type RegionCollection struct { + // Collection of regions. + Regions []Region `json:"regions" validate:"required"` +} + +// UnmarshalRegionCollection unmarshals an instance of RegionCollection from the specified map of raw messages. +func UnmarshalRegionCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionCollection) + err = core.UnmarshalModel(m, "regions", &obj.Regions, UnmarshalRegion) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RegionReference : RegionReference struct +type RegionReference struct { + // The URL for this region. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this region. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalRegionReference unmarshals an instance of RegionReference from the specified map of raw messages. +func UnmarshalRegionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RegionReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RemoveEndpointGatewayIPOptions : The RemoveEndpointGatewayIP options. +type RemoveEndpointGatewayIPOptions struct { + // The endpoint gateway identifier. + EndpointGatewayID *string `validate:"required,ne="` + + // The reserved IP identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewRemoveEndpointGatewayIPOptions : Instantiate RemoveEndpointGatewayIPOptions +func (*VpcV1) NewRemoveEndpointGatewayIPOptions(endpointGatewayID string, id string) *RemoveEndpointGatewayIPOptions { + return &RemoveEndpointGatewayIPOptions{ + EndpointGatewayID: core.StringPtr(endpointGatewayID), + ID: core.StringPtr(id), + } +} + +// SetEndpointGatewayID : Allow user to set EndpointGatewayID +func (options *RemoveEndpointGatewayIPOptions) SetEndpointGatewayID(endpointGatewayID string) *RemoveEndpointGatewayIPOptions { + options.EndpointGatewayID = core.StringPtr(endpointGatewayID) + return options +} + +// SetID : Allow user to set ID +func (options *RemoveEndpointGatewayIPOptions) SetID(id string) *RemoveEndpointGatewayIPOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveEndpointGatewayIPOptions) SetHeaders(param map[string]string) *RemoveEndpointGatewayIPOptions { + options.Headers = param + return options +} + +// RemoveInstanceNetworkInterfaceFloatingIPOptions : The RemoveInstanceNetworkInterfaceFloatingIP options. +type RemoveInstanceNetworkInterfaceFloatingIPOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The network interface identifier. + NetworkInterfaceID *string `validate:"required,ne="` + + // The floating IP identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewRemoveInstanceNetworkInterfaceFloatingIPOptions : Instantiate RemoveInstanceNetworkInterfaceFloatingIPOptions +func (*VpcV1) NewRemoveInstanceNetworkInterfaceFloatingIPOptions(instanceID string, networkInterfaceID string, id string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + return &RemoveInstanceNetworkInterfaceFloatingIPOptions{ + InstanceID: core.StringPtr(instanceID), + NetworkInterfaceID: core.StringPtr(networkInterfaceID), + ID: core.StringPtr(id), + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetInstanceID(instanceID string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetNetworkInterfaceID : Allow user to set NetworkInterfaceID +func (options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetNetworkInterfaceID(networkInterfaceID string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + options.NetworkInterfaceID = core.StringPtr(networkInterfaceID) + return options +} + +// SetID : Allow user to set ID +func (options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetID(id string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveInstanceNetworkInterfaceFloatingIPOptions) SetHeaders(param map[string]string) *RemoveInstanceNetworkInterfaceFloatingIPOptions { + options.Headers = param + return options +} + +// RemoveSecurityGroupNetworkInterfaceOptions : The RemoveSecurityGroupNetworkInterface options. +type RemoveSecurityGroupNetworkInterfaceOptions struct { + // The security group identifier. + SecurityGroupID *string `validate:"required,ne="` + + // The network interface identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewRemoveSecurityGroupNetworkInterfaceOptions : Instantiate RemoveSecurityGroupNetworkInterfaceOptions +func (*VpcV1) NewRemoveSecurityGroupNetworkInterfaceOptions(securityGroupID string, id string) *RemoveSecurityGroupNetworkInterfaceOptions { + return &RemoveSecurityGroupNetworkInterfaceOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (options *RemoveSecurityGroupNetworkInterfaceOptions) SetSecurityGroupID(securityGroupID string) *RemoveSecurityGroupNetworkInterfaceOptions { + options.SecurityGroupID = core.StringPtr(securityGroupID) + return options +} + +// SetID : Allow user to set ID +func (options *RemoveSecurityGroupNetworkInterfaceOptions) SetID(id string) *RemoveSecurityGroupNetworkInterfaceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveSecurityGroupNetworkInterfaceOptions) SetHeaders(param map[string]string) *RemoveSecurityGroupNetworkInterfaceOptions { + options.Headers = param + return options +} + +// RemoveVPNGatewayConnectionLocalCIDROptions : The RemoveVPNGatewayConnectionLocalCIDR options. +type RemoveVPNGatewayConnectionLocalCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `validate:"required,ne="` + + // The address prefix part of the CIDR. + CIDRPrefix *string `validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewRemoveVPNGatewayConnectionLocalCIDROptions : Instantiate RemoveVPNGatewayConnectionLocalCIDROptions +func (*VpcV1) NewRemoveVPNGatewayConnectionLocalCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *RemoveVPNGatewayConnectionLocalCIDROptions { + return &RemoveVPNGatewayConnectionLocalCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (options *RemoveVPNGatewayConnectionLocalCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionLocalCIDROptions { + options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return options +} + +// SetID : Allow user to set ID +func (options *RemoveVPNGatewayConnectionLocalCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionLocalCIDROptions { + options.ID = core.StringPtr(id) + return options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (options *RemoveVPNGatewayConnectionLocalCIDROptions) SetCIDRPrefix(cidrPrefix string) *RemoveVPNGatewayConnectionLocalCIDROptions { + options.CIDRPrefix = core.StringPtr(cidrPrefix) + return options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (options *RemoveVPNGatewayConnectionLocalCIDROptions) SetPrefixLength(prefixLength string) *RemoveVPNGatewayConnectionLocalCIDROptions { + options.PrefixLength = core.StringPtr(prefixLength) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveVPNGatewayConnectionLocalCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionLocalCIDROptions { + options.Headers = param + return options +} + +// RemoveVPNGatewayConnectionPeerCIDROptions : The RemoveVPNGatewayConnectionPeerCIDR options. +type RemoveVPNGatewayConnectionPeerCIDROptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `validate:"required,ne="` + + // The address prefix part of the CIDR. + CIDRPrefix *string `validate:"required,ne="` + + // The prefix length part of the CIDR. + PrefixLength *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewRemoveVPNGatewayConnectionPeerCIDROptions : Instantiate RemoveVPNGatewayConnectionPeerCIDROptions +func (*VpcV1) NewRemoveVPNGatewayConnectionPeerCIDROptions(vpnGatewayID string, id string, cidrPrefix string, prefixLength string) *RemoveVPNGatewayConnectionPeerCIDROptions { + return &RemoveVPNGatewayConnectionPeerCIDROptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + CIDRPrefix: core.StringPtr(cidrPrefix), + PrefixLength: core.StringPtr(prefixLength), + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (options *RemoveVPNGatewayConnectionPeerCIDROptions) SetVPNGatewayID(vpnGatewayID string) *RemoveVPNGatewayConnectionPeerCIDROptions { + options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return options +} + +// SetID : Allow user to set ID +func (options *RemoveVPNGatewayConnectionPeerCIDROptions) SetID(id string) *RemoveVPNGatewayConnectionPeerCIDROptions { + options.ID = core.StringPtr(id) + return options +} + +// SetCIDRPrefix : Allow user to set CIDRPrefix +func (options *RemoveVPNGatewayConnectionPeerCIDROptions) SetCIDRPrefix(cidrPrefix string) *RemoveVPNGatewayConnectionPeerCIDROptions { + options.CIDRPrefix = core.StringPtr(cidrPrefix) + return options +} + +// SetPrefixLength : Allow user to set PrefixLength +func (options *RemoveVPNGatewayConnectionPeerCIDROptions) SetPrefixLength(prefixLength string) *RemoveVPNGatewayConnectionPeerCIDROptions { + options.PrefixLength = core.StringPtr(prefixLength) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *RemoveVPNGatewayConnectionPeerCIDROptions) SetHeaders(param map[string]string) *RemoveVPNGatewayConnectionPeerCIDROptions { + options.Headers = param + return options +} + +// ReplaceLoadBalancerPoolMembersOptions : The ReplaceLoadBalancerPoolMembers options. +type ReplaceLoadBalancerPoolMembersOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The pool identifier. + PoolID *string `validate:"required,ne="` + + // Array of pool member prototype objects. + Members []LoadBalancerPoolMemberPrototype `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceLoadBalancerPoolMembersOptions : Instantiate ReplaceLoadBalancerPoolMembersOptions +func (*VpcV1) NewReplaceLoadBalancerPoolMembersOptions(loadBalancerID string, poolID string, members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { + return &ReplaceLoadBalancerPoolMembersOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + Members: members, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *ReplaceLoadBalancerPoolMembersOptions) SetLoadBalancerID(loadBalancerID string) *ReplaceLoadBalancerPoolMembersOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetPoolID : Allow user to set PoolID +func (options *ReplaceLoadBalancerPoolMembersOptions) SetPoolID(poolID string) *ReplaceLoadBalancerPoolMembersOptions { + options.PoolID = core.StringPtr(poolID) + return options +} + +// SetMembers : Allow user to set Members +func (options *ReplaceLoadBalancerPoolMembersOptions) SetMembers(members []LoadBalancerPoolMemberPrototype) *ReplaceLoadBalancerPoolMembersOptions { + options.Members = members + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceLoadBalancerPoolMembersOptions) SetHeaders(param map[string]string) *ReplaceLoadBalancerPoolMembersOptions { + options.Headers = param + return options +} + +// ReplaceSubnetNetworkACLOptions : The ReplaceSubnetNetworkACL options. +type ReplaceSubnetNetworkACLOptions struct { + // The subnet identifier. + ID *string `validate:"required,ne="` + + // The network ACL identity. + NetworkACLIdentity NetworkACLIdentityIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceSubnetNetworkACLOptions : Instantiate ReplaceSubnetNetworkACLOptions +func (*VpcV1) NewReplaceSubnetNetworkACLOptions(id string, networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { + return &ReplaceSubnetNetworkACLOptions{ + ID: core.StringPtr(id), + NetworkACLIdentity: networkACLIdentity, + } +} + +// SetID : Allow user to set ID +func (options *ReplaceSubnetNetworkACLOptions) SetID(id string) *ReplaceSubnetNetworkACLOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetNetworkACLIdentity : Allow user to set NetworkACLIdentity +func (options *ReplaceSubnetNetworkACLOptions) SetNetworkACLIdentity(networkACLIdentity NetworkACLIdentityIntf) *ReplaceSubnetNetworkACLOptions { + options.NetworkACLIdentity = networkACLIdentity + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceSubnetNetworkACLOptions) SetHeaders(param map[string]string) *ReplaceSubnetNetworkACLOptions { + options.Headers = param + return options +} + +// ReplaceSubnetRoutingTableOptions : The ReplaceSubnetRoutingTable options. +type ReplaceSubnetRoutingTableOptions struct { + // The subnet identifier. + ID *string `validate:"required,ne="` + + // The routing table identity. + RoutingTableIdentity RoutingTableIdentityIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewReplaceSubnetRoutingTableOptions : Instantiate ReplaceSubnetRoutingTableOptions +func (*VpcV1) NewReplaceSubnetRoutingTableOptions(id string, routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { + return &ReplaceSubnetRoutingTableOptions{ + ID: core.StringPtr(id), + RoutingTableIdentity: routingTableIdentity, + } +} + +// SetID : Allow user to set ID +func (options *ReplaceSubnetRoutingTableOptions) SetID(id string) *ReplaceSubnetRoutingTableOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetRoutingTableIdentity : Allow user to set RoutingTableIdentity +func (options *ReplaceSubnetRoutingTableOptions) SetRoutingTableIdentity(routingTableIdentity RoutingTableIdentityIntf) *ReplaceSubnetRoutingTableOptions { + options.RoutingTableIdentity = routingTableIdentity + return options +} + +// SetHeaders : Allow user to set Headers +func (options *ReplaceSubnetRoutingTableOptions) SetHeaders(param map[string]string) *ReplaceSubnetRoutingTableOptions { + options.Headers = param + return options +} + +// ReservedIP : ReservedIP struct +type ReservedIP struct { + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // If set to `true`, this reserved IP will be automatically deleted when the target is deleted or when the reserved IP + // is unbound. + AutoDelete *bool `json:"auto_delete" validate:"required"` + + // The date and time that the reserved IP was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` + + // The user-defined or system-provided name for this reserved IP. + Name *string `json:"name" validate:"required"` + + // The owner of a reserved IP, defining whether it is managed by the user or the provider. + Owner *string `json:"owner" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The target of this reserved IP. + Target ReservedIPTargetIntf `json:"target,omitempty"` +} + +// Constants associated with the ReservedIP.Owner property. +// The owner of a reserved IP, defining whether it is managed by the user or the provider. +const ( + ReservedIPOwnerProviderConst = "provider" + ReservedIPOwnerUserConst = "user" +) + +// Constants associated with the ReservedIP.ResourceType property. +// The resource type. +const ( + ReservedIPResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" +) + +// UnmarshalReservedIP unmarshals an instance of ReservedIP from the specified map of raw messages. +func UnmarshalReservedIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "owner", &obj.Owner) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalReservedIPTarget) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollection : ReservedIPCollection struct +type ReservedIPCollection struct { + // A link to the first page of resources. + First *ReservedIPCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *ReservedIPCollectionNext `json:"next,omitempty"` + + // Collection of reserved IPs in this subnet. + ReservedIps []ReservedIP `json:"reserved_ips" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalReservedIPCollection unmarshals an instance of ReservedIPCollection from the specified map of raw messages. +func UnmarshalReservedIPCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "reserved_ips", &obj.ReservedIps, UnmarshalReservedIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionEndpointGatewayContext : ReservedIPCollectionEndpointGatewayContext struct +type ReservedIPCollectionEndpointGatewayContext struct { + // A link to the first page of resources. + First *ReservedIPCollectionEndpointGatewayContextFirst `json:"first" validate:"required"` + + // Collection of reserved IPs bound to an endpoint gateway. + Ips []ReservedIP `json:"ips" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *ReservedIPCollectionEndpointGatewayContextNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalReservedIPCollectionEndpointGatewayContext unmarshals an instance of ReservedIPCollectionEndpointGatewayContext from the specified map of raw messages. +func UnmarshalReservedIPCollectionEndpointGatewayContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionEndpointGatewayContext) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalReservedIPCollectionEndpointGatewayContextFirst) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ips", &obj.Ips, UnmarshalReservedIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalReservedIPCollectionEndpointGatewayContextNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionEndpointGatewayContextFirst : A link to the first page of resources. +type ReservedIPCollectionEndpointGatewayContextFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionEndpointGatewayContextFirst unmarshals an instance of ReservedIPCollectionEndpointGatewayContextFirst from the specified map of raw messages. +func UnmarshalReservedIPCollectionEndpointGatewayContextFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionEndpointGatewayContextFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionEndpointGatewayContextNext : A link to the next page of resources. This property is present for all pages except the last page. +type ReservedIPCollectionEndpointGatewayContextNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionEndpointGatewayContextNext unmarshals an instance of ReservedIPCollectionEndpointGatewayContextNext from the specified map of raw messages. +func UnmarshalReservedIPCollectionEndpointGatewayContextNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionEndpointGatewayContextNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionFirst : A link to the first page of resources. +type ReservedIPCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionFirst unmarshals an instance of ReservedIPCollectionFirst from the specified map of raw messages. +func UnmarshalReservedIPCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type ReservedIPCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalReservedIPCollectionNext unmarshals an instance of ReservedIPCollectionNext from the specified map of raw messages. +func UnmarshalReservedIPCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPPatch : ReservedIPPatch struct +type ReservedIPPatch struct { + // If set to `true`, this reserved IP will be automatically deleted when the target is deleted or when the reserved IP + // is unbound. The value cannot be set to `true` if the reserved IP is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The user-defined name for this reserved IP. Names must be unique within the subnet the reserved IP resides in. Names + // beginning with `ibm-` are reserved for provider-owned resources. + Name *string `json:"name,omitempty"` +} + +// UnmarshalReservedIPPatch unmarshals an instance of ReservedIPPatch from the specified map of raw messages. +func UnmarshalReservedIPPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPPatch) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the ReservedIPPatch +func (reservedIPPatch *ReservedIPPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(reservedIPPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// ReservedIPReference : ReservedIPReference struct +type ReservedIPReference struct { + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *ReservedIPReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` + + // The user-defined or system-provided name for this reserved IP. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPReference.ResourceType property. +// The resource type. +const ( + ReservedIPReferenceResourceTypeSubnetReservedIPConst = "subnet_reserved_ip" +) + +// UnmarshalReservedIPReference unmarshals an instance of ReservedIPReference from the specified map of raw messages. +func UnmarshalReservedIPReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPReference) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalReservedIPReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type ReservedIPReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalReservedIPReferenceDeleted unmarshals an instance of ReservedIPReferenceDeleted from the specified map of raw messages. +func UnmarshalReservedIPReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTarget : The target of this reserved IP. +// Models which "extend" this model: +// - ReservedIPTargetEndpointGatewayReference +type ReservedIPTarget struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href,omitempty"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id,omitempty"` + + // The unique user-defined name for this endpoint gateway. + Name *string `json:"name,omitempty"` + + // The type of resource referenced. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the ReservedIPTarget.ResourceType property. +// The type of resource referenced. +const ( + ReservedIPTargetResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +func (*ReservedIPTarget) isaReservedIPTarget() bool { + return true +} + +type ReservedIPTargetIntf interface { + isaReservedIPTarget() bool +} + +// UnmarshalReservedIPTarget unmarshals an instance of ReservedIPTarget from the specified map of raw messages. +func UnmarshalReservedIPTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTarget) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototype : The target this reserved IP is to be bound to. +// Models which "extend" this model: +// - ReservedIPTargetPrototypeEndpointGatewayIdentity +type ReservedIPTargetPrototype struct { + // The unique identifier for this endpoint gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this endpoint gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href,omitempty"` +} + +func (*ReservedIPTargetPrototype) isaReservedIPTargetPrototype() bool { + return true +} + +type ReservedIPTargetPrototypeIntf interface { + isaReservedIPTargetPrototype() bool +} + +// UnmarshalReservedIPTargetPrototype unmarshals an instance of ReservedIPTargetPrototype from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototype) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceGroupIdentity : The resource group to use. If unspecified, the account's [default resource +// group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. +// Models which "extend" this model: +// - ResourceGroupIdentityByID +type ResourceGroupIdentity struct { + // The unique identifier for this resource group. + ID *string `json:"id,omitempty"` +} + +func (*ResourceGroupIdentity) isaResourceGroupIdentity() bool { + return true +} + +type ResourceGroupIdentityIntf interface { + isaResourceGroupIdentity() bool +} + +// UnmarshalResourceGroupIdentity unmarshals an instance of ResourceGroupIdentity from the specified map of raw messages. +func UnmarshalResourceGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceGroupReference : ResourceGroupReference struct +type ResourceGroupReference struct { + // The URL for this resource group. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this resource group. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this resource group. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalResourceGroupReference unmarshals an instance of ResourceGroupReference from the specified map of raw messages. +func UnmarshalResourceGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Route : Route struct +type Route struct { + // The date and time that the route was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination of the route. + Destination *string `json:"destination" validate:"required"` + + // The URL for this route. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this route. + ID *string `json:"id" validate:"required"` + + // The lifecycle state of the route. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The user-defined name for this route. + Name *string `json:"name" validate:"required"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For + // other `action` values, its `address` will be `0.0.0.0`. + NextHop RouteNextHopIntf `json:"next_hop" validate:"required"` + + // The zone the route applies to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Route.LifecycleState property. +// The lifecycle state of the route. +const ( + RouteLifecycleStateDeletedConst = "deleted" + RouteLifecycleStateDeletingConst = "deleting" + RouteLifecycleStateFailedConst = "failed" + RouteLifecycleStatePendingConst = "pending" + RouteLifecycleStateStableConst = "stable" + RouteLifecycleStateSuspendedConst = "suspended" + RouteLifecycleStateUpdatingConst = "updating" + RouteLifecycleStateWaitingConst = "waiting" +) + +// UnmarshalRoute unmarshals an instance of Route from the specified map of raw messages. +func UnmarshalRoute(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Route) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHop) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCollection : RouteCollection struct +type RouteCollection struct { + // A link to the first page of resources. + First *RouteCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *RouteCollectionNext `json:"next,omitempty"` + + // Collection of routes. + Routes []Route `json:"routes" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalRouteCollection unmarshals an instance of RouteCollection from the specified map of raw messages. +func UnmarshalRouteCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalRouteCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRouteCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRoute) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCollectionFirst : A link to the first page of resources. +type RouteCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalRouteCollectionFirst unmarshals an instance of RouteCollectionFirst from the specified map of raw messages. +func UnmarshalRouteCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type RouteCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalRouteCollectionNext unmarshals an instance of RouteCollectionNext from the specified map of raw messages. +func UnmarshalRouteCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHop : RouteNextHop struct +// Models which "extend" this model: +// - RouteNextHopIP +// - RouteNextHopVPNGatewayConnectionReference +type RouteNextHop struct { + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The user-defined name for this VPN connection. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` +} + +// Constants associated with the RouteNextHop.ResourceType property. +// The resource type. +const ( + RouteNextHopResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +func (*RouteNextHop) isaRouteNextHop() bool { + return true +} + +type RouteNextHopIntf interface { + isaRouteNextHop() bool +} + +// UnmarshalRouteNextHop unmarshals an instance of RouteNextHop from the specified map of raw messages. +func UnmarshalRouteNextHop(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHop) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPrototype : The next hop packets will be routed to. +// Models which "extend" this model: +// - RouteNextHopPrototypeRouteNextHopIP +// - RouteNextHopPrototypeVPNGatewayConnectionIdentity +type RouteNextHopPrototype struct { + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RouteNextHopPrototype) isaRouteNextHopPrototype() bool { + return true +} + +type RouteNextHopPrototypeIntf interface { + isaRouteNextHopPrototype() bool +} + +// UnmarshalRouteNextHopPrototype unmarshals an instance of RouteNextHopPrototype from the specified map of raw messages. +func UnmarshalRouteNextHopPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPrototype) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutePatch : RoutePatch struct +type RoutePatch struct { + // The user-defined name for this route. Names must be unique within the VPC routing table the route resides in. + Name *string `json:"name,omitempty"` +} + +// UnmarshalRoutePatch unmarshals an instance of RoutePatch from the specified map of raw messages. +func UnmarshalRoutePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the RoutePatch +func (routePatch *RoutePatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(routePatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// RoutePrototype : RoutePrototype struct +type RoutePrototype struct { + // The action to perform with a packet matching the route: + // - `delegate`: delegate to the system's built-in routes + // - `delegate_vpc`: delegate to the system's built-in routes, ignoring Internet-bound + // routes + // - `deliver`: deliver the packet to the specified `next_hop` + // - `drop`: drop the packet. + Action *string `json:"action,omitempty"` + + // The destination of the route. At most two routes per `zone` in a table can have the same destination, and only if + // both routes have an `action` of `deliver` and the + // `next_hop` is an IP address. + Destination *string `json:"destination" validate:"required"` + + // The user-defined name for this route. If unspecified, the name will be a hyphenated list of randomly-selected words. + // Names must be unique within the VPC routing table the route resides in. + Name *string `json:"name,omitempty"` + + // If `action` is `deliver`, the next hop that packets will be delivered to. For + // other `action` values, it must be omitted or specified as `0.0.0.0`. + NextHop RouteNextHopPrototypeIntf `json:"next_hop,omitempty"` + + // The zone to apply the route to. (Traffic from subnets in this zone will be + // subject to this route.). + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// Constants associated with the RoutePrototype.Action property. +// The action to perform with a packet matching the route: +// - `delegate`: delegate to the system's built-in routes +// - `delegate_vpc`: delegate to the system's built-in routes, ignoring Internet-bound +// routes +// - `deliver`: deliver the packet to the specified `next_hop` +// - `drop`: drop the packet. +const ( + RoutePrototypeActionDelegateConst = "delegate" + RoutePrototypeActionDelegateVPCConst = "delegate_vpc" + RoutePrototypeActionDeliverConst = "deliver" + RoutePrototypeActionDropConst = "drop" +) + +// NewRoutePrototype : Instantiate RoutePrototype (Generic Model Constructor) +func (*VpcV1) NewRoutePrototype(destination string, zone ZoneIdentityIntf) (model *RoutePrototype, err error) { + model = &RoutePrototype{ + Destination: core.StringPtr(destination), + Zone: zone, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalRoutePrototype unmarshals an instance of RoutePrototype from the specified map of raw messages. +func UnmarshalRoutePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutePrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next_hop", &obj.NextHop, UnmarshalRouteNextHopPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteReference : RouteReference struct +type RouteReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *RouteReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this route. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this route. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this route. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalRouteReference unmarshals an instance of RouteReference from the specified map of raw messages. +func UnmarshalRouteReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRouteReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type RouteReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalRouteReferenceDeleted unmarshals an instance of RouteReferenceDeleted from the specified map of raw messages. +func UnmarshalRouteReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTable : RoutingTable struct +type RoutingTable struct { + // The date and time that this routing table was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The URL for this routing table. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` + + // Indicates whether this is the default routing table for this VPC. + IsDefault *bool `json:"is_default" validate:"required"` + + // The lifecycle state of the routing table. + LifecycleState *string `json:"lifecycle_state" validate:"required"` + + // The user-defined name for this routing table. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. + // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from from [Transit + // Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. + // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress" validate:"required"` + + // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this + // VPC. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. + // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress" validate:"required"` + + // The routes for this routing table. + Routes []RouteReference `json:"routes" validate:"required"` + + // The subnets to which this routing table is attached. + Subnets []SubnetReference `json:"subnets" validate:"required"` +} + +// Constants associated with the RoutingTable.LifecycleState property. +// The lifecycle state of the routing table. +const ( + RoutingTableLifecycleStateDeletedConst = "deleted" + RoutingTableLifecycleStateDeletingConst = "deleting" + RoutingTableLifecycleStateFailedConst = "failed" + RoutingTableLifecycleStatePendingConst = "pending" + RoutingTableLifecycleStateStableConst = "stable" + RoutingTableLifecycleStateSuspendedConst = "suspended" + RoutingTableLifecycleStateUpdatingConst = "updating" + RoutingTableLifecycleStateWaitingConst = "waiting" +) + +// Constants associated with the RoutingTable.ResourceType property. +// The resource type. +const ( + RoutingTableResourceTypeRoutingTableConst = "routing_table" +) + +// UnmarshalRoutingTable unmarshals an instance of RoutingTable from the specified map of raw messages. +func UnmarshalRoutingTable(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTable) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "is_default", &obj.IsDefault) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "lifecycle_state", &obj.LifecycleState) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routes", &obj.Routes, UnmarshalRouteReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnetReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableCollection : RoutingTableCollection struct +type RoutingTableCollection struct { + // A link to the first page of resources. + First *RoutingTableCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *RoutingTableCollectionNext `json:"next,omitempty"` + + // Collection of routing tables. + RoutingTables []RoutingTable `json:"routing_tables" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalRoutingTableCollection unmarshals an instance of RoutingTableCollection from the specified map of raw messages. +func UnmarshalRoutingTableCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalRoutingTableCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalRoutingTableCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_tables", &obj.RoutingTables, UnmarshalRoutingTable) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableCollectionFirst : A link to the first page of resources. +type RoutingTableCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalRoutingTableCollectionFirst unmarshals an instance of RoutingTableCollectionFirst from the specified map of raw messages. +func UnmarshalRoutingTableCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type RoutingTableCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalRoutingTableCollectionNext unmarshals an instance of RoutingTableCollectionNext from the specified map of raw messages. +func UnmarshalRoutingTableCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableIdentity : Identifies a routing table by a unique property. +// Models which "extend" this model: +// - RoutingTableIdentityByID +// - RoutingTableIdentityByHref +type RoutingTableIdentity struct { + // The unique identifier for this routing table. + ID *string `json:"id,omitempty"` + + // The URL for this routing table. + Href *string `json:"href,omitempty"` +} + +func (*RoutingTableIdentity) isaRoutingTableIdentity() bool { + return true +} + +type RoutingTableIdentityIntf interface { + isaRoutingTableIdentity() bool +} + +// UnmarshalRoutingTableIdentity unmarshals an instance of RoutingTableIdentity from the specified map of raw messages. +func UnmarshalRoutingTableIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTablePatch : RoutingTablePatch struct +type RoutingTablePatch struct { + // The user-defined name for this routing table. Names must be unique within the VPC the routing table resides in. + Name *string `json:"name,omitempty"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Direct Link](https://cloud.ibm.com/docs/dl/) to this VPC. Updating to `true` selects this routing table, provided + // no other routing table in the VPC already has this property set to `true`, and no subnets are attached to this + // routing table. Updating to `false` deselects this routing table. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. + // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. + RouteDirectLinkIngress *bool `json:"route_direct_link_ingress,omitempty"` + + // Indicates whether this routing table is used to route traffic that originates from + // [Transit Gateway](https://cloud.ibm.com/cloud/transit-gateway/) to this VPC. Updating to + // `true` selects this routing table, provided no other routing table in the VPC already has this property set to + // `true`, and no subnets are attached to this routing table. Updating to `false` deselects this routing table. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. + // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. + // + // If [Classic Access](https://cloud.ibm.com/docs/vpc?topic=vpc-setting-up-access-to-classic-infrastructure) is enabled + // for this VPC, and this property is set to `true`, its incoming traffic will also be routed according to this routing + // table. + RouteTransitGatewayIngress *bool `json:"route_transit_gateway_ingress,omitempty"` + + // Indicates whether this routing table is used to route traffic that originates from subnets in other zones in this + // VPC. Updating to `true` selects this routing table, provided no other routing table in the VPC already has this + // property set to `true`, and no subnets are attached to this routing table. Updating to `false` deselects this + // routing table. + // + // Incoming traffic will be routed according to the routing table with one exception: routes with an `action` of + // `deliver` are treated as `drop` unless the `next_hop` is an IP address within the VPC's address prefix ranges. + // Therefore, if an incoming packet matches a route with a `next_hop` of an internet-bound IP address or a VPN gateway + // connection, the packet will be dropped. + RouteVPCZoneIngress *bool `json:"route_vpc_zone_ingress,omitempty"` +} + +// UnmarshalRoutingTablePatch unmarshals an instance of RoutingTablePatch from the specified map of raw messages. +func UnmarshalRoutingTablePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTablePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_direct_link_ingress", &obj.RouteDirectLinkIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_transit_gateway_ingress", &obj.RouteTransitGatewayIngress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "route_vpc_zone_ingress", &obj.RouteVPCZoneIngress) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the RoutingTablePatch +func (routingTablePatch *RoutingTablePatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(routingTablePatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// RoutingTableReference : RoutingTableReference struct +type RoutingTableReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *RoutingTableReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this routing table. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this routing table. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RoutingTableReference.ResourceType property. +// The resource type. +const ( + RoutingTableReferenceResourceTypeRoutingTableConst = "routing_table" +) + +// UnmarshalRoutingTableReference unmarshals an instance of RoutingTableReference from the specified map of raw messages. +func UnmarshalRoutingTableReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalRoutingTableReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type RoutingTableReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalRoutingTableReferenceDeleted unmarshals an instance of RoutingTableReferenceDeleted from the specified map of raw messages. +func UnmarshalRoutingTableReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroup : SecurityGroup struct +type SecurityGroup struct { + // The date and time that this security group was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this security group. Names must be unique within the VPC the security group resides in. + Name *string `json:"name" validate:"required"` + + // Array of references to network interfaces. + NetworkInterfaces []NetworkInterfaceReference `json:"network_interfaces" validate:"required"` + + // The resource group for this security group. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // Array of rules for this security group. If no rules exist, all traffic will be denied. + Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` + + // Array of references to targets. + Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` + + // The VPC this security group is a part of. + VPC *VPCReference `json:"vpc" validate:"required"` +} + +// UnmarshalSecurityGroup unmarshals an instance of SecurityGroup from the specified map of raw messages. +func UnmarshalSecurityGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroup) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfaceReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) + if err != nil { + return + } + err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupCollection : SecurityGroupCollection struct +type SecurityGroupCollection struct { + // A link to the first page of resources. + First *SecurityGroupCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *SecurityGroupCollectionNext `json:"next,omitempty"` + + // Collection of security groups. + SecurityGroups []SecurityGroup `json:"security_groups" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalSecurityGroupCollection unmarshals an instance of SecurityGroupCollection from the specified map of raw messages. +func UnmarshalSecurityGroupCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSecurityGroupCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "security_groups", &obj.SecurityGroups, UnmarshalSecurityGroup) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupCollectionFirst : A link to the first page of resources. +type SecurityGroupCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalSecurityGroupCollectionFirst unmarshals an instance of SecurityGroupCollectionFirst from the specified map of raw messages. +func UnmarshalSecurityGroupCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type SecurityGroupCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalSecurityGroupCollectionNext unmarshals an instance of SecurityGroupCollectionNext from the specified map of raw messages. +func UnmarshalSecurityGroupCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupIdentity : Identifies a security group by a unique property. +// Models which "extend" this model: +// - SecurityGroupIdentityByID +// - SecurityGroupIdentityByCRN +// - SecurityGroupIdentityByHref +type SecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupIdentity) isaSecurityGroupIdentity() bool { + return true +} + +type SecurityGroupIdentityIntf interface { + isaSecurityGroupIdentity() bool +} + +// UnmarshalSecurityGroupIdentity unmarshals an instance of SecurityGroupIdentity from the specified map of raw messages. +func UnmarshalSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupPatch : SecurityGroupPatch struct +type SecurityGroupPatch struct { + // The user-defined name for this security group. Names must be unique within the VPC the security group resides in. + Name *string `json:"name,omitempty"` +} + +// UnmarshalSecurityGroupPatch unmarshals an instance of SecurityGroupPatch from the specified map of raw messages. +func UnmarshalSecurityGroupPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the SecurityGroupPatch +func (securityGroupPatch *SecurityGroupPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(securityGroupPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// SecurityGroupReference : SecurityGroupReference struct +type SecurityGroupReference struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this security group. Names must be unique within the VPC the security group resides in. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalSecurityGroupReference unmarshals an instance of SecurityGroupReference from the specified map of raw messages. +func UnmarshalSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type SecurityGroupReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalSecurityGroupReferenceDeleted unmarshals an instance of SecurityGroupReferenceDeleted from the specified map of raw messages. +func UnmarshalSecurityGroupReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRule : SecurityGroupRule struct +// Models which "extend" this model: +// - SecurityGroupRuleSecurityGroupRuleProtocolAll +// - SecurityGroupRuleSecurityGroupRuleProtocolIcmp +// - SecurityGroupRuleSecurityGroupRuleProtocolTcpudp +type SecurityGroupRule struct { + // The direction of traffic to enforce, either `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are + // used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network + // interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol,omitempty"` + + // The IP addresses or security groups from which this rule allows traffic (or to which, + // for outbound rules). Can be specified as an IP address, a CIDR block, or a security + // group. A CIDR block of `0.0.0.0/0` allows traffic from any source (or to any source, + // for outbound rules). + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The ICMP traffic code to allow. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to allow. + Type *int64 `json:"type,omitempty"` + + // The inclusive upper bound of TCP/UDP port range. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP port range. + PortMin *int64 `json:"port_min,omitempty"` +} + +// Constants associated with the SecurityGroupRule.Direction property. +// The direction of traffic to enforce, either `inbound` or `outbound`. +const ( + SecurityGroupRuleDirectionInboundConst = "inbound" + SecurityGroupRuleDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRule.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are +// used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network +// interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleIPVersionIpv4Const = "ipv4" +) + +func (*SecurityGroupRule) isaSecurityGroupRule() bool { + return true +} + +type SecurityGroupRuleIntf interface { + isaSecurityGroupRule() bool +} + +// UnmarshalSecurityGroupRule unmarshals an instance of SecurityGroupRule from the specified map of raw messages. +func UnmarshalSecurityGroupRule(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "protocol", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// SecurityGroupRuleCollection : Collection of rules in a security group. +type SecurityGroupRuleCollection struct { + // Array of rules. + Rules []SecurityGroupRuleIntf `json:"rules" validate:"required"` +} + +// UnmarshalSecurityGroupRuleCollection unmarshals an instance of SecurityGroupRuleCollection from the specified map of raw messages. +func UnmarshalSecurityGroupRuleCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleCollection) + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalSecurityGroupRule) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePatch : SecurityGroupRulePatch struct +type SecurityGroupRulePatch struct { + // The ICMP traffic code to allow. + Code *int64 `json:"code,omitempty"` + + // The direction of traffic to enforce, either `inbound` or `outbound`. + Direction *string `json:"direction,omitempty"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are + // used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network + // interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The inclusive upper bound of TCP/UDP port range. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP port range. + PortMin *int64 `json:"port_min,omitempty"` + + // The IP addresses or security groups from which this rule will allow traffic (or to + // which, for outbound rules). Can be specified as an IP address, a CIDR block, or a + // security group. A CIDR block of `0.0.0.0/0` will allow traffic from any source (or to + // any source, for outbound rules). + Remote SecurityGroupRuleRemotePatchIntf `json:"remote,omitempty"` + + // The ICMP traffic type to allow. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the SecurityGroupRulePatch.Direction property. +// The direction of traffic to enforce, either `inbound` or `outbound`. +const ( + SecurityGroupRulePatchDirectionInboundConst = "inbound" + SecurityGroupRulePatchDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePatch.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are +// used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network +// interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePatchIPVersionIpv4Const = "ipv4" +) + +// UnmarshalSecurityGroupRulePatch unmarshals an instance of SecurityGroupRulePatch from the specified map of raw messages. +func UnmarshalSecurityGroupRulePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePatch) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePatch) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the SecurityGroupRulePatch +func (securityGroupRulePatch *SecurityGroupRulePatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(securityGroupRulePatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// SecurityGroupRulePrototype : SecurityGroupRulePrototype struct +// Models which "extend" this model: +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp +// - SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp +type SecurityGroupRulePrototype struct { + // The direction of traffic to enforce, either `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are + // used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network + // interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol,omitempty"` + + // The IP addresses or security groups from which this rule will allow traffic (or to + // which, for outbound rules). Can be specified as an IP address, a CIDR block, or a + // security group. If omitted, a CIDR block of `0.0.0.0/0` will be used to allow traffic + // from any source (or to any source, for outbound rules). + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + + // The ICMP traffic code to allow. + Code *int64 `json:"code,omitempty"` + + // The ICMP traffic type to allow. + Type *int64 `json:"type,omitempty"` + + // The inclusive upper bound of TCP/UDP port range. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP port range. + PortMin *int64 `json:"port_min,omitempty"` +} + +// Constants associated with the SecurityGroupRulePrototype.Direction property. +// The direction of traffic to enforce, either `inbound` or `outbound`. +const ( + SecurityGroupRulePrototypeDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototype.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are +// used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network +// interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeIPVersionIpv4Const = "ipv4" +) + +func (*SecurityGroupRulePrototype) isaSecurityGroupRulePrototype() bool { + return true +} + +type SecurityGroupRulePrototypeIntf interface { + isaSecurityGroupRulePrototype() bool +} + +// UnmarshalSecurityGroupRulePrototype unmarshals an instance of SecurityGroupRulePrototype from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + // Retrieve discriminator value to determine correct "subclass". + var discValue string + err = core.UnmarshalPrimitive(m, "protocol", &discValue) + if err != nil { + err = fmt.Errorf("error unmarshalling discriminator property 'protocol': %s", err.Error()) + return + } + if discValue == "" { + err = fmt.Errorf("required discriminator property 'protocol' not found in JSON object") + return + } + if discValue == "all" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) + } else if discValue == "icmp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) + } else if discValue == "tcp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + } else if discValue == "udp" { + err = core.UnmarshalModel(m, "", result, UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + } else { + err = fmt.Errorf("unrecognized value for discriminator property 'protocol': %s", discValue) + } + return +} + +// SecurityGroupRuleRemote : The IP addresses or security groups from which this rule allows traffic (or to which, for outbound rules). Can be +// specified as an IP address, a CIDR block, or a security group. A CIDR block of `0.0.0.0/0` allows traffic from any +// source (or to any source, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleRemoteIP +// - SecurityGroupRuleRemoteCIDR +// - SecurityGroupRuleRemoteSecurityGroupReference +type SecurityGroupRuleRemote struct { + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` + + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The user-defined name for this security group. Names must be unique within the VPC the security group resides in. + Name *string `json:"name,omitempty"` +} + +func (*SecurityGroupRuleRemote) isaSecurityGroupRuleRemote() bool { + return true +} + +type SecurityGroupRuleRemoteIntf interface { + isaSecurityGroupRuleRemote() bool +} + +// UnmarshalSecurityGroupRuleRemote unmarshals an instance of SecurityGroupRuleRemote from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemote(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemote) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatch : The IP addresses or security groups from which this rule will allow traffic (or to which, for outbound rules). Can be +// specified as an IP address, a CIDR block, or a security group. A CIDR block of `0.0.0.0/0` will allow traffic from +// any source (or to any source, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleRemotePatchIP +// - SecurityGroupRuleRemotePatchCIDR +// - SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatch struct { + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block,omitempty"` + + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePatch) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +type SecurityGroupRuleRemotePatchIntf interface { + isaSecurityGroupRuleRemotePatch() bool +} + +// UnmarshalSecurityGroupRuleRemotePatch unmarshals an instance of SecurityGroupRuleRemotePatch from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatch) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototype : The IP addresses or security groups from which this rule will allow traffic (or to which, for outbound rules). Can be +// specified as an IP address, a CIDR block, or a security group. If omitted, a CIDR block of `0.0.0.0/0` will be used +// to allow traffic from any source (or to any source, for outbound rules). +// Models which "extend" this model: +// - SecurityGroupRuleRemotePrototypeIP +// - SecurityGroupRuleRemotePrototypeCIDR +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototype struct { + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address,omitempty"` + + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block,omitempty"` + + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePrototype) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +type SecurityGroupRuleRemotePrototypeIntf interface { + isaSecurityGroupRuleRemotePrototype() bool +} + +// UnmarshalSecurityGroupRuleRemotePrototype unmarshals an instance of SecurityGroupRuleRemotePrototype from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototype) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetCollection : SecurityGroupTargetCollection struct +type SecurityGroupTargetCollection struct { + // A link to the first page of resources. + First *SecurityGroupTargetCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *SecurityGroupTargetCollectionNext `json:"next,omitempty"` + + // Collection of security group target references. + Targets []SecurityGroupTargetReferenceIntf `json:"targets" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalSecurityGroupTargetCollection unmarshals an instance of SecurityGroupTargetCollection from the specified map of raw messages. +func UnmarshalSecurityGroupTargetCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSecurityGroupTargetCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSecurityGroupTargetCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "targets", &obj.Targets, UnmarshalSecurityGroupTargetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetCollectionFirst : A link to the first page of resources. +type SecurityGroupTargetCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalSecurityGroupTargetCollectionFirst unmarshals an instance of SecurityGroupTargetCollectionFirst from the specified map of raw messages. +func UnmarshalSecurityGroupTargetCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type SecurityGroupTargetCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalSecurityGroupTargetCollectionNext unmarshals an instance of SecurityGroupTargetCollectionNext from the specified map of raw messages. +func UnmarshalSecurityGroupTargetCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReference : The resource types that can be security group targets are expected to expand in the future. When iterating over +// security group targets, do not assume that every target resource will be from a known set of resource types. +// Optionally halt processing and surface an error, or bypass resources of unrecognized types. +// Models which "extend" this model: +// - SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext +// - SecurityGroupTargetReferenceLoadBalancerReference +type SecurityGroupTargetReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` + + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The user-defined name for this network interface. + Name *string `json:"name,omitempty"` + + // The resource type. + ResourceType *string `json:"resource_type,omitempty"` + + // The load balancer's CRN. + CRN *string `json:"crn,omitempty"` +} + +// Constants associated with the SecurityGroupTargetReference.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*SecurityGroupTargetReference) isaSecurityGroupTargetReference() bool { + return true +} + +type SecurityGroupTargetReferenceIntf interface { + isaSecurityGroupTargetReference() bool +} + +// UnmarshalSecurityGroupTargetReference unmarshals an instance of SecurityGroupTargetReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SetSubnetPublicGatewayOptions : The SetSubnetPublicGateway options. +type SetSubnetPublicGatewayOptions struct { + // The subnet identifier. + ID *string `validate:"required,ne="` + + // The public gateway identity. + PublicGatewayIdentity PublicGatewayIdentityIntf `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewSetSubnetPublicGatewayOptions : Instantiate SetSubnetPublicGatewayOptions +func (*VpcV1) NewSetSubnetPublicGatewayOptions(id string, publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { + return &SetSubnetPublicGatewayOptions{ + ID: core.StringPtr(id), + PublicGatewayIdentity: publicGatewayIdentity, + } +} + +// SetID : Allow user to set ID +func (options *SetSubnetPublicGatewayOptions) SetID(id string) *SetSubnetPublicGatewayOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetPublicGatewayIdentity : Allow user to set PublicGatewayIdentity +func (options *SetSubnetPublicGatewayOptions) SetPublicGatewayIdentity(publicGatewayIdentity PublicGatewayIdentityIntf) *SetSubnetPublicGatewayOptions { + options.PublicGatewayIdentity = publicGatewayIdentity + return options +} + +// SetHeaders : Allow user to set Headers +func (options *SetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *SetSubnetPublicGatewayOptions { + options.Headers = param + return options +} + +// Subnet : Subnet struct +type Subnet struct { + // The number of IPv4 addresses in this subnet that are not in-use, and have not been reserved by the user or the + // provider. + AvailableIpv4AddressCount *int64 `json:"available_ipv4_address_count" validate:"required"` + + // The date and time that the subnet was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` + + // The URL for this subnet. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` + + // The IP version(s) supported by this subnet. + IPVersion *string `json:"ip_version" validate:"required"` + + // The IPv4 range of the subnet, expressed in CIDR format. + Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` + + // The user-defined name for this subnet. + Name *string `json:"name" validate:"required"` + + // The network ACL for this subnet. + NetworkACL *NetworkACLReference `json:"network_acl" validate:"required"` + + // The public gateway to handle internet bound traffic for this subnet. + PublicGateway *PublicGatewayReference `json:"public_gateway,omitempty"` + + // The resource group for this subnet. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The routing table for this subnet. + RoutingTable *RoutingTableReference `json:"routing_table" validate:"required"` + + // The status of the subnet. + Status *string `json:"status" validate:"required"` + + // The total number of IPv4 addresses in this subnet. + // + // Note: This is calculated as 2(32 − prefix length). For example, the prefix length `/24` gives:
+ // 2(32 − 24) = 28 = 256 addresses. + TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count" validate:"required"` + + // The VPC this subnet is a part of. + VPC *VPCReference `json:"vpc" validate:"required"` + + // The zone this subnet resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Subnet.IPVersion property. +// The IP version(s) supported by this subnet. +const ( + SubnetIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the Subnet.Status property. +// The status of the subnet. +const ( + SubnetStatusAvailableConst = "available" + SubnetStatusDeletingConst = "deleting" + SubnetStatusFailedConst = "failed" + SubnetStatusPendingConst = "pending" +) + +// UnmarshalSubnet unmarshals an instance of Subnet from the specified map of raw messages. +func UnmarshalSubnet(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Subnet) + err = core.UnmarshalPrimitive(m, "available_ipv4_address_count", &obj.AvailableIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetCollection : SubnetCollection struct +type SubnetCollection struct { + // A link to the first page of resources. + First *SubnetCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *SubnetCollectionNext `json:"next,omitempty"` + + // Collection of subnets. + Subnets []Subnet `json:"subnets" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalSubnetCollection unmarshals an instance of SubnetCollection from the specified map of raw messages. +func UnmarshalSubnetCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalSubnetCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalSubnetCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnets", &obj.Subnets, UnmarshalSubnet) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetCollectionFirst : A link to the first page of resources. +type SubnetCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalSubnetCollectionFirst unmarshals an instance of SubnetCollectionFirst from the specified map of raw messages. +func UnmarshalSubnetCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type SubnetCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalSubnetCollectionNext unmarshals an instance of SubnetCollectionNext from the specified map of raw messages. +func UnmarshalSubnetCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentity : Identifies a subnet by a unique property. +// Models which "extend" this model: +// - SubnetIdentityByID +// - SubnetIdentityByCRN +// - SubnetIdentityByHref +type SubnetIdentity struct { + // The unique identifier for this subnet. + ID *string `json:"id,omitempty"` + + // The CRN for this subnet. + CRN *string `json:"crn,omitempty"` + + // The URL for this subnet. + Href *string `json:"href,omitempty"` +} + +func (*SubnetIdentity) isaSubnetIdentity() bool { + return true +} + +type SubnetIdentityIntf interface { + isaSubnetIdentity() bool +} + +// UnmarshalSubnetIdentity unmarshals an instance of SubnetIdentity from the specified map of raw messages. +func UnmarshalSubnetIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPatch : SubnetPatch struct +type SubnetPatch struct { + // The user-defined name for this subnet. Names must be unique within the VPC the subnet resides in. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to handle internet bound traffic for this subnet. + PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` + + // The routing table to use for this subnet. The routing table properties + // `route_direct_link_ingress`, `route_transit_gateway_ingress`, and + // `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` +} + +// UnmarshalSubnetPatch unmarshals an instance of SubnetPatch from the specified map of raw messages. +func UnmarshalSubnetPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the SubnetPatch +func (subnetPatch *SubnetPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(subnetPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// SubnetPrototype : SubnetPrototype struct +// Models which "extend" this model: +// - SubnetPrototypeSubnetByTotalCount +// - SubnetPrototypeSubnetByCIDR +type SubnetPrototype struct { + // The IP version(s) to support for this subnet. + IPVersion *string `json:"ip_version,omitempty"` + + // The user-defined name for this subnet. Names must be unique within the VPC the subnet resides in. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to handle internet bound traffic for this subnet. + PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The routing table to use for this subnet. If unspecified, the default routing table + // for the VPC is used. The routing table properties `route_direct_link_ingress`, + // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` + + // The VPC the subnet is to be a part of. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The total number of IPv4 addresses required. Must be a power of 2. The VPC must have a default address prefix in the + // specified zone, and that prefix must have a free CIDR range with at least this number of addresses. + TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count,omitempty"` + + // The zone this subnet will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` + + // The IPv4 range of the subnet, expressed in CIDR format. The prefix length of the subnet's CIDR must be between `/9` + // (8,388,608 addresses) and `/29` (8 addresses). The IPv4 range of the subnet's CIDR must fall within an existing + // address prefix in the VPC. The subnet will be created in the zone of the address prefix that contains the IPv4 CIDR. + // If zone is specified, it must match the zone of the address prefix that contains the subnet's IPv4 CIDR. + Ipv4CIDRBlock *string `json:"ipv4_cidr_block,omitempty"` +} + +// Constants associated with the SubnetPrototype.IPVersion property. +// The IP version(s) to support for this subnet. +const ( + SubnetPrototypeIPVersionIpv4Const = "ipv4" +) + +func (*SubnetPrototype) isaSubnetPrototype() bool { + return true +} + +type SubnetPrototypeIntf interface { + isaSubnetPrototype() bool +} + +// UnmarshalSubnetPrototype unmarshals an instance of SubnetPrototype from the specified map of raw messages. +func UnmarshalSubnetPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPrototype) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetReference : SubnetReference struct +type SubnetReference struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *SubnetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this subnet. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this subnet. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalSubnetReference unmarshals an instance of SubnetReference from the specified map of raw messages. +func UnmarshalSubnetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSubnetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type SubnetReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalSubnetReferenceDeleted unmarshals an instance of SubnetReferenceDeleted from the specified map of raw messages. +func UnmarshalSubnetReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// UnsetSubnetPublicGatewayOptions : The UnsetSubnetPublicGateway options. +type UnsetSubnetPublicGatewayOptions struct { + // The subnet identifier. + ID *string `validate:"required,ne="` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUnsetSubnetPublicGatewayOptions : Instantiate UnsetSubnetPublicGatewayOptions +func (*VpcV1) NewUnsetSubnetPublicGatewayOptions(id string) *UnsetSubnetPublicGatewayOptions { + return &UnsetSubnetPublicGatewayOptions{ + ID: core.StringPtr(id), + } +} + +// SetID : Allow user to set ID +func (options *UnsetSubnetPublicGatewayOptions) SetID(id string) *UnsetSubnetPublicGatewayOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UnsetSubnetPublicGatewayOptions) SetHeaders(param map[string]string) *UnsetSubnetPublicGatewayOptions { + options.Headers = param + return options +} + +// UpdateDedicatedHostDiskOptions : The UpdateDedicatedHostDisk options. +type UpdateDedicatedHostDiskOptions struct { + // The dedicated host identifier. + DedicatedHostID *string `validate:"required,ne="` + + // The dedicated host disk identifier. + ID *string `validate:"required,ne="` + + // The dedicated host disk patch. + DedicatedHostDiskPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateDedicatedHostDiskOptions : Instantiate UpdateDedicatedHostDiskOptions +func (*VpcV1) NewUpdateDedicatedHostDiskOptions(dedicatedHostID string, id string, dedicatedHostDiskPatch map[string]interface{}) *UpdateDedicatedHostDiskOptions { + return &UpdateDedicatedHostDiskOptions{ + DedicatedHostID: core.StringPtr(dedicatedHostID), + ID: core.StringPtr(id), + DedicatedHostDiskPatch: dedicatedHostDiskPatch, + } +} + +// SetDedicatedHostID : Allow user to set DedicatedHostID +func (options *UpdateDedicatedHostDiskOptions) SetDedicatedHostID(dedicatedHostID string) *UpdateDedicatedHostDiskOptions { + options.DedicatedHostID = core.StringPtr(dedicatedHostID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateDedicatedHostDiskOptions) SetID(id string) *UpdateDedicatedHostDiskOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetDedicatedHostDiskPatch : Allow user to set DedicatedHostDiskPatch +func (options *UpdateDedicatedHostDiskOptions) SetDedicatedHostDiskPatch(dedicatedHostDiskPatch map[string]interface{}) *UpdateDedicatedHostDiskOptions { + options.DedicatedHostDiskPatch = dedicatedHostDiskPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateDedicatedHostDiskOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostDiskOptions { + options.Headers = param + return options +} + +// UpdateDedicatedHostGroupOptions : The UpdateDedicatedHostGroup options. +type UpdateDedicatedHostGroupOptions struct { + // The dedicated host group identifier. + ID *string `validate:"required,ne="` + + // The dedicated host group patch. + DedicatedHostGroupPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateDedicatedHostGroupOptions : Instantiate UpdateDedicatedHostGroupOptions +func (*VpcV1) NewUpdateDedicatedHostGroupOptions(id string, dedicatedHostGroupPatch map[string]interface{}) *UpdateDedicatedHostGroupOptions { + return &UpdateDedicatedHostGroupOptions{ + ID: core.StringPtr(id), + DedicatedHostGroupPatch: dedicatedHostGroupPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateDedicatedHostGroupOptions) SetID(id string) *UpdateDedicatedHostGroupOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetDedicatedHostGroupPatch : Allow user to set DedicatedHostGroupPatch +func (options *UpdateDedicatedHostGroupOptions) SetDedicatedHostGroupPatch(dedicatedHostGroupPatch map[string]interface{}) *UpdateDedicatedHostGroupOptions { + options.DedicatedHostGroupPatch = dedicatedHostGroupPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateDedicatedHostGroupOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostGroupOptions { + options.Headers = param + return options +} + +// UpdateDedicatedHostOptions : The UpdateDedicatedHost options. +type UpdateDedicatedHostOptions struct { + // The dedicated host identifier. + ID *string `validate:"required,ne="` + + // The dedicated host patch. + DedicatedHostPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateDedicatedHostOptions : Instantiate UpdateDedicatedHostOptions +func (*VpcV1) NewUpdateDedicatedHostOptions(id string, dedicatedHostPatch map[string]interface{}) *UpdateDedicatedHostOptions { + return &UpdateDedicatedHostOptions{ + ID: core.StringPtr(id), + DedicatedHostPatch: dedicatedHostPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateDedicatedHostOptions) SetID(id string) *UpdateDedicatedHostOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetDedicatedHostPatch : Allow user to set DedicatedHostPatch +func (options *UpdateDedicatedHostOptions) SetDedicatedHostPatch(dedicatedHostPatch map[string]interface{}) *UpdateDedicatedHostOptions { + options.DedicatedHostPatch = dedicatedHostPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateDedicatedHostOptions) SetHeaders(param map[string]string) *UpdateDedicatedHostOptions { + options.Headers = param + return options +} + +// UpdateEndpointGatewayOptions : The UpdateEndpointGateway options. +type UpdateEndpointGatewayOptions struct { + // The endpoint gateway identifier. + ID *string `validate:"required,ne="` + + // The endpoint gateway patch. + EndpointGatewayPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateEndpointGatewayOptions : Instantiate UpdateEndpointGatewayOptions +func (*VpcV1) NewUpdateEndpointGatewayOptions(id string, endpointGatewayPatch map[string]interface{}) *UpdateEndpointGatewayOptions { + return &UpdateEndpointGatewayOptions{ + ID: core.StringPtr(id), + EndpointGatewayPatch: endpointGatewayPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateEndpointGatewayOptions) SetID(id string) *UpdateEndpointGatewayOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetEndpointGatewayPatch : Allow user to set EndpointGatewayPatch +func (options *UpdateEndpointGatewayOptions) SetEndpointGatewayPatch(endpointGatewayPatch map[string]interface{}) *UpdateEndpointGatewayOptions { + options.EndpointGatewayPatch = endpointGatewayPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateEndpointGatewayOptions) SetHeaders(param map[string]string) *UpdateEndpointGatewayOptions { + options.Headers = param + return options +} + +// UpdateFloatingIPOptions : The UpdateFloatingIP options. +type UpdateFloatingIPOptions struct { + // The floating IP identifier. + ID *string `validate:"required,ne="` + + // The floating IP patch. + FloatingIPPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateFloatingIPOptions : Instantiate UpdateFloatingIPOptions +func (*VpcV1) NewUpdateFloatingIPOptions(id string, floatingIPPatch map[string]interface{}) *UpdateFloatingIPOptions { + return &UpdateFloatingIPOptions{ + ID: core.StringPtr(id), + FloatingIPPatch: floatingIPPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateFloatingIPOptions) SetID(id string) *UpdateFloatingIPOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetFloatingIPPatch : Allow user to set FloatingIPPatch +func (options *UpdateFloatingIPOptions) SetFloatingIPPatch(floatingIPPatch map[string]interface{}) *UpdateFloatingIPOptions { + options.FloatingIPPatch = floatingIPPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateFloatingIPOptions) SetHeaders(param map[string]string) *UpdateFloatingIPOptions { + options.Headers = param + return options +} + +// UpdateFlowLogCollectorOptions : The UpdateFlowLogCollector options. +type UpdateFlowLogCollectorOptions struct { + // The flow log collector identifier. + ID *string `validate:"required,ne="` + + // The flow log collector patch. + FlowLogCollectorPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateFlowLogCollectorOptions : Instantiate UpdateFlowLogCollectorOptions +func (*VpcV1) NewUpdateFlowLogCollectorOptions(id string, flowLogCollectorPatch map[string]interface{}) *UpdateFlowLogCollectorOptions { + return &UpdateFlowLogCollectorOptions{ + ID: core.StringPtr(id), + FlowLogCollectorPatch: flowLogCollectorPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateFlowLogCollectorOptions) SetID(id string) *UpdateFlowLogCollectorOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetFlowLogCollectorPatch : Allow user to set FlowLogCollectorPatch +func (options *UpdateFlowLogCollectorOptions) SetFlowLogCollectorPatch(flowLogCollectorPatch map[string]interface{}) *UpdateFlowLogCollectorOptions { + options.FlowLogCollectorPatch = flowLogCollectorPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateFlowLogCollectorOptions) SetHeaders(param map[string]string) *UpdateFlowLogCollectorOptions { + options.Headers = param + return options +} + +// UpdateIkePolicyOptions : The UpdateIkePolicy options. +type UpdateIkePolicyOptions struct { + // The IKE policy identifier. + ID *string `validate:"required,ne="` + + // The IKE policy patch. + IkePolicyPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateIkePolicyOptions : Instantiate UpdateIkePolicyOptions +func (*VpcV1) NewUpdateIkePolicyOptions(id string, ikePolicyPatch map[string]interface{}) *UpdateIkePolicyOptions { + return &UpdateIkePolicyOptions{ + ID: core.StringPtr(id), + IkePolicyPatch: ikePolicyPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateIkePolicyOptions) SetID(id string) *UpdateIkePolicyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetIkePolicyPatch : Allow user to set IkePolicyPatch +func (options *UpdateIkePolicyOptions) SetIkePolicyPatch(ikePolicyPatch map[string]interface{}) *UpdateIkePolicyOptions { + options.IkePolicyPatch = ikePolicyPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateIkePolicyOptions) SetHeaders(param map[string]string) *UpdateIkePolicyOptions { + options.Headers = param + return options +} + +// UpdateImageOptions : The UpdateImage options. +type UpdateImageOptions struct { + // The image identifier. + ID *string `validate:"required,ne="` + + // The image patch. + ImagePatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateImageOptions : Instantiate UpdateImageOptions +func (*VpcV1) NewUpdateImageOptions(id string, imagePatch map[string]interface{}) *UpdateImageOptions { + return &UpdateImageOptions{ + ID: core.StringPtr(id), + ImagePatch: imagePatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateImageOptions) SetID(id string) *UpdateImageOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetImagePatch : Allow user to set ImagePatch +func (options *UpdateImageOptions) SetImagePatch(imagePatch map[string]interface{}) *UpdateImageOptions { + options.ImagePatch = imagePatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateImageOptions) SetHeaders(param map[string]string) *UpdateImageOptions { + options.Headers = param + return options +} + +// UpdateInstanceDiskOptions : The UpdateInstanceDisk options. +type UpdateInstanceDiskOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The instance disk identifier. + ID *string `validate:"required,ne="` + + // The instance disk patch. + InstanceDiskPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceDiskOptions : Instantiate UpdateInstanceDiskOptions +func (*VpcV1) NewUpdateInstanceDiskOptions(instanceID string, id string, instanceDiskPatch map[string]interface{}) *UpdateInstanceDiskOptions { + return &UpdateInstanceDiskOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + InstanceDiskPatch: instanceDiskPatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *UpdateInstanceDiskOptions) SetInstanceID(instanceID string) *UpdateInstanceDiskOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateInstanceDiskOptions) SetID(id string) *UpdateInstanceDiskOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetInstanceDiskPatch : Allow user to set InstanceDiskPatch +func (options *UpdateInstanceDiskOptions) SetInstanceDiskPatch(instanceDiskPatch map[string]interface{}) *UpdateInstanceDiskOptions { + options.InstanceDiskPatch = instanceDiskPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceDiskOptions) SetHeaders(param map[string]string) *UpdateInstanceDiskOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupManagerOptions : The UpdateInstanceGroupManager options. +type UpdateInstanceGroupManagerOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // The instance group manager identifier. + ID *string `validate:"required,ne="` + + // The instance group manager patch. + InstanceGroupManagerPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupManagerOptions : Instantiate UpdateInstanceGroupManagerOptions +func (*VpcV1) NewUpdateInstanceGroupManagerOptions(instanceGroupID string, id string, instanceGroupManagerPatch map[string]interface{}) *UpdateInstanceGroupManagerOptions { + return &UpdateInstanceGroupManagerOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + InstanceGroupManagerPatch: instanceGroupManagerPatch, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *UpdateInstanceGroupManagerOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateInstanceGroupManagerOptions) SetID(id string) *UpdateInstanceGroupManagerOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetInstanceGroupManagerPatch : Allow user to set InstanceGroupManagerPatch +func (options *UpdateInstanceGroupManagerOptions) SetInstanceGroupManagerPatch(instanceGroupManagerPatch map[string]interface{}) *UpdateInstanceGroupManagerOptions { + options.InstanceGroupManagerPatch = instanceGroupManagerPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupManagerOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupManagerPolicyOptions : The UpdateInstanceGroupManagerPolicy options. +type UpdateInstanceGroupManagerPolicyOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // The instance group manager identifier. + InstanceGroupManagerID *string `validate:"required,ne="` + + // The instance group manager policy identifier. + ID *string `validate:"required,ne="` + + // The instance group manager policy patch. + InstanceGroupManagerPolicyPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupManagerPolicyOptions : Instantiate UpdateInstanceGroupManagerPolicyOptions +func (*VpcV1) NewUpdateInstanceGroupManagerPolicyOptions(instanceGroupID string, instanceGroupManagerID string, id string, instanceGroupManagerPolicyPatch map[string]interface{}) *UpdateInstanceGroupManagerPolicyOptions { + return &UpdateInstanceGroupManagerPolicyOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + InstanceGroupManagerID: core.StringPtr(instanceGroupManagerID), + ID: core.StringPtr(id), + InstanceGroupManagerPolicyPatch: instanceGroupManagerPolicyPatch, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupManagerPolicyOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetInstanceGroupManagerID : Allow user to set InstanceGroupManagerID +func (options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerID(instanceGroupManagerID string) *UpdateInstanceGroupManagerPolicyOptions { + options.InstanceGroupManagerID = core.StringPtr(instanceGroupManagerID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateInstanceGroupManagerPolicyOptions) SetID(id string) *UpdateInstanceGroupManagerPolicyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetInstanceGroupManagerPolicyPatch : Allow user to set InstanceGroupManagerPolicyPatch +func (options *UpdateInstanceGroupManagerPolicyOptions) SetInstanceGroupManagerPolicyPatch(instanceGroupManagerPolicyPatch map[string]interface{}) *UpdateInstanceGroupManagerPolicyOptions { + options.InstanceGroupManagerPolicyPatch = instanceGroupManagerPolicyPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupManagerPolicyOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupManagerPolicyOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupMembershipOptions : The UpdateInstanceGroupMembership options. +type UpdateInstanceGroupMembershipOptions struct { + // The instance group identifier. + InstanceGroupID *string `validate:"required,ne="` + + // The instance group membership identifier. + ID *string `validate:"required,ne="` + + // The instance group membership patch. + InstanceGroupMembershipPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupMembershipOptions : Instantiate UpdateInstanceGroupMembershipOptions +func (*VpcV1) NewUpdateInstanceGroupMembershipOptions(instanceGroupID string, id string, instanceGroupMembershipPatch map[string]interface{}) *UpdateInstanceGroupMembershipOptions { + return &UpdateInstanceGroupMembershipOptions{ + InstanceGroupID: core.StringPtr(instanceGroupID), + ID: core.StringPtr(id), + InstanceGroupMembershipPatch: instanceGroupMembershipPatch, + } +} + +// SetInstanceGroupID : Allow user to set InstanceGroupID +func (options *UpdateInstanceGroupMembershipOptions) SetInstanceGroupID(instanceGroupID string) *UpdateInstanceGroupMembershipOptions { + options.InstanceGroupID = core.StringPtr(instanceGroupID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateInstanceGroupMembershipOptions) SetID(id string) *UpdateInstanceGroupMembershipOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetInstanceGroupMembershipPatch : Allow user to set InstanceGroupMembershipPatch +func (options *UpdateInstanceGroupMembershipOptions) SetInstanceGroupMembershipPatch(instanceGroupMembershipPatch map[string]interface{}) *UpdateInstanceGroupMembershipOptions { + options.InstanceGroupMembershipPatch = instanceGroupMembershipPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupMembershipOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupMembershipOptions { + options.Headers = param + return options +} + +// UpdateInstanceGroupOptions : The UpdateInstanceGroup options. +type UpdateInstanceGroupOptions struct { + // The instance group identifier. + ID *string `validate:"required,ne="` + + // The instance group patch. + InstanceGroupPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceGroupOptions : Instantiate UpdateInstanceGroupOptions +func (*VpcV1) NewUpdateInstanceGroupOptions(id string, instanceGroupPatch map[string]interface{}) *UpdateInstanceGroupOptions { + return &UpdateInstanceGroupOptions{ + ID: core.StringPtr(id), + InstanceGroupPatch: instanceGroupPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateInstanceGroupOptions) SetID(id string) *UpdateInstanceGroupOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetInstanceGroupPatch : Allow user to set InstanceGroupPatch +func (options *UpdateInstanceGroupOptions) SetInstanceGroupPatch(instanceGroupPatch map[string]interface{}) *UpdateInstanceGroupOptions { + options.InstanceGroupPatch = instanceGroupPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceGroupOptions) SetHeaders(param map[string]string) *UpdateInstanceGroupOptions { + options.Headers = param + return options +} + +// UpdateInstanceNetworkInterfaceOptions : The UpdateInstanceNetworkInterface options. +type UpdateInstanceNetworkInterfaceOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The network interface identifier. + ID *string `validate:"required,ne="` + + // The network interface patch. + NetworkInterfacePatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceNetworkInterfaceOptions : Instantiate UpdateInstanceNetworkInterfaceOptions +func (*VpcV1) NewUpdateInstanceNetworkInterfaceOptions(instanceID string, id string, networkInterfacePatch map[string]interface{}) *UpdateInstanceNetworkInterfaceOptions { + return &UpdateInstanceNetworkInterfaceOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + NetworkInterfacePatch: networkInterfacePatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *UpdateInstanceNetworkInterfaceOptions) SetInstanceID(instanceID string) *UpdateInstanceNetworkInterfaceOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateInstanceNetworkInterfaceOptions) SetID(id string) *UpdateInstanceNetworkInterfaceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetNetworkInterfacePatch : Allow user to set NetworkInterfacePatch +func (options *UpdateInstanceNetworkInterfaceOptions) SetNetworkInterfacePatch(networkInterfacePatch map[string]interface{}) *UpdateInstanceNetworkInterfaceOptions { + options.NetworkInterfacePatch = networkInterfacePatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceNetworkInterfaceOptions) SetHeaders(param map[string]string) *UpdateInstanceNetworkInterfaceOptions { + options.Headers = param + return options +} + +// UpdateInstanceOptions : The UpdateInstance options. +type UpdateInstanceOptions struct { + // The instance identifier. + ID *string `validate:"required,ne="` + + // The instance patch. + InstancePatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceOptions : Instantiate UpdateInstanceOptions +func (*VpcV1) NewUpdateInstanceOptions(id string, instancePatch map[string]interface{}) *UpdateInstanceOptions { + return &UpdateInstanceOptions{ + ID: core.StringPtr(id), + InstancePatch: instancePatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateInstanceOptions) SetID(id string) *UpdateInstanceOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetInstancePatch : Allow user to set InstancePatch +func (options *UpdateInstanceOptions) SetInstancePatch(instancePatch map[string]interface{}) *UpdateInstanceOptions { + options.InstancePatch = instancePatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceOptions) SetHeaders(param map[string]string) *UpdateInstanceOptions { + options.Headers = param + return options +} + +// UpdateInstanceTemplateOptions : The UpdateInstanceTemplate options. +type UpdateInstanceTemplateOptions struct { + // The instance template identifier. + ID *string `validate:"required,ne="` + + // The instance template patch. + InstanceTemplatePatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceTemplateOptions : Instantiate UpdateInstanceTemplateOptions +func (*VpcV1) NewUpdateInstanceTemplateOptions(id string, instanceTemplatePatch map[string]interface{}) *UpdateInstanceTemplateOptions { + return &UpdateInstanceTemplateOptions{ + ID: core.StringPtr(id), + InstanceTemplatePatch: instanceTemplatePatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateInstanceTemplateOptions) SetID(id string) *UpdateInstanceTemplateOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetInstanceTemplatePatch : Allow user to set InstanceTemplatePatch +func (options *UpdateInstanceTemplateOptions) SetInstanceTemplatePatch(instanceTemplatePatch map[string]interface{}) *UpdateInstanceTemplateOptions { + options.InstanceTemplatePatch = instanceTemplatePatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceTemplateOptions) SetHeaders(param map[string]string) *UpdateInstanceTemplateOptions { + options.Headers = param + return options +} + +// UpdateInstanceVolumeAttachmentOptions : The UpdateInstanceVolumeAttachment options. +type UpdateInstanceVolumeAttachmentOptions struct { + // The instance identifier. + InstanceID *string `validate:"required,ne="` + + // The volume attachment identifier. + ID *string `validate:"required,ne="` + + // The volume attachment patch. + VolumeAttachmentPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateInstanceVolumeAttachmentOptions : Instantiate UpdateInstanceVolumeAttachmentOptions +func (*VpcV1) NewUpdateInstanceVolumeAttachmentOptions(instanceID string, id string, volumeAttachmentPatch map[string]interface{}) *UpdateInstanceVolumeAttachmentOptions { + return &UpdateInstanceVolumeAttachmentOptions{ + InstanceID: core.StringPtr(instanceID), + ID: core.StringPtr(id), + VolumeAttachmentPatch: volumeAttachmentPatch, + } +} + +// SetInstanceID : Allow user to set InstanceID +func (options *UpdateInstanceVolumeAttachmentOptions) SetInstanceID(instanceID string) *UpdateInstanceVolumeAttachmentOptions { + options.InstanceID = core.StringPtr(instanceID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateInstanceVolumeAttachmentOptions) SetID(id string) *UpdateInstanceVolumeAttachmentOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetVolumeAttachmentPatch : Allow user to set VolumeAttachmentPatch +func (options *UpdateInstanceVolumeAttachmentOptions) SetVolumeAttachmentPatch(volumeAttachmentPatch map[string]interface{}) *UpdateInstanceVolumeAttachmentOptions { + options.VolumeAttachmentPatch = volumeAttachmentPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateInstanceVolumeAttachmentOptions) SetHeaders(param map[string]string) *UpdateInstanceVolumeAttachmentOptions { + options.Headers = param + return options +} + +// UpdateIpsecPolicyOptions : The UpdateIpsecPolicy options. +type UpdateIpsecPolicyOptions struct { + // The IPsec policy identifier. + ID *string `validate:"required,ne="` + + // The IPsec policy patch. + IPsecPolicyPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateIpsecPolicyOptions : Instantiate UpdateIpsecPolicyOptions +func (*VpcV1) NewUpdateIpsecPolicyOptions(id string, iPsecPolicyPatch map[string]interface{}) *UpdateIpsecPolicyOptions { + return &UpdateIpsecPolicyOptions{ + ID: core.StringPtr(id), + IPsecPolicyPatch: iPsecPolicyPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateIpsecPolicyOptions) SetID(id string) *UpdateIpsecPolicyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetIPsecPolicyPatch : Allow user to set IPsecPolicyPatch +func (options *UpdateIpsecPolicyOptions) SetIPsecPolicyPatch(iPsecPolicyPatch map[string]interface{}) *UpdateIpsecPolicyOptions { + options.IPsecPolicyPatch = iPsecPolicyPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateIpsecPolicyOptions) SetHeaders(param map[string]string) *UpdateIpsecPolicyOptions { + options.Headers = param + return options +} + +// UpdateKeyOptions : The UpdateKey options. +type UpdateKeyOptions struct { + // The key identifier. + ID *string `validate:"required,ne="` + + // The key patch. + KeyPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateKeyOptions : Instantiate UpdateKeyOptions +func (*VpcV1) NewUpdateKeyOptions(id string, keyPatch map[string]interface{}) *UpdateKeyOptions { + return &UpdateKeyOptions{ + ID: core.StringPtr(id), + KeyPatch: keyPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateKeyOptions) SetID(id string) *UpdateKeyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetKeyPatch : Allow user to set KeyPatch +func (options *UpdateKeyOptions) SetKeyPatch(keyPatch map[string]interface{}) *UpdateKeyOptions { + options.KeyPatch = keyPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateKeyOptions) SetHeaders(param map[string]string) *UpdateKeyOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerListenerOptions : The UpdateLoadBalancerListener options. +type UpdateLoadBalancerListenerOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The listener identifier. + ID *string `validate:"required,ne="` + + // The load balancer listener patch. + LoadBalancerListenerPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerListenerOptions : Instantiate UpdateLoadBalancerListenerOptions +func (*VpcV1) NewUpdateLoadBalancerListenerOptions(loadBalancerID string, id string, loadBalancerListenerPatch map[string]interface{}) *UpdateLoadBalancerListenerOptions { + return &UpdateLoadBalancerListenerOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + LoadBalancerListenerPatch: loadBalancerListenerPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *UpdateLoadBalancerListenerOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateLoadBalancerListenerOptions) SetID(id string) *UpdateLoadBalancerListenerOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetLoadBalancerListenerPatch : Allow user to set LoadBalancerListenerPatch +func (options *UpdateLoadBalancerListenerOptions) SetLoadBalancerListenerPatch(loadBalancerListenerPatch map[string]interface{}) *UpdateLoadBalancerListenerOptions { + options.LoadBalancerListenerPatch = loadBalancerListenerPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerListenerOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerListenerPolicyOptions : The UpdateLoadBalancerListenerPolicy options. +type UpdateLoadBalancerListenerPolicyOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The listener identifier. + ListenerID *string `validate:"required,ne="` + + // The policy identifier. + ID *string `validate:"required,ne="` + + // The listener policy patch. + LoadBalancerListenerPolicyPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerListenerPolicyOptions : Instantiate UpdateLoadBalancerListenerPolicyOptions +func (*VpcV1) NewUpdateLoadBalancerListenerPolicyOptions(loadBalancerID string, listenerID string, id string, loadBalancerListenerPolicyPatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyOptions { + return &UpdateLoadBalancerListenerPolicyOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + ID: core.StringPtr(id), + LoadBalancerListenerPolicyPatch: loadBalancerListenerPolicyPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *UpdateLoadBalancerListenerPolicyOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerPolicyOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetListenerID : Allow user to set ListenerID +func (options *UpdateLoadBalancerListenerPolicyOptions) SetListenerID(listenerID string) *UpdateLoadBalancerListenerPolicyOptions { + options.ListenerID = core.StringPtr(listenerID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateLoadBalancerListenerPolicyOptions) SetID(id string) *UpdateLoadBalancerListenerPolicyOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetLoadBalancerListenerPolicyPatch : Allow user to set LoadBalancerListenerPolicyPatch +func (options *UpdateLoadBalancerListenerPolicyOptions) SetLoadBalancerListenerPolicyPatch(loadBalancerListenerPolicyPatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyOptions { + options.LoadBalancerListenerPolicyPatch = loadBalancerListenerPolicyPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerListenerPolicyOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerPolicyOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerListenerPolicyRuleOptions : The UpdateLoadBalancerListenerPolicyRule options. +type UpdateLoadBalancerListenerPolicyRuleOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The listener identifier. + ListenerID *string `validate:"required,ne="` + + // The policy identifier. + PolicyID *string `validate:"required,ne="` + + // The rule identifier. + ID *string `validate:"required,ne="` + + // The listener policy rule patch. + LoadBalancerListenerPolicyRulePatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerListenerPolicyRuleOptions : Instantiate UpdateLoadBalancerListenerPolicyRuleOptions +func (*VpcV1) NewUpdateLoadBalancerListenerPolicyRuleOptions(loadBalancerID string, listenerID string, policyID string, id string, loadBalancerListenerPolicyRulePatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyRuleOptions { + return &UpdateLoadBalancerListenerPolicyRuleOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ListenerID: core.StringPtr(listenerID), + PolicyID: core.StringPtr(policyID), + ID: core.StringPtr(id), + LoadBalancerListenerPolicyRulePatch: loadBalancerListenerPolicyRulePatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *UpdateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerListenerPolicyRuleOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetListenerID : Allow user to set ListenerID +func (options *UpdateLoadBalancerListenerPolicyRuleOptions) SetListenerID(listenerID string) *UpdateLoadBalancerListenerPolicyRuleOptions { + options.ListenerID = core.StringPtr(listenerID) + return options +} + +// SetPolicyID : Allow user to set PolicyID +func (options *UpdateLoadBalancerListenerPolicyRuleOptions) SetPolicyID(policyID string) *UpdateLoadBalancerListenerPolicyRuleOptions { + options.PolicyID = core.StringPtr(policyID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateLoadBalancerListenerPolicyRuleOptions) SetID(id string) *UpdateLoadBalancerListenerPolicyRuleOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetLoadBalancerListenerPolicyRulePatch : Allow user to set LoadBalancerListenerPolicyRulePatch +func (options *UpdateLoadBalancerListenerPolicyRuleOptions) SetLoadBalancerListenerPolicyRulePatch(loadBalancerListenerPolicyRulePatch map[string]interface{}) *UpdateLoadBalancerListenerPolicyRuleOptions { + options.LoadBalancerListenerPolicyRulePatch = loadBalancerListenerPolicyRulePatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerListenerPolicyRuleOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerListenerPolicyRuleOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerOptions : The UpdateLoadBalancer options. +type UpdateLoadBalancerOptions struct { + // The load balancer identifier. + ID *string `validate:"required,ne="` + + // The load balancer patch. + LoadBalancerPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerOptions : Instantiate UpdateLoadBalancerOptions +func (*VpcV1) NewUpdateLoadBalancerOptions(id string, loadBalancerPatch map[string]interface{}) *UpdateLoadBalancerOptions { + return &UpdateLoadBalancerOptions{ + ID: core.StringPtr(id), + LoadBalancerPatch: loadBalancerPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateLoadBalancerOptions) SetID(id string) *UpdateLoadBalancerOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetLoadBalancerPatch : Allow user to set LoadBalancerPatch +func (options *UpdateLoadBalancerOptions) SetLoadBalancerPatch(loadBalancerPatch map[string]interface{}) *UpdateLoadBalancerOptions { + options.LoadBalancerPatch = loadBalancerPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerPoolMemberOptions : The UpdateLoadBalancerPoolMember options. +type UpdateLoadBalancerPoolMemberOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The pool identifier. + PoolID *string `validate:"required,ne="` + + // The member identifier. + ID *string `validate:"required,ne="` + + // The load balancer pool member patch. + LoadBalancerPoolMemberPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerPoolMemberOptions : Instantiate UpdateLoadBalancerPoolMemberOptions +func (*VpcV1) NewUpdateLoadBalancerPoolMemberOptions(loadBalancerID string, poolID string, id string, loadBalancerPoolMemberPatch map[string]interface{}) *UpdateLoadBalancerPoolMemberOptions { + return &UpdateLoadBalancerPoolMemberOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + PoolID: core.StringPtr(poolID), + ID: core.StringPtr(id), + LoadBalancerPoolMemberPatch: loadBalancerPoolMemberPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *UpdateLoadBalancerPoolMemberOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerPoolMemberOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetPoolID : Allow user to set PoolID +func (options *UpdateLoadBalancerPoolMemberOptions) SetPoolID(poolID string) *UpdateLoadBalancerPoolMemberOptions { + options.PoolID = core.StringPtr(poolID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateLoadBalancerPoolMemberOptions) SetID(id string) *UpdateLoadBalancerPoolMemberOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetLoadBalancerPoolMemberPatch : Allow user to set LoadBalancerPoolMemberPatch +func (options *UpdateLoadBalancerPoolMemberOptions) SetLoadBalancerPoolMemberPatch(loadBalancerPoolMemberPatch map[string]interface{}) *UpdateLoadBalancerPoolMemberOptions { + options.LoadBalancerPoolMemberPatch = loadBalancerPoolMemberPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerPoolMemberOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerPoolMemberOptions { + options.Headers = param + return options +} + +// UpdateLoadBalancerPoolOptions : The UpdateLoadBalancerPool options. +type UpdateLoadBalancerPoolOptions struct { + // The load balancer identifier. + LoadBalancerID *string `validate:"required,ne="` + + // The pool identifier. + ID *string `validate:"required,ne="` + + // The load balancer pool patch. + LoadBalancerPoolPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateLoadBalancerPoolOptions : Instantiate UpdateLoadBalancerPoolOptions +func (*VpcV1) NewUpdateLoadBalancerPoolOptions(loadBalancerID string, id string, loadBalancerPoolPatch map[string]interface{}) *UpdateLoadBalancerPoolOptions { + return &UpdateLoadBalancerPoolOptions{ + LoadBalancerID: core.StringPtr(loadBalancerID), + ID: core.StringPtr(id), + LoadBalancerPoolPatch: loadBalancerPoolPatch, + } +} + +// SetLoadBalancerID : Allow user to set LoadBalancerID +func (options *UpdateLoadBalancerPoolOptions) SetLoadBalancerID(loadBalancerID string) *UpdateLoadBalancerPoolOptions { + options.LoadBalancerID = core.StringPtr(loadBalancerID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateLoadBalancerPoolOptions) SetID(id string) *UpdateLoadBalancerPoolOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetLoadBalancerPoolPatch : Allow user to set LoadBalancerPoolPatch +func (options *UpdateLoadBalancerPoolOptions) SetLoadBalancerPoolPatch(loadBalancerPoolPatch map[string]interface{}) *UpdateLoadBalancerPoolOptions { + options.LoadBalancerPoolPatch = loadBalancerPoolPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateLoadBalancerPoolOptions) SetHeaders(param map[string]string) *UpdateLoadBalancerPoolOptions { + options.Headers = param + return options +} + +// UpdateNetworkACLOptions : The UpdateNetworkACL options. +type UpdateNetworkACLOptions struct { + // The network ACL identifier. + ID *string `validate:"required,ne="` + + // The network ACL patch. + NetworkACLPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateNetworkACLOptions : Instantiate UpdateNetworkACLOptions +func (*VpcV1) NewUpdateNetworkACLOptions(id string, networkACLPatch map[string]interface{}) *UpdateNetworkACLOptions { + return &UpdateNetworkACLOptions{ + ID: core.StringPtr(id), + NetworkACLPatch: networkACLPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateNetworkACLOptions) SetID(id string) *UpdateNetworkACLOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetNetworkACLPatch : Allow user to set NetworkACLPatch +func (options *UpdateNetworkACLOptions) SetNetworkACLPatch(networkACLPatch map[string]interface{}) *UpdateNetworkACLOptions { + options.NetworkACLPatch = networkACLPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateNetworkACLOptions) SetHeaders(param map[string]string) *UpdateNetworkACLOptions { + options.Headers = param + return options +} + +// UpdateNetworkACLRuleOptions : The UpdateNetworkACLRule options. +type UpdateNetworkACLRuleOptions struct { + // The network ACL identifier. + NetworkACLID *string `validate:"required,ne="` + + // The rule identifier. + ID *string `validate:"required,ne="` + + // The network ACL rule patch. + NetworkACLRulePatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateNetworkACLRuleOptions : Instantiate UpdateNetworkACLRuleOptions +func (*VpcV1) NewUpdateNetworkACLRuleOptions(networkACLID string, id string, networkACLRulePatch map[string]interface{}) *UpdateNetworkACLRuleOptions { + return &UpdateNetworkACLRuleOptions{ + NetworkACLID: core.StringPtr(networkACLID), + ID: core.StringPtr(id), + NetworkACLRulePatch: networkACLRulePatch, + } +} + +// SetNetworkACLID : Allow user to set NetworkACLID +func (options *UpdateNetworkACLRuleOptions) SetNetworkACLID(networkACLID string) *UpdateNetworkACLRuleOptions { + options.NetworkACLID = core.StringPtr(networkACLID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateNetworkACLRuleOptions) SetID(id string) *UpdateNetworkACLRuleOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetNetworkACLRulePatch : Allow user to set NetworkACLRulePatch +func (options *UpdateNetworkACLRuleOptions) SetNetworkACLRulePatch(networkACLRulePatch map[string]interface{}) *UpdateNetworkACLRuleOptions { + options.NetworkACLRulePatch = networkACLRulePatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateNetworkACLRuleOptions) SetHeaders(param map[string]string) *UpdateNetworkACLRuleOptions { + options.Headers = param + return options +} + +// UpdatePublicGatewayOptions : The UpdatePublicGateway options. +type UpdatePublicGatewayOptions struct { + // The public gateway identifier. + ID *string `validate:"required,ne="` + + // The public gateway patch. + PublicGatewayPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdatePublicGatewayOptions : Instantiate UpdatePublicGatewayOptions +func (*VpcV1) NewUpdatePublicGatewayOptions(id string, publicGatewayPatch map[string]interface{}) *UpdatePublicGatewayOptions { + return &UpdatePublicGatewayOptions{ + ID: core.StringPtr(id), + PublicGatewayPatch: publicGatewayPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdatePublicGatewayOptions) SetID(id string) *UpdatePublicGatewayOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetPublicGatewayPatch : Allow user to set PublicGatewayPatch +func (options *UpdatePublicGatewayOptions) SetPublicGatewayPatch(publicGatewayPatch map[string]interface{}) *UpdatePublicGatewayOptions { + options.PublicGatewayPatch = publicGatewayPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdatePublicGatewayOptions) SetHeaders(param map[string]string) *UpdatePublicGatewayOptions { + options.Headers = param + return options +} + +// UpdateSecurityGroupOptions : The UpdateSecurityGroup options. +type UpdateSecurityGroupOptions struct { + // The security group identifier. + ID *string `validate:"required,ne="` + + // The security group patch. + SecurityGroupPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSecurityGroupOptions : Instantiate UpdateSecurityGroupOptions +func (*VpcV1) NewUpdateSecurityGroupOptions(id string, securityGroupPatch map[string]interface{}) *UpdateSecurityGroupOptions { + return &UpdateSecurityGroupOptions{ + ID: core.StringPtr(id), + SecurityGroupPatch: securityGroupPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateSecurityGroupOptions) SetID(id string) *UpdateSecurityGroupOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetSecurityGroupPatch : Allow user to set SecurityGroupPatch +func (options *UpdateSecurityGroupOptions) SetSecurityGroupPatch(securityGroupPatch map[string]interface{}) *UpdateSecurityGroupOptions { + options.SecurityGroupPatch = securityGroupPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSecurityGroupOptions) SetHeaders(param map[string]string) *UpdateSecurityGroupOptions { + options.Headers = param + return options +} + +// UpdateSecurityGroupRuleOptions : The UpdateSecurityGroupRule options. +type UpdateSecurityGroupRuleOptions struct { + // The security group identifier. + SecurityGroupID *string `validate:"required,ne="` + + // The rule identifier. + ID *string `validate:"required,ne="` + + // The security group rule patch. + SecurityGroupRulePatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSecurityGroupRuleOptions : Instantiate UpdateSecurityGroupRuleOptions +func (*VpcV1) NewUpdateSecurityGroupRuleOptions(securityGroupID string, id string, securityGroupRulePatch map[string]interface{}) *UpdateSecurityGroupRuleOptions { + return &UpdateSecurityGroupRuleOptions{ + SecurityGroupID: core.StringPtr(securityGroupID), + ID: core.StringPtr(id), + SecurityGroupRulePatch: securityGroupRulePatch, + } +} + +// SetSecurityGroupID : Allow user to set SecurityGroupID +func (options *UpdateSecurityGroupRuleOptions) SetSecurityGroupID(securityGroupID string) *UpdateSecurityGroupRuleOptions { + options.SecurityGroupID = core.StringPtr(securityGroupID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateSecurityGroupRuleOptions) SetID(id string) *UpdateSecurityGroupRuleOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetSecurityGroupRulePatch : Allow user to set SecurityGroupRulePatch +func (options *UpdateSecurityGroupRuleOptions) SetSecurityGroupRulePatch(securityGroupRulePatch map[string]interface{}) *UpdateSecurityGroupRuleOptions { + options.SecurityGroupRulePatch = securityGroupRulePatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSecurityGroupRuleOptions) SetHeaders(param map[string]string) *UpdateSecurityGroupRuleOptions { + options.Headers = param + return options +} + +// UpdateSubnetOptions : The UpdateSubnet options. +type UpdateSubnetOptions struct { + // The subnet identifier. + ID *string `validate:"required,ne="` + + // The subnet patch. + SubnetPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSubnetOptions : Instantiate UpdateSubnetOptions +func (*VpcV1) NewUpdateSubnetOptions(id string, subnetPatch map[string]interface{}) *UpdateSubnetOptions { + return &UpdateSubnetOptions{ + ID: core.StringPtr(id), + SubnetPatch: subnetPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateSubnetOptions) SetID(id string) *UpdateSubnetOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetSubnetPatch : Allow user to set SubnetPatch +func (options *UpdateSubnetOptions) SetSubnetPatch(subnetPatch map[string]interface{}) *UpdateSubnetOptions { + options.SubnetPatch = subnetPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSubnetOptions) SetHeaders(param map[string]string) *UpdateSubnetOptions { + options.Headers = param + return options +} + +// UpdateSubnetReservedIPOptions : The UpdateSubnetReservedIP options. +type UpdateSubnetReservedIPOptions struct { + // The subnet identifier. + SubnetID *string `validate:"required,ne="` + + // The reserved IP identifier. + ID *string `validate:"required,ne="` + + // The reserved IP patch. + ReservedIPPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateSubnetReservedIPOptions : Instantiate UpdateSubnetReservedIPOptions +func (*VpcV1) NewUpdateSubnetReservedIPOptions(subnetID string, id string, reservedIPPatch map[string]interface{}) *UpdateSubnetReservedIPOptions { + return &UpdateSubnetReservedIPOptions{ + SubnetID: core.StringPtr(subnetID), + ID: core.StringPtr(id), + ReservedIPPatch: reservedIPPatch, + } +} + +// SetSubnetID : Allow user to set SubnetID +func (options *UpdateSubnetReservedIPOptions) SetSubnetID(subnetID string) *UpdateSubnetReservedIPOptions { + options.SubnetID = core.StringPtr(subnetID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateSubnetReservedIPOptions) SetID(id string) *UpdateSubnetReservedIPOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetReservedIPPatch : Allow user to set ReservedIPPatch +func (options *UpdateSubnetReservedIPOptions) SetReservedIPPatch(reservedIPPatch map[string]interface{}) *UpdateSubnetReservedIPOptions { + options.ReservedIPPatch = reservedIPPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateSubnetReservedIPOptions) SetHeaders(param map[string]string) *UpdateSubnetReservedIPOptions { + options.Headers = param + return options +} + +// UpdateVolumeOptions : The UpdateVolume options. +type UpdateVolumeOptions struct { + // The volume identifier. + ID *string `validate:"required,ne="` + + // The volume patch. + VolumePatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVolumeOptions : Instantiate UpdateVolumeOptions +func (*VpcV1) NewUpdateVolumeOptions(id string, volumePatch map[string]interface{}) *UpdateVolumeOptions { + return &UpdateVolumeOptions{ + ID: core.StringPtr(id), + VolumePatch: volumePatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateVolumeOptions) SetID(id string) *UpdateVolumeOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetVolumePatch : Allow user to set VolumePatch +func (options *UpdateVolumeOptions) SetVolumePatch(volumePatch map[string]interface{}) *UpdateVolumeOptions { + options.VolumePatch = volumePatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVolumeOptions) SetHeaders(param map[string]string) *UpdateVolumeOptions { + options.Headers = param + return options +} + +// UpdateVPCAddressPrefixOptions : The UpdateVPCAddressPrefix options. +type UpdateVPCAddressPrefixOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The prefix identifier. + ID *string `validate:"required,ne="` + + // The prefix patch. + AddressPrefixPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCAddressPrefixOptions : Instantiate UpdateVPCAddressPrefixOptions +func (*VpcV1) NewUpdateVPCAddressPrefixOptions(vpcID string, id string, addressPrefixPatch map[string]interface{}) *UpdateVPCAddressPrefixOptions { + return &UpdateVPCAddressPrefixOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + AddressPrefixPatch: addressPrefixPatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (options *UpdateVPCAddressPrefixOptions) SetVPCID(vpcID string) *UpdateVPCAddressPrefixOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateVPCAddressPrefixOptions) SetID(id string) *UpdateVPCAddressPrefixOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetAddressPrefixPatch : Allow user to set AddressPrefixPatch +func (options *UpdateVPCAddressPrefixOptions) SetAddressPrefixPatch(addressPrefixPatch map[string]interface{}) *UpdateVPCAddressPrefixOptions { + options.AddressPrefixPatch = addressPrefixPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCAddressPrefixOptions) SetHeaders(param map[string]string) *UpdateVPCAddressPrefixOptions { + options.Headers = param + return options +} + +// UpdateVPCOptions : The UpdateVPC options. +type UpdateVPCOptions struct { + // The VPC identifier. + ID *string `validate:"required,ne="` + + // The VPC patch. + VPCPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCOptions : Instantiate UpdateVPCOptions +func (*VpcV1) NewUpdateVPCOptions(id string, vpcPatch map[string]interface{}) *UpdateVPCOptions { + return &UpdateVPCOptions{ + ID: core.StringPtr(id), + VPCPatch: vpcPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateVPCOptions) SetID(id string) *UpdateVPCOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetVPCPatch : Allow user to set VPCPatch +func (options *UpdateVPCOptions) SetVPCPatch(vpcPatch map[string]interface{}) *UpdateVPCOptions { + options.VPCPatch = vpcPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCOptions) SetHeaders(param map[string]string) *UpdateVPCOptions { + options.Headers = param + return options +} + +// UpdateVPCRouteOptions : The UpdateVPCRoute options. +type UpdateVPCRouteOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The route identifier. + ID *string `validate:"required,ne="` + + // The route patch. + RoutePatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCRouteOptions : Instantiate UpdateVPCRouteOptions +func (*VpcV1) NewUpdateVPCRouteOptions(vpcID string, id string, routePatch map[string]interface{}) *UpdateVPCRouteOptions { + return &UpdateVPCRouteOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + RoutePatch: routePatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (options *UpdateVPCRouteOptions) SetVPCID(vpcID string) *UpdateVPCRouteOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateVPCRouteOptions) SetID(id string) *UpdateVPCRouteOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetRoutePatch : Allow user to set RoutePatch +func (options *UpdateVPCRouteOptions) SetRoutePatch(routePatch map[string]interface{}) *UpdateVPCRouteOptions { + options.RoutePatch = routePatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCRouteOptions) SetHeaders(param map[string]string) *UpdateVPCRouteOptions { + options.Headers = param + return options +} + +// UpdateVPCRoutingTableOptions : The UpdateVPCRoutingTable options. +type UpdateVPCRoutingTableOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The routing table identifier. + ID *string `validate:"required,ne="` + + // The routing table patch. + RoutingTablePatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCRoutingTableOptions : Instantiate UpdateVPCRoutingTableOptions +func (*VpcV1) NewUpdateVPCRoutingTableOptions(vpcID string, id string, routingTablePatch map[string]interface{}) *UpdateVPCRoutingTableOptions { + return &UpdateVPCRoutingTableOptions{ + VPCID: core.StringPtr(vpcID), + ID: core.StringPtr(id), + RoutingTablePatch: routingTablePatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (options *UpdateVPCRoutingTableOptions) SetVPCID(vpcID string) *UpdateVPCRoutingTableOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateVPCRoutingTableOptions) SetID(id string) *UpdateVPCRoutingTableOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetRoutingTablePatch : Allow user to set RoutingTablePatch +func (options *UpdateVPCRoutingTableOptions) SetRoutingTablePatch(routingTablePatch map[string]interface{}) *UpdateVPCRoutingTableOptions { + options.RoutingTablePatch = routingTablePatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCRoutingTableOptions) SetHeaders(param map[string]string) *UpdateVPCRoutingTableOptions { + options.Headers = param + return options +} + +// UpdateVPCRoutingTableRouteOptions : The UpdateVPCRoutingTableRoute options. +type UpdateVPCRoutingTableRouteOptions struct { + // The VPC identifier. + VPCID *string `validate:"required,ne="` + + // The routing table identifier. + RoutingTableID *string `validate:"required,ne="` + + // The VPC routing table route identifier. + ID *string `validate:"required,ne="` + + // The VPC route patch. + RoutePatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPCRoutingTableRouteOptions : Instantiate UpdateVPCRoutingTableRouteOptions +func (*VpcV1) NewUpdateVPCRoutingTableRouteOptions(vpcID string, routingTableID string, id string, routePatch map[string]interface{}) *UpdateVPCRoutingTableRouteOptions { + return &UpdateVPCRoutingTableRouteOptions{ + VPCID: core.StringPtr(vpcID), + RoutingTableID: core.StringPtr(routingTableID), + ID: core.StringPtr(id), + RoutePatch: routePatch, + } +} + +// SetVPCID : Allow user to set VPCID +func (options *UpdateVPCRoutingTableRouteOptions) SetVPCID(vpcID string) *UpdateVPCRoutingTableRouteOptions { + options.VPCID = core.StringPtr(vpcID) + return options +} + +// SetRoutingTableID : Allow user to set RoutingTableID +func (options *UpdateVPCRoutingTableRouteOptions) SetRoutingTableID(routingTableID string) *UpdateVPCRoutingTableRouteOptions { + options.RoutingTableID = core.StringPtr(routingTableID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateVPCRoutingTableRouteOptions) SetID(id string) *UpdateVPCRoutingTableRouteOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetRoutePatch : Allow user to set RoutePatch +func (options *UpdateVPCRoutingTableRouteOptions) SetRoutePatch(routePatch map[string]interface{}) *UpdateVPCRoutingTableRouteOptions { + options.RoutePatch = routePatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPCRoutingTableRouteOptions) SetHeaders(param map[string]string) *UpdateVPCRoutingTableRouteOptions { + options.Headers = param + return options +} + +// UpdateVPNGatewayConnectionOptions : The UpdateVPNGatewayConnection options. +type UpdateVPNGatewayConnectionOptions struct { + // The VPN gateway identifier. + VPNGatewayID *string `validate:"required,ne="` + + // The VPN gateway connection identifier. + ID *string `validate:"required,ne="` + + // The VPN gateway connection patch. + VPNGatewayConnectionPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPNGatewayConnectionOptions : Instantiate UpdateVPNGatewayConnectionOptions +func (*VpcV1) NewUpdateVPNGatewayConnectionOptions(vpnGatewayID string, id string, vpnGatewayConnectionPatch map[string]interface{}) *UpdateVPNGatewayConnectionOptions { + return &UpdateVPNGatewayConnectionOptions{ + VPNGatewayID: core.StringPtr(vpnGatewayID), + ID: core.StringPtr(id), + VPNGatewayConnectionPatch: vpnGatewayConnectionPatch, + } +} + +// SetVPNGatewayID : Allow user to set VPNGatewayID +func (options *UpdateVPNGatewayConnectionOptions) SetVPNGatewayID(vpnGatewayID string) *UpdateVPNGatewayConnectionOptions { + options.VPNGatewayID = core.StringPtr(vpnGatewayID) + return options +} + +// SetID : Allow user to set ID +func (options *UpdateVPNGatewayConnectionOptions) SetID(id string) *UpdateVPNGatewayConnectionOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetVPNGatewayConnectionPatch : Allow user to set VPNGatewayConnectionPatch +func (options *UpdateVPNGatewayConnectionOptions) SetVPNGatewayConnectionPatch(vpnGatewayConnectionPatch map[string]interface{}) *UpdateVPNGatewayConnectionOptions { + options.VPNGatewayConnectionPatch = vpnGatewayConnectionPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNGatewayConnectionOptions) SetHeaders(param map[string]string) *UpdateVPNGatewayConnectionOptions { + options.Headers = param + return options +} + +// UpdateVPNGatewayOptions : The UpdateVPNGateway options. +type UpdateVPNGatewayOptions struct { + // The VPN gateway identifier. + ID *string `validate:"required,ne="` + + // The VPN gateway patch. + VPNGatewayPatch map[string]interface{} `validate:"required"` + + // Allows users to set headers on API requests + Headers map[string]string +} + +// NewUpdateVPNGatewayOptions : Instantiate UpdateVPNGatewayOptions +func (*VpcV1) NewUpdateVPNGatewayOptions(id string, vpnGatewayPatch map[string]interface{}) *UpdateVPNGatewayOptions { + return &UpdateVPNGatewayOptions{ + ID: core.StringPtr(id), + VPNGatewayPatch: vpnGatewayPatch, + } +} + +// SetID : Allow user to set ID +func (options *UpdateVPNGatewayOptions) SetID(id string) *UpdateVPNGatewayOptions { + options.ID = core.StringPtr(id) + return options +} + +// SetVPNGatewayPatch : Allow user to set VPNGatewayPatch +func (options *UpdateVPNGatewayOptions) SetVPNGatewayPatch(vpnGatewayPatch map[string]interface{}) *UpdateVPNGatewayOptions { + options.VPNGatewayPatch = vpnGatewayPatch + return options +} + +// SetHeaders : Allow user to set Headers +func (options *UpdateVPNGatewayOptions) SetHeaders(param map[string]string) *UpdateVPNGatewayOptions { + options.Headers = param + return options +} + +// Vcpu : The VCPU configuration. +type Vcpu struct { + // The VCPU architecture. + Architecture *string `json:"architecture" validate:"required"` + + // The number of VCPUs assigned. + Count *int64 `json:"count" validate:"required"` +} + +// UnmarshalVcpu unmarshals an instance of Vcpu from the specified map of raw messages. +func UnmarshalVcpu(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Vcpu) + err = core.UnmarshalPrimitive(m, "architecture", &obj.Architecture) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "count", &obj.Count) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPC : VPC struct +type VPC struct { + // Indicates whether this VPC is connected to Classic Infrastructure. If true, this VPC's resources have private + // network connectivity to the account's Classic Infrastructure resources. Only one VPC, per region, may be connected + // in this way. This value is set at creation and subsequently immutable. + ClassicAccess *bool `json:"classic_access" validate:"required"` + + // The date and time that the VPC was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // Array of CSE ([Cloud Service Endpoint](https://cloud.ibm.com/docs/resources?topic=resources-service-endpoints)) + // source IP addresses for the VPC. The VPC will have one CSE source IP address per zone. + CseSourceIps []VpccseSourceIP `json:"cse_source_ips,omitempty"` + + // The default network ACL to use for subnets created in this VPC. + DefaultNetworkACL *NetworkACLReference `json:"default_network_acl" validate:"required"` + + // The default routing table to use for subnets created in this VPC. + DefaultRoutingTable *RoutingTableReference `json:"default_routing_table" validate:"required"` + + // The default security group to use for network interfaces created in this VPC. + DefaultSecurityGroup *SecurityGroupReference `json:"default_security_group" validate:"required"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this VPC. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPC. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The status of this VPC. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the VPC.Status property. +// The status of this VPC. +const ( + VPCStatusAvailableConst = "available" + VPCStatusDeletingConst = "deleting" + VPCStatusFailedConst = "failed" + VPCStatusPendingConst = "pending" +) + +// UnmarshalVPC unmarshals an instance of VPC from the specified map of raw messages. +func UnmarshalVPC(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPC) + err = core.UnmarshalPrimitive(m, "classic_access", &obj.ClassicAccess) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "cse_source_ips", &obj.CseSourceIps, UnmarshalVpccseSourceIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_network_acl", &obj.DefaultNetworkACL, UnmarshalNetworkACLReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_routing_table", &obj.DefaultRoutingTable, UnmarshalRoutingTableReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "default_security_group", &obj.DefaultSecurityGroup, UnmarshalSecurityGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VpccseSourceIP : VpccseSourceIP struct +type VpccseSourceIP struct { + // The cloud service endpoint source IP address for this zone. + IP *IP `json:"ip" validate:"required"` + + // The zone this cloud service endpoint source IP resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// UnmarshalVpccseSourceIP unmarshals an instance of VpccseSourceIP from the specified map of raw messages. +func UnmarshalVpccseSourceIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VpccseSourceIP) + err = core.UnmarshalModel(m, "ip", &obj.IP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCCollection : VPCCollection struct +type VPCCollection struct { + // A link to the first page of resources. + First *VPCCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VPCCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of VPCs. + Vpcs []VPC `json:"vpcs" validate:"required"` +} + +// UnmarshalVPCCollection unmarshals an instance of VPCCollection from the specified map of raw messages. +func UnmarshalVPCCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPCCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPCCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpcs", &obj.Vpcs, UnmarshalVPC) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCCollectionFirst : A link to the first page of resources. +type VPCCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPCCollectionFirst unmarshals an instance of VPCCollectionFirst from the specified map of raw messages. +func UnmarshalVPCCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VPCCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPCCollectionNext unmarshals an instance of VPCCollectionNext from the specified map of raw messages. +func UnmarshalVPCCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentity : Identifies a VPC by a unique property. +// Models which "extend" this model: +// - VPCIdentityByID +// - VPCIdentityByCRN +// - VPCIdentityByHref +type VPCIdentity struct { + // The unique identifier for this VPC. + ID *string `json:"id,omitempty"` + + // The CRN for this VPC. + CRN *string `json:"crn,omitempty"` + + // The URL for this VPC. + Href *string `json:"href,omitempty"` +} + +func (*VPCIdentity) isaVPCIdentity() bool { + return true +} + +type VPCIdentityIntf interface { + isaVPCIdentity() bool +} + +// UnmarshalVPCIdentity unmarshals an instance of VPCIdentity from the specified map of raw messages. +func UnmarshalVPCIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCPatch : VPCPatch struct +type VPCPatch struct { + // The unique user-defined name for this VPC. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVPCPatch unmarshals an instance of VPCPatch from the specified map of raw messages. +func UnmarshalVPCPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VPCPatch +func (vpcPatch *VPCPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpcPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// VPCReference : VPCReference struct +type VPCReference struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this VPC. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalVPCReference unmarshals an instance of VPCReference from the specified map of raw messages. +func UnmarshalVPCReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type VPCReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPCReferenceDeleted unmarshals an instance of VPCReferenceDeleted from the specified map of raw messages. +func UnmarshalVPCReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGateway : VPNGateway struct +// Models which "extend" this model: +// - VPNGatewayRouteMode +// - VPNGatewayPolicyMode +type VPNGateway struct { + // Collection of references to VPN gateway connections. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this VPN gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // Collection of VPN gateway members. + Members []VPNGatewayMember `json:"members" validate:"required"` + + // The user-defined name for this VPN gateway. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPN gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the VPN gateway. + Status *string `json:"status" validate:"required"` + + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGateway.ResourceType property. +// The resource type. +const ( + VPNGatewayResourceTypeVPNGatewayConst = "vpn_gateway" +) + +// Constants associated with the VPNGateway.Status property. +// The status of the VPN gateway. +const ( + VPNGatewayStatusAvailableConst = "available" + VPNGatewayStatusDeletingConst = "deleting" + VPNGatewayStatusFailedConst = "failed" + VPNGatewayStatusPendingConst = "pending" +) + +// Constants associated with the VPNGateway.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayModeRouteConst = "route" +) + +func (*VPNGateway) isaVPNGateway() bool { + return true +} + +type VPNGatewayIntf interface { + isaVPNGateway() bool +} + +// UnmarshalVPNGateway unmarshals an instance of VPNGateway from the specified map of raw messages. +func UnmarshalVPNGateway(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGateway) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayCollection : VPNGatewayCollection struct +type VPNGatewayCollection struct { + // A link to the first page of resources. + First *VPNGatewayCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VPNGatewayCollectionNext `json:"next,omitempty"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` + + // Collection of VPN gateways. + VPNGateways []VPNGatewayIntf `json:"vpn_gateways" validate:"required"` +} + +// UnmarshalVPNGatewayCollection unmarshals an instance of VPNGatewayCollection from the specified map of raw messages. +func UnmarshalVPNGatewayCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVPNGatewayCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVPNGatewayCollectionNext) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpn_gateways", &obj.VPNGateways, UnmarshalVPNGateway) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayCollectionFirst : A link to the first page of resources. +type VPNGatewayCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPNGatewayCollectionFirst unmarshals an instance of VPNGatewayCollectionFirst from the specified map of raw messages. +func UnmarshalVPNGatewayCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VPNGatewayCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVPNGatewayCollectionNext unmarshals an instance of VPNGatewayCollectionNext from the specified map of raw messages. +func UnmarshalVPNGatewayCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnection : VPNGatewayConnection struct +// Models which "extend" this model: +// - VPNGatewayConnectionStaticRouteMode +// - VPNGatewayConnectionPolicyMode +type VPNGatewayConnection struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The Dead Peer Detection settings. + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // Optional IKE policy configuration. The absence of a policy indicates autonegotiation. + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // Optional IPsec policy configuration. The absence of a policy indicates + // autonegotiation. + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name" validate:"required"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` + + // The VPN tunnel configuration for this VPN gateway connection (in static route mode). + Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels,omitempty"` + + // A collection of local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs,omitempty"` + + // A collection of peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs,omitempty"` +} + +// Constants associated with the VPNGatewayConnection.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnection.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionModePolicyConst = "policy" + VPNGatewayConnectionModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnection.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnection.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionStatusDownConst = "down" + VPNGatewayConnectionStatusUpConst = "up" +) + +// Constants associated with the VPNGatewayConnection.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnection) isaVPNGatewayConnection() bool { + return true +} + +type VPNGatewayConnectionIntf interface { + isaVPNGatewayConnection() bool +} + +// UnmarshalVPNGatewayConnection unmarshals an instance of VPNGatewayConnection from the specified map of raw messages. +func UnmarshalVPNGatewayConnection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnection) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionCollection : Collection of VPN gateway connections in a VPN gateway. +type VPNGatewayConnectionCollection struct { + // Array of VPN gateway connections. + Connections []VPNGatewayConnectionIntf `json:"connections" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionCollection unmarshals an instance of VPNGatewayConnectionCollection from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionCollection) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnection) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDpd : The Dead Peer Detection settings. +type VPNGatewayConnectionDpd struct { + // Dead Peer Detection actions. + Action *string `json:"action" validate:"required"` + + // Dead Peer Detection interval in seconds. + Interval *int64 `json:"interval" validate:"required"` + + // Dead Peer Detection timeout in seconds. Must be at least the interval. + Timeout *int64 `json:"timeout" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionDpd.Action property. +// Dead Peer Detection actions. +const ( + VPNGatewayConnectionDpdActionClearConst = "clear" + VPNGatewayConnectionDpdActionHoldConst = "hold" + VPNGatewayConnectionDpdActionNoneConst = "none" + VPNGatewayConnectionDpdActionRestartConst = "restart" +) + +// UnmarshalVPNGatewayConnectionDpd unmarshals an instance of VPNGatewayConnectionDpd from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDpd(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDpd) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionDpdPrototype : The Dead Peer Detection settings. +type VPNGatewayConnectionDpdPrototype struct { + // Dead Peer Detection actions. + Action *string `json:"action,omitempty"` + + // Dead Peer Detection interval in seconds. + Interval *int64 `json:"interval,omitempty"` + + // Dead Peer Detection timeout in seconds. Must be at least the interval. + Timeout *int64 `json:"timeout,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionDpdPrototype.Action property. +// Dead Peer Detection actions. +const ( + VPNGatewayConnectionDpdPrototypeActionClearConst = "clear" + VPNGatewayConnectionDpdPrototypeActionHoldConst = "hold" + VPNGatewayConnectionDpdPrototypeActionNoneConst = "none" + VPNGatewayConnectionDpdPrototypeActionRestartConst = "restart" +) + +// UnmarshalVPNGatewayConnectionDpdPrototype unmarshals an instance of VPNGatewayConnectionDpdPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionDpdPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionDpdPrototype) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "interval", &obj.Interval) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "timeout", &obj.Timeout) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionLocalCIDRs : VPNGatewayConnectionLocalCIDRs struct +type VPNGatewayConnectionLocalCIDRs struct { + // A collection of local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs,omitempty"` +} + +// UnmarshalVPNGatewayConnectionLocalCIDRs unmarshals an instance of VPNGatewayConnectionLocalCIDRs from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionLocalCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionLocalCIDRs) + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPatch : VPNGatewayConnectionPatch struct +// Models which "extend" this model: +// - VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch +type VPNGatewayConnectionPatch struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + // The Dead Peer Detection settings. + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + + // Optional IKE policy configuration. The absence of a policy indicates autonegotiation. + IkePolicy IkePolicyIdentityIntf `json:"ike_policy,omitempty"` + + // Optional IPsec policy configuration. The absence of a policy indicates + // autonegotiation. + IpsecPolicy IPsecPolicyIdentityIntf `json:"ipsec_policy,omitempty"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address,omitempty"` + + // The preshared key. + Psk *string `json:"psk,omitempty"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPatch.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPatchRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionPatch) isaVPNGatewayConnectionPatch() bool { + return true +} + +type VPNGatewayConnectionPatchIntf interface { + isaVPNGatewayConnectionPatch() bool +} + +// UnmarshalVPNGatewayConnectionPatch unmarshals an instance of VPNGatewayConnectionPatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPatch) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VPNGatewayConnectionPatch +func (vpnGatewayConnectionPatch *VPNGatewayConnectionPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpnGatewayConnectionPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// VPNGatewayConnectionPeerCIDRs : VPNGatewayConnectionPeerCIDRs struct +type VPNGatewayConnectionPeerCIDRs struct { + // A collection of peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs,omitempty"` +} + +// UnmarshalVPNGatewayConnectionPeerCIDRs unmarshals an instance of VPNGatewayConnectionPeerCIDRs from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPeerCIDRs(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPeerCIDRs) + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPrototype : VPNGatewayConnectionPrototype struct +// Models which "extend" this model: +// - VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype +// - VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype +type VPNGatewayConnectionPrototype struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + // The Dead Peer Detection settings. + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + + // Optional IKE policy configuration. The absence of a policy indicates autonegotiation. + IkePolicy IkePolicyIdentityIntf `json:"ike_policy,omitempty"` + + // Optional IPsec policy configuration. The absence of a policy indicates + // autonegotiation. + IpsecPolicy IPsecPolicyIdentityIntf `json:"ipsec_policy,omitempty"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` + + // A collection of local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs,omitempty"` + + // A collection of peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPrototype.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPrototypeRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionPrototype) isaVPNGatewayConnectionPrototype() bool { + return true +} + +type VPNGatewayConnectionPrototypeIntf interface { + isaVPNGatewayConnectionPrototype() bool +} + +// UnmarshalVPNGatewayConnectionPrototype unmarshals an instance of VPNGatewayConnectionPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPrototype) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionReference : VPNGatewayConnectionReference struct +type VPNGatewayConnectionReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this VPN connection. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionReference.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// UnmarshalVPNGatewayConnectionReference unmarshals an instance of VPNGatewayConnectionReference from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type VPNGatewayConnectionReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVPNGatewayConnectionReferenceDeleted unmarshals an instance of VPNGatewayConnectionReferenceDeleted from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteModeTunnel : VPNGatewayConnectionStaticRouteModeTunnel struct +type VPNGatewayConnectionStaticRouteModeTunnel struct { + // The IP address of the VPN gateway member in which the tunnel resides. + PublicIP *IP `json:"public_ip" validate:"required"` + + // The status of the VPN Tunnel. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionStaticRouteModeTunnel.Status property. +// The status of the VPN Tunnel. +const ( + VPNGatewayConnectionStaticRouteModeTunnelStatusDownConst = "down" + VPNGatewayConnectionStaticRouteModeTunnelStatusUpConst = "up" +) + +// UnmarshalVPNGatewayConnectionStaticRouteModeTunnel unmarshals an instance of VPNGatewayConnectionStaticRouteModeTunnel from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteModeTunnel(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteModeTunnel) + err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayMember : VPNGatewayMember struct +type VPNGatewayMember struct { + // The private IP address assigned to the VPN gateway member. This + // property will be present only when the VPN gateway status is + // `available`. + PrivateIP *IP `json:"private_ip,omitempty"` + + // The public IP address assigned to the VPN gateway member. + PublicIP *IP `json:"public_ip" validate:"required"` + + // The high availability role assigned to the VPN gateway member. + Role *string `json:"role" validate:"required"` + + // The status of the VPN gateway member. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the VPNGatewayMember.Role property. +// The high availability role assigned to the VPN gateway member. +const ( + VPNGatewayMemberRoleActiveConst = "active" + VPNGatewayMemberRoleStandbyConst = "standby" +) + +// Constants associated with the VPNGatewayMember.Status property. +// The status of the VPN gateway member. +const ( + VPNGatewayMemberStatusAvailableConst = "available" + VPNGatewayMemberStatusDeletingConst = "deleting" + VPNGatewayMemberStatusFailedConst = "failed" + VPNGatewayMemberStatusPendingConst = "pending" +) + +// UnmarshalVPNGatewayMember unmarshals an instance of VPNGatewayMember from the specified map of raw messages. +func UnmarshalVPNGatewayMember(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayMember) + err = core.UnmarshalModel(m, "private_ip", &obj.PrivateIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_ip", &obj.PublicIP, UnmarshalIP) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "role", &obj.Role) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPatch : VPNGatewayPatch struct +type VPNGatewayPatch struct { + // The user-defined name for this VPN gateway. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVPNGatewayPatch unmarshals an instance of VPNGatewayPatch from the specified map of raw messages. +func UnmarshalVPNGatewayPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VPNGatewayPatch +func (vpnGatewayPatch *VPNGatewayPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(vpnGatewayPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// VPNGatewayPrototype : VPNGatewayPrototype struct +// Models which "extend" this model: +// - VPNGatewayPrototypeVPNGatewayRouteModePrototype +// - VPNGatewayPrototypeVPNGatewayPolicyModePrototype +type VPNGatewayPrototype struct { + // The user-defined name for this VPN gateway. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // Identifies a subnet by a unique property. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototype.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayPrototypeModeRouteConst = "route" +) + +func (*VPNGatewayPrototype) isaVPNGatewayPrototype() bool { + return true +} + +type VPNGatewayPrototypeIntf interface { + isaVPNGatewayPrototype() bool +} + +// UnmarshalVPNGatewayPrototype unmarshals an instance of VPNGatewayPrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Volume : Volume struct +type Volume struct { + // The capacity of the volume in gigabytes. The specified minimum and maximum capacity values for creating or updating + // volumes may expand in the future. + Capacity *int64 `json:"capacity" validate:"required"` + + // The date and time that the volume was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` + + // The type of encryption used on the volume. + Encryption *string `json:"encryption" validate:"required"` + + // A reference to the root key used to wrap the data encryption key for the volume. + // + // This property will be present for volumes with an `encryption` type of + // `user_managed`. + EncryptionKey *EncryptionKeyReference `json:"encryption_key,omitempty"` + + // The URL for this volume. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` + + // The bandwidth for the volume. + Iops *int64 `json:"iops" validate:"required"` + + // The unique user-defined name for this volume. + Name *string `json:"name" validate:"required"` + + // The profile this volume uses. + Profile *VolumeProfileReference `json:"profile" validate:"required"` + + // The resource group for this volume. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The status of the volume. + // + // The enumerated values for this property will expand in the future. When processing this property, check for and log + // unknown values. Optionally halt processing and surface the error, or bypass the volume on which the unexpected + // property value was encountered. + Status *string `json:"status" validate:"required"` + + // Array of reasons for the current status (if any). + // + // The enumerated reason code values for this property will expand in the future. When processing this property, check + // for and log unknown values. Optionally halt processing and surface the error, or bypass the resource on which the + // unexpected reason code was encountered. + StatusReasons []VolumeStatusReason `json:"status_reasons" validate:"required"` + + // The collection of volume attachments attaching instances to the volume. + VolumeAttachments []VolumeAttachmentReferenceVolumeContext `json:"volume_attachments" validate:"required"` + + // The zone this volume resides in. + Zone *ZoneReference `json:"zone" validate:"required"` +} + +// Constants associated with the Volume.Encryption property. +// The type of encryption used on the volume. +const ( + VolumeEncryptionProviderManagedConst = "provider_managed" + VolumeEncryptionUserManagedConst = "user_managed" +) + +// Constants associated with the Volume.Status property. +// The status of the volume. +// +// The enumerated values for this property will expand in the future. When processing this property, check for and log +// unknown values. Optionally halt processing and surface the error, or bypass the volume on which the unexpected +// property value was encountered. +const ( + VolumeStatusAvailableConst = "available" + VolumeStatusFailedConst = "failed" + VolumeStatusPendingConst = "pending" + VolumeStatusPendingDeletionConst = "pending_deletion" + VolumeStatusUnusableConst = "unusable" +) + +// UnmarshalVolume unmarshals an instance of Volume from the specified map of raw messages. +func UnmarshalVolume(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Volume) + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encryption", &obj.Encryption) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "status_reasons", &obj.StatusReasons, UnmarshalVolumeStatusReason) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentReferenceVolumeContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachment : VolumeAttachment struct +type VolumeAttachment struct { + // The date and time that the volume was attached. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // If set to true, when deleting the instance the volume will also be deleted. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // Information about how the volume is exposed to the instance operating system. + // + // This property may be absent if the volume attachment's `status` is not `attached`. + Device *VolumeAttachmentDevice `json:"device,omitempty"` + + // The URL for this volume attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume attachment. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this volume attachment. + Name *string `json:"name" validate:"required"` + + // The status of this volume attachment. + Status *string `json:"status" validate:"required"` + + // The type of volume attachment. + Type *string `json:"type" validate:"required"` + + // The attached volume. + Volume *VolumeReference `json:"volume" validate:"required"` +} + +// Constants associated with the VolumeAttachment.Status property. +// The status of this volume attachment. +const ( + VolumeAttachmentStatusAttachedConst = "attached" + VolumeAttachmentStatusAttachingConst = "attaching" + VolumeAttachmentStatusDeletingConst = "deleting" + VolumeAttachmentStatusDetachingConst = "detaching" +) + +// Constants associated with the VolumeAttachment.Type property. +// The type of volume attachment. +const ( + VolumeAttachmentTypeBootConst = "boot" + VolumeAttachmentTypeDataConst = "data" +) + +// UnmarshalVolumeAttachment unmarshals an instance of VolumeAttachment from the specified map of raw messages. +func UnmarshalVolumeAttachment(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachment) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentCollection : VolumeAttachmentCollection struct +type VolumeAttachmentCollection struct { + // Collection of volume attachments. + VolumeAttachments []VolumeAttachment `json:"volume_attachments" validate:"required"` +} + +// UnmarshalVolumeAttachmentCollection unmarshals an instance of VolumeAttachmentCollection from the specified map of raw messages. +func UnmarshalVolumeAttachmentCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentCollection) + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachment) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentDevice : VolumeAttachmentDevice struct +type VolumeAttachmentDevice struct { + // A unique identifier for the device which is exposed to the instance operating system. + ID *string `json:"id,omitempty"` +} + +// UnmarshalVolumeAttachmentDevice unmarshals an instance of VolumeAttachmentDevice from the specified map of raw messages. +func UnmarshalVolumeAttachmentDevice(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentDevice) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPatch : VolumeAttachmentPatch struct +type VolumeAttachmentPatch struct { + // If set to true, when deleting the instance the volume will also be deleted. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The user-defined name for this volume attachment. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVolumeAttachmentPatch unmarshals an instance of VolumeAttachmentPatch from the specified map of raw messages. +func UnmarshalVolumeAttachmentPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPatch) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VolumeAttachmentPatch +func (volumeAttachmentPatch *VolumeAttachmentPatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(volumeAttachmentPatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// VolumeAttachmentPrototypeInstanceByImageContext : VolumeAttachmentPrototypeInstanceByImageContext struct +type VolumeAttachmentPrototypeInstanceByImageContext struct { + // If set to true, when deleting the instance the volume will also be deleted. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The user-defined name for this volume attachment. + Name *string `json:"name,omitempty"` + + // A prototype object for a new volume. + Volume *VolumePrototypeInstanceByImageContext `json:"volume" validate:"required"` +} + +// NewVolumeAttachmentPrototypeInstanceByImageContext : Instantiate VolumeAttachmentPrototypeInstanceByImageContext (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeInstanceByImageContext(volume *VolumePrototypeInstanceByImageContext) (model *VolumeAttachmentPrototypeInstanceByImageContext, err error) { + model = &VolumeAttachmentPrototypeInstanceByImageContext{ + Volume: volume, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalVolumeAttachmentPrototypeInstanceByImageContext unmarshals an instance of VolumeAttachmentPrototypeInstanceByImageContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeInstanceByImageContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeInstanceByImageContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumePrototypeInstanceByImageContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentPrototypeInstanceContext : VolumeAttachmentPrototypeInstanceContext struct +type VolumeAttachmentPrototypeInstanceContext struct { + // If set to true, when deleting the instance the volume will also be deleted. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete,omitempty"` + + // The user-defined name for this volume attachment. + Name *string `json:"name,omitempty"` + + // The identity of the volume to attach to the instance, or a prototype object for a new + // volume. + Volume VolumeAttachmentVolumePrototypeInstanceContextIntf `json:"volume" validate:"required"` +} + +// NewVolumeAttachmentPrototypeInstanceContext : Instantiate VolumeAttachmentPrototypeInstanceContext (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentPrototypeInstanceContext(volume VolumeAttachmentVolumePrototypeInstanceContextIntf) (model *VolumeAttachmentPrototypeInstanceContext, err error) { + model = &VolumeAttachmentPrototypeInstanceContext{ + Volume: volume, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalVolumeAttachmentPrototypeInstanceContext unmarshals an instance of VolumeAttachmentPrototypeInstanceContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentPrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentPrototypeInstanceContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeAttachmentVolumePrototypeInstanceContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceInstanceContext : VolumeAttachmentReferenceInstanceContext struct +type VolumeAttachmentReferenceInstanceContext struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *VolumeAttachmentReferenceInstanceContextDeleted `json:"deleted,omitempty"` + + // Information about how the volume is exposed to the instance operating system. + // + // This property may be absent if the volume attachment's `status` is not `attached`. + Device *VolumeAttachmentDevice `json:"device,omitempty"` + + // The URL for this volume attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume attachment. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this volume attachment. + Name *string `json:"name" validate:"required"` + + // The attached volume. + Volume *VolumeReference `json:"volume" validate:"required"` +} + +// UnmarshalVolumeAttachmentReferenceInstanceContext unmarshals an instance of VolumeAttachmentReferenceInstanceContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceInstanceContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceInstanceContextDeleted) + if err != nil { + return + } + err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume", &obj.Volume, UnmarshalVolumeReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceInstanceContextDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type VolumeAttachmentReferenceInstanceContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVolumeAttachmentReferenceInstanceContextDeleted unmarshals an instance of VolumeAttachmentReferenceInstanceContextDeleted from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceInstanceContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceInstanceContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceVolumeContext : VolumeAttachmentReferenceVolumeContext struct +type VolumeAttachmentReferenceVolumeContext struct { + // If set to true, when deleting the instance the volume will also be deleted. + DeleteVolumeOnInstanceDelete *bool `json:"delete_volume_on_instance_delete" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *VolumeAttachmentReferenceVolumeContextDeleted `json:"deleted,omitempty"` + + // Information about how the volume is exposed to the instance operating system. + // + // This property may be absent if the volume attachment's `status` is not `attached`. + Device *VolumeAttachmentDevice `json:"device,omitempty"` + + // The URL for this volume attachment. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume attachment. + ID *string `json:"id" validate:"required"` + + // The attached instance. + Instance *InstanceReference `json:"instance" validate:"required"` + + // The user-defined name for this volume attachment. + Name *string `json:"name" validate:"required"` + + // The type of volume attachment. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the VolumeAttachmentReferenceVolumeContext.Type property. +// The type of volume attachment. +const ( + VolumeAttachmentReferenceVolumeContextTypeBootConst = "boot" + VolumeAttachmentReferenceVolumeContextTypeDataConst = "data" +) + +// UnmarshalVolumeAttachmentReferenceVolumeContext unmarshals an instance of VolumeAttachmentReferenceVolumeContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceVolumeContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceVolumeContext) + err = core.UnmarshalPrimitive(m, "delete_volume_on_instance_delete", &obj.DeleteVolumeOnInstanceDelete) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeAttachmentReferenceVolumeContextDeleted) + if err != nil { + return + } + err = core.UnmarshalModel(m, "device", &obj.Device, UnmarshalVolumeAttachmentDevice) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "instance", &obj.Instance, UnmarshalInstanceReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentReferenceVolumeContextDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type VolumeAttachmentReferenceVolumeContextDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVolumeAttachmentReferenceVolumeContextDeleted unmarshals an instance of VolumeAttachmentReferenceVolumeContextDeleted from the specified map of raw messages. +func UnmarshalVolumeAttachmentReferenceVolumeContextDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentReferenceVolumeContextDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentVolumePrototypeInstanceContext : The identity of the volume to attach to the instance, or a prototype object for a new volume. +// Models which "extend" this model: +// - VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity +// - VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext +type VolumeAttachmentVolumePrototypeInstanceContext struct { + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` + + // The identity of the root key to use to wrap the data encryption key for the volume. + // + // If this property is not provided, the `encryption` type for the volume will be + // `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The bandwidth for the volume. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile,omitempty"` + + // The capacity of the volume in gigabytes. The specified minimum and maximum capacity values for creating or updating + // volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` +} + +func (*VolumeAttachmentVolumePrototypeInstanceContext) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { + return true +} + +type VolumeAttachmentVolumePrototypeInstanceContextIntf interface { + isaVolumeAttachmentVolumePrototypeInstanceContext() bool +} + +// UnmarshalVolumeAttachmentVolumePrototypeInstanceContext unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentVolumePrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentVolumePrototypeInstanceContext) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeCollection : VolumeCollection struct +type VolumeCollection struct { + // A link to the first page of resources. + First *VolumeCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VolumeCollectionNext `json:"next,omitempty"` + + // Collection of volumes. + Volumes []Volume `json:"volumes" validate:"required"` +} + +// UnmarshalVolumeCollection unmarshals an instance of VolumeCollection from the specified map of raw messages. +func UnmarshalVolumeCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVolumeCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVolumeCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volumes", &obj.Volumes, UnmarshalVolume) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeCollectionFirst : A link to the first page of resources. +type VolumeCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVolumeCollectionFirst unmarshals an instance of VolumeCollectionFirst from the specified map of raw messages. +func UnmarshalVolumeCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VolumeCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVolumeCollectionNext unmarshals an instance of VolumeCollectionNext from the specified map of raw messages. +func UnmarshalVolumeCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentity : Identifies a volume by a unique property. +// Models which "extend" this model: +// - VolumeIdentityByID +// - VolumeIdentityByCRN +// - VolumeIdentityByHref +type VolumeIdentity struct { + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` +} + +func (*VolumeIdentity) isaVolumeIdentity() bool { + return true +} + +type VolumeIdentityIntf interface { + isaVolumeIdentity() bool +} + +// UnmarshalVolumeIdentity unmarshals an instance of VolumeIdentity from the specified map of raw messages. +func UnmarshalVolumeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePatch : VolumePatch struct +type VolumePatch struct { + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` +} + +// UnmarshalVolumePatch unmarshals an instance of VolumePatch from the specified map of raw messages. +func UnmarshalVolumePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePatch) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// AsPatch returns a generic map representation of the VolumePatch +func (volumePatch *VolumePatch) AsPatch() (patch map[string]interface{}, err error) { + var jsonData []byte + jsonData, err = json.Marshal(volumePatch) + if err == nil { + err = json.Unmarshal(jsonData, &patch) + } + return +} + +// VolumeProfile : VolumeProfile struct +type VolumeProfile struct { + // The product family this volume profile belongs to. + Family *string `json:"family,omitempty"` + + // The URL for this volume profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this volume profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalVolumeProfile unmarshals an instance of VolumeProfile from the specified map of raw messages. +func UnmarshalVolumeProfile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfile) + err = core.UnmarshalPrimitive(m, "family", &obj.Family) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileCollection : VolumeProfileCollection struct +type VolumeProfileCollection struct { + // A link to the first page of resources. + First *VolumeProfileCollectionFirst `json:"first" validate:"required"` + + // The maximum number of resources that can be returned by the request. + Limit *int64 `json:"limit" validate:"required"` + + // A link to the next page of resources. This property is present for all pages + // except the last page. + Next *VolumeProfileCollectionNext `json:"next,omitempty"` + + // Collection of volume profiles. + Profiles []VolumeProfile `json:"profiles" validate:"required"` + + // The total number of resources across all pages. + TotalCount *int64 `json:"total_count" validate:"required"` +} + +// UnmarshalVolumeProfileCollection unmarshals an instance of VolumeProfileCollection from the specified map of raw messages. +func UnmarshalVolumeProfileCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileCollection) + err = core.UnmarshalModel(m, "first", &obj.First, UnmarshalVolumeProfileCollectionFirst) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "limit", &obj.Limit) + if err != nil { + return + } + err = core.UnmarshalModel(m, "next", &obj.Next, UnmarshalVolumeProfileCollectionNext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profiles", &obj.Profiles, UnmarshalVolumeProfile) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_count", &obj.TotalCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileCollectionFirst : A link to the first page of resources. +type VolumeProfileCollectionFirst struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVolumeProfileCollectionFirst unmarshals an instance of VolumeProfileCollectionFirst from the specified map of raw messages. +func UnmarshalVolumeProfileCollectionFirst(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileCollectionFirst) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileCollectionNext : A link to the next page of resources. This property is present for all pages except the last page. +type VolumeProfileCollectionNext struct { + // The URL for a page of resources. + Href *string `json:"href" validate:"required"` +} + +// UnmarshalVolumeProfileCollectionNext unmarshals an instance of VolumeProfileCollectionNext from the specified map of raw messages. +func UnmarshalVolumeProfileCollectionNext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileCollectionNext) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileIdentity : Identifies a volume profile by a unique property. +// Models which "extend" this model: +// - VolumeProfileIdentityByName +// - VolumeProfileIdentityByHref +type VolumeProfileIdentity struct { + // The globally unique name for this volume profile. + Name *string `json:"name,omitempty"` + + // The URL for this volume profile. + Href *string `json:"href,omitempty"` +} + +func (*VolumeProfileIdentity) isaVolumeProfileIdentity() bool { + return true +} + +type VolumeProfileIdentityIntf interface { + isaVolumeProfileIdentity() bool +} + +// UnmarshalVolumeProfileIdentity unmarshals an instance of VolumeProfileIdentity from the specified map of raw messages. +func UnmarshalVolumeProfileIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileReference : VolumeProfileReference struct +type VolumeProfileReference struct { + // The URL for this volume profile. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this volume profile. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalVolumeProfileReference unmarshals an instance of VolumeProfileReference from the specified map of raw messages. +func UnmarshalVolumeProfileReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototype : VolumePrototype struct +// Models which "extend" this model: +// - VolumePrototypeVolumeByCapacity +type VolumePrototype struct { + // The identity of the root key to use to wrap the data encryption key for the volume. + // + // If this property is not provided, the `encryption` type for the volume will be + // `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The bandwidth for the volume. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The zone this volume will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The capacity of the volume in gigabytes. The specified minimum and maximum capacity values for creating or updating + // volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` +} + +func (*VolumePrototype) isaVolumePrototype() bool { + return true +} + +type VolumePrototypeIntf interface { + isaVolumePrototype() bool +} + +// UnmarshalVolumePrototype unmarshals an instance of VolumePrototype from the specified map of raw messages. +func UnmarshalVolumePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototype) + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototypeInstanceByImageContext : VolumePrototypeInstanceByImageContext struct +type VolumePrototypeInstanceByImageContext struct { + // The capacity of the volume in gigabytes. The specified minimum and maximum capacity values for creating or updating + // volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` + + // The identity of the root key to use to wrap the data encryption key for the volume. + // + // If this property is not provided but the image is encrypted, the image's + // `encryption_key` will be used. Otherwise, the `encryption` type for the + // volume will be `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The bandwidth for the volume. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` +} + +// NewVolumePrototypeInstanceByImageContext : Instantiate VolumePrototypeInstanceByImageContext (Generic Model Constructor) +func (*VpcV1) NewVolumePrototypeInstanceByImageContext(profile VolumeProfileIdentityIntf) (model *VolumePrototypeInstanceByImageContext, err error) { + model = &VolumePrototypeInstanceByImageContext{ + Profile: profile, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +// UnmarshalVolumePrototypeInstanceByImageContext unmarshals an instance of VolumePrototypeInstanceByImageContext from the specified map of raw messages. +func UnmarshalVolumePrototypeInstanceByImageContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototypeInstanceByImageContext) + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeReference : VolumeReference struct +type VolumeReference struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *VolumeReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this volume. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this volume. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalVolumeReference unmarshals an instance of VolumeReference from the specified map of raw messages. +func UnmarshalVolumeReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVolumeReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeReferenceDeleted : If present, this property indicates the referenced resource has been deleted and provides some supplementary +// information. +type VolumeReferenceDeleted struct { + // Link to documentation about deleted resources. + MoreInfo *string `json:"more_info" validate:"required"` +} + +// UnmarshalVolumeReferenceDeleted unmarshals an instance of VolumeReferenceDeleted from the specified map of raw messages. +func UnmarshalVolumeReferenceDeleted(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeReferenceDeleted) + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeStatusReason : VolumeStatusReason struct +type VolumeStatusReason struct { + // A snake case string succinctly identifying the status reason. + Code *string `json:"code" validate:"required"` + + // An explanation of the status reason. + Message *string `json:"message" validate:"required"` + + // Link to documentation about this status reason. + MoreInfo *string `json:"more_info,omitempty"` +} + +// Constants associated with the VolumeStatusReason.Code property. +// A snake case string succinctly identifying the status reason. +const ( + VolumeStatusReasonCodeEncryptionKeyDeletedConst = "encryption_key_deleted" +) + +// UnmarshalVolumeStatusReason unmarshals an instance of VolumeStatusReason from the specified map of raw messages. +func UnmarshalVolumeStatusReason(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeStatusReason) + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "message", &obj.Message) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "more_info", &obj.MoreInfo) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// Zone : Zone struct +type Zone struct { + // The URL for this zone. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this zone. + Name *string `json:"name" validate:"required"` + + // The region this zone resides in. + Region *RegionReference `json:"region" validate:"required"` + + // The availability status of this zone. + Status *string `json:"status" validate:"required"` +} + +// Constants associated with the Zone.Status property. +// The availability status of this zone. +const ( + ZoneStatusAvailableConst = "available" + ZoneStatusImpairedConst = "impaired" + ZoneStatusUnavailableConst = "unavailable" +) + +// UnmarshalZone unmarshals an instance of Zone from the specified map of raw messages. +func UnmarshalZone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(Zone) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "region", &obj.Region, UnmarshalRegionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneCollection : ZoneCollection struct +type ZoneCollection struct { + // Collection of zones. + Zones []Zone `json:"zones" validate:"required"` +} + +// UnmarshalZoneCollection unmarshals an instance of ZoneCollection from the specified map of raw messages. +func UnmarshalZoneCollection(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneCollection) + err = core.UnmarshalModel(m, "zones", &obj.Zones, UnmarshalZone) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneIdentity : Identifies a zone by a unique property. +// Models which "extend" this model: +// - ZoneIdentityByName +// - ZoneIdentityByHref +type ZoneIdentity struct { + // The globally unique name for this zone. + Name *string `json:"name,omitempty"` + + // The URL for this zone. + Href *string `json:"href,omitempty"` +} + +func (*ZoneIdentity) isaZoneIdentity() bool { + return true +} + +type ZoneIdentityIntf interface { + isaZoneIdentity() bool +} + +// UnmarshalZoneIdentity unmarshals an instance of ZoneIdentity from the specified map of raw messages. +func UnmarshalZoneIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneIdentity) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneReference : ZoneReference struct +type ZoneReference struct { + // The URL for this zone. + Href *string `json:"href" validate:"required"` + + // The globally unique name for this zone. + Name *string `json:"name" validate:"required"` +} + +// UnmarshalZoneReference unmarshals an instance of ZoneReference from the specified map of raw messages. +func UnmarshalZoneReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneReference) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CertificateInstanceIdentityByCRN : CertificateInstanceIdentityByCRN struct +// This model "extends" CertificateInstanceIdentity +type CertificateInstanceIdentityByCRN struct { + // The CRN for this certificate instance. + CRN *string `json:"crn" validate:"required"` +} + +// NewCertificateInstanceIdentityByCRN : Instantiate CertificateInstanceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewCertificateInstanceIdentityByCRN(crn string) (model *CertificateInstanceIdentityByCRN, err error) { + model = &CertificateInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*CertificateInstanceIdentityByCRN) isaCertificateInstanceIdentity() bool { + return true +} + +// UnmarshalCertificateInstanceIdentityByCRN unmarshals an instance of CertificateInstanceIdentityByCRN from the specified map of raw messages. +func UnmarshalCertificateInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CertificateInstanceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// CloudObjectStorageBucketIdentityByName : CloudObjectStorageBucketIdentityByName struct +// This model "extends" CloudObjectStorageBucketIdentity +type CloudObjectStorageBucketIdentityByName struct { + // The globally unique name of this COS bucket. + Name *string `json:"name" validate:"required"` +} + +// NewCloudObjectStorageBucketIdentityByName : Instantiate CloudObjectStorageBucketIdentityByName (Generic Model Constructor) +func (*VpcV1) NewCloudObjectStorageBucketIdentityByName(name string) (model *CloudObjectStorageBucketIdentityByName, err error) { + model = &CloudObjectStorageBucketIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*CloudObjectStorageBucketIdentityByName) isaCloudObjectStorageBucketIdentity() bool { + return true +} + +// UnmarshalCloudObjectStorageBucketIdentityByName unmarshals an instance of CloudObjectStorageBucketIdentityByName from the specified map of raw messages. +func UnmarshalCloudObjectStorageBucketIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(CloudObjectStorageBucketIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupIdentityByCRN : DedicatedHostGroupIdentityByCRN struct +// This model "extends" DedicatedHostGroupIdentity +type DedicatedHostGroupIdentityByCRN struct { + // The CRN for this dedicated host group. + CRN *string `json:"crn" validate:"required"` +} + +// NewDedicatedHostGroupIdentityByCRN : Instantiate DedicatedHostGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostGroupIdentityByCRN(crn string) (model *DedicatedHostGroupIdentityByCRN, err error) { + model = &DedicatedHostGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*DedicatedHostGroupIdentityByCRN) isaDedicatedHostGroupIdentity() bool { + return true +} + +// UnmarshalDedicatedHostGroupIdentityByCRN unmarshals an instance of DedicatedHostGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupIdentityByHref : DedicatedHostGroupIdentityByHref struct +// This model "extends" DedicatedHostGroupIdentity +type DedicatedHostGroupIdentityByHref struct { + // The URL for this dedicated host group. + Href *string `json:"href" validate:"required"` +} + +// NewDedicatedHostGroupIdentityByHref : Instantiate DedicatedHostGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostGroupIdentityByHref(href string) (model *DedicatedHostGroupIdentityByHref, err error) { + model = &DedicatedHostGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*DedicatedHostGroupIdentityByHref) isaDedicatedHostGroupIdentity() bool { + return true +} + +// UnmarshalDedicatedHostGroupIdentityByHref unmarshals an instance of DedicatedHostGroupIdentityByHref from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostGroupIdentityByID : DedicatedHostGroupIdentityByID struct +// This model "extends" DedicatedHostGroupIdentity +type DedicatedHostGroupIdentityByID struct { + // The unique identifier for this dedicated host group. + ID *string `json:"id" validate:"required"` +} + +// NewDedicatedHostGroupIdentityByID : Instantiate DedicatedHostGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostGroupIdentityByID(id string) (model *DedicatedHostGroupIdentityByID, err error) { + model = &DedicatedHostGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*DedicatedHostGroupIdentityByID) isaDedicatedHostGroupIdentity() bool { + return true +} + +// UnmarshalDedicatedHostGroupIdentityByID unmarshals an instance of DedicatedHostGroupIdentityByID from the specified map of raw messages. +func UnmarshalDedicatedHostGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileIdentityByHref : DedicatedHostProfileIdentityByHref struct +// This model "extends" DedicatedHostProfileIdentity +type DedicatedHostProfileIdentityByHref struct { + // The URL for this dedicated host profile. + Href *string `json:"href" validate:"required"` +} + +// NewDedicatedHostProfileIdentityByHref : Instantiate DedicatedHostProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostProfileIdentityByHref(href string) (model *DedicatedHostProfileIdentityByHref, err error) { + model = &DedicatedHostProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*DedicatedHostProfileIdentityByHref) isaDedicatedHostProfileIdentity() bool { + return true +} + +// UnmarshalDedicatedHostProfileIdentityByHref unmarshals an instance of DedicatedHostProfileIdentityByHref from the specified map of raw messages. +func UnmarshalDedicatedHostProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileIdentityByName : DedicatedHostProfileIdentityByName struct +// This model "extends" DedicatedHostProfileIdentity +type DedicatedHostProfileIdentityByName struct { + // The globally unique name for this dedicated host profile. + Name *string `json:"name" validate:"required"` +} + +// NewDedicatedHostProfileIdentityByName : Instantiate DedicatedHostProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostProfileIdentityByName(name string) (model *DedicatedHostProfileIdentityByName, err error) { + model = &DedicatedHostProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*DedicatedHostProfileIdentityByName) isaDedicatedHostProfileIdentity() bool { + return true +} + +// UnmarshalDedicatedHostProfileIdentityByName unmarshals an instance of DedicatedHostProfileIdentityByName from the specified map of raw messages. +func UnmarshalDedicatedHostProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryDependent : The memory value for a dedicated host with this profile depends on its configuration. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileMemoryDependent.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryDependentTypeDependentConst = "dependent" +) + +func (*DedicatedHostProfileMemoryDependent) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryDependent unmarshals an instance of DedicatedHostProfileMemoryDependent from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryEnum : The permitted memory values (in gibibytes) for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileMemoryEnum.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryEnumTypeEnumConst = "enum" +) + +func (*DedicatedHostProfileMemoryEnum) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryEnum unmarshals an instance of DedicatedHostProfileMemoryEnum from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryFixed : The memory (in gibibytes) for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileMemoryFixed.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryFixedTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileMemoryFixed) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryFixed unmarshals an instance of DedicatedHostProfileMemoryFixed from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileMemoryRange : The permitted memory range (in gibibytes) for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileMemory +type DedicatedHostProfileMemoryRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileMemoryRange.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileMemoryRangeTypeRangeConst = "range" +) + +func (*DedicatedHostProfileMemoryRange) isaDedicatedHostProfileMemory() bool { + return true +} + +// UnmarshalDedicatedHostProfileMemoryRange unmarshals an instance of DedicatedHostProfileMemoryRange from the specified map of raw messages. +func UnmarshalDedicatedHostProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileMemoryRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketDependent : The CPU socket count for a dedicated host with this profile depends on its configuration. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileSocketDependent.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketDependentTypeDependentConst = "dependent" +) + +func (*DedicatedHostProfileSocketDependent) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketDependent unmarshals an instance of DedicatedHostProfileSocketDependent from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketEnum : The permitted values for CPU socket count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileSocketEnum.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketEnumTypeEnumConst = "enum" +) + +func (*DedicatedHostProfileSocketEnum) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketEnum unmarshals an instance of DedicatedHostProfileSocketEnum from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketFixed : The CPU socket count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileSocketFixed.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketFixedTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileSocketFixed) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketFixed unmarshals an instance of DedicatedHostProfileSocketFixed from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileSocketRange : The permitted range for CPU socket count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileSocket +type DedicatedHostProfileSocketRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileSocketRange.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileSocketRangeTypeRangeConst = "range" +) + +func (*DedicatedHostProfileSocketRange) isaDedicatedHostProfileSocket() bool { + return true +} + +// UnmarshalDedicatedHostProfileSocketRange unmarshals an instance of DedicatedHostProfileSocketRange from the specified map of raw messages. +func UnmarshalDedicatedHostProfileSocketRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileSocketRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuDependent : The VCPU count for a dedicated host with this profile depends on its configuration. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuDependent.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuDependentTypeDependentConst = "dependent" +) + +func (*DedicatedHostProfileVcpuDependent) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuDependent unmarshals an instance of DedicatedHostProfileVcpuDependent from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuEnum : The permitted values for VCPU count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuEnum.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuEnumTypeEnumConst = "enum" +) + +func (*DedicatedHostProfileVcpuEnum) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuEnum unmarshals an instance of DedicatedHostProfileVcpuEnum from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuFixed : The VCPU count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuFixed.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuFixedTypeFixedConst = "fixed" +) + +func (*DedicatedHostProfileVcpuFixed) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuFixed unmarshals an instance of DedicatedHostProfileVcpuFixed from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostProfileVcpuRange : The permitted range for VCPU count for a dedicated host with this profile. +// This model "extends" DedicatedHostProfileVcpu +type DedicatedHostProfileVcpuRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the DedicatedHostProfileVcpuRange.Type property. +// The type for this profile field. +const ( + DedicatedHostProfileVcpuRangeTypeRangeConst = "range" +) + +func (*DedicatedHostProfileVcpuRange) isaDedicatedHostProfileVcpu() bool { + return true +} + +// UnmarshalDedicatedHostProfileVcpuRange unmarshals an instance of DedicatedHostProfileVcpuRange from the specified map of raw messages. +func UnmarshalDedicatedHostProfileVcpuRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostProfileVcpuRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPrototypeDedicatedHostByGroup : DedicatedHostPrototypeDedicatedHostByGroup struct +// This model "extends" DedicatedHostPrototype +type DedicatedHostPrototypeDedicatedHostByGroup struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The unique user-defined name for this dedicated host. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The profile to use for this dedicated host. + Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The dedicated host group for this dedicated host. + Group DedicatedHostGroupIdentityIntf `json:"group" validate:"required"` +} + +// NewDedicatedHostPrototypeDedicatedHostByGroup : Instantiate DedicatedHostPrototypeDedicatedHostByGroup (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByGroup(profile DedicatedHostProfileIdentityIntf, group DedicatedHostGroupIdentityIntf) (model *DedicatedHostPrototypeDedicatedHostByGroup, err error) { + model = &DedicatedHostPrototypeDedicatedHostByGroup{ + Profile: profile, + Group: group, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*DedicatedHostPrototypeDedicatedHostByGroup) isaDedicatedHostPrototype() bool { + return true +} + +// UnmarshalDedicatedHostPrototypeDedicatedHostByGroup unmarshals an instance of DedicatedHostPrototypeDedicatedHostByGroup from the specified map of raw messages. +func UnmarshalDedicatedHostPrototypeDedicatedHostByGroup(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPrototypeDedicatedHostByGroup) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// DedicatedHostPrototypeDedicatedHostByZone : DedicatedHostPrototypeDedicatedHostByZone struct +// This model "extends" DedicatedHostPrototype +type DedicatedHostPrototypeDedicatedHostByZone struct { + // If set to true, instances can be placed on this dedicated host. + InstancePlacementEnabled *bool `json:"instance_placement_enabled,omitempty"` + + // The unique user-defined name for this dedicated host. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The profile to use for this dedicated host. + Profile DedicatedHostProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Group *DedicatedHostGroupPrototypeDedicatedHostByZoneContext `json:"group,omitempty"` + + // The zone this dedicated host will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewDedicatedHostPrototypeDedicatedHostByZone : Instantiate DedicatedHostPrototypeDedicatedHostByZone (Generic Model Constructor) +func (*VpcV1) NewDedicatedHostPrototypeDedicatedHostByZone(profile DedicatedHostProfileIdentityIntf, zone ZoneIdentityIntf) (model *DedicatedHostPrototypeDedicatedHostByZone, err error) { + model = &DedicatedHostPrototypeDedicatedHostByZone{ + Profile: profile, + Zone: zone, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*DedicatedHostPrototypeDedicatedHostByZone) isaDedicatedHostPrototype() bool { + return true +} + +// UnmarshalDedicatedHostPrototypeDedicatedHostByZone unmarshals an instance of DedicatedHostPrototypeDedicatedHostByZone from the specified map of raw messages. +func UnmarshalDedicatedHostPrototypeDedicatedHostByZone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(DedicatedHostPrototypeDedicatedHostByZone) + err = core.UnmarshalPrimitive(m, "instance_placement_enabled", &obj.InstancePlacementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalDedicatedHostProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "group", &obj.Group, UnmarshalDedicatedHostGroupPrototypeDedicatedHostByZoneContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EncryptionKeyIdentityByCRN : EncryptionKeyIdentityByCRN struct +// This model "extends" EncryptionKeyIdentity +type EncryptionKeyIdentityByCRN struct { + // The CRN of the [Key Protect Root + // Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) or [Hyper Protect Crypto + // Service Root Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this resource. + CRN *string `json:"crn" validate:"required"` +} + +// NewEncryptionKeyIdentityByCRN : Instantiate EncryptionKeyIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewEncryptionKeyIdentityByCRN(crn string) (model *EncryptionKeyIdentityByCRN, err error) { + model = &EncryptionKeyIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*EncryptionKeyIdentityByCRN) isaEncryptionKeyIdentity() bool { + return true +} + +// UnmarshalEncryptionKeyIdentityByCRN unmarshals an instance of EncryptionKeyIdentityByCRN from the specified map of raw messages. +func UnmarshalEncryptionKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EncryptionKeyIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPIdentity : Identifies a reserved IP by a unique property. +// Models which "extend" this model: +// - EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID +// - EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref +// This model "extends" EndpointGatewayReservedIP +type EndpointGatewayReservedIPReservedIPIdentity struct { + // The unique identifier for this reserved IP. + ID *string `json:"id,omitempty"` + + // The URL for this reserved IP. + Href *string `json:"href,omitempty"` +} + +func (*EndpointGatewayReservedIPReservedIPIdentity) isaEndpointGatewayReservedIPReservedIPIdentity() bool { + return true +} + +type EndpointGatewayReservedIPReservedIPIdentityIntf interface { + EndpointGatewayReservedIPIntf + isaEndpointGatewayReservedIPReservedIPIdentity() bool +} + +func (*EndpointGatewayReservedIPReservedIPIdentity) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPIdentity unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentity from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPPrototypeTargetContext : EndpointGatewayReservedIPReservedIPPrototypeTargetContext struct +// This model "extends" EndpointGatewayReservedIP +type EndpointGatewayReservedIPReservedIPPrototypeTargetContext struct { + // If set to `true`, this reserved IP will be automatically deleted when the target is deleted or when the reserved IP + // is unbound. + AutoDelete *bool `json:"auto_delete,omitempty"` + + // The user-defined name for this reserved IP. If not specified, the name will be a hyphenated list of + // randomly-selected words. Names must be unique within the subnet the reserved IP resides in. Names beginning with + // `ibm-` are reserved for provider-owned resources. + Name *string `json:"name,omitempty"` + + // The subnet in which to create this reserved IP. + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` +} + +// NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext : Instantiate EndpointGatewayReservedIPReservedIPPrototypeTargetContext (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPPrototypeTargetContext(subnet SubnetIdentityIntf) (model *EndpointGatewayReservedIPReservedIPPrototypeTargetContext, err error) { + model = &EndpointGatewayReservedIPReservedIPPrototypeTargetContext{ + Subnet: subnet, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*EndpointGatewayReservedIPReservedIPPrototypeTargetContext) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPPrototypeTargetContext unmarshals an instance of EndpointGatewayReservedIPReservedIPPrototypeTargetContext from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPPrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPPrototypeTargetContext) + err = core.UnmarshalPrimitive(m, "auto_delete", &obj.AutoDelete) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderCloudServiceIdentity : EndpointGatewayTargetPrototypeProviderCloudServiceIdentity struct +// Models which "extend" this model: +// - EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN +// This model "extends" EndpointGatewayTargetPrototype +type EndpointGatewayTargetPrototypeProviderCloudServiceIdentity struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn,omitempty"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderCloudServiceIdentity.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool { + return true +} + +type EndpointGatewayTargetPrototypeProviderCloudServiceIdentityIntf interface { + EndpointGatewayTargetPrototypeIntf + isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool +} + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity unmarshals an instance of EndpointGatewayTargetPrototypeProviderCloudServiceIdentity from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentity) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity : EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity struct +// Models which "extend" this model: +// - EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName +// This model "extends" EndpointGatewayTargetPrototype +type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name,omitempty"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool { + return true +} + +type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityIntf interface { + EndpointGatewayTargetPrototypeIntf + isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool +} + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity unmarshals an instance of EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetProviderCloudServiceReference : EndpointGatewayTargetProviderCloudServiceReference struct +// This model "extends" EndpointGatewayTarget +type EndpointGatewayTargetProviderCloudServiceReference struct { + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn" validate:"required"` + + // The type of target. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetProviderCloudServiceReference.ResourceType property. +// The type of target. +const ( + EndpointGatewayTargetProviderCloudServiceReferenceResourceTypeProviderCloudServiceConst = "provider_cloud_service" +) + +func (*EndpointGatewayTargetProviderCloudServiceReference) isaEndpointGatewayTarget() bool { + return true +} + +// UnmarshalEndpointGatewayTargetProviderCloudServiceReference unmarshals an instance of EndpointGatewayTargetProviderCloudServiceReference from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetProviderCloudServiceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetProviderCloudServiceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetProviderInfrastructureServiceReference : The name of this provider infrastructure service. +// This model "extends" EndpointGatewayTarget +type EndpointGatewayTargetProviderInfrastructureServiceReference struct { + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name" validate:"required"` + + // The type of target. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetProviderInfrastructureServiceReference.ResourceType property. +// The type of target. +const ( + EndpointGatewayTargetProviderInfrastructureServiceReferenceResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +func (*EndpointGatewayTargetProviderInfrastructureServiceReference) isaEndpointGatewayTarget() bool { + return true +} + +// UnmarshalEndpointGatewayTargetProviderInfrastructureServiceReference unmarshals an instance of EndpointGatewayTargetProviderInfrastructureServiceReference from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetProviderInfrastructureServiceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetProviderInfrastructureServiceReference) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPByTargetNetworkInterfaceIdentity +type FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { + // The URL for this network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (model *FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { + model = &FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPByTargetNetworkInterfaceIdentity() bool { + return true +} + +// UnmarshalFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPByTargetNetworkInterfaceIdentity +type FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (model *FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { + model = &FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPByTargetNetworkInterfaceIdentity() bool { + return true +} + +// UnmarshalFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPByTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct +// This model "extends" FloatingIPPatchTargetNetworkInterfaceIdentity +type FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { + // The URL for this network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (model *FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { + model = &FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFloatingIPPatchTargetNetworkInterfaceIdentity() bool { + return true +} + +// UnmarshalFloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct +// This model "extends" FloatingIPPatchTargetNetworkInterfaceIdentity +type FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (model *FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { + model = &FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFloatingIPPatchTargetNetworkInterfaceIdentity() bool { + return true +} + +// UnmarshalFloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPatchTargetNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPPrototypeFloatingIPByTarget : FloatingIPPrototypeFloatingIPByTarget struct +// This model "extends" FloatingIPPrototype +type FloatingIPPrototypeFloatingIPByTarget struct { + // The unique user-defined name for this floating IP. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The network interface this floating IP is to be bound to. + Target FloatingIPByTargetNetworkInterfaceIdentityIntf `json:"target" validate:"required"` +} + +// NewFloatingIPPrototypeFloatingIPByTarget : Instantiate FloatingIPPrototypeFloatingIPByTarget (Generic Model Constructor) +func (*VpcV1) NewFloatingIPPrototypeFloatingIPByTarget(target FloatingIPByTargetNetworkInterfaceIdentityIntf) (model *FloatingIPPrototypeFloatingIPByTarget, err error) { + model = &FloatingIPPrototypeFloatingIPByTarget{ + Target: target, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FloatingIPPrototypeFloatingIPByTarget) isaFloatingIPPrototype() bool { + return true +} + +// UnmarshalFloatingIPPrototypeFloatingIPByTarget unmarshals an instance of FloatingIPPrototypeFloatingIPByTarget from the specified map of raw messages. +func UnmarshalFloatingIPPrototypeFloatingIPByTarget(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPrototypeFloatingIPByTarget) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "target", &obj.Target, UnmarshalFloatingIPByTargetNetworkInterfaceIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPPrototypeFloatingIPByZone : FloatingIPPrototypeFloatingIPByZone struct +// This model "extends" FloatingIPPrototype +type FloatingIPPrototypeFloatingIPByZone struct { + // The unique user-defined name for this floating IP. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The zone this floating IP will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewFloatingIPPrototypeFloatingIPByZone : Instantiate FloatingIPPrototypeFloatingIPByZone (Generic Model Constructor) +func (*VpcV1) NewFloatingIPPrototypeFloatingIPByZone(zone ZoneIdentityIntf) (model *FloatingIPPrototypeFloatingIPByZone, err error) { + model = &FloatingIPPrototypeFloatingIPByZone{ + Zone: zone, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FloatingIPPrototypeFloatingIPByZone) isaFloatingIPPrototype() bool { + return true +} + +// UnmarshalFloatingIPPrototypeFloatingIPByZone unmarshals an instance of FloatingIPPrototypeFloatingIPByZone from the specified map of raw messages. +func UnmarshalFloatingIPPrototypeFloatingIPByZone(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPPrototypeFloatingIPByZone) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetNetworkInterfaceReference : FloatingIPTargetNetworkInterfaceReference struct +// This model "extends" FloatingIPTarget +type FloatingIPTargetNetworkInterfaceReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + // The primary IPv4 address. + PrimaryIpv4Address *string `json:"primary_ipv4_address" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FloatingIPTargetNetworkInterfaceReference.ResourceType property. +// The resource type. +const ( + FloatingIPTargetNetworkInterfaceReferenceResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FloatingIPTargetNetworkInterfaceReference) isaFloatingIPTarget() bool { + return true +} + +// UnmarshalFloatingIPTargetNetworkInterfaceReference unmarshals an instance of FloatingIPTargetNetworkInterfaceReference from the specified map of raw messages. +func UnmarshalFloatingIPTargetNetworkInterfaceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetNetworkInterfaceReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "primary_ipv4_address", &obj.PrimaryIpv4Address) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FloatingIPTargetPublicGatewayReference : FloatingIPTargetPublicGatewayReference struct +// This model "extends" FloatingIPTarget +type FloatingIPTargetPublicGatewayReference struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *PublicGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this public gateway. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FloatingIPTargetPublicGatewayReference.ResourceType property. +// The resource type. +const ( + FloatingIPTargetPublicGatewayReferenceResourceTypePublicGatewayConst = "public_gateway" +) + +func (*FloatingIPTargetPublicGatewayReference) isaFloatingIPTarget() bool { + return true +} + +// UnmarshalFloatingIPTargetPublicGatewayReference unmarshals an instance of FloatingIPTargetPublicGatewayReference from the specified map of raw messages. +func UnmarshalFloatingIPTargetPublicGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FloatingIPTargetPublicGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalPublicGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID +// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN +// - FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeInstanceIdentity struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentity) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeInstanceIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity : Identifies a network interface by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID +// - FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity struct { + // The unique identifier for this network interface. + ID *string `json:"id,omitempty"` + + // The URL for this network interface. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentity : Identifies a subnet by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID +// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN +// - FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeSubnetIdentity struct { + // The unique identifier for this subnet. + ID *string `json:"id,omitempty"` + + // The CRN for this subnet. + CRN *string `json:"crn,omitempty"` + + // The URL for this subnet. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentity) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeSubnetIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentity : Identifies a VPC by a unique property. +// Models which "extend" this model: +// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID +// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN +// - FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref +// This model "extends" FlowLogCollectorTargetPrototype +type FlowLogCollectorTargetPrototypeVPCIdentity struct { + // The unique identifier for this VPC. + ID *string `json:"id,omitempty"` + + // The CRN for this VPC. + CRN *string `json:"crn,omitempty"` + + // The URL for this VPC. + Href *string `json:"href,omitempty"` +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentity) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +type FlowLogCollectorTargetPrototypeVPCIdentityIntf interface { + FlowLogCollectorTargetPrototypeIntf + isaFlowLogCollectorTargetPrototypeVPCIdentity() bool +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentity) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentity from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetInstanceReference : FlowLogCollectorTargetInstanceReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetInstanceReference struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this virtual server instance (and default system hostname). + Name *string `json:"name" validate:"required"` +} + +func (*FlowLogCollectorTargetInstanceReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetInstanceReference unmarshals an instance of FlowLogCollectorTargetInstanceReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext : FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + FlowLogCollectorTargetNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext unmarshals an instance of FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetSubnetReference : FlowLogCollectorTargetSubnetReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetSubnetReference struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *SubnetReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this subnet. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this subnet. + Name *string `json:"name" validate:"required"` +} + +func (*FlowLogCollectorTargetSubnetReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetSubnetReference unmarshals an instance of FlowLogCollectorTargetSubnetReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetSubnetReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetSubnetReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSubnetReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetVPCReference : FlowLogCollectorTargetVPCReference struct +// This model "extends" FlowLogCollectorTarget +type FlowLogCollectorTargetVPCReference struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *VPCReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this VPC. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this VPC. + Name *string `json:"name" validate:"required"` +} + +func (*FlowLogCollectorTargetVPCReference) isaFlowLogCollectorTarget() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetVPCReference unmarshals an instance of FlowLogCollectorTargetVPCReference from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetVPCReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetVPCReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPCReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyIdentityByHref : IkePolicyIdentityByHref struct +// This model "extends" IkePolicyIdentity +type IkePolicyIdentityByHref struct { + // The IKE policy's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewIkePolicyIdentityByHref : Instantiate IkePolicyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewIkePolicyIdentityByHref(href string) (model *IkePolicyIdentityByHref, err error) { + model = &IkePolicyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*IkePolicyIdentityByHref) isaIkePolicyIdentity() bool { + return true +} + +// UnmarshalIkePolicyIdentityByHref unmarshals an instance of IkePolicyIdentityByHref from the specified map of raw messages. +func UnmarshalIkePolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IkePolicyIdentityByID : IkePolicyIdentityByID struct +// This model "extends" IkePolicyIdentity +type IkePolicyIdentityByID struct { + // The unique identifier for this IKE policy. + ID *string `json:"id" validate:"required"` +} + +// NewIkePolicyIdentityByID : Instantiate IkePolicyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewIkePolicyIdentityByID(id string) (model *IkePolicyIdentityByID, err error) { + model = &IkePolicyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*IkePolicyIdentityByID) isaIkePolicyIdentity() bool { + return true +} + +// UnmarshalIkePolicyIdentityByID unmarshals an instance of IkePolicyIdentityByID from the specified map of raw messages. +func UnmarshalIkePolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IkePolicyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyIdentityByHref : IPsecPolicyIdentityByHref struct +// This model "extends" IPsecPolicyIdentity +type IPsecPolicyIdentityByHref struct { + // The IPsec policy's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewIPsecPolicyIdentityByHref : Instantiate IPsecPolicyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewIPsecPolicyIdentityByHref(href string) (model *IPsecPolicyIdentityByHref, err error) { + model = &IPsecPolicyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*IPsecPolicyIdentityByHref) isaIPsecPolicyIdentity() bool { + return true +} + +// UnmarshalIPsecPolicyIdentityByHref unmarshals an instance of IPsecPolicyIdentityByHref from the specified map of raw messages. +func UnmarshalIPsecPolicyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// IPsecPolicyIdentityByID : IPsecPolicyIdentityByID struct +// This model "extends" IPsecPolicyIdentity +type IPsecPolicyIdentityByID struct { + // The unique identifier for this IPsec policy. + ID *string `json:"id" validate:"required"` +} + +// NewIPsecPolicyIdentityByID : Instantiate IPsecPolicyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewIPsecPolicyIdentityByID(id string) (model *IPsecPolicyIdentityByID, err error) { + model = &IPsecPolicyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*IPsecPolicyIdentityByID) isaIPsecPolicyIdentity() bool { + return true +} + +// UnmarshalIPsecPolicyIdentityByID unmarshals an instance of IPsecPolicyIdentityByID from the specified map of raw messages. +func UnmarshalIPsecPolicyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(IPsecPolicyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentityByCRN : ImageIdentityByCRN struct +// This model "extends" ImageIdentity +type ImageIdentityByCRN struct { + // The CRN for this image. + CRN *string `json:"crn" validate:"required"` +} + +// NewImageIdentityByCRN : Instantiate ImageIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewImageIdentityByCRN(crn string) (model *ImageIdentityByCRN, err error) { + model = &ImageIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*ImageIdentityByCRN) isaImageIdentity() bool { + return true +} + +// UnmarshalImageIdentityByCRN unmarshals an instance of ImageIdentityByCRN from the specified map of raw messages. +func UnmarshalImageIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentityByHref : ImageIdentityByHref struct +// This model "extends" ImageIdentity +type ImageIdentityByHref struct { + // The URL for this image. + Href *string `json:"href" validate:"required"` +} + +// NewImageIdentityByHref : Instantiate ImageIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewImageIdentityByHref(href string) (model *ImageIdentityByHref, err error) { + model = &ImageIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*ImageIdentityByHref) isaImageIdentity() bool { + return true +} + +// UnmarshalImageIdentityByHref unmarshals an instance of ImageIdentityByHref from the specified map of raw messages. +func UnmarshalImageIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImageIdentityByID : ImageIdentityByID struct +// This model "extends" ImageIdentity +type ImageIdentityByID struct { + // The unique identifier for this image. + ID *string `json:"id" validate:"required"` +} + +// NewImageIdentityByID : Instantiate ImageIdentityByID (Generic Model Constructor) +func (*VpcV1) NewImageIdentityByID(id string) (model *ImageIdentityByID, err error) { + model = &ImageIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*ImageIdentityByID) isaImageIdentity() bool { + return true +} + +// UnmarshalImageIdentityByID unmarshals an instance of ImageIdentityByID from the specified map of raw messages. +func UnmarshalImageIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImageIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ImagePrototypeImageByFile : ImagePrototypeImageByFile struct +// This model "extends" ImagePrototype +type ImagePrototypeImageByFile struct { + // The unique user-defined name for this image. Names starting with "ibm-" are not allowed. If unspecified, the name + // will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // A base64-encoded, encrypted representation of the key that was used to encrypt the data for this image. + // + // That representation is created by wrapping the key's value with the `encryption_key` root key (which must also be + // provided), using either [Key Protect](https://cloud.ibm.com/docs/key-protect?topic=key-protect-wrap-keys) or the + // [Hyper Protect Crypto Service](https://cloud.ibm.com/docs/services/hs-crypto?topic=hs-crypto-wrap-keys). + // + // If this property is not provided, the imported image is treated as unencrypted. + EncryptedDataKey *string `json:"encrypted_data_key,omitempty"` + + // The identity of the root key that was used to wrap the data key (which is ultimately + // represented as `encrypted_data_key`). Additionally, the root key will be used to encrypt + // volumes created from this image (unless an alternate `encryption_key` is provided at + // volume creation). + // + // If this property is not provided, the imported image is treated as unencrypted. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The file from which to create the image. + File *ImageFilePrototype `json:"file" validate:"required"` + + // The identity of the [supported operating + // system](https://cloud.ibm.com/apidocs/vpc#list-operating-systems) included in + // this image. + OperatingSystem OperatingSystemIdentityIntf `json:"operating_system" validate:"required"` +} + +// NewImagePrototypeImageByFile : Instantiate ImagePrototypeImageByFile (Generic Model Constructor) +func (*VpcV1) NewImagePrototypeImageByFile(file *ImageFilePrototype, operatingSystem OperatingSystemIdentityIntf) (model *ImagePrototypeImageByFile, err error) { + model = &ImagePrototypeImageByFile{ + File: file, + OperatingSystem: operatingSystem, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*ImagePrototypeImageByFile) isaImagePrototype() bool { + return true +} + +// UnmarshalImagePrototypeImageByFile unmarshals an instance of ImagePrototypeImageByFile from the specified map of raw messages. +func UnmarshalImagePrototypeImageByFile(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ImagePrototypeImageByFile) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "encrypted_data_key", &obj.EncryptedDataKey) + if err != nil { + return + } + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "file", &obj.File, UnmarshalImageFilePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "operating_system", &obj.OperatingSystem, UnmarshalOperatingSystemIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerAutoScale : InstanceGroupManagerAutoScale struct +// This model "extends" InstanceGroupManager +type InstanceGroupManagerAutoScale struct { + // The URL for this instance group manager. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager. + ID *string `json:"id" validate:"required"` + + // If set to `true`, this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled" validate:"required"` + + // The user-defined name for this instance group manager. Names must be unique within the instance group. + Name *string `json:"name" validate:"required"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window" validate:"required"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown" validate:"required"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type" validate:"required"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count" validate:"required"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count" validate:"required"` + + // The policies of the instance group manager. + Policies []InstanceGroupManagerPolicyReference `json:"policies" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerAutoScale.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerAutoScaleManagerTypeAutoscaleConst = "autoscale" +) + +func (*InstanceGroupManagerAutoScale) isaInstanceGroupManager() bool { + return true +} + +// UnmarshalInstanceGroupManagerAutoScale unmarshals an instance of InstanceGroupManagerAutoScale from the specified map of raw messages. +func UnmarshalInstanceGroupManagerAutoScale(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerAutoScale) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "policies", &obj.Policies, UnmarshalInstanceGroupManagerPolicyReference) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype : InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype struct +// This model "extends" InstanceGroupManagerPolicyPrototype +type InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype struct { + // The user-defined name for this instance group manager policy. Names must be unique within the instance group + // manager. + Name *string `json:"name,omitempty"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type" validate:"required"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value" validate:"required"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypeMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototypePolicyTypeTargetConst = "target" +) + +// NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype : Instantiate InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype(metricType string, metricValue int64, policyType string) (model *InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype, err error) { + model = &InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype{ + MetricType: core.StringPtr(metricType), + MetricValue: core.Int64Ptr(metricValue), + PolicyType: core.StringPtr(policyType), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) isaInstanceGroupManagerPolicyPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype unmarshals an instance of InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyPrototypeInstanceGroupManagerTargetPolicyPrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy : InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy struct +// This model "extends" InstanceGroupManagerPolicy +type InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy struct { + // The URL for this instance group manager policy. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance group manager policy. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this instance group manager policy. Names must be unique within the instance group + // manager. + Name *string `json:"name" validate:"required"` + + // The type of metric to be evaluated. + MetricType *string `json:"metric_type" validate:"required"` + + // The metric value to be evaluated. + MetricValue *int64 `json:"metric_value" validate:"required"` + + // The type of policy for the instance group. + PolicyType *string `json:"policy_type" validate:"required"` +} + +// Constants associated with the InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy.MetricType property. +// The type of metric to be evaluated. +const ( + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeCpuConst = "cpu" + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeMemoryConst = "memory" + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeNetworkInConst = "network_in" + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyMetricTypeNetworkOutConst = "network_out" +) + +// Constants associated with the InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy.PolicyType property. +// The type of policy for the instance group. +const ( + InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicyPolicyTypeTargetConst = "target" +) + +func (*InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy) isaInstanceGroupManagerPolicy() bool { + return true +} + +// UnmarshalInstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy unmarshals an instance of InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPolicyInstanceGroupManagerTargetPolicy) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_type", &obj.MetricType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "metric_value", &obj.MetricValue) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "policy_type", &obj.PolicyType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype : InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype struct +// This model "extends" InstanceGroupManagerPrototype +type InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype struct { + // If set to `true`, this manager will control the instance group. + ManagementEnabled *bool `json:"management_enabled,omitempty"` + + // The user-defined name for this instance group manager. Names must be unique within the instance group. + Name *string `json:"name,omitempty"` + + // The time window in seconds to aggregate metrics prior to evaluation. + AggregationWindow *int64 `json:"aggregation_window,omitempty"` + + // The duration of time in seconds to pause further scale actions after scaling has taken place. + Cooldown *int64 `json:"cooldown,omitempty"` + + // The type of instance group manager. + ManagerType *string `json:"manager_type" validate:"required"` + + // The maximum number of members in a managed instance group. + MaxMembershipCount *int64 `json:"max_membership_count" validate:"required"` + + // The minimum number of members in a managed instance group. + MinMembershipCount *int64 `json:"min_membership_count,omitempty"` +} + +// Constants associated with the InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype.ManagerType property. +// The type of instance group manager. +const ( + InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototypeManagerTypeAutoscaleConst = "autoscale" +) + +// NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype : Instantiate InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype (Generic Model Constructor) +func (*VpcV1) NewInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype(managerType string, maxMembershipCount int64) (model *InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype, err error) { + model = &InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype{ + ManagerType: core.StringPtr(managerType), + MaxMembershipCount: core.Int64Ptr(maxMembershipCount), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) isaInstanceGroupManagerPrototype() bool { + return true +} + +// UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype unmarshals an instance of InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype from the specified map of raw messages. +func UnmarshalInstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceGroupManagerPrototypeInstanceGroupManagerAutoScalePrototype) + err = core.UnmarshalPrimitive(m, "management_enabled", &obj.ManagementEnabled) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "aggregation_window", &obj.AggregationWindow) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "cooldown", &obj.Cooldown) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "manager_type", &obj.ManagerType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max_membership_count", &obj.MaxMembershipCount) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min_membership_count", &obj.MinMembershipCount) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePatchProfileInstanceProfileIdentityByHref : InstancePatchProfileInstanceProfileIdentityByHref struct +// This model "extends" InstancePatchProfile +type InstancePatchProfileInstanceProfileIdentityByHref struct { + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` +} + +// NewInstancePatchProfileInstanceProfileIdentityByHref : Instantiate InstancePatchProfileInstanceProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByHref(href string) (model *InstancePatchProfileInstanceProfileIdentityByHref, err error) { + model = &InstancePatchProfileInstanceProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*InstancePatchProfileInstanceProfileIdentityByHref) isaInstancePatchProfile() bool { + return true +} + +// UnmarshalInstancePatchProfileInstanceProfileIdentityByHref unmarshals an instance of InstancePatchProfileInstanceProfileIdentityByHref from the specified map of raw messages. +func UnmarshalInstancePatchProfileInstanceProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatchProfileInstanceProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePatchProfileInstanceProfileIdentityByName : InstancePatchProfileInstanceProfileIdentityByName struct +// This model "extends" InstancePatchProfile +type InstancePatchProfileInstanceProfileIdentityByName struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` +} + +// NewInstancePatchProfileInstanceProfileIdentityByName : Instantiate InstancePatchProfileInstanceProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewInstancePatchProfileInstanceProfileIdentityByName(name string) (model *InstancePatchProfileInstanceProfileIdentityByName, err error) { + model = &InstancePatchProfileInstanceProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*InstancePatchProfileInstanceProfileIdentityByName) isaInstancePatchProfile() bool { + return true +} + +// UnmarshalInstancePatchProfileInstanceProfileIdentityByName unmarshals an instance of InstancePatchProfileInstanceProfileIdentityByName from the specified map of raw messages. +func UnmarshalInstancePatchProfileInstanceProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePatchProfileInstanceProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthDependent : The total bandwidth shared across the network interfaces of an instance with this profile depends on its +// configuration. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileBandwidthDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileBandwidthDependent) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthDependent unmarshals an instance of InstanceProfileBandwidthDependent from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthEnum : The permitted total bandwidth values (in megabits per second) shared across the network interfaces of an instance +// with this profile. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileBandwidthEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileBandwidthEnum) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthEnum unmarshals an instance of InstanceProfileBandwidthEnum from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthFixed : The total bandwidth (in megabits per second) shared across the network interfaces of an instance with this profile. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileBandwidthFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileBandwidthFixed) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthFixed unmarshals an instance of InstanceProfileBandwidthFixed from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileBandwidthRange : The permitted total bandwidth range (in megabits per second) shared across the network interfaces of an instance with +// this profile. +// This model "extends" InstanceProfileBandwidth +type InstanceProfileBandwidthRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileBandwidthRange.Type property. +// The type for this profile field. +const ( + InstanceProfileBandwidthRangeTypeRangeConst = "range" +) + +func (*InstanceProfileBandwidthRange) isaInstanceProfileBandwidth() bool { + return true +} + +// UnmarshalInstanceProfileBandwidthRange unmarshals an instance of InstanceProfileBandwidthRange from the specified map of raw messages. +func UnmarshalInstanceProfileBandwidthRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileBandwidthRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantityDependent : The number of disks of this configuration for an instance with this profile depends on its instance configuration. +// This model "extends" InstanceProfileDiskQuantity +type InstanceProfileDiskQuantityDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskQuantityDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileDiskQuantityDependent) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityDependent unmarshals an instance of InstanceProfileDiskQuantityDependent from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantityEnum : The permitted the number of disks of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskQuantity +type InstanceProfileDiskQuantityEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskQuantityEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileDiskQuantityEnum) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityEnum unmarshals an instance of InstanceProfileDiskQuantityEnum from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantityFixed : The number of disks of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskQuantity +type InstanceProfileDiskQuantityFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskQuantityFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskQuantityFixed) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityFixed unmarshals an instance of InstanceProfileDiskQuantityFixed from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskQuantityRange : The permitted range for the number of disks of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskQuantity +type InstanceProfileDiskQuantityRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskQuantityRange.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskQuantityRangeTypeRangeConst = "range" +) + +func (*InstanceProfileDiskQuantityRange) isaInstanceProfileDiskQuantity() bool { + return true +} + +// UnmarshalInstanceProfileDiskQuantityRange unmarshals an instance of InstanceProfileDiskQuantityRange from the specified map of raw messages. +func UnmarshalInstanceProfileDiskQuantityRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskQuantityRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeDependent : The disk size in GB (gigabytes) of this configuration for an instance with this profile depends on its instance +// configuration. +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSizeDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileDiskSizeDependent) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeDependent unmarshals an instance of InstanceProfileDiskSizeDependent from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeEnum : The permitted disk size in GB (gigabytes) of this configuration for an instance with this profile. +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSizeEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileDiskSizeEnum) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeEnum unmarshals an instance of InstanceProfileDiskSizeEnum from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeFixed : The size of the disk in GB (gigabytes). +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSizeFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileDiskSizeFixed) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeFixed unmarshals an instance of InstanceProfileDiskSizeFixed from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileDiskSizeRange : The permitted range for the disk size of this configuration in GB (gigabytes) for an instance with this profile. +// This model "extends" InstanceProfileDiskSize +type InstanceProfileDiskSizeRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileDiskSizeRange.Type property. +// The type for this profile field. +const ( + InstanceProfileDiskSizeRangeTypeRangeConst = "range" +) + +func (*InstanceProfileDiskSizeRange) isaInstanceProfileDiskSize() bool { + return true +} + +// UnmarshalInstanceProfileDiskSizeRange unmarshals an instance of InstanceProfileDiskSizeRange from the specified map of raw messages. +func UnmarshalInstanceProfileDiskSizeRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileDiskSizeRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileIdentityByHref : InstanceProfileIdentityByHref struct +// This model "extends" InstanceProfileIdentity +type InstanceProfileIdentityByHref struct { + // The URL for this virtual server instance profile. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceProfileIdentityByHref : Instantiate InstanceProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceProfileIdentityByHref(href string) (model *InstanceProfileIdentityByHref, err error) { + model = &InstanceProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*InstanceProfileIdentityByHref) isaInstanceProfileIdentity() bool { + return true +} + +// UnmarshalInstanceProfileIdentityByHref unmarshals an instance of InstanceProfileIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileIdentityByName : InstanceProfileIdentityByName struct +// This model "extends" InstanceProfileIdentity +type InstanceProfileIdentityByName struct { + // The globally unique name for this virtual server instance profile. + Name *string `json:"name" validate:"required"` +} + +// NewInstanceProfileIdentityByName : Instantiate InstanceProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewInstanceProfileIdentityByName(name string) (model *InstanceProfileIdentityByName, err error) { + model = &InstanceProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*InstanceProfileIdentityByName) isaInstanceProfileIdentity() bool { + return true +} + +// UnmarshalInstanceProfileIdentityByName unmarshals an instance of InstanceProfileIdentityByName from the specified map of raw messages. +func UnmarshalInstanceProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryDependent : The memory value for an instance with this profile depends on its configuration. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileMemoryDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileMemoryDependent) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryDependent unmarshals an instance of InstanceProfileMemoryDependent from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryEnum : The permitted memory values (in gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileMemoryEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileMemoryEnum) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryEnum unmarshals an instance of InstanceProfileMemoryEnum from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryFixed : The memory (in gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileMemoryFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileMemoryFixed) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryFixed unmarshals an instance of InstanceProfileMemoryFixed from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileMemoryRange : The permitted memory range (in gibibytes) for an instance with this profile. +// This model "extends" InstanceProfileMemory +type InstanceProfileMemoryRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileMemoryRange.Type property. +// The type for this profile field. +const ( + InstanceProfileMemoryRangeTypeRangeConst = "range" +) + +func (*InstanceProfileMemoryRange) isaInstanceProfileMemory() bool { + return true +} + +// UnmarshalInstanceProfileMemoryRange unmarshals an instance of InstanceProfileMemoryRange from the specified map of raw messages. +func UnmarshalInstanceProfileMemoryRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileMemoryRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfilePortSpeedDependent : The port speed of each network interface of an instance with this profile depends on its configuration. +// This model "extends" InstanceProfilePortSpeed +type InstanceProfilePortSpeedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfilePortSpeedDependent.Type property. +// The type for this profile field. +const ( + InstanceProfilePortSpeedDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfilePortSpeedDependent) isaInstanceProfilePortSpeed() bool { + return true +} + +// UnmarshalInstanceProfilePortSpeedDependent unmarshals an instance of InstanceProfilePortSpeedDependent from the specified map of raw messages. +func UnmarshalInstanceProfilePortSpeedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfilePortSpeedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfilePortSpeedFixed : The maximum speed (in megabits per second) of each network interface of an instance with this profile. +// This model "extends" InstanceProfilePortSpeed +type InstanceProfilePortSpeedFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfilePortSpeedFixed.Type property. +// The type for this profile field. +const ( + InstanceProfilePortSpeedFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfilePortSpeedFixed) isaInstanceProfilePortSpeed() bool { + return true +} + +// UnmarshalInstanceProfilePortSpeedFixed unmarshals an instance of InstanceProfilePortSpeedFixed from the specified map of raw messages. +func UnmarshalInstanceProfilePortSpeedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfilePortSpeedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuDependent : The VCPU count for an instance with this profile depends on its configuration. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuDependent.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuDependentTypeDependentConst = "dependent" +) + +func (*InstanceProfileVcpuDependent) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuDependent unmarshals an instance of InstanceProfileVcpuDependent from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuEnum : The permitted values for VCPU count for an instance with this profile. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuEnum struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The permitted values for this profile field. + Values []int64 `json:"values" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuEnum.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuEnumTypeEnumConst = "enum" +) + +func (*InstanceProfileVcpuEnum) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuEnum unmarshals an instance of InstanceProfileVcpuEnum from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuEnum(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuEnum) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "values", &obj.Values) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuFixed : The VCPU count for an instance with this profile. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *int64 `json:"value" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuFixed.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuFixedTypeFixedConst = "fixed" +) + +func (*InstanceProfileVcpuFixed) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuFixed unmarshals an instance of InstanceProfileVcpuFixed from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceProfileVcpuRange : The permitted range for VCPU count for an instance with this profile. +// This model "extends" InstanceProfileVcpu +type InstanceProfileVcpuRange struct { + // The default value for this profile field. + Default *int64 `json:"default" validate:"required"` + + // The maximum value for this profile field. + Max *int64 `json:"max" validate:"required"` + + // The minimum value for this profile field. + Min *int64 `json:"min" validate:"required"` + + // The increment step value for this profile field. + Step *int64 `json:"step" validate:"required"` + + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the InstanceProfileVcpuRange.Type property. +// The type for this profile field. +const ( + InstanceProfileVcpuRangeTypeRangeConst = "range" +) + +func (*InstanceProfileVcpuRange) isaInstanceProfileVcpu() bool { + return true +} + +// UnmarshalInstanceProfileVcpuRange unmarshals an instance of InstanceProfileVcpuRange from the specified map of raw messages. +func UnmarshalInstanceProfileVcpuRange(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceProfileVcpuRange) + err = core.UnmarshalPrimitive(m, "default", &obj.Default) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "max", &obj.Max) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "min", &obj.Min) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "step", &obj.Step) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceByImage : InstancePrototypeInstanceByImage struct +// This model "extends" InstancePrototype +type InstancePrototypeInstanceByImage struct { + // The public SSH keys for the administrative user of the virtual server instance. Up to 10 keys may be provided; if no + // keys are provided the instance will be inaccessible unless the image used provides another means of access. For + // Windows instances, one of the keys will be used to encrypt the administrator password. + // + // Keys will be made available to the virtual server instance as cloud-init vendor data. For cloud-init enabled images, + // these keys will also be added as SSH authorized keys for the administrative user. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // Collection of additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The profile to use for this virtual server instance. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // User data to be made available when setting up the virtual server instance. + UserData *string `json:"user_data,omitempty"` + + // Collection of volume attachments. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If provided, must match the VPC tied to the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The identity of the image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewInstancePrototypeInstanceByImage : Instantiate InstancePrototypeInstanceByImage (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (model *InstancePrototypeInstanceByImage, err error) { + model = &InstancePrototypeInstanceByImage{ + Image: image, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*InstancePrototypeInstanceByImage) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceByImage unmarshals an instance of InstancePrototypeInstanceByImage from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceByImage) + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstancePrototypeInstanceBySourceTemplate : InstancePrototypeInstanceBySourceTemplate struct +// This model "extends" InstancePrototype +type InstancePrototypeInstanceBySourceTemplate struct { + // The public SSH keys for the administrative user of the virtual server instance. Up to 10 keys may be provided; if no + // keys are provided the instance will be inaccessible unless the image used provides another means of access. For + // Windows instances, one of the keys will be used to encrypt the administrator password. + // + // Keys will be made available to the virtual server instance as cloud-init vendor data. For cloud-init enabled images, + // these keys will also be added as SSH authorized keys for the administrative user. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // Collection of additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The profile to use for this virtual server instance. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // User data to be made available when setting up the virtual server instance. + UserData *string `json:"user_data,omitempty"` + + // Collection of volume attachments. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If provided, must match the VPC tied to the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The identity of the image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // Identifies an instance template by a unique property. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// NewInstancePrototypeInstanceBySourceTemplate : Instantiate InstancePrototypeInstanceBySourceTemplate (Generic Model Constructor) +func (*VpcV1) NewInstancePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (model *InstancePrototypeInstanceBySourceTemplate, err error) { + model = &InstancePrototypeInstanceBySourceTemplate{ + SourceTemplate: sourceTemplate, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*InstancePrototypeInstanceBySourceTemplate) isaInstancePrototype() bool { + return true +} + +// UnmarshalInstancePrototypeInstanceBySourceTemplate unmarshals an instance of InstancePrototypeInstanceBySourceTemplate from the specified map of raw messages. +func UnmarshalInstancePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstancePrototypeInstanceBySourceTemplate) + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByCRN : InstanceTemplateIdentityByCRN struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByCRN struct { + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` +} + +// NewInstanceTemplateIdentityByCRN : Instantiate InstanceTemplateIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByCRN(crn string) (model *InstanceTemplateIdentityByCRN, err error) { + model = &InstanceTemplateIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByCRN) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByCRN unmarshals an instance of InstanceTemplateIdentityByCRN from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByHref : InstanceTemplateIdentityByHref struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByHref struct { + // The URL for this instance template. + Href *string `json:"href" validate:"required"` +} + +// NewInstanceTemplateIdentityByHref : Instantiate InstanceTemplateIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByHref(href string) (model *InstanceTemplateIdentityByHref, err error) { + model = &InstanceTemplateIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByHref) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByHref unmarshals an instance of InstanceTemplateIdentityByHref from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateIdentityByID : InstanceTemplateIdentityByID struct +// This model "extends" InstanceTemplateIdentity +type InstanceTemplateIdentityByID struct { + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` +} + +// NewInstanceTemplateIdentityByID : Instantiate InstanceTemplateIdentityByID (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplateIdentityByID(id string) (model *InstanceTemplateIdentityByID, err error) { + model = &InstanceTemplateIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*InstanceTemplateIdentityByID) isaInstanceTemplateIdentity() bool { + return true +} + +// UnmarshalInstanceTemplateIdentityByID unmarshals an instance of InstanceTemplateIdentityByID from the specified map of raw messages. +func UnmarshalInstanceTemplateIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceByImage : InstanceTemplatePrototypeInstanceByImage struct +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceByImage struct { + // The public SSH keys for the administrative user of the virtual server instance. Up to 10 keys may be provided; if no + // keys are provided the instance will be inaccessible unless the image used provides another means of access. For + // Windows instances, one of the keys will be used to encrypt the administrator password. + // + // Keys will be made available to the virtual server instance as cloud-init vendor data. For cloud-init enabled images, + // these keys will also be added as SSH authorized keys for the administrative user. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // Collection of additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The profile to use for this virtual server instance. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // User data to be made available when setting up the virtual server instance. + UserData *string `json:"user_data,omitempty"` + + // Collection of volume attachments. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If provided, must match the VPC tied to the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The identity of the image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// NewInstanceTemplatePrototypeInstanceByImage : Instantiate InstanceTemplatePrototypeInstanceByImage (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceByImage(image ImageIdentityIntf, primaryNetworkInterface *NetworkInterfacePrototype, zone ZoneIdentityIntf) (model *InstanceTemplatePrototypeInstanceByImage, err error) { + model = &InstanceTemplatePrototypeInstanceByImage{ + Image: image, + PrimaryNetworkInterface: primaryNetworkInterface, + Zone: zone, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceByImage) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceByImage unmarshals an instance of InstanceTemplatePrototypeInstanceByImage from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceByImage) + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplatePrototypeInstanceBySourceTemplate : InstanceTemplatePrototypeInstanceBySourceTemplate struct +// This model "extends" InstanceTemplatePrototype +type InstanceTemplatePrototypeInstanceBySourceTemplate struct { + // The public SSH keys for the administrative user of the virtual server instance. Up to 10 keys may be provided; if no + // keys are provided the instance will be inaccessible unless the image used provides another means of access. For + // Windows instances, one of the keys will be used to encrypt the administrator password. + // + // Keys will be made available to the virtual server instance as cloud-init vendor data. For cloud-init enabled images, + // these keys will also be added as SSH authorized keys for the administrative user. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The unique user-defined name for this virtual server instance (and default system hostname). If unspecified, the + // name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // Collection of additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The profile to use for this virtual server instance. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // User data to be made available when setting up the virtual server instance. + UserData *string `json:"user_data,omitempty"` + + // Collection of volume attachments. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If provided, must match the VPC tied to the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The identity of the image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // Identifies an instance template by a unique property. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// NewInstanceTemplatePrototypeInstanceBySourceTemplate : Instantiate InstanceTemplatePrototypeInstanceBySourceTemplate (Generic Model Constructor) +func (*VpcV1) NewInstanceTemplatePrototypeInstanceBySourceTemplate(sourceTemplate InstanceTemplateIdentityIntf) (model *InstanceTemplatePrototypeInstanceBySourceTemplate, err error) { + model = &InstanceTemplatePrototypeInstanceBySourceTemplate{ + SourceTemplate: sourceTemplate, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*InstanceTemplatePrototypeInstanceBySourceTemplate) isaInstanceTemplatePrototype() bool { + return true +} + +// UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate unmarshals an instance of InstanceTemplatePrototypeInstanceBySourceTemplate from the specified map of raw messages. +func UnmarshalInstanceTemplatePrototypeInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplatePrototypeInstanceBySourceTemplate) + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceByImage : InstanceTemplateInstanceByImage struct +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceByImage struct { + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Up to 10 keys may be provided; if no + // keys are provided the instance will be inaccessible unless the image used provides another means of access. For + // Windows instances, one of the keys will be used to encrypt the administrator password. + // + // Keys will be made available to the virtual server instance as cloud-init vendor data. For cloud-init enabled images, + // these keys will also be added as SSH authorized keys for the administrative user. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The unique user-defined name for this instance template. + Name *string `json:"name" validate:"required"` + + // Collection of additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The profile to use for this virtual server instance. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // User data to be made available when setting up the virtual server instance. + UserData *string `json:"user_data,omitempty"` + + // Collection of volume attachments. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If provided, must match the VPC tied to the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The identity of the image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image" validate:"required"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +func (*InstanceTemplateInstanceByImage) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceByImage unmarshals an instance of InstanceTemplateInstanceByImage from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceByImage(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceByImage) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// InstanceTemplateInstanceBySourceTemplate : InstanceTemplateInstanceBySourceTemplate struct +// This model "extends" InstanceTemplate +type InstanceTemplateInstanceBySourceTemplate struct { + // The date and time that the instance template was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The CRN for this instance template. + CRN *string `json:"crn" validate:"required"` + + // The URL for this instance template. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this instance template. + ID *string `json:"id" validate:"required"` + + // The public SSH keys for the administrative user of the virtual server instance. Up to 10 keys may be provided; if no + // keys are provided the instance will be inaccessible unless the image used provides another means of access. For + // Windows instances, one of the keys will be used to encrypt the administrator password. + // + // Keys will be made available to the virtual server instance as cloud-init vendor data. For cloud-init enabled images, + // these keys will also be added as SSH authorized keys for the administrative user. + Keys []KeyIdentityIntf `json:"keys,omitempty"` + + // The unique user-defined name for this instance template. + Name *string `json:"name" validate:"required"` + + // Collection of additional network interfaces to create for the virtual server instance. + NetworkInterfaces []NetworkInterfacePrototype `json:"network_interfaces,omitempty"` + + // The profile to use for this virtual server instance. + Profile InstanceProfileIdentityIntf `json:"profile,omitempty"` + + // The resource group for this instance template. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // User data to be made available when setting up the virtual server instance. + UserData *string `json:"user_data,omitempty"` + + // Collection of volume attachments. + VolumeAttachments []VolumeAttachmentPrototypeInstanceContext `json:"volume_attachments,omitempty"` + + // The VPC the virtual server instance is to be a part of. If provided, must match the VPC tied to the subnets of the + // instance's network interfaces. + VPC VPCIdentityIntf `json:"vpc,omitempty"` + + // The boot volume attachment for the virtual server instance. + BootVolumeAttachment *VolumeAttachmentPrototypeInstanceByImageContext `json:"boot_volume_attachment,omitempty"` + + // The identity of the image to use when provisioning the virtual server instance. + Image ImageIdentityIntf `json:"image,omitempty"` + + // Primary network interface. + PrimaryNetworkInterface *NetworkInterfacePrototype `json:"primary_network_interface,omitempty"` + + // Identifies an instance template by a unique property. + SourceTemplate InstanceTemplateIdentityIntf `json:"source_template" validate:"required"` + + // The zone this virtual server instance will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +func (*InstanceTemplateInstanceBySourceTemplate) isaInstanceTemplate() bool { + return true +} + +// UnmarshalInstanceTemplateInstanceBySourceTemplate unmarshals an instance of InstanceTemplateInstanceBySourceTemplate from the specified map of raw messages. +func UnmarshalInstanceTemplateInstanceBySourceTemplate(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(InstanceTemplateInstanceBySourceTemplate) + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "keys", &obj.Keys, UnmarshalKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_interfaces", &obj.NetworkInterfaces, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalInstanceProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "user_data", &obj.UserData) + if err != nil { + return + } + err = core.UnmarshalModel(m, "volume_attachments", &obj.VolumeAttachments, UnmarshalVolumeAttachmentPrototypeInstanceContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "boot_volume_attachment", &obj.BootVolumeAttachment, UnmarshalVolumeAttachmentPrototypeInstanceByImageContext) + if err != nil { + return + } + err = core.UnmarshalModel(m, "image", &obj.Image, UnmarshalImageIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "primary_network_interface", &obj.PrimaryNetworkInterface, UnmarshalNetworkInterfacePrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_template", &obj.SourceTemplate, UnmarshalInstanceTemplateIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByCRN : KeyIdentityByCRN struct +// This model "extends" KeyIdentity +type KeyIdentityByCRN struct { + // The CRN for this key. + CRN *string `json:"crn" validate:"required"` +} + +// NewKeyIdentityByCRN : Instantiate KeyIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByCRN(crn string) (model *KeyIdentityByCRN, err error) { + model = &KeyIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*KeyIdentityByCRN) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByCRN unmarshals an instance of KeyIdentityByCRN from the specified map of raw messages. +func UnmarshalKeyIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByHref : KeyIdentityByHref struct +// This model "extends" KeyIdentity +type KeyIdentityByHref struct { + // The URL for this key. + Href *string `json:"href" validate:"required"` +} + +// NewKeyIdentityByHref : Instantiate KeyIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByHref(href string) (model *KeyIdentityByHref, err error) { + model = &KeyIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*KeyIdentityByHref) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByHref unmarshals an instance of KeyIdentityByHref from the specified map of raw messages. +func UnmarshalKeyIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityByID : KeyIdentityByID struct +// This model "extends" KeyIdentity +type KeyIdentityByID struct { + // The unique identifier for this key. + ID *string `json:"id" validate:"required"` +} + +// NewKeyIdentityByID : Instantiate KeyIdentityByID (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityByID(id string) (model *KeyIdentityByID, err error) { + model = &KeyIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*KeyIdentityByID) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityByID unmarshals an instance of KeyIdentityByID from the specified map of raw messages. +func UnmarshalKeyIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyIdentityKeyIdentityByFingerprint : KeyIdentityKeyIdentityByFingerprint struct +// This model "extends" KeyIdentity +type KeyIdentityKeyIdentityByFingerprint struct { + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint" validate:"required"` +} + +// NewKeyIdentityKeyIdentityByFingerprint : Instantiate KeyIdentityKeyIdentityByFingerprint (Generic Model Constructor) +func (*VpcV1) NewKeyIdentityKeyIdentityByFingerprint(fingerprint string) (model *KeyIdentityKeyIdentityByFingerprint, err error) { + model = &KeyIdentityKeyIdentityByFingerprint{ + Fingerprint: core.StringPtr(fingerprint), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*KeyIdentityKeyIdentityByFingerprint) isaKeyIdentity() bool { + return true +} + +// UnmarshalKeyIdentityKeyIdentityByFingerprint unmarshals an instance of KeyIdentityKeyIdentityByFingerprint from the specified map of raw messages. +func UnmarshalKeyIdentityKeyIdentityByFingerprint(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyIdentityKeyIdentityByFingerprint) + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyReferenceInstanceInitializationContextKeyIdentityByFingerprint : KeyReferenceInstanceInitializationContextKeyIdentityByFingerprint struct +// This model "extends" KeyReferenceInstanceInitializationContext +type KeyReferenceInstanceInitializationContextKeyIdentityByFingerprint struct { + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint" validate:"required"` +} + +func (*KeyReferenceInstanceInitializationContextKeyIdentityByFingerprint) isaKeyReferenceInstanceInitializationContext() bool { + return true +} + +// UnmarshalKeyReferenceInstanceInitializationContextKeyIdentityByFingerprint unmarshals an instance of KeyReferenceInstanceInitializationContextKeyIdentityByFingerprint from the specified map of raw messages. +func UnmarshalKeyReferenceInstanceInitializationContextKeyIdentityByFingerprint(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyReferenceInstanceInitializationContextKeyIdentityByFingerprint) + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// KeyReferenceInstanceInitializationContextKeyReference : KeyReferenceInstanceInitializationContextKeyReference struct +// This model "extends" KeyReferenceInstanceInitializationContext +type KeyReferenceInstanceInitializationContextKeyReference struct { + // The CRN for this key. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *KeyReferenceDeleted `json:"deleted,omitempty"` + + // The fingerprint for this key. The value is returned base64-encoded and prefixed with the hash algorithm (always + // `SHA256`). + Fingerprint *string `json:"fingerprint" validate:"required"` + + // The URL for this key. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this key. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this key. + Name *string `json:"name" validate:"required"` +} + +func (*KeyReferenceInstanceInitializationContextKeyReference) isaKeyReferenceInstanceInitializationContext() bool { + return true +} + +// UnmarshalKeyReferenceInstanceInitializationContextKeyReference unmarshals an instance of KeyReferenceInstanceInitializationContextKeyReference from the specified map of raw messages. +func UnmarshalKeyReferenceInstanceInitializationContextKeyReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(KeyReferenceInstanceInitializationContextKeyReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalKeyReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "fingerprint", &obj.Fingerprint) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentityByCRN : LoadBalancerIdentityByCRN struct +// This model "extends" LoadBalancerIdentity +type LoadBalancerIdentityByCRN struct { + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewLoadBalancerIdentityByCRN : Instantiate LoadBalancerIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerIdentityByCRN(crn string) (model *LoadBalancerIdentityByCRN, err error) { + model = &LoadBalancerIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerIdentityByCRN) isaLoadBalancerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerIdentityByCRN unmarshals an instance of LoadBalancerIdentityByCRN from the specified map of raw messages. +func UnmarshalLoadBalancerIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentityByHref : LoadBalancerIdentityByHref struct +// This model "extends" LoadBalancerIdentity +type LoadBalancerIdentityByHref struct { + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerIdentityByHref : Instantiate LoadBalancerIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerIdentityByHref(href string) (model *LoadBalancerIdentityByHref, err error) { + model = &LoadBalancerIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerIdentityByHref) isaLoadBalancerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerIdentityByHref unmarshals an instance of LoadBalancerIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerIdentityByID : LoadBalancerIdentityByID struct +// This model "extends" LoadBalancerIdentity +type LoadBalancerIdentityByID struct { + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerIdentityByID : Instantiate LoadBalancerIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerIdentityByID(id string) (model *LoadBalancerIdentityByID, err error) { + model = &LoadBalancerIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerIdentityByID) isaLoadBalancerIdentity() bool { + return true +} + +// UnmarshalLoadBalancerIdentityByID unmarshals an instance of LoadBalancerIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch : LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch struct { + // The http status code in the redirect response. + HTTPStatusCode *int64 `json:"http_status_code,omitempty"` + + // The redirect target URL. + URL *string `json:"url,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerListenerPolicyRedirectURLPatch) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +// This model "extends" LoadBalancerListenerPolicyTargetPatch +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityIntf interface { + LoadBalancerListenerPolicyTargetPatchIntf + isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototype +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype struct { + // The http status code in the redirect response. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // The redirect target URL. + URL *string `json:"url" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(httpStatusCode int64, url string) (model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype, err error) { + model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype{ + HTTPStatusCode: core.Int64Ptr(httpStatusCode), + URL: core.StringPtr(url), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerListenerPolicyRedirectURLPrototype) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity : Identifies a load balancer pool by a unique property. +// Models which "extend" this model: +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID +// - LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref +// This model "extends" LoadBalancerListenerPolicyTargetPrototype +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { + return true +} + +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityIntf interface { + LoadBalancerListenerPolicyTargetPrototypeIntf + isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL : LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct +// This model "extends" LoadBalancerListenerPolicyTarget +type LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL struct { + // The http status code in the redirect response. + HTTPStatusCode *int64 `json:"http_status_code" validate:"required"` + + // The redirect target URL. + URL *string `json:"url" validate:"required"` +} + +func (*LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerListenerPolicyRedirectURL) + err = core.UnmarshalPrimitive(m, "http_status_code", &obj.HTTPStatusCode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "url", &obj.URL) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetLoadBalancerPoolReference : LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct +// This model "extends" LoadBalancerListenerPolicyTarget +type LoadBalancerListenerPolicyTargetLoadBalancerPoolReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *LoadBalancerPoolReferenceDeleted `json:"deleted,omitempty"` + + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this load balancer pool. + Name *string `json:"name" validate:"required"` +} + +func (*LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) isaLoadBalancerListenerPolicyTarget() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference unmarshals an instance of LoadBalancerListenerPolicyTargetLoadBalancerPoolReference from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetLoadBalancerPoolReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetLoadBalancerPoolReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerPoolReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentityByHref : LoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerPoolIdentity +type LoadBalancerPoolIdentityByHref struct { + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityByHref(href string) (model *LoadBalancerPoolIdentityByHref, err error) { + model = &LoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerPoolIdentityByHref) isaLoadBalancerPoolIdentity() bool { + return true +} + +// UnmarshalLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolIdentityByID : LoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerPoolIdentity +type LoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerPoolIdentityByID : Instantiate LoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolIdentityByID(id string) (model *LoadBalancerPoolIdentityByID, err error) { + model = &LoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerPoolIdentityByID) isaLoadBalancerPoolIdentity() bool { + return true +} + +// UnmarshalLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeIP : LoadBalancerPoolMemberTargetPrototypeIP struct +// This model "extends" LoadBalancerPoolMemberTargetPrototype +type LoadBalancerPoolMemberTargetPrototypeIP struct { + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeIP : Instantiate LoadBalancerPoolMemberTargetPrototypeIP (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeIP(address string) (model *LoadBalancerPoolMemberTargetPrototypeIP, err error) { + model = &LoadBalancerPoolMemberTargetPrototypeIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeIP) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeIP unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeIP from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentity : Identifies a virtual server instance by a unique property. +// Models which "extend" this model: +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN +// - LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref +// This model "extends" LoadBalancerPoolMemberTargetPrototype +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentity struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id,omitempty"` + + // The CRN for this virtual server instance. + CRN *string `json:"crn,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href,omitempty"` +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityIntf interface { + LoadBalancerPoolMemberTargetPrototypeIntf + isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentity from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetIP : LoadBalancerPoolMemberTargetIP struct +// This model "extends" LoadBalancerPoolMemberTarget +type LoadBalancerPoolMemberTargetIP struct { + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +func (*LoadBalancerPoolMemberTargetIP) isaLoadBalancerPoolMemberTarget() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetIP unmarshals an instance of LoadBalancerPoolMemberTargetIP from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetInstanceReference : LoadBalancerPoolMemberTargetInstanceReference struct +// This model "extends" LoadBalancerPoolMemberTarget +type LoadBalancerPoolMemberTargetInstanceReference struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *InstanceReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this virtual server instance (and default system hostname). + Name *string `json:"name" validate:"required"` +} + +func (*LoadBalancerPoolMemberTargetInstanceReference) isaLoadBalancerPoolMemberTarget() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetInstanceReference unmarshals an instance of LoadBalancerPoolMemberTargetInstanceReference from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetInstanceReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetInstanceReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalInstanceReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileIdentityByHref : LoadBalancerProfileIdentityByHref struct +// This model "extends" LoadBalancerProfileIdentity +type LoadBalancerProfileIdentityByHref struct { + // The URL for this load balancer profile. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerProfileIdentityByHref : Instantiate LoadBalancerProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerProfileIdentityByHref(href string) (model *LoadBalancerProfileIdentityByHref, err error) { + model = &LoadBalancerProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerProfileIdentityByHref) isaLoadBalancerProfileIdentity() bool { + return true +} + +// UnmarshalLoadBalancerProfileIdentityByHref unmarshals an instance of LoadBalancerProfileIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileIdentityByName : LoadBalancerProfileIdentityByName struct +// This model "extends" LoadBalancerProfileIdentity +type LoadBalancerProfileIdentityByName struct { + // The globally unique name for this load balancer profile. + Name *string `json:"name" validate:"required"` +} + +// NewLoadBalancerProfileIdentityByName : Instantiate LoadBalancerProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerProfileIdentityByName(name string) (model *LoadBalancerProfileIdentityByName, err error) { + model = &LoadBalancerProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerProfileIdentityByName) isaLoadBalancerProfileIdentity() bool { + return true +} + +// UnmarshalLoadBalancerProfileIdentityByName unmarshals an instance of LoadBalancerProfileIdentityByName from the specified map of raw messages. +func UnmarshalLoadBalancerProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileSecurityGroupsSupportedDependent : The security group support for a load balancer with this profile depends on its configuration. +// This model "extends" LoadBalancerProfileSecurityGroupsSupported +type LoadBalancerProfileSecurityGroupsSupportedDependent struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileSecurityGroupsSupportedDependent.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSecurityGroupsSupportedDependentTypeDependentConst = "dependent" +) + +func (*LoadBalancerProfileSecurityGroupsSupportedDependent) isaLoadBalancerProfileSecurityGroupsSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedDependent from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSecurityGroupsSupportedDependent(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSecurityGroupsSupportedDependent) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerProfileSecurityGroupsSupportedFixed : The security group support for a load balancer with this profile. +// This model "extends" LoadBalancerProfileSecurityGroupsSupported +type LoadBalancerProfileSecurityGroupsSupportedFixed struct { + // The type for this profile field. + Type *string `json:"type" validate:"required"` + + // The value for this profile field. + Value *bool `json:"value" validate:"required"` +} + +// Constants associated with the LoadBalancerProfileSecurityGroupsSupportedFixed.Type property. +// The type for this profile field. +const ( + LoadBalancerProfileSecurityGroupsSupportedFixedTypeFixedConst = "fixed" +) + +func (*LoadBalancerProfileSecurityGroupsSupportedFixed) isaLoadBalancerProfileSecurityGroupsSupported() bool { + return true +} + +// UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed unmarshals an instance of LoadBalancerProfileSecurityGroupsSupportedFixed from the specified map of raw messages. +func UnmarshalLoadBalancerProfileSecurityGroupsSupportedFixed(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerProfileSecurityGroupsSupportedFixed) + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "value", &obj.Value) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLIdentityByCRN : NetworkACLIdentityByCRN struct +// This model "extends" NetworkACLIdentity +type NetworkACLIdentityByCRN struct { + // The CRN for this network ACL. + CRN *string `json:"crn" validate:"required"` +} + +// NewNetworkACLIdentityByCRN : Instantiate NetworkACLIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewNetworkACLIdentityByCRN(crn string) (model *NetworkACLIdentityByCRN, err error) { + model = &NetworkACLIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*NetworkACLIdentityByCRN) isaNetworkACLIdentity() bool { + return true +} + +// UnmarshalNetworkACLIdentityByCRN unmarshals an instance of NetworkACLIdentityByCRN from the specified map of raw messages. +func UnmarshalNetworkACLIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLIdentityByHref : NetworkACLIdentityByHref struct +// This model "extends" NetworkACLIdentity +type NetworkACLIdentityByHref struct { + // The URL for this network ACL. + Href *string `json:"href" validate:"required"` +} + +// NewNetworkACLIdentityByHref : Instantiate NetworkACLIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkACLIdentityByHref(href string) (model *NetworkACLIdentityByHref, err error) { + model = &NetworkACLIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*NetworkACLIdentityByHref) isaNetworkACLIdentity() bool { + return true +} + +// UnmarshalNetworkACLIdentityByHref unmarshals an instance of NetworkACLIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkACLIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLIdentityByID : NetworkACLIdentityByID struct +// This model "extends" NetworkACLIdentity +type NetworkACLIdentityByID struct { + // The unique identifier for this network ACL. + ID *string `json:"id" validate:"required"` +} + +// NewNetworkACLIdentityByID : Instantiate NetworkACLIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkACLIdentityByID(id string) (model *NetworkACLIdentityByID, err error) { + model = &NetworkACLIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*NetworkACLIdentityByID) isaNetworkACLIdentity() bool { + return true +} + +// UnmarshalNetworkACLIdentityByID unmarshals an instance of NetworkACLIdentityByID from the specified map of raw messages. +func UnmarshalNetworkACLIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLPrototypeNetworkACLByRules : NetworkACLPrototypeNetworkACLByRules struct +// This model "extends" NetworkACLPrototype +type NetworkACLPrototypeNetworkACLByRules struct { + // The user-defined name for this network ACL. Names must be unique within the VPC the network ACL resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The VPC this network ACL is to be a part of. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // Array of prototype objects for rules to create along with this network ACL. If unspecified, no rules will be + // created, resulting in all traffic being denied. + Rules []NetworkACLRulePrototypeNetworkACLContextIntf `json:"rules,omitempty"` +} + +func (*NetworkACLPrototypeNetworkACLByRules) isaNetworkACLPrototype() bool { + return true +} + +// UnmarshalNetworkACLPrototypeNetworkACLByRules unmarshals an instance of NetworkACLPrototypeNetworkACLByRules from the specified map of raw messages. +func UnmarshalNetworkACLPrototypeNetworkACLByRules(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPrototypeNetworkACLByRules) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "rules", &obj.Rules, UnmarshalNetworkACLRulePrototypeNetworkACLContext) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLPrototypeNetworkACLBySourceNetworkACL : NetworkACLPrototypeNetworkACLBySourceNetworkACL struct +// This model "extends" NetworkACLPrototype +type NetworkACLPrototypeNetworkACLBySourceNetworkACL struct { + // The user-defined name for this network ACL. Names must be unique within the VPC the network ACL resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The VPC this network ACL is to be a part of. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // Network ACL to copy rules from. + SourceNetworkACL NetworkACLIdentityIntf `json:"source_network_acl" validate:"required"` +} + +// NewNetworkACLPrototypeNetworkACLBySourceNetworkACL : Instantiate NetworkACLPrototypeNetworkACLBySourceNetworkACL (Generic Model Constructor) +func (*VpcV1) NewNetworkACLPrototypeNetworkACLBySourceNetworkACL(vpc VPCIdentityIntf, sourceNetworkACL NetworkACLIdentityIntf) (model *NetworkACLPrototypeNetworkACLBySourceNetworkACL, err error) { + model = &NetworkACLPrototypeNetworkACLBySourceNetworkACL{ + VPC: vpc, + SourceNetworkACL: sourceNetworkACL, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*NetworkACLPrototypeNetworkACLBySourceNetworkACL) isaNetworkACLPrototype() bool { + return true +} + +// UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL unmarshals an instance of NetworkACLPrototypeNetworkACLBySourceNetworkACL from the specified map of raw messages. +func UnmarshalNetworkACLPrototypeNetworkACLBySourceNetworkACL(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLPrototypeNetworkACLBySourceNetworkACL) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "source_network_acl", &obj.SourceNetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct +// This model "extends" NetworkACLRuleBeforePatch +type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref struct { + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` +} + +// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(href string) (model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref, err error) { + model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePatch() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct +// This model "extends" NetworkACLRuleBeforePatch +type NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` +} + +// NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(id string) (model *NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID, err error) { + model = &NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePatch() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePatchNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePatchNetworkACLRuleIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct +// This model "extends" NetworkACLRuleBeforePrototype +type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref struct { + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` +} + +// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(href string) (model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref, err error) { + model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) isaNetworkACLRuleBeforePrototype() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct +// This model "extends" NetworkACLRuleBeforePrototype +type NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID struct { + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` +} + +// NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID : Instantiate NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(id string) (model *NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID, err error) { + model = &NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) isaNetworkACLRuleBeforePrototype() bool { + return true +} + +// UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID unmarshals an instance of NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID from the specified map of raw messages. +func UnmarshalNetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleBeforePrototypeNetworkACLRuleIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItemNetworkACLRuleProtocolAll : NetworkACLRuleItemNetworkACLRuleProtocolAll struct +// This model "extends" NetworkACLRuleItem +type NetworkACLRuleItemNetworkACLRuleProtocolAll struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the + // collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name" validate:"required"` + + // The source CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllActionAllowConst = "allow" + NetworkACLRuleItemNetworkACLRuleProtocolAllActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" + NetworkACLRuleItemNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" + NetworkACLRuleItemNetworkACLRuleProtocolAllIPVersionIpv6Const = "ipv6" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolAllProtocolAllConst = "all" +) + +func (*NetworkACLRuleItemNetworkACLRuleProtocolAll) isaNetworkACLRuleItem() bool { + return true +} + +// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolAll from the specified map of raw messages. +func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleItemNetworkACLRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItemNetworkACLRuleProtocolIcmp : NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct +// This model "extends" NetworkACLRuleItem +type NetworkACLRuleItemNetworkACLRuleProtocolIcmp struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the + // collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name" validate:"required"` + + // The source CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to allow. If unspecified, all codes are allowed. This can only be specified if type is also + // specified. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to allow. If unspecified, all types are allowed by this rule. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionAllowConst = "allow" + NetworkACLRuleItemNetworkACLRuleProtocolIcmpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" + NetworkACLRuleItemNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" + NetworkACLRuleItemNetworkACLRuleProtocolIcmpIPVersionIpv6Const = "ipv6" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +func (*NetworkACLRuleItemNetworkACLRuleProtocolIcmp) isaNetworkACLRuleItem() bool { + return true +} + +// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleItemNetworkACLRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleItemNetworkACLRuleProtocolTcpudp : NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct +// This model "extends" NetworkACLRuleItem +type NetworkACLRuleItemNetworkACLRuleProtocolTcpudp struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. In a rule collection, this always refers to the next item in the + // collection. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name" validate:"required"` + + // The source CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` +} + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpIPVersionIpv6Const = "ipv6" +) + +// Constants associated with the NetworkACLRuleItemNetworkACLRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" + NetworkACLRuleItemNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +func (*NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) isaNetworkACLRuleItem() bool { + return true +} + +// UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleItemNetworkACLRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalNetworkACLRuleItemNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleItemNetworkACLRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll struct +// This model "extends" NetworkACLRulePrototypeNetworkACLContext +type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAllProtocolAllConst = "all" +) + +// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll(action string, destination string, direction string, source string, protocol string) (model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll, err error) { + model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp struct +// This model "extends" NetworkACLRulePrototypeNetworkACLContext +type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to allow. If unspecified, all codes are allowed. This can only be specified if type is also + // specified. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to allow. If unspecified, all types are allowed by this rule. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp(action string, destination string, direction string, source string, protocol string) (model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp, err error) { + model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp : NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp struct +// This model "extends" NetworkACLRulePrototypeNetworkACLContext +type NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + // The destination IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" + NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +// NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp : Instantiate NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp(action string, destination string, direction string, source string, protocol string) (model *NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp, err error) { + model = &NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp) isaNetworkACLRulePrototypeNetworkACLContext() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLContextNetworkACLRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLRuleProtocolAll : NetworkACLRulePrototypeNetworkACLRuleProtocolAll struct +// This model "extends" NetworkACLRulePrototype +type NetworkACLRulePrototypeNetworkACLRuleProtocolAll struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAll.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLRuleProtocolAllActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAll.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolAllProtocolAllConst = "all" +) + +// NewNetworkACLRulePrototypeNetworkACLRuleProtocolAll : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolAll (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolAll(action string, destination string, direction string, source string, protocol string) (model *NetworkACLRulePrototypeNetworkACLRuleProtocolAll, err error) { + model = &NetworkACLRulePrototypeNetworkACLRuleProtocolAll{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLRuleProtocolAll) isaNetworkACLRulePrototype() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolAll from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLRuleProtocolIcmp : NetworkACLRulePrototypeNetworkACLRuleProtocolIcmp struct +// This model "extends" NetworkACLRulePrototype +type NetworkACLRulePrototypeNetworkACLRuleProtocolIcmp struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to allow. If unspecified, all codes are allowed. This can only be specified if type is also + // specified. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to allow. If unspecified, all types are allowed by this rule. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmp.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmp.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +// NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmp : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolIcmp (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolIcmp(action string, destination string, direction string, source string, protocol string) (model *NetworkACLRulePrototypeNetworkACLRuleProtocolIcmp, err error) { + model = &NetworkACLRulePrototypeNetworkACLRuleProtocolIcmp{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLRuleProtocolIcmp) isaNetworkACLRulePrototype() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp : NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp struct +// This model "extends" NetworkACLRulePrototype +type NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + Before NetworkACLRuleBeforePrototypeIntf `json:"before,omitempty"` + + // The destination IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The source IP address or CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` +} + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" + NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +// NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp : Instantiate NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp (Generic Model Constructor) +func (*VpcV1) NewNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp(action string, destination string, direction string, source string, protocol string) (model *NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp, err error) { + model = &NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp{ + Action: core.StringPtr(action), + Destination: core.StringPtr(destination), + Direction: core.StringPtr(direction), + Source: core.StringPtr(source), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp) isaNetworkACLRulePrototype() bool { + return true +} + +// UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalNetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRulePrototypeNetworkACLRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleBeforePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleNetworkACLRuleProtocolAll : NetworkACLRuleNetworkACLRuleProtocolAll struct +// This model "extends" NetworkACLRule +type NetworkACLRuleNetworkACLRuleProtocolAll struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name" validate:"required"` + + // The source CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllActionAllowConst = "allow" + NetworkACLRuleNetworkACLRuleProtocolAllActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllDirectionInboundConst = "inbound" + NetworkACLRuleNetworkACLRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllIPVersionIpv4Const = "ipv4" + NetworkACLRuleNetworkACLRuleProtocolAllIPVersionIpv6Const = "ipv6" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleNetworkACLRuleProtocolAllProtocolAllConst = "all" +) + +func (*NetworkACLRuleNetworkACLRuleProtocolAll) isaNetworkACLRule() bool { + return true +} + +// UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolAll from the specified map of raw messages. +func UnmarshalNetworkACLRuleNetworkACLRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleNetworkACLRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleNetworkACLRuleProtocolIcmp : NetworkACLRuleNetworkACLRuleProtocolIcmp struct +// This model "extends" NetworkACLRule +type NetworkACLRuleNetworkACLRuleProtocolIcmp struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name" validate:"required"` + + // The source CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The ICMP traffic code to allow. If unspecified, all codes are allowed. This can only be specified if type is also + // specified. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to allow. If unspecified, all types are allowed by this rule. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpActionAllowConst = "allow" + NetworkACLRuleNetworkACLRuleProtocolIcmpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionInboundConst = "inbound" + NetworkACLRuleNetworkACLRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpIPVersionIpv4Const = "ipv4" + NetworkACLRuleNetworkACLRuleProtocolIcmpIPVersionIpv6Const = "ipv6" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleNetworkACLRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +func (*NetworkACLRuleNetworkACLRuleProtocolIcmp) isaNetworkACLRule() bool { + return true +} + +// UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalNetworkACLRuleNetworkACLRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleNetworkACLRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// NetworkACLRuleNetworkACLRuleProtocolTcpudp : NetworkACLRuleNetworkACLRuleProtocolTcpudp struct +// This model "extends" NetworkACLRule +type NetworkACLRuleNetworkACLRuleProtocolTcpudp struct { + // Whether to allow or deny matching traffic. + Action *string `json:"action" validate:"required"` + + // The rule that this rule is immediately before. If absent, this is the last rule. + Before *NetworkACLRuleReference `json:"before,omitempty"` + + // The date and time that the rule was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The destination CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Destination *string `json:"destination" validate:"required"` + + // Whether the traffic to be matched is `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The URL for this network ACL rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network ACL rule. + ID *string `json:"id" validate:"required"` + + // The IP version for this rule. + IPVersion *string `json:"ip_version" validate:"required"` + + // The user-defined name for this rule. Names must be unique within the network ACL the rule resides in. If + // unspecified, the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name" validate:"required"` + + // The source CIDR block. The CIDR block `0.0.0.0/0` applies to all addresses. + Source *string `json:"source" validate:"required"` + + // The inclusive upper bound of TCP/UDP destination port range. + DestinationPortMax *int64 `json:"destination_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP destination port range. + DestinationPortMin *int64 `json:"destination_port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The inclusive upper bound of TCP/UDP source port range. + SourcePortMax *int64 `json:"source_port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP source port range. + SourcePortMin *int64 `json:"source_port_min,omitempty"` +} + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Action property. +// Whether to allow or deny matching traffic. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpActionAllowConst = "allow" + NetworkACLRuleNetworkACLRuleProtocolTcpudpActionDenyConst = "deny" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Direction property. +// Whether the traffic to be matched is `inbound` or `outbound`. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionInboundConst = "inbound" + NetworkACLRuleNetworkACLRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.IPVersion property. +// The IP version for this rule. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" + NetworkACLRuleNetworkACLRuleProtocolTcpudpIPVersionIpv6Const = "ipv6" +) + +// Constants associated with the NetworkACLRuleNetworkACLRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolTCPConst = "tcp" + NetworkACLRuleNetworkACLRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +func (*NetworkACLRuleNetworkACLRuleProtocolTcpudp) isaNetworkACLRule() bool { + return true +} + +// UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp unmarshals an instance of NetworkACLRuleNetworkACLRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalNetworkACLRuleNetworkACLRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(NetworkACLRuleNetworkACLRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "action", &obj.Action) + if err != nil { + return + } + err = core.UnmarshalModel(m, "before", &obj.Before, UnmarshalNetworkACLRuleReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination", &obj.Destination) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source", &obj.Source) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_max", &obj.DestinationPortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "destination_port_min", &obj.DestinationPortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_max", &obj.SourcePortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "source_port_min", &obj.SourcePortMin) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemIdentityByHref : OperatingSystemIdentityByHref struct +// This model "extends" OperatingSystemIdentity +type OperatingSystemIdentityByHref struct { + // The URL for this operating system. + Href *string `json:"href" validate:"required"` +} + +// NewOperatingSystemIdentityByHref : Instantiate OperatingSystemIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewOperatingSystemIdentityByHref(href string) (model *OperatingSystemIdentityByHref, err error) { + model = &OperatingSystemIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*OperatingSystemIdentityByHref) isaOperatingSystemIdentity() bool { + return true +} + +// UnmarshalOperatingSystemIdentityByHref unmarshals an instance of OperatingSystemIdentityByHref from the specified map of raw messages. +func UnmarshalOperatingSystemIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// OperatingSystemIdentityByName : OperatingSystemIdentityByName struct +// This model "extends" OperatingSystemIdentity +type OperatingSystemIdentityByName struct { + // The globally unique name for this operating system. + Name *string `json:"name" validate:"required"` +} + +// NewOperatingSystemIdentityByName : Instantiate OperatingSystemIdentityByName (Generic Model Constructor) +func (*VpcV1) NewOperatingSystemIdentityByName(name string) (model *OperatingSystemIdentityByName, err error) { + model = &OperatingSystemIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*OperatingSystemIdentityByName) isaOperatingSystemIdentity() bool { + return true +} + +// UnmarshalOperatingSystemIdentityByName unmarshals an instance of OperatingSystemIdentityByName from the specified map of raw messages. +func UnmarshalOperatingSystemIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(OperatingSystemIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentity : Identifies a floating IP by a unique property. +// Models which "extend" this model: +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref +// - PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress +// This model "extends" PublicGatewayFloatingIPPrototype +type PublicGatewayFloatingIPPrototypeFloatingIPIdentity struct { + // The unique identifier for this floating IP. + ID *string `json:"id,omitempty"` + + // The CRN for this floating IP. + CRN *string `json:"crn,omitempty"` + + // The URL for this floating IP. + Href *string `json:"href,omitempty"` + + // The globally unique IP address. + Address *string `json:"address,omitempty"` +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityIntf interface { + PublicGatewayFloatingIPPrototypeIntf + isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentity) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentity from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext : PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct +// This model "extends" PublicGatewayFloatingIPPrototype +type PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext struct { + // The unique user-defined name for this floating IP. If unspecified, the name will be a hyphenated list of + // randomly-selected words. + Name *string `json:"name,omitempty"` + + // The resource group to use. If unspecified, the account's [default resource + // group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPPrototypeTargetContext) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentityByCRN : PublicGatewayIdentityByCRN struct +// This model "extends" PublicGatewayIdentity +type PublicGatewayIdentityByCRN struct { + // The CRN for this public gateway. + CRN *string `json:"crn" validate:"required"` +} + +// NewPublicGatewayIdentityByCRN : Instantiate PublicGatewayIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayIdentityByCRN(crn string) (model *PublicGatewayIdentityByCRN, err error) { + model = &PublicGatewayIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*PublicGatewayIdentityByCRN) isaPublicGatewayIdentity() bool { + return true +} + +// UnmarshalPublicGatewayIdentityByCRN unmarshals an instance of PublicGatewayIdentityByCRN from the specified map of raw messages. +func UnmarshalPublicGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentityByHref : PublicGatewayIdentityByHref struct +// This model "extends" PublicGatewayIdentity +type PublicGatewayIdentityByHref struct { + // The URL for this public gateway. + Href *string `json:"href" validate:"required"` +} + +// NewPublicGatewayIdentityByHref : Instantiate PublicGatewayIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayIdentityByHref(href string) (model *PublicGatewayIdentityByHref, err error) { + model = &PublicGatewayIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*PublicGatewayIdentityByHref) isaPublicGatewayIdentity() bool { + return true +} + +// UnmarshalPublicGatewayIdentityByHref unmarshals an instance of PublicGatewayIdentityByHref from the specified map of raw messages. +func UnmarshalPublicGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayIdentityByID : PublicGatewayIdentityByID struct +// This model "extends" PublicGatewayIdentity +type PublicGatewayIdentityByID struct { + // The unique identifier for this public gateway. + ID *string `json:"id" validate:"required"` +} + +// NewPublicGatewayIdentityByID : Instantiate PublicGatewayIdentityByID (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayIdentityByID(id string) (model *PublicGatewayIdentityByID, err error) { + model = &PublicGatewayIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*PublicGatewayIdentityByID) isaPublicGatewayIdentity() bool { + return true +} + +// UnmarshalPublicGatewayIdentityByID unmarshals an instance of PublicGatewayIdentityByID from the specified map of raw messages. +func UnmarshalPublicGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentity : ReservedIPTargetPrototypeEndpointGatewayIdentity struct +// Models which "extend" this model: +// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID +// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN +// - ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref +// This model "extends" ReservedIPTargetPrototype +type ReservedIPTargetPrototypeEndpointGatewayIdentity struct { + // The unique identifier for this endpoint gateway. + ID *string `json:"id,omitempty"` + + // The CRN for this endpoint gateway. + CRN *string `json:"crn,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href,omitempty"` +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +type ReservedIPTargetPrototypeEndpointGatewayIdentityIntf interface { + ReservedIPTargetPrototypeIntf + isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentity) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentity from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetEndpointGatewayReference : ReservedIPTargetEndpointGatewayReference struct +// This model "extends" ReservedIPTarget +type ReservedIPTargetEndpointGatewayReference struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *EndpointGatewayReferenceDeleted `json:"deleted,omitempty"` + + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this endpoint gateway. + Name *string `json:"name" validate:"required"` + + // The type of resource referenced. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the ReservedIPTargetEndpointGatewayReference.ResourceType property. +// The type of resource referenced. +const ( + ReservedIPTargetEndpointGatewayReferenceResourceTypeEndpointGatewayConst = "endpoint_gateway" +) + +func (*ReservedIPTargetEndpointGatewayReference) isaReservedIPTarget() bool { + return true +} + +// UnmarshalReservedIPTargetEndpointGatewayReference unmarshals an instance of ReservedIPTargetEndpointGatewayReference from the specified map of raw messages. +func UnmarshalReservedIPTargetEndpointGatewayReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetEndpointGatewayReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalEndpointGatewayReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ResourceGroupIdentityByID : ResourceGroupIdentityByID struct +// This model "extends" ResourceGroupIdentity +type ResourceGroupIdentityByID struct { + // The unique identifier for this resource group. + ID *string `json:"id" validate:"required"` +} + +// NewResourceGroupIdentityByID : Instantiate ResourceGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewResourceGroupIdentityByID(id string) (model *ResourceGroupIdentityByID, err error) { + model = &ResourceGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*ResourceGroupIdentityByID) isaResourceGroupIdentity() bool { + return true +} + +// UnmarshalResourceGroupIdentityByID unmarshals an instance of ResourceGroupIdentityByID from the specified map of raw messages. +func UnmarshalResourceGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ResourceGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopIP : RouteNextHopIP struct +// This model "extends" RouteNextHop +type RouteNextHopIP struct { + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +func (*RouteNextHopIP) isaRouteNextHop() bool { + return true +} + +// UnmarshalRouteNextHopIP unmarshals an instance of RouteNextHopIP from the specified map of raw messages. +func UnmarshalRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPrototypeRouteNextHopIP : The IP address of the next hop to which to route packets. +// This model "extends" RouteNextHopPrototype +type RouteNextHopPrototypeRouteNextHopIP struct { + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewRouteNextHopPrototypeRouteNextHopIP : Instantiate RouteNextHopPrototypeRouteNextHopIP (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPrototypeRouteNextHopIP(address string) (model *RouteNextHopPrototypeRouteNextHopIP, err error) { + model = &RouteNextHopPrototypeRouteNextHopIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*RouteNextHopPrototypeRouteNextHopIP) isaRouteNextHopPrototype() bool { + return true +} + +// UnmarshalRouteNextHopPrototypeRouteNextHopIP unmarshals an instance of RouteNextHopPrototypeRouteNextHopIP from the specified map of raw messages. +func UnmarshalRouteNextHopPrototypeRouteNextHopIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPrototypeRouteNextHopIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPrototypeVPNGatewayConnectionIdentity : Identifies a VPN gateway connection by a unique property. +// Models which "extend" this model: +// - RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID +// - RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref +// This model "extends" RouteNextHopPrototype +type RouteNextHopPrototypeVPNGatewayConnectionIdentity struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true +} + +type RouteNextHopPrototypeVPNGatewayConnectionIdentityIntf interface { + RouteNextHopPrototypeIntf + isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool +} + +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentity) isaRouteNextHopPrototype() bool { + return true +} + +// UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentity unmarshals an instance of RouteNextHopPrototypeVPNGatewayConnectionIdentity from the specified map of raw messages. +func UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPrototypeVPNGatewayConnectionIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopVPNGatewayConnectionReference : RouteNextHopVPNGatewayConnectionReference struct +// This model "extends" RouteNextHop +type RouteNextHopVPNGatewayConnectionReference struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *VPNGatewayConnectionReferenceDeleted `json:"deleted,omitempty"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this VPN connection. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the RouteNextHopVPNGatewayConnectionReference.ResourceType property. +// The resource type. +const ( + RouteNextHopVPNGatewayConnectionReferenceResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +func (*RouteNextHopVPNGatewayConnectionReference) isaRouteNextHop() bool { + return true +} + +// UnmarshalRouteNextHopVPNGatewayConnectionReference unmarshals an instance of RouteNextHopVPNGatewayConnectionReference from the specified map of raw messages. +func UnmarshalRouteNextHopVPNGatewayConnectionReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopVPNGatewayConnectionReference) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalVPNGatewayConnectionReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableIdentityByHref : RoutingTableIdentityByHref struct +// This model "extends" RoutingTableIdentity +type RoutingTableIdentityByHref struct { + // The URL for this routing table. + Href *string `json:"href" validate:"required"` +} + +// NewRoutingTableIdentityByHref : Instantiate RoutingTableIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRoutingTableIdentityByHref(href string) (model *RoutingTableIdentityByHref, err error) { + model = &RoutingTableIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*RoutingTableIdentityByHref) isaRoutingTableIdentity() bool { + return true +} + +// UnmarshalRoutingTableIdentityByHref unmarshals an instance of RoutingTableIdentityByHref from the specified map of raw messages. +func UnmarshalRoutingTableIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RoutingTableIdentityByID : RoutingTableIdentityByID struct +// This model "extends" RoutingTableIdentity +type RoutingTableIdentityByID struct { + // The unique identifier for this routing table. + ID *string `json:"id" validate:"required"` +} + +// NewRoutingTableIdentityByID : Instantiate RoutingTableIdentityByID (Generic Model Constructor) +func (*VpcV1) NewRoutingTableIdentityByID(id string) (model *RoutingTableIdentityByID, err error) { + model = &RoutingTableIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*RoutingTableIdentityByID) isaRoutingTableIdentity() bool { + return true +} + +// UnmarshalRoutingTableIdentityByID unmarshals an instance of RoutingTableIdentityByID from the specified map of raw messages. +func UnmarshalRoutingTableIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RoutingTableIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupIdentityByCRN : SecurityGroupIdentityByCRN struct +// This model "extends" SecurityGroupIdentity +type SecurityGroupIdentityByCRN struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewSecurityGroupIdentityByCRN : Instantiate SecurityGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupIdentityByCRN(crn string) (model *SecurityGroupIdentityByCRN, err error) { + model = &SecurityGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupIdentityByCRN) isaSecurityGroupIdentity() bool { + return true +} + +// UnmarshalSecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalSecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupIdentityByHref : SecurityGroupIdentityByHref struct +// This model "extends" SecurityGroupIdentity +type SecurityGroupIdentityByHref struct { + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewSecurityGroupIdentityByHref : Instantiate SecurityGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupIdentityByHref(href string) (model *SecurityGroupIdentityByHref, err error) { + model = &SecurityGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupIdentityByHref) isaSecurityGroupIdentity() bool { + return true +} + +// UnmarshalSecurityGroupIdentityByHref unmarshals an instance of SecurityGroupIdentityByHref from the specified map of raw messages. +func UnmarshalSecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupIdentityByID : SecurityGroupIdentityByID struct +// This model "extends" SecurityGroupIdentity +type SecurityGroupIdentityByID struct { + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` +} + +// NewSecurityGroupIdentityByID : Instantiate SecurityGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupIdentityByID(id string) (model *SecurityGroupIdentityByID, err error) { + model = &SecurityGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupIdentityByID) isaSecurityGroupIdentity() bool { + return true +} + +// UnmarshalSecurityGroupIdentityByID unmarshals an instance of SecurityGroupIdentityByID from the specified map of raw messages. +func UnmarshalSecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : When `protocol` is `all`, then it's invalid to specify `port_min`, `port_max`, `type` or +// `code`. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll struct { + // The direction of traffic to enforce, either `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are + // used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network + // interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Direction property. +// The direction of traffic to enforce, either `inbound` or `outbound`. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are +// used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network +// interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolAllProtocolAllConst = "all" +) + +// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(direction string, protocol string) (model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll, err error) { + model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll{ + Direction: core.StringPtr(direction), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) isaSecurityGroupRulePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : When `protocol` is `icmp`, then the rule may also contain fields to specify an ICMP `type` and `code`. Field `code` +// may only be specified if `type` is also specified. If type is not specified, then traffic is allowed for all types +// and codes. If type is specified and code is not specified, then traffic is allowed with the specified type for all +// codes. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp struct { + // The direction of traffic to enforce, either `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are + // used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network + // interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + + // The ICMP traffic code to allow. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to allow. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Direction property. +// The direction of traffic to enforce, either `inbound` or `outbound`. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are +// used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network +// interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(direction string, protocol string) (model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp, err error) { + model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp{ + Direction: core.StringPtr(direction), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) isaSecurityGroupRulePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : If `protocol` is either `tcp` or `udp`, then the rule may also contain `port_min` and +// `port_max`. Either both should be set, or neither. When neither is set then traffic is allowed on all ports. For a +// single port, set both to the same value. +// This model "extends" SecurityGroupRulePrototype +type SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp struct { + // The direction of traffic to enforce, either `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are + // used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network + // interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + Remote SecurityGroupRuleRemotePrototypeIntf `json:"remote,omitempty"` + + // The inclusive upper bound of TCP/UDP port range. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP port range. + PortMin *int64 `json:"port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Direction property. +// The direction of traffic to enforce, either `inbound` or `outbound`. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are +// used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network +// interfaces) in that group matching this IP version. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" + SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +// NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp : Instantiate SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(direction string, protocol string) (model *SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp, err error) { + model = &SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp{ + Direction: core.StringPtr(direction), + Protocol: core.StringPtr(protocol), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRulePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalSecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRulePrototypeSecurityGroupRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemotePrototype) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchCIDR : SecurityGroupRuleRemotePatchCIDR struct +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchCIDR struct { + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchCIDR : Instantiate SecurityGroupRuleRemotePatchCIDR (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchCIDR(cidrBlock string) (model *SecurityGroupRuleRemotePatchCIDR, err error) { + model = &SecurityGroupRuleRemotePatchCIDR{ + CIDRBlock: core.StringPtr(cidrBlock), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchCIDR) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchCIDR unmarshals an instance of SecurityGroupRuleRemotePatchCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchIP : SecurityGroupRuleRemotePatchIP struct +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchIP struct { + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchIP : Instantiate SecurityGroupRuleRemotePatchIP (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchIP(address string) (model *SecurityGroupRuleRemotePatchIP, err error) { + model = &SecurityGroupRuleRemotePatchIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchIP) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchIP unmarshals an instance of SecurityGroupRuleRemotePatchIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentity : Identifies a security group by a unique property. +// Models which "extend" this model: +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN +// - SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref +// This model "extends" SecurityGroupRuleRemotePatch +type SecurityGroupRuleRemotePatchSecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +type SecurityGroupRuleRemotePatchSecurityGroupIdentityIntf interface { + SecurityGroupRuleRemotePatchIntf + isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentity) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentity from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeCIDR : SecurityGroupRuleRemotePrototypeCIDR struct +// This model "extends" SecurityGroupRuleRemotePrototype +type SecurityGroupRuleRemotePrototypeCIDR struct { + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeCIDR : Instantiate SecurityGroupRuleRemotePrototypeCIDR (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeCIDR(cidrBlock string) (model *SecurityGroupRuleRemotePrototypeCIDR, err error) { + model = &SecurityGroupRuleRemotePrototypeCIDR{ + CIDRBlock: core.StringPtr(cidrBlock), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeCIDR) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeCIDR unmarshals an instance of SecurityGroupRuleRemotePrototypeCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeIP : SecurityGroupRuleRemotePrototypeIP struct +// This model "extends" SecurityGroupRuleRemotePrototype +type SecurityGroupRuleRemotePrototypeIP struct { + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeIP : Instantiate SecurityGroupRuleRemotePrototypeIP (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeIP(address string) (model *SecurityGroupRuleRemotePrototypeIP, err error) { + model = &SecurityGroupRuleRemotePrototypeIP{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeIP) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeIP unmarshals an instance of SecurityGroupRuleRemotePrototypeIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentity : Identifies a security group by a unique property. +// Models which "extend" this model: +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN +// - SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref +// This model "extends" SecurityGroupRuleRemotePrototype +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentity struct { + // The unique identifier for this security group. + ID *string `json:"id,omitempty"` + + // The security group's CRN. + CRN *string `json:"crn,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href,omitempty"` +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentityIntf interface { + SecurityGroupRuleRemotePrototypeIntf + isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentity from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemoteCIDR : SecurityGroupRuleRemoteCIDR struct +// This model "extends" SecurityGroupRuleRemote +type SecurityGroupRuleRemoteCIDR struct { + // The CIDR block. This property may add support for IPv6 CIDR blocks in the future. When processing a value in this + // property, verify that the CIDR block is in an expected format. If it is not, log an error. Optionally halt + // processing and surface the error, or bypass the resource on which the unexpected CIDR block format was encountered. + CIDRBlock *string `json:"cidr_block" validate:"required"` +} + +func (*SecurityGroupRuleRemoteCIDR) isaSecurityGroupRuleRemote() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemoteCIDR unmarshals an instance of SecurityGroupRuleRemoteCIDR from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemoteCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemoteCIDR) + err = core.UnmarshalPrimitive(m, "cidr_block", &obj.CIDRBlock) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemoteIP : SecurityGroupRuleRemoteIP struct +// This model "extends" SecurityGroupRuleRemote +type SecurityGroupRuleRemoteIP struct { + // The IP address. This property may add support for IPv6 addresses in the future. When processing a value in this + // property, verify that the address is in an expected format. If it is not, log an error. Optionally halt processing + // and surface the error, or bypass the resource on which the unexpected IP address format was encountered. + Address *string `json:"address" validate:"required"` +} + +func (*SecurityGroupRuleRemoteIP) isaSecurityGroupRuleRemote() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemoteIP unmarshals an instance of SecurityGroupRuleRemoteIP from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemoteIP(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemoteIP) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemoteSecurityGroupReference : SecurityGroupRuleRemoteSecurityGroupReference struct +// This model "extends" SecurityGroupRuleRemote +type SecurityGroupRuleRemoteSecurityGroupReference struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *SecurityGroupReferenceDeleted `json:"deleted,omitempty"` + + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this security group. Names must be unique within the VPC the security group resides in. + Name *string `json:"name" validate:"required"` +} + +func (*SecurityGroupRuleRemoteSecurityGroupReference) isaSecurityGroupRuleRemote() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemoteSecurityGroupReference unmarshals an instance of SecurityGroupRuleRemoteSecurityGroupReference from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemoteSecurityGroupReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemoteSecurityGroupReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalSecurityGroupReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleSecurityGroupRuleProtocolAll : When `protocol` is `all`, then it's invalid to specify `port_min`, `port_max`, `type` or +// `code`. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolAll struct { + // The direction of traffic to enforce, either `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are + // used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network + // interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Direction property. +// The direction of traffic to enforce, either `inbound` or `outbound`. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolAllDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are +// used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network +// interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolAll.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolAllProtocolAllConst = "all" +) + +func (*SecurityGroupRuleSecurityGroupRuleProtocolAll) isaSecurityGroupRule() bool { + return true +} + +// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolAll from the specified map of raw messages. +func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolAll(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleSecurityGroupRuleProtocolAll) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleSecurityGroupRuleProtocolIcmp : When `protocol` is `icmp`, then the rule may also contain fields to specify an ICMP `type` and `code`. Field `code` +// may only be specified if `type` is also specified. If type is not specified, then traffic is allowed for all types +// and codes. If type is specified and code is not specified, then traffic is allowed with the specified type for all +// codes. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolIcmp struct { + // The direction of traffic to enforce, either `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are + // used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network + // interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The ICMP traffic code to allow. + Code *int64 `json:"code,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` + + // The ICMP traffic type to allow. + Type *int64 `json:"type,omitempty"` +} + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Direction property. +// The direction of traffic to enforce, either `inbound` or `outbound`. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolIcmpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are +// used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network +// interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolIcmp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolIcmpProtocolIcmpConst = "icmp" +) + +func (*SecurityGroupRuleSecurityGroupRuleProtocolIcmp) isaSecurityGroupRule() bool { + return true +} + +// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolIcmp from the specified map of raw messages. +func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolIcmp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleSecurityGroupRuleProtocolIcmp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "code", &obj.Code) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "type", &obj.Type) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleSecurityGroupRuleProtocolTcpudp : If `protocol` is either `tcp` or `udp`, then the rule may also contain `port_min` and +// `port_max`. Either both should be set, or neither. When neither is set then traffic is allowed on all ports. For a +// single port, set both to the same value. +// This model "extends" SecurityGroupRule +type SecurityGroupRuleSecurityGroupRuleProtocolTcpudp struct { + // The direction of traffic to enforce, either `inbound` or `outbound`. + Direction *string `json:"direction" validate:"required"` + + // The URL for this security group rule. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this security group rule. + ID *string `json:"id" validate:"required"` + + // The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are + // used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network + // interfaces) in that group matching this IP version. + IPVersion *string `json:"ip_version,omitempty"` + + Remote SecurityGroupRuleRemoteIntf `json:"remote" validate:"required"` + + // The inclusive upper bound of TCP/UDP port range. + PortMax *int64 `json:"port_max,omitempty"` + + // The inclusive lower bound of TCP/UDP port range. + PortMin *int64 `json:"port_min,omitempty"` + + // The protocol to enforce. + Protocol *string `json:"protocol" validate:"required"` +} + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Direction property. +// The direction of traffic to enforce, either `inbound` or `outbound`. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionInboundConst = "inbound" + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpDirectionOutboundConst = "outbound" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.IPVersion property. +// The IP version to enforce. The format of `remote.address` or `remote.cidr_block` must match this field, if they are +// used. Alternatively, if `remote` references a security group, then this rule only applies to IP addresses (network +// interfaces) in that group matching this IP version. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpIPVersionIpv4Const = "ipv4" +) + +// Constants associated with the SecurityGroupRuleSecurityGroupRuleProtocolTcpudp.Protocol property. +// The protocol to enforce. +const ( + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolTCPConst = "tcp" + SecurityGroupRuleSecurityGroupRuleProtocolTcpudpProtocolUDPConst = "udp" +) + +func (*SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) isaSecurityGroupRule() bool { + return true +} + +// UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp unmarshals an instance of SecurityGroupRuleSecurityGroupRuleProtocolTcpudp from the specified map of raw messages. +func UnmarshalSecurityGroupRuleSecurityGroupRuleProtocolTcpudp(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleSecurityGroupRuleProtocolTcpudp) + err = core.UnmarshalPrimitive(m, "direction", &obj.Direction) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalModel(m, "remote", &obj.Remote, UnmarshalSecurityGroupRuleRemote) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_max", &obj.PortMax) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "port_min", &obj.PortMin) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "protocol", &obj.Protocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceLoadBalancerReference : SecurityGroupTargetReferenceLoadBalancerReference struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceLoadBalancerReference struct { + // The load balancer's CRN. + CRN *string `json:"crn" validate:"required"` + + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *LoadBalancerReferenceDeleted `json:"deleted,omitempty"` + + // The load balancer's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this load balancer. + ID *string `json:"id" validate:"required"` + + // The unique user-defined name for this load balancer. + Name *string `json:"name" validate:"required"` +} + +func (*SecurityGroupTargetReferenceLoadBalancerReference) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceLoadBalancerReference unmarshals an instance of SecurityGroupTargetReferenceLoadBalancerReference from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceLoadBalancerReference(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceLoadBalancerReference) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalLoadBalancerReferenceDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext : SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct +// This model "extends" SecurityGroupTargetReference +type SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext struct { + // If present, this property indicates the referenced resource has been deleted and provides + // some supplementary information. + Deleted *NetworkInterfaceReferenceTargetContextDeleted `json:"deleted,omitempty"` + + // The URL for this network interface. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` + + // The user-defined name for this network interface. + Name *string `json:"name" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` +} + +// Constants associated with the SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext.ResourceType property. +// The resource type. +const ( + SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContextResourceTypeNetworkInterfaceConst = "network_interface" +) + +func (*SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) isaSecurityGroupTargetReference() bool { + return true +} + +// UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext unmarshals an instance of SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext from the specified map of raw messages. +func UnmarshalSecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupTargetReferenceNetworkInterfaceReferenceTargetContext) + err = core.UnmarshalModel(m, "deleted", &obj.Deleted, UnmarshalNetworkInterfaceReferenceTargetContextDeleted) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentityByCRN : SubnetIdentityByCRN struct +// This model "extends" SubnetIdentity +type SubnetIdentityByCRN struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` +} + +// NewSubnetIdentityByCRN : Instantiate SubnetIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSubnetIdentityByCRN(crn string) (model *SubnetIdentityByCRN, err error) { + model = &SubnetIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SubnetIdentityByCRN) isaSubnetIdentity() bool { + return true +} + +// UnmarshalSubnetIdentityByCRN unmarshals an instance of SubnetIdentityByCRN from the specified map of raw messages. +func UnmarshalSubnetIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentityByHref : SubnetIdentityByHref struct +// This model "extends" SubnetIdentity +type SubnetIdentityByHref struct { + // The URL for this subnet. + Href *string `json:"href" validate:"required"` +} + +// NewSubnetIdentityByHref : Instantiate SubnetIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSubnetIdentityByHref(href string) (model *SubnetIdentityByHref, err error) { + model = &SubnetIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SubnetIdentityByHref) isaSubnetIdentity() bool { + return true +} + +// UnmarshalSubnetIdentityByHref unmarshals an instance of SubnetIdentityByHref from the specified map of raw messages. +func UnmarshalSubnetIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetIdentityByID : SubnetIdentityByID struct +// This model "extends" SubnetIdentity +type SubnetIdentityByID struct { + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` +} + +// NewSubnetIdentityByID : Instantiate SubnetIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSubnetIdentityByID(id string) (model *SubnetIdentityByID, err error) { + model = &SubnetIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SubnetIdentityByID) isaSubnetIdentity() bool { + return true +} + +// UnmarshalSubnetIdentityByID unmarshals an instance of SubnetIdentityByID from the specified map of raw messages. +func UnmarshalSubnetIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPrototypeSubnetByCIDR : SubnetPrototypeSubnetByCIDR struct +// This model "extends" SubnetPrototype +type SubnetPrototypeSubnetByCIDR struct { + // The IP version(s) to support for this subnet. + IPVersion *string `json:"ip_version,omitempty"` + + // The user-defined name for this subnet. Names must be unique within the VPC the subnet resides in. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. If unspecified, the default network ACL for the VPC is used. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to handle internet bound traffic for this subnet. + PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The routing table to use for this subnet. If unspecified, the default routing table for the VPC is used. The routing + // table properties `route_direct_link_ingress`, + // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` + + // The VPC the subnet is to be a part of. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The IPv4 range of the subnet, expressed in CIDR format. The prefix length of the subnet's CIDR must be between `/9` + // (8,388,608 addresses) and `/29` (8 addresses). The IPv4 range of the subnet's CIDR must fall within an existing + // address prefix in the VPC. The subnet will be created in the zone of the address prefix that contains the IPv4 CIDR. + // If zone is specified, it must match the zone of the address prefix that contains the subnet's IPv4 CIDR. + Ipv4CIDRBlock *string `json:"ipv4_cidr_block" validate:"required"` + + // The zone this subnet will reside in. + Zone ZoneIdentityIntf `json:"zone,omitempty"` +} + +// Constants associated with the SubnetPrototypeSubnetByCIDR.IPVersion property. +// The IP version(s) to support for this subnet. +const ( + SubnetPrototypeSubnetByCIDRIPVersionIpv4Const = "ipv4" +) + +// NewSubnetPrototypeSubnetByCIDR : Instantiate SubnetPrototypeSubnetByCIDR (Generic Model Constructor) +func (*VpcV1) NewSubnetPrototypeSubnetByCIDR(vpc VPCIdentityIntf, ipv4CIDRBlock string) (model *SubnetPrototypeSubnetByCIDR, err error) { + model = &SubnetPrototypeSubnetByCIDR{ + VPC: vpc, + Ipv4CIDRBlock: core.StringPtr(ipv4CIDRBlock), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SubnetPrototypeSubnetByCIDR) isaSubnetPrototype() bool { + return true +} + +// UnmarshalSubnetPrototypeSubnetByCIDR unmarshals an instance of SubnetPrototypeSubnetByCIDR from the specified map of raw messages. +func UnmarshalSubnetPrototypeSubnetByCIDR(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPrototypeSubnetByCIDR) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "ipv4_cidr_block", &obj.Ipv4CIDRBlock) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SubnetPrototypeSubnetByTotalCount : SubnetPrototypeSubnetByTotalCount struct +// This model "extends" SubnetPrototype +type SubnetPrototypeSubnetByTotalCount struct { + // The IP version(s) to support for this subnet. + IPVersion *string `json:"ip_version,omitempty"` + + // The user-defined name for this subnet. Names must be unique within the VPC the subnet resides in. If unspecified, + // the name will be a hyphenated list of randomly-selected words. + Name *string `json:"name,omitempty"` + + // The network ACL to use for this subnet. If unspecified, the default network ACL for the VPC is used. + NetworkACL NetworkACLIdentityIntf `json:"network_acl,omitempty"` + + // The public gateway to handle internet bound traffic for this subnet. + PublicGateway PublicGatewayIdentityIntf `json:"public_gateway,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The routing table to use for this subnet. If unspecified, the default routing table for the VPC is used. The routing + // table properties `route_direct_link_ingress`, + // `route_transit_gateway_ingress`, and `route_vpc_zone_ingress` must be `false`. + RoutingTable RoutingTableIdentityIntf `json:"routing_table,omitempty"` + + // The VPC the subnet is to be a part of. + VPC VPCIdentityIntf `json:"vpc" validate:"required"` + + // The total number of IPv4 addresses required. Must be a power of 2. The VPC must have a default address prefix in the + // specified zone, and that prefix must have a free CIDR range with at least this number of addresses. + TotalIpv4AddressCount *int64 `json:"total_ipv4_address_count" validate:"required"` + + // The zone this subnet will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` +} + +// Constants associated with the SubnetPrototypeSubnetByTotalCount.IPVersion property. +// The IP version(s) to support for this subnet. +const ( + SubnetPrototypeSubnetByTotalCountIPVersionIpv4Const = "ipv4" +) + +// NewSubnetPrototypeSubnetByTotalCount : Instantiate SubnetPrototypeSubnetByTotalCount (Generic Model Constructor) +func (*VpcV1) NewSubnetPrototypeSubnetByTotalCount(vpc VPCIdentityIntf, totalIpv4AddressCount int64, zone ZoneIdentityIntf) (model *SubnetPrototypeSubnetByTotalCount, err error) { + model = &SubnetPrototypeSubnetByTotalCount{ + VPC: vpc, + TotalIpv4AddressCount: core.Int64Ptr(totalIpv4AddressCount), + Zone: zone, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SubnetPrototypeSubnetByTotalCount) isaSubnetPrototype() bool { + return true +} + +// UnmarshalSubnetPrototypeSubnetByTotalCount unmarshals an instance of SubnetPrototypeSubnetByTotalCount from the specified map of raw messages. +func UnmarshalSubnetPrototypeSubnetByTotalCount(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SubnetPrototypeSubnetByTotalCount) + err = core.UnmarshalPrimitive(m, "ip_version", &obj.IPVersion) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "network_acl", &obj.NetworkACL, UnmarshalNetworkACLIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "public_gateway", &obj.PublicGateway, UnmarshalPublicGatewayIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "routing_table", &obj.RoutingTable, UnmarshalRoutingTableIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "vpc", &obj.VPC, UnmarshalVPCIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "total_ipv4_address_count", &obj.TotalIpv4AddressCount) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentityByCRN : VPCIdentityByCRN struct +// This model "extends" VPCIdentity +type VPCIdentityByCRN struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` +} + +// NewVPCIdentityByCRN : Instantiate VPCIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVPCIdentityByCRN(crn string) (model *VPCIdentityByCRN, err error) { + model = &VPCIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*VPCIdentityByCRN) isaVPCIdentity() bool { + return true +} + +// UnmarshalVPCIdentityByCRN unmarshals an instance of VPCIdentityByCRN from the specified map of raw messages. +func UnmarshalVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentityByHref : VPCIdentityByHref struct +// This model "extends" VPCIdentity +type VPCIdentityByHref struct { + // The URL for this VPC. + Href *string `json:"href" validate:"required"` +} + +// NewVPCIdentityByHref : Instantiate VPCIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVPCIdentityByHref(href string) (model *VPCIdentityByHref, err error) { + model = &VPCIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*VPCIdentityByHref) isaVPCIdentity() bool { + return true +} + +// UnmarshalVPCIdentityByHref unmarshals an instance of VPCIdentityByHref from the specified map of raw messages. +func UnmarshalVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPCIdentityByID : VPCIdentityByID struct +// This model "extends" VPCIdentity +type VPCIdentityByID struct { + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` +} + +// NewVPCIdentityByID : Instantiate VPCIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVPCIdentityByID(id string) (model *VPCIdentityByID, err error) { + model = &VPCIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*VPCIdentityByID) isaVPCIdentity() bool { + return true +} + +// UnmarshalVPCIdentityByID unmarshals an instance of VPCIdentityByID from the specified map of raw messages. +func UnmarshalVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPCIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch : VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch struct +// This model "extends" VPNGatewayConnectionPatch +type VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + + // Optional IKE policy configuration. The absence of a policy indicates autonegotiation. + IkePolicy IkePolicyIdentityIntf `json:"ike_policy,omitempty"` + + // Optional IPsec policy configuration. The absence of a policy indicates autonegotiation. + IpsecPolicy IPsecPolicyIdentityIntf `json:"ipsec_policy,omitempty"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address,omitempty"` + + // The preshared key. + Psk *string `json:"psk,omitempty"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatchRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) isaVPNGatewayConnectionPatch() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch unmarshals an instance of VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPatchVPNGatewayConnectionStaticRouteModePatch) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPolicyMode : VPNGatewayConnectionPolicyMode struct +// This model "extends" VPNGatewayConnection +type VPNGatewayConnectionPolicyMode struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // Optional IKE policy configuration. The absence of a policy indicates autonegotiation. + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // Optional IPsec policy configuration. The absence of a policy indicates autonegotiation. + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name" validate:"required"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // A collection of local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs" validate:"required"` + + // A collection of peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionPolicyMode.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionPolicyModeAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnectionPolicyMode.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionPolicyModeModePolicyConst = "policy" + VPNGatewayConnectionPolicyModeModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnectionPolicyMode.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionPolicyModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnectionPolicyMode.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionPolicyModeStatusDownConst = "down" + VPNGatewayConnectionPolicyModeStatusUpConst = "up" +) + +func (*VPNGatewayConnectionPolicyMode) isaVPNGatewayConnection() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPolicyMode unmarshals an instance of VPNGatewayConnectionPolicyMode from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPolicyMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPolicyMode) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct +// This model "extends" VPNGatewayConnectionPrototype +type VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + + // Optional IKE policy configuration. The absence of a policy indicates autonegotiation. + IkePolicy IkePolicyIdentityIntf `json:"ike_policy,omitempty"` + + // Optional IPsec policy configuration. The absence of a policy indicates autonegotiation. + IpsecPolicy IPsecPolicyIdentityIntf `json:"ipsec_policy,omitempty"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // A collection of local CIDRs for this resource. + LocalCIDRs []string `json:"local_cidrs" validate:"required"` + + // A collection of peer CIDRs for this resource. + PeerCIDRs []string `json:"peer_cidrs" validate:"required"` +} + +// NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype : Instantiate VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype (Generic Model Constructor) +func (*VpcV1) NewVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(peerAddress string, psk string, localCIDRs []string, peerCIDRs []string) (model *VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype, err error) { + model = &VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype{ + PeerAddress: core.StringPtr(peerAddress), + Psk: core.StringPtr(psk), + LocalCIDRs: localCIDRs, + PeerCIDRs: peerCIDRs, + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype) isaVPNGatewayConnectionPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype unmarshals an instance of VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionPolicyModePrototype) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "local_cidrs", &obj.LocalCIDRs) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_cidrs", &obj.PeerCIDRs) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype : VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype struct +// This model "extends" VPNGatewayConnectionPrototype +type VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up,omitempty"` + + DeadPeerDetection *VPNGatewayConnectionDpdPrototype `json:"dead_peer_detection,omitempty"` + + // Optional IKE policy configuration. The absence of a policy indicates autonegotiation. + IkePolicy IkePolicyIdentityIntf `json:"ike_policy,omitempty"` + + // Optional IPsec policy configuration. The absence of a policy indicates autonegotiation. + IpsecPolicy IPsecPolicyIdentityIntf `json:"ipsec_policy,omitempty"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name,omitempty"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol,omitempty"` +} + +// Constants associated with the VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototypeRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) isaVPNGatewayConnectionPrototype() bool { + return true +} + +// UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype unmarshals an instance of VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionPrototypeVPNGatewayConnectionStaticRouteModePrototype) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpdPrototype) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayConnectionStaticRouteMode : VPNGatewayConnectionStaticRouteMode struct +// This model "extends" VPNGatewayConnection +type VPNGatewayConnectionStaticRouteMode struct { + // If set to false, the VPN gateway connection is shut down. + AdminStateUp *bool `json:"admin_state_up" validate:"required"` + + // The authentication mode. Only `psk` is currently supported. + AuthenticationMode *string `json:"authentication_mode" validate:"required"` + + // The date and time that this VPN gateway connection was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + DeadPeerDetection *VPNGatewayConnectionDpd `json:"dead_peer_detection" validate:"required"` + + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` + + // Optional IKE policy configuration. The absence of a policy indicates autonegotiation. + IkePolicy *IkePolicyReference `json:"ike_policy,omitempty"` + + // Optional IPsec policy configuration. The absence of a policy indicates autonegotiation. + IpsecPolicy *IPsecPolicyReference `json:"ipsec_policy,omitempty"` + + // The mode of the VPN gateway. + Mode *string `json:"mode" validate:"required"` + + // The user-defined name for this VPN gateway connection. + Name *string `json:"name" validate:"required"` + + // The IP address of the peer VPN gateway. + PeerAddress *string `json:"peer_address" validate:"required"` + + // The preshared key. + Psk *string `json:"psk" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of a VPN gateway connection. + Status *string `json:"status" validate:"required"` + + // Routing protocols are disabled for this VPN gateway connection. + RoutingProtocol *string `json:"routing_protocol" validate:"required"` + + // The VPN tunnel configuration for this VPN gateway connection (in static route mode). + Tunnels []VPNGatewayConnectionStaticRouteModeTunnel `json:"tunnels" validate:"required"` +} + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.AuthenticationMode property. +// The authentication mode. Only `psk` is currently supported. +const ( + VPNGatewayConnectionStaticRouteModeAuthenticationModePskConst = "psk" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.Mode property. +// The mode of the VPN gateway. +const ( + VPNGatewayConnectionStaticRouteModeModePolicyConst = "policy" + VPNGatewayConnectionStaticRouteModeModeRouteConst = "route" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.ResourceType property. +// The resource type. +const ( + VPNGatewayConnectionStaticRouteModeResourceTypeVPNGatewayConnectionConst = "vpn_gateway_connection" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.Status property. +// The status of a VPN gateway connection. +const ( + VPNGatewayConnectionStaticRouteModeStatusDownConst = "down" + VPNGatewayConnectionStaticRouteModeStatusUpConst = "up" +) + +// Constants associated with the VPNGatewayConnectionStaticRouteMode.RoutingProtocol property. +// Routing protocols are disabled for this VPN gateway connection. +const ( + VPNGatewayConnectionStaticRouteModeRoutingProtocolNoneConst = "none" +) + +func (*VPNGatewayConnectionStaticRouteMode) isaVPNGatewayConnection() bool { + return true +} + +// UnmarshalVPNGatewayConnectionStaticRouteMode unmarshals an instance of VPNGatewayConnectionStaticRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayConnectionStaticRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayConnectionStaticRouteMode) + err = core.UnmarshalPrimitive(m, "admin_state_up", &obj.AdminStateUp) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "authentication_mode", &obj.AuthenticationMode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalModel(m, "dead_peer_detection", &obj.DeadPeerDetection, UnmarshalVPNGatewayConnectionDpd) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ike_policy", &obj.IkePolicy, UnmarshalIkePolicyReference) + if err != nil { + return + } + err = core.UnmarshalModel(m, "ipsec_policy", &obj.IpsecPolicy, UnmarshalIPsecPolicyReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "peer_address", &obj.PeerAddress) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "psk", &obj.Psk) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "routing_protocol", &obj.RoutingProtocol) + if err != nil { + return + } + err = core.UnmarshalModel(m, "tunnels", &obj.Tunnels, UnmarshalVPNGatewayConnectionStaticRouteModeTunnel) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPolicyMode : VPNGatewayPolicyMode struct +// This model "extends" VPNGateway +type VPNGatewayPolicyMode struct { + // Collection of references to VPN gateway connections. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this VPN gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // Collection of VPN gateway members. + Members []VPNGatewayMember `json:"members" validate:"required"` + + // The user-defined name for this VPN gateway. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPN gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the VPN gateway. + Status *string `json:"status" validate:"required"` + + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // Policy mode VPN gateway. + Mode *string `json:"mode" validate:"required"` +} + +// Constants associated with the VPNGatewayPolicyMode.ResourceType property. +// The resource type. +const ( + VPNGatewayPolicyModeResourceTypeVPNGatewayConst = "vpn_gateway" +) + +// Constants associated with the VPNGatewayPolicyMode.Status property. +// The status of the VPN gateway. +const ( + VPNGatewayPolicyModeStatusAvailableConst = "available" + VPNGatewayPolicyModeStatusDeletingConst = "deleting" + VPNGatewayPolicyModeStatusFailedConst = "failed" + VPNGatewayPolicyModeStatusPendingConst = "pending" +) + +// Constants associated with the VPNGatewayPolicyMode.Mode property. +// Policy mode VPN gateway. +const ( + VPNGatewayPolicyModeModePolicyConst = "policy" +) + +func (*VPNGatewayPolicyMode) isaVPNGateway() bool { + return true +} + +// UnmarshalVPNGatewayPolicyMode unmarshals an instance of VPNGatewayPolicyMode from the specified map of raw messages. +func UnmarshalVPNGatewayPolicyMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPolicyMode) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPrototypeVPNGatewayPolicyModePrototype : VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct +// This model "extends" VPNGatewayPrototype +type VPNGatewayPrototypeVPNGatewayPolicyModePrototype struct { + // The user-defined name for this VPN gateway. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Policy mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototypeVPNGatewayPolicyModePrototype.Mode property. +// Policy mode VPN gateway. +const ( + VPNGatewayPrototypeVPNGatewayPolicyModePrototypeModePolicyConst = "policy" +) + +func (*VPNGatewayPrototypeVPNGatewayPolicyModePrototype) isaVPNGatewayPrototype() bool { + return true +} + +// UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayPolicyModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototypeVPNGatewayPolicyModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototypeVPNGatewayPolicyModePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayPrototypeVPNGatewayRouteModePrototype : VPNGatewayPrototypeVPNGatewayRouteModePrototype struct +// This model "extends" VPNGatewayPrototype +type VPNGatewayPrototypeVPNGatewayRouteModePrototype struct { + // The user-defined name for this VPN gateway. + Name *string `json:"name,omitempty"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + Subnet SubnetIdentityIntf `json:"subnet" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode,omitempty"` +} + +// Constants associated with the VPNGatewayPrototypeVPNGatewayRouteModePrototype.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayPrototypeVPNGatewayRouteModePrototypeModeRouteConst = "route" +) + +func (*VPNGatewayPrototypeVPNGatewayRouteModePrototype) isaVPNGatewayPrototype() bool { + return true +} + +// UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype unmarshals an instance of VPNGatewayPrototypeVPNGatewayRouteModePrototype from the specified map of raw messages. +func UnmarshalVPNGatewayPrototypeVPNGatewayRouteModePrototype(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayPrototypeVPNGatewayRouteModePrototype) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VPNGatewayRouteMode : VPNGatewayRouteMode struct +// This model "extends" VPNGateway +type VPNGatewayRouteMode struct { + // Collection of references to VPN gateway connections. + Connections []VPNGatewayConnectionReference `json:"connections" validate:"required"` + + // The date and time that this VPN gateway was created. + CreatedAt *strfmt.DateTime `json:"created_at" validate:"required"` + + // The VPN gateway's CRN. + CRN *string `json:"crn" validate:"required"` + + // The VPN gateway's canonical URL. + Href *string `json:"href" validate:"required"` + + // The unique identifier for this VPN gateway. + ID *string `json:"id" validate:"required"` + + // Collection of VPN gateway members. + Members []VPNGatewayMember `json:"members" validate:"required"` + + // The user-defined name for this VPN gateway. + Name *string `json:"name" validate:"required"` + + // The resource group for this VPN gateway. + ResourceGroup *ResourceGroupReference `json:"resource_group" validate:"required"` + + // The resource type. + ResourceType *string `json:"resource_type" validate:"required"` + + // The status of the VPN gateway. + Status *string `json:"status" validate:"required"` + + Subnet *SubnetReference `json:"subnet" validate:"required"` + + // Route mode VPN gateway. + Mode *string `json:"mode" validate:"required"` +} + +// Constants associated with the VPNGatewayRouteMode.ResourceType property. +// The resource type. +const ( + VPNGatewayRouteModeResourceTypeVPNGatewayConst = "vpn_gateway" +) + +// Constants associated with the VPNGatewayRouteMode.Status property. +// The status of the VPN gateway. +const ( + VPNGatewayRouteModeStatusAvailableConst = "available" + VPNGatewayRouteModeStatusDeletingConst = "deleting" + VPNGatewayRouteModeStatusFailedConst = "failed" + VPNGatewayRouteModeStatusPendingConst = "pending" +) + +// Constants associated with the VPNGatewayRouteMode.Mode property. +// Route mode VPN gateway. +const ( + VPNGatewayRouteModeModeRouteConst = "route" +) + +func (*VPNGatewayRouteMode) isaVPNGateway() bool { + return true +} + +// UnmarshalVPNGatewayRouteMode unmarshals an instance of VPNGatewayRouteMode from the specified map of raw messages. +func UnmarshalVPNGatewayRouteMode(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VPNGatewayRouteMode) + err = core.UnmarshalModel(m, "connections", &obj.Connections, UnmarshalVPNGatewayConnectionReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "created_at", &obj.CreatedAt) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalModel(m, "members", &obj.Members, UnmarshalVPNGatewayMember) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "status", &obj.Status) + if err != nil { + return + } + err = core.UnmarshalModel(m, "subnet", &obj.Subnet, UnmarshalSubnetReference) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "mode", &obj.Mode) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity : Identifies a volume by a unique property. +// Models which "extend" this model: +// - VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID +// - VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN +// - VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref +// This model "extends" VolumeAttachmentVolumePrototypeInstanceContext +type VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity struct { + // The unique identifier for this volume. + ID *string `json:"id,omitempty"` + + // The CRN for this volume. + CRN *string `json:"crn,omitempty"` + + // The URL for this volume. + Href *string `json:"href,omitempty"` +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity) isaVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity() bool { + return true +} + +type VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityIntf interface { + VolumeAttachmentVolumePrototypeInstanceContextIntf + isaVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity() bool +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { + return true +} + +// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity from the specified map of raw messages. +func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext : VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext struct +// Models which "extend" this model: +// - VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity +// This model "extends" VolumeAttachmentVolumePrototypeInstanceContext +type VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext struct { + // The identity of the root key to use to wrap the data encryption key for the volume. + // + // If this property is not provided, the `encryption` type for the volume will be + // `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The bandwidth for the volume. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The capacity of the volume in gigabytes. The specified minimum and maximum capacity values for creating or updating + // volumes may expand in the future. + Capacity *int64 `json:"capacity,omitempty"` +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext) isaVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext() bool { + return true +} + +type VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextIntf interface { + VolumeAttachmentVolumePrototypeInstanceContextIntf + isaVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext() bool +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { + return true +} + +// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext from the specified map of raw messages. +func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext) + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentityByCRN : VolumeIdentityByCRN struct +// This model "extends" VolumeIdentity +type VolumeIdentityByCRN struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` +} + +// NewVolumeIdentityByCRN : Instantiate VolumeIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVolumeIdentityByCRN(crn string) (model *VolumeIdentityByCRN, err error) { + model = &VolumeIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*VolumeIdentityByCRN) isaVolumeIdentity() bool { + return true +} + +// UnmarshalVolumeIdentityByCRN unmarshals an instance of VolumeIdentityByCRN from the specified map of raw messages. +func UnmarshalVolumeIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentityByHref : VolumeIdentityByHref struct +// This model "extends" VolumeIdentity +type VolumeIdentityByHref struct { + // The URL for this volume. + Href *string `json:"href" validate:"required"` +} + +// NewVolumeIdentityByHref : Instantiate VolumeIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVolumeIdentityByHref(href string) (model *VolumeIdentityByHref, err error) { + model = &VolumeIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*VolumeIdentityByHref) isaVolumeIdentity() bool { + return true +} + +// UnmarshalVolumeIdentityByHref unmarshals an instance of VolumeIdentityByHref from the specified map of raw messages. +func UnmarshalVolumeIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeIdentityByID : VolumeIdentityByID struct +// This model "extends" VolumeIdentity +type VolumeIdentityByID struct { + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` +} + +// NewVolumeIdentityByID : Instantiate VolumeIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVolumeIdentityByID(id string) (model *VolumeIdentityByID, err error) { + model = &VolumeIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*VolumeIdentityByID) isaVolumeIdentity() bool { + return true +} + +// UnmarshalVolumeIdentityByID unmarshals an instance of VolumeIdentityByID from the specified map of raw messages. +func UnmarshalVolumeIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileIdentityByHref : VolumeProfileIdentityByHref struct +// This model "extends" VolumeProfileIdentity +type VolumeProfileIdentityByHref struct { + // The URL for this volume profile. + Href *string `json:"href" validate:"required"` +} + +// NewVolumeProfileIdentityByHref : Instantiate VolumeProfileIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVolumeProfileIdentityByHref(href string) (model *VolumeProfileIdentityByHref, err error) { + model = &VolumeProfileIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*VolumeProfileIdentityByHref) isaVolumeProfileIdentity() bool { + return true +} + +// UnmarshalVolumeProfileIdentityByHref unmarshals an instance of VolumeProfileIdentityByHref from the specified map of raw messages. +func UnmarshalVolumeProfileIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeProfileIdentityByName : VolumeProfileIdentityByName struct +// This model "extends" VolumeProfileIdentity +type VolumeProfileIdentityByName struct { + // The globally unique name for this volume profile. + Name *string `json:"name" validate:"required"` +} + +// NewVolumeProfileIdentityByName : Instantiate VolumeProfileIdentityByName (Generic Model Constructor) +func (*VpcV1) NewVolumeProfileIdentityByName(name string) (model *VolumeProfileIdentityByName, err error) { + model = &VolumeProfileIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*VolumeProfileIdentityByName) isaVolumeProfileIdentity() bool { + return true +} + +// UnmarshalVolumeProfileIdentityByName unmarshals an instance of VolumeProfileIdentityByName from the specified map of raw messages. +func UnmarshalVolumeProfileIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeProfileIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumePrototypeVolumeByCapacity : VolumePrototypeVolumeByCapacity struct +// This model "extends" VolumePrototype +type VolumePrototypeVolumeByCapacity struct { + // The identity of the root key to use to wrap the data encryption key for the volume. + // + // If this property is not provided, the `encryption` type for the volume will be + // `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The bandwidth for the volume. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + ResourceGroup ResourceGroupIdentityIntf `json:"resource_group,omitempty"` + + // The zone this volume will reside in. + Zone ZoneIdentityIntf `json:"zone" validate:"required"` + + // The capacity of the volume in gigabytes. The specified minimum and maximum capacity values for creating or updating + // volumes may expand in the future. + Capacity *int64 `json:"capacity" validate:"required"` +} + +// NewVolumePrototypeVolumeByCapacity : Instantiate VolumePrototypeVolumeByCapacity (Generic Model Constructor) +func (*VpcV1) NewVolumePrototypeVolumeByCapacity(profile VolumeProfileIdentityIntf, zone ZoneIdentityIntf, capacity int64) (model *VolumePrototypeVolumeByCapacity, err error) { + model = &VolumePrototypeVolumeByCapacity{ + Profile: profile, + Zone: zone, + Capacity: core.Int64Ptr(capacity), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*VolumePrototypeVolumeByCapacity) isaVolumePrototype() bool { + return true +} + +// UnmarshalVolumePrototypeVolumeByCapacity unmarshals an instance of VolumePrototypeVolumeByCapacity from the specified map of raw messages. +func UnmarshalVolumePrototypeVolumeByCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumePrototypeVolumeByCapacity) + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "resource_group", &obj.ResourceGroup, UnmarshalResourceGroupIdentity) + if err != nil { + return + } + err = core.UnmarshalModel(m, "zone", &obj.Zone, UnmarshalZoneIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneIdentityByHref : ZoneIdentityByHref struct +// This model "extends" ZoneIdentity +type ZoneIdentityByHref struct { + // The URL for this zone. + Href *string `json:"href" validate:"required"` +} + +// NewZoneIdentityByHref : Instantiate ZoneIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewZoneIdentityByHref(href string) (model *ZoneIdentityByHref, err error) { + model = &ZoneIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*ZoneIdentityByHref) isaZoneIdentity() bool { + return true +} + +// UnmarshalZoneIdentityByHref unmarshals an instance of ZoneIdentityByHref from the specified map of raw messages. +func UnmarshalZoneIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ZoneIdentityByName : ZoneIdentityByName struct +// This model "extends" ZoneIdentity +type ZoneIdentityByName struct { + // The globally unique name for this zone. + Name *string `json:"name" validate:"required"` +} + +// NewZoneIdentityByName : Instantiate ZoneIdentityByName (Generic Model Constructor) +func (*VpcV1) NewZoneIdentityByName(name string) (model *ZoneIdentityByName, err error) { + model = &ZoneIdentityByName{ + Name: core.StringPtr(name), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*ZoneIdentityByName) isaZoneIdentity() bool { + return true +} + +// UnmarshalZoneIdentityByName unmarshals an instance of ZoneIdentityByName from the specified map of raw messages. +func UnmarshalZoneIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ZoneIdentityByName) + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref : EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref struct +// This model "extends" EndpointGatewayReservedIPReservedIPIdentity +type EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref struct { + // The URL for this reserved IP. + Href *string `json:"href" validate:"required"` +} + +// NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref : Instantiate EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref(href string) (model *EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref, err error) { + model = &EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref) isaEndpointGatewayReservedIPReservedIPIdentity() bool { + return true +} + +func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID : EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID struct +// This model "extends" EndpointGatewayReservedIPReservedIPIdentity +type EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID struct { + // The unique identifier for this reserved IP. + ID *string `json:"id" validate:"required"` +} + +// NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID : Instantiate EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID(id string) (model *EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID, err error) { + model = &EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) isaEndpointGatewayReservedIPReservedIPIdentity() bool { + return true +} + +func (*EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) isaEndpointGatewayReservedIP() bool { + return true +} + +// UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID unmarshals an instance of EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID from the specified map of raw messages. +func UnmarshalEndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayReservedIPReservedIPIdentityReservedIPIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN : EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN struct +// This model "extends" EndpointGatewayTargetPrototypeProviderCloudServiceIdentity +type EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The CRN for this provider cloud service, or the CRN for the user's instance of a provider cloud service. + CRN *string `json:"crn" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRNResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRNResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +// NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN : Instantiate EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(resourceType string, crn string) (model *EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN, err error) { + model = &EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN{ + ResourceType: core.StringPtr(resourceType), + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) isaEndpointGatewayTargetPrototypeProviderCloudServiceIdentity() bool { + return true +} + +func (*EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN unmarshals an instance of EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderCloudServiceIdentityProviderCloudServiceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName : The name of this provider infrastructure service. +// This model "extends" EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity +type EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName struct { + // The type of target for this endpoint gateway. + ResourceType *string `json:"resource_type" validate:"required"` + + // The name of a provider infrastructure service. Must be: + // - `ibm-ntp-server`: An NTP (Network Time Protocol) server provided by IBM. + Name *string `json:"name" validate:"required"` +} + +// Constants associated with the EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName.ResourceType property. +// The type of target for this endpoint gateway. +const ( + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByNameResourceTypeProviderCloudServiceConst = "provider_cloud_service" + EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByNameResourceTypeProviderInfrastructureServiceConst = "provider_infrastructure_service" +) + +// NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName : Instantiate EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName (Generic Model Constructor) +func (*VpcV1) NewEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(resourceType string, name string) (model *EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName, err error) { + model = &EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName{ + ResourceType: core.StringPtr(resourceType), + Name: core.StringPtr(name), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) isaEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentity() bool { + return true +} + +func (*EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) isaEndpointGatewayTargetPrototype() bool { + return true +} + +// UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName unmarshals an instance of EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName from the specified map of raw messages. +func UnmarshalEndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(EndpointGatewayTargetPrototypeProviderInfrastructureServiceIdentityProviderInfrastructureServiceIdentityByName) + err = core.UnmarshalPrimitive(m, "resource_type", &obj.ResourceType) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity +type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN(crn string) (model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN, err error) { + model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity +type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref struct { + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref(href string) (model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref, err error) { + model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID : FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeInstanceIdentity +type FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID(id string) (model *FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID, err error) { + model = &FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) isaFlowLogCollectorTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeInstanceIdentityInstanceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref struct { + // The URL for this network interface. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(href string) (model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref, err error) { + model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID : FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeNetworkInterfaceIdentity +type FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID struct { + // The unique identifier for this network interface. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID : Instantiate FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID(id string) (model *FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID, err error) { + model = &FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototypeNetworkInterfaceIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeNetworkInterfaceIdentityNetworkInterfaceIdentityNetworkInterfaceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity +type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN struct { + // The CRN for this subnet. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(crn string) (model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN, err error) { + model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity +type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref struct { + // The URL for this subnet. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref(href string) (model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref, err error) { + model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID : FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeSubnetIdentity +type FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID struct { + // The unique identifier for this subnet. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID : Instantiate FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(id string) (model *FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID, err error) { + model = &FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) isaFlowLogCollectorTargetPrototypeSubnetIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeSubnetIdentitySubnetIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN struct +// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity +type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN struct { + // The CRN for this VPC. + CRN *string `json:"crn" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(crn string) (model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN, err error) { + model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref struct +// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity +type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref struct { + // The URL for this VPC. + Href *string `json:"href" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(href string) (model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref, err error) { + model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID : FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID struct +// This model "extends" FlowLogCollectorTargetPrototypeVPCIdentity +type FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID struct { + // The unique identifier for this VPC. + ID *string `json:"id" validate:"required"` +} + +// NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID : Instantiate FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID (Generic Model Constructor) +func (*VpcV1) NewFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(id string) (model *FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID, err error) { + model = &FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) isaFlowLogCollectorTargetPrototypeVPCIdentity() bool { + return true +} + +func (*FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) isaFlowLogCollectorTargetPrototype() bool { + return true +} + +// UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID unmarshals an instance of FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID from the specified map of raw messages. +func UnmarshalFlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(FlowLogCollectorTargetPrototypeVPCIdentityVPCIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { + model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (model *LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { + model = &LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPatch() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPatchLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref struct { + // The pool's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(href string) (model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref, err error) { + model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct +// This model "extends" LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity +type LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID struct { + // The unique identifier for this load balancer pool. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID : Instantiate LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(id string) (model *LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID, err error) { + model = &LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentity() bool { + return true +} + +func (*LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) isaLoadBalancerListenerPolicyTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID unmarshals an instance of LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerListenerPolicyTargetPrototypeLoadBalancerPoolIdentityLoadBalancerPoolIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct +// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN struct { + // The CRN for this virtual server instance. + CRN *string `json:"crn" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN(crn string) (model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN, err error) { + model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref struct +// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref struct { + // The URL for this virtual server instance. + Href *string `json:"href" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref(href string) (model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref, err error) { + model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID : LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID struct +// This model "extends" LoadBalancerPoolMemberTargetPrototypeInstanceIdentity +type LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID struct { + // The unique identifier for this virtual server instance. + ID *string `json:"id" validate:"required"` +} + +// NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID : Instantiate LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID (Generic Model Constructor) +func (*VpcV1) NewLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID(id string) (model *LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID, err error) { + model = &LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) isaLoadBalancerPoolMemberTargetPrototypeInstanceIdentity() bool { + return true +} + +func (*LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) isaLoadBalancerPoolMemberTargetPrototype() bool { + return true +} + +// UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID unmarshals an instance of LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID from the specified map of raw messages. +func UnmarshalLoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(LoadBalancerPoolMemberTargetPrototypeInstanceIdentityInstanceIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress struct { + // The globally unique IP address. + Address *string `json:"address" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress(address string) (model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress, err error) { + model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress{ + Address: core.StringPtr(address), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByAddress) + err = core.UnmarshalPrimitive(m, "address", &obj.Address) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN struct { + // The CRN for this floating IP. + CRN *string `json:"crn" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN(crn string) (model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN, err error) { + model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref struct { + // The URL for this floating IP. + Href *string `json:"href" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref(href string) (model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref, err error) { + model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID : PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID struct +// This model "extends" PublicGatewayFloatingIPPrototypeFloatingIPIdentity +type PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID struct { + // The unique identifier for this floating IP. + ID *string `json:"id" validate:"required"` +} + +// NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID : Instantiate PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID (Generic Model Constructor) +func (*VpcV1) NewPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID(id string) (model *PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID, err error) { + model = &PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) isaPublicGatewayFloatingIPPrototypeFloatingIPIdentity() bool { + return true +} + +func (*PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) isaPublicGatewayFloatingIPPrototype() bool { + return true +} + +// UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID unmarshals an instance of PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID from the specified map of raw messages. +func UnmarshalPublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(PublicGatewayFloatingIPPrototypeFloatingIPIdentityFloatingIPIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN struct +// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity +type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN struct { + // The CRN for this endpoint gateway. + CRN *string `json:"crn" validate:"required"` +} + +// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN(crn string) (model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN, err error) { + model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref struct +// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity +type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref struct { + // The URL for this endpoint gateway. + Href *string `json:"href" validate:"required"` +} + +// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref(href string) (model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref, err error) { + model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID : ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID struct +// This model "extends" ReservedIPTargetPrototypeEndpointGatewayIdentity +type ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID struct { + // The unique identifier for this endpoint gateway. + ID *string `json:"id" validate:"required"` +} + +// NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID : Instantiate ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID (Generic Model Constructor) +func (*VpcV1) NewReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID(id string) (model *ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID, err error) { + model = &ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) isaReservedIPTargetPrototypeEndpointGatewayIdentity() bool { + return true +} + +func (*ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) isaReservedIPTargetPrototype() bool { + return true +} + +// UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID unmarshals an instance of ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID from the specified map of raw messages. +func UnmarshalReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(ReservedIPTargetPrototypeEndpointGatewayIdentityEndpointGatewayIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct +// This model "extends" RouteNextHopPrototypeVPNGatewayConnectionIdentity +type RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref struct { + // The VPN connection's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref : Instantiate RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(href string) (model *RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref, err error) { + model = &RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) isaRouteNextHopPrototype() bool { + return true +} + +// UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref unmarshals an instance of RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref from the specified map of raw messages. +func UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct +// This model "extends" RouteNextHopPrototypeVPNGatewayConnectionIdentity +type RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID struct { + // The unique identifier for this VPN gateway connection. + ID *string `json:"id" validate:"required"` +} + +// NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID : Instantiate RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID (Generic Model Constructor) +func (*VpcV1) NewRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(id string) (model *RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID, err error) { + model = &RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPrototypeVPNGatewayConnectionIdentity() bool { + return true +} + +func (*RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) isaRouteNextHopPrototype() bool { + return true +} + +// UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID unmarshals an instance of RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID from the specified map of raw messages. +func UnmarshalRouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(RouteNextHopPrototypeVPNGatewayConnectionIdentityVPNGatewayConnectionIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct +// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN(crn string) (model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN, err error) { + model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct +// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref struct { + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref(href string) (model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref, err error) { + model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID : SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID struct +// This model "extends" SecurityGroupRuleRemotePatchSecurityGroupIdentity +type SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID struct { + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` +} + +// NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID : Instantiate SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID(id string) (model *SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID, err error) { + model = &SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePatchSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePatch() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID unmarshals an instance of SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePatchSecurityGroupIdentitySecurityGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct +// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN struct { + // The security group's CRN. + CRN *string `json:"crn" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN(crn string) (model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN, err error) { + model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref struct +// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref struct { + // The security group's canonical URL. + Href *string `json:"href" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref(href string) (model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref, err error) { + model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID : SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID struct +// This model "extends" SecurityGroupRuleRemotePrototypeSecurityGroupIdentity +type SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID struct { + // The unique identifier for this security group. + ID *string `json:"id" validate:"required"` +} + +// NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID : Instantiate SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID (Generic Model Constructor) +func (*VpcV1) NewSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID(id string) (model *SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID, err error) { + model = &SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePrototypeSecurityGroupIdentity() bool { + return true +} + +func (*SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) isaSecurityGroupRuleRemotePrototype() bool { + return true +} + +// UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID unmarshals an instance of SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID from the specified map of raw messages. +func UnmarshalSecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(SecurityGroupRuleRemotePrototypeSecurityGroupIdentitySecurityGroupIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN : VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN struct +// This model "extends" VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity +type VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN struct { + // The CRN for this volume. + CRN *string `json:"crn" validate:"required"` +} + +// NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN : Instantiate VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN(crn string) (model *VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN, err error) { + model = &VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN{ + CRN: core.StringPtr(crn), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity() bool { + return true +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { + return true +} + +// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN from the specified map of raw messages. +func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByCRN) + err = core.UnmarshalPrimitive(m, "crn", &obj.CRN) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref : VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref struct +// This model "extends" VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity +type VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref struct { + // The URL for this volume. + Href *string `json:"href" validate:"required"` +} + +// NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref : Instantiate VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref(href string) (model *VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref, err error) { + model = &VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref{ + Href: core.StringPtr(href), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity() bool { + return true +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { + return true +} + +// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref from the specified map of raw messages. +func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByHref) + err = core.UnmarshalPrimitive(m, "href", &obj.Href) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID : VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID struct +// This model "extends" VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity +type VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID struct { + // The unique identifier for this volume. + ID *string `json:"id" validate:"required"` +} + +// NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID : Instantiate VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID(id string) (model *VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID, err error) { + model = &VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID{ + ID: core.StringPtr(id), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentity() bool { + return true +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { + return true +} + +// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID from the specified map of raw messages. +func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumeIdentityVolumeIdentityByID) + err = core.UnmarshalPrimitive(m, "id", &obj.ID) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} + +// VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct +// This model "extends" VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext +type VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity struct { + // The identity of the root key to use to wrap the data encryption key for the volume. + // + // If this property is not provided, the `encryption` type for the volume will be + // `provider_managed`. + EncryptionKey EncryptionKeyIdentityIntf `json:"encryption_key,omitempty"` + + // The bandwidth for the volume. + Iops *int64 `json:"iops,omitempty"` + + // The unique user-defined name for this volume. + Name *string `json:"name,omitempty"` + + // The profile to use for this volume. + Profile VolumeProfileIdentityIntf `json:"profile" validate:"required"` + + // The capacity of the volume in gigabytes. The specified minimum and maximum capacity values for creating or updating + // volumes may expand in the future. + Capacity *int64 `json:"capacity" validate:"required"` +} + +// NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity : Instantiate VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity (Generic Model Constructor) +func (*VpcV1) NewVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(profile VolumeProfileIdentityIntf, capacity int64) (model *VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity, err error) { + model = &VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity{ + Profile: profile, + Capacity: core.Int64Ptr(capacity), + } + err = core.ValidateStruct(model, "required parameters") + return +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContext() bool { + return true +} + +func (*VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) isaVolumeAttachmentVolumePrototypeInstanceContext() bool { + return true +} + +// UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity unmarshals an instance of VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity from the specified map of raw messages. +func UnmarshalVolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity(m map[string]json.RawMessage, result interface{}) (err error) { + obj := new(VolumeAttachmentVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumePrototypeInstanceContextVolumeByCapacity) + err = core.UnmarshalModel(m, "encryption_key", &obj.EncryptionKey, UnmarshalEncryptionKeyIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "iops", &obj.Iops) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "name", &obj.Name) + if err != nil { + return + } + err = core.UnmarshalModel(m, "profile", &obj.Profile, UnmarshalVolumeProfileIdentity) + if err != nil { + return + } + err = core.UnmarshalPrimitive(m, "capacity", &obj.Capacity) + if err != nil { + return + } + reflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj)) + return +} diff --git a/vendor/github.com/PuerkitoBio/purell/.gitignore b/vendor/github.com/PuerkitoBio/purell/.gitignore new file mode 100644 index 00000000000..748e4c8073c --- /dev/null +++ b/vendor/github.com/PuerkitoBio/purell/.gitignore @@ -0,0 +1,5 @@ +*.sublime-* +.DS_Store +*.swp +*.swo +tags diff --git a/vendor/github.com/PuerkitoBio/purell/.travis.yml b/vendor/github.com/PuerkitoBio/purell/.travis.yml new file mode 100644 index 00000000000..cf31e6af6d5 --- /dev/null +++ b/vendor/github.com/PuerkitoBio/purell/.travis.yml @@ -0,0 +1,12 @@ +language: go + +go: + - 1.4.x + - 1.5.x + - 1.6.x + - 1.7.x + - 1.8.x + - 1.9.x + - "1.10.x" + - "1.11.x" + - tip diff --git a/vendor/github.com/PuerkitoBio/purell/LICENSE b/vendor/github.com/PuerkitoBio/purell/LICENSE new file mode 100644 index 00000000000..4b9986dea71 --- /dev/null +++ b/vendor/github.com/PuerkitoBio/purell/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2012, Martin Angers +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +* Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/PuerkitoBio/purell/README.md b/vendor/github.com/PuerkitoBio/purell/README.md new file mode 100644 index 00000000000..07de0c49866 --- /dev/null +++ b/vendor/github.com/PuerkitoBio/purell/README.md @@ -0,0 +1,188 @@ +# Purell + +Purell is a tiny Go library to normalize URLs. It returns a pure URL. Pure-ell. Sanitizer and all. Yeah, I know... + +Based on the [wikipedia paper][wiki] and the [RFC 3986 document][rfc]. + +[![build status](https://travis-ci.org/PuerkitoBio/purell.svg?branch=master)](http://travis-ci.org/PuerkitoBio/purell) + +## Install + +`go get github.com/PuerkitoBio/purell` + +## Changelog + +* **v1.1.1** : Fix failing test due to Go1.12 changes (thanks to @ianlancetaylor). +* **2016-11-14 (v1.1.0)** : IDN: Conform to RFC 5895: Fold character width (thanks to @beeker1121). +* **2016-07-27 (v1.0.0)** : Normalize IDN to ASCII (thanks to @zenovich). +* **2015-02-08** : Add fix for relative paths issue ([PR #5][pr5]) and add fix for unnecessary encoding of reserved characters ([see issue #7][iss7]). +* **v0.2.0** : Add benchmarks, Attempt IDN support. +* **v0.1.0** : Initial release. + +## Examples + +From `example_test.go` (note that in your code, you would import "github.com/PuerkitoBio/purell", and would prefix references to its methods and constants with "purell."): + +```go +package purell + +import ( + "fmt" + "net/url" +) + +func ExampleNormalizeURLString() { + if normalized, err := NormalizeURLString("hTTp://someWEBsite.com:80/Amazing%3f/url/", + FlagLowercaseScheme|FlagLowercaseHost|FlagUppercaseEscapes); err != nil { + panic(err) + } else { + fmt.Print(normalized) + } + // Output: http://somewebsite.com:80/Amazing%3F/url/ +} + +func ExampleMustNormalizeURLString() { + normalized := MustNormalizeURLString("hTTpS://someWEBsite.com:443/Amazing%fa/url/", + FlagsUnsafeGreedy) + fmt.Print(normalized) + + // Output: http://somewebsite.com/Amazing%FA/url +} + +func ExampleNormalizeURL() { + if u, err := url.Parse("Http://SomeUrl.com:8080/a/b/.././c///g?c=3&a=1&b=9&c=0#target"); err != nil { + panic(err) + } else { + normalized := NormalizeURL(u, FlagsUsuallySafeGreedy|FlagRemoveDuplicateSlashes|FlagRemoveFragment) + fmt.Print(normalized) + } + + // Output: http://someurl.com:8080/a/c/g?c=3&a=1&b=9&c=0 +} +``` + +## API + +As seen in the examples above, purell offers three methods, `NormalizeURLString(string, NormalizationFlags) (string, error)`, `MustNormalizeURLString(string, NormalizationFlags) (string)` and `NormalizeURL(*url.URL, NormalizationFlags) (string)`. They all normalize the provided URL based on the specified flags. Here are the available flags: + +```go +const ( + // Safe normalizations + FlagLowercaseScheme NormalizationFlags = 1 << iota // HTTP://host -> http://host, applied by default in Go1.1 + FlagLowercaseHost // http://HOST -> http://host + FlagUppercaseEscapes // http://host/t%ef -> http://host/t%EF + FlagDecodeUnnecessaryEscapes // http://host/t%41 -> http://host/tA + FlagEncodeNecessaryEscapes // http://host/!"#$ -> http://host/%21%22#$ + FlagRemoveDefaultPort // http://host:80 -> http://host + FlagRemoveEmptyQuerySeparator // http://host/path? -> http://host/path + + // Usually safe normalizations + FlagRemoveTrailingSlash // http://host/path/ -> http://host/path + FlagAddTrailingSlash // http://host/path -> http://host/path/ (should choose only one of these add/remove trailing slash flags) + FlagRemoveDotSegments // http://host/path/./a/b/../c -> http://host/path/a/c + + // Unsafe normalizations + FlagRemoveDirectoryIndex // http://host/path/index.html -> http://host/path/ + FlagRemoveFragment // http://host/path#fragment -> http://host/path + FlagForceHTTP // https://host -> http://host + FlagRemoveDuplicateSlashes // http://host/path//a///b -> http://host/path/a/b + FlagRemoveWWW // http://www.host/ -> http://host/ + FlagAddWWW // http://host/ -> http://www.host/ (should choose only one of these add/remove WWW flags) + FlagSortQuery // http://host/path?c=3&b=2&a=1&b=1 -> http://host/path?a=1&b=1&b=2&c=3 + + // Normalizations not in the wikipedia article, required to cover tests cases + // submitted by jehiah + FlagDecodeDWORDHost // http://1113982867 -> http://66.102.7.147 + FlagDecodeOctalHost // http://0102.0146.07.0223 -> http://66.102.7.147 + FlagDecodeHexHost // http://0x42660793 -> http://66.102.7.147 + FlagRemoveUnnecessaryHostDots // http://.host../path -> http://host/path + FlagRemoveEmptyPortSeparator // http://host:/path -> http://host/path + + // Convenience set of safe normalizations + FlagsSafe NormalizationFlags = FlagLowercaseHost | FlagLowercaseScheme | FlagUppercaseEscapes | FlagDecodeUnnecessaryEscapes | FlagEncodeNecessaryEscapes | FlagRemoveDefaultPort | FlagRemoveEmptyQuerySeparator + + // For convenience sets, "greedy" uses the "remove trailing slash" and "remove www. prefix" flags, + // while "non-greedy" uses the "add (or keep) the trailing slash" and "add www. prefix". + + // Convenience set of usually safe normalizations (includes FlagsSafe) + FlagsUsuallySafeGreedy NormalizationFlags = FlagsSafe | FlagRemoveTrailingSlash | FlagRemoveDotSegments + FlagsUsuallySafeNonGreedy NormalizationFlags = FlagsSafe | FlagAddTrailingSlash | FlagRemoveDotSegments + + // Convenience set of unsafe normalizations (includes FlagsUsuallySafe) + FlagsUnsafeGreedy NormalizationFlags = FlagsUsuallySafeGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagRemoveWWW | FlagSortQuery + FlagsUnsafeNonGreedy NormalizationFlags = FlagsUsuallySafeNonGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagAddWWW | FlagSortQuery + + // Convenience set of all available flags + FlagsAllGreedy = FlagsUnsafeGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator + FlagsAllNonGreedy = FlagsUnsafeNonGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator +) +``` + +For convenience, the set of flags `FlagsSafe`, `FlagsUsuallySafe[Greedy|NonGreedy]`, `FlagsUnsafe[Greedy|NonGreedy]` and `FlagsAll[Greedy|NonGreedy]` are provided for the similarly grouped normalizations on [wikipedia's URL normalization page][wiki]. You can add (using the bitwise OR `|` operator) or remove (using the bitwise AND NOT `&^` operator) individual flags from the sets if required, to build your own custom set. + +The [full godoc reference is available on gopkgdoc][godoc]. + +Some things to note: + +* `FlagDecodeUnnecessaryEscapes`, `FlagEncodeNecessaryEscapes`, `FlagUppercaseEscapes` and `FlagRemoveEmptyQuerySeparator` are always implicitly set, because internally, the URL string is parsed as an URL object, which automatically decodes unnecessary escapes, uppercases and encodes necessary ones, and removes empty query separators (an unnecessary `?` at the end of the url). So this operation cannot **not** be done. For this reason, `FlagRemoveEmptyQuerySeparator` (as well as the other three) has been included in the `FlagsSafe` convenience set, instead of `FlagsUnsafe`, where Wikipedia puts it. + +* The `FlagDecodeUnnecessaryEscapes` decodes the following escapes (*from -> to*): + - %24 -> $ + - %26 -> & + - %2B-%3B -> +,-./0123456789:; + - %3D -> = + - %40-%5A -> @ABCDEFGHIJKLMNOPQRSTUVWXYZ + - %5F -> _ + - %61-%7A -> abcdefghijklmnopqrstuvwxyz + - %7E -> ~ + + +* When the `NormalizeURL` function is used (passing an URL object), this source URL object is modified (that is, after the call, the URL object will be modified to reflect the normalization). + +* The *replace IP with domain name* normalization (`http://208.77.188.166/ → http://www.example.com/`) is obviously not possible for a library without making some network requests. This is not implemented in purell. + +* The *remove unused query string parameters* and *remove default query parameters* are also not implemented, since this is a very case-specific normalization, and it is quite trivial to do with an URL object. + +### Safe vs Usually Safe vs Unsafe + +Purell allows you to control the level of risk you take while normalizing an URL. You can aggressively normalize, play it totally safe, or anything in between. + +Consider the following URL: + +`HTTPS://www.RooT.com/toto/t%45%1f///a/./b/../c/?z=3&w=2&a=4&w=1#invalid` + +Normalizing with the `FlagsSafe` gives: + +`https://www.root.com/toto/tE%1F///a/./b/../c/?z=3&w=2&a=4&w=1#invalid` + +With the `FlagsUsuallySafeGreedy`: + +`https://www.root.com/toto/tE%1F///a/c?z=3&w=2&a=4&w=1#invalid` + +And with `FlagsUnsafeGreedy`: + +`http://root.com/toto/tE%1F/a/c?a=4&w=1&w=2&z=3` + +## TODOs + +* Add a class/default instance to allow specifying custom directory index names? At the moment, removing directory index removes `(^|/)((?:default|index)\.\w{1,4})$`. + +## Thanks / Contributions + +@rogpeppe +@jehiah +@opennota +@pchristopher1275 +@zenovich +@beeker1121 + +## License + +The [BSD 3-Clause license][bsd]. + +[bsd]: http://opensource.org/licenses/BSD-3-Clause +[wiki]: http://en.wikipedia.org/wiki/URL_normalization +[rfc]: http://tools.ietf.org/html/rfc3986#section-6 +[godoc]: http://go.pkgdoc.org/github.com/PuerkitoBio/purell +[pr5]: https://github.com/PuerkitoBio/purell/pull/5 +[iss7]: https://github.com/PuerkitoBio/purell/issues/7 diff --git a/vendor/github.com/PuerkitoBio/purell/purell.go b/vendor/github.com/PuerkitoBio/purell/purell.go new file mode 100644 index 00000000000..6d0fc190a18 --- /dev/null +++ b/vendor/github.com/PuerkitoBio/purell/purell.go @@ -0,0 +1,379 @@ +/* +Package purell offers URL normalization as described on the wikipedia page: +http://en.wikipedia.org/wiki/URL_normalization +*/ +package purell + +import ( + "bytes" + "fmt" + "net/url" + "regexp" + "sort" + "strconv" + "strings" + + "github.com/PuerkitoBio/urlesc" + "golang.org/x/net/idna" + "golang.org/x/text/unicode/norm" + "golang.org/x/text/width" +) + +// A set of normalization flags determines how a URL will +// be normalized. +type NormalizationFlags uint + +const ( + // Safe normalizations + FlagLowercaseScheme NormalizationFlags = 1 << iota // HTTP://host -> http://host, applied by default in Go1.1 + FlagLowercaseHost // http://HOST -> http://host + FlagUppercaseEscapes // http://host/t%ef -> http://host/t%EF + FlagDecodeUnnecessaryEscapes // http://host/t%41 -> http://host/tA + FlagEncodeNecessaryEscapes // http://host/!"#$ -> http://host/%21%22#$ + FlagRemoveDefaultPort // http://host:80 -> http://host + FlagRemoveEmptyQuerySeparator // http://host/path? -> http://host/path + + // Usually safe normalizations + FlagRemoveTrailingSlash // http://host/path/ -> http://host/path + FlagAddTrailingSlash // http://host/path -> http://host/path/ (should choose only one of these add/remove trailing slash flags) + FlagRemoveDotSegments // http://host/path/./a/b/../c -> http://host/path/a/c + + // Unsafe normalizations + FlagRemoveDirectoryIndex // http://host/path/index.html -> http://host/path/ + FlagRemoveFragment // http://host/path#fragment -> http://host/path + FlagForceHTTP // https://host -> http://host + FlagRemoveDuplicateSlashes // http://host/path//a///b -> http://host/path/a/b + FlagRemoveWWW // http://www.host/ -> http://host/ + FlagAddWWW // http://host/ -> http://www.host/ (should choose only one of these add/remove WWW flags) + FlagSortQuery // http://host/path?c=3&b=2&a=1&b=1 -> http://host/path?a=1&b=1&b=2&c=3 + + // Normalizations not in the wikipedia article, required to cover tests cases + // submitted by jehiah + FlagDecodeDWORDHost // http://1113982867 -> http://66.102.7.147 + FlagDecodeOctalHost // http://0102.0146.07.0223 -> http://66.102.7.147 + FlagDecodeHexHost // http://0x42660793 -> http://66.102.7.147 + FlagRemoveUnnecessaryHostDots // http://.host../path -> http://host/path + FlagRemoveEmptyPortSeparator // http://host:/path -> http://host/path + + // Convenience set of safe normalizations + FlagsSafe NormalizationFlags = FlagLowercaseHost | FlagLowercaseScheme | FlagUppercaseEscapes | FlagDecodeUnnecessaryEscapes | FlagEncodeNecessaryEscapes | FlagRemoveDefaultPort | FlagRemoveEmptyQuerySeparator + + // For convenience sets, "greedy" uses the "remove trailing slash" and "remove www. prefix" flags, + // while "non-greedy" uses the "add (or keep) the trailing slash" and "add www. prefix". + + // Convenience set of usually safe normalizations (includes FlagsSafe) + FlagsUsuallySafeGreedy NormalizationFlags = FlagsSafe | FlagRemoveTrailingSlash | FlagRemoveDotSegments + FlagsUsuallySafeNonGreedy NormalizationFlags = FlagsSafe | FlagAddTrailingSlash | FlagRemoveDotSegments + + // Convenience set of unsafe normalizations (includes FlagsUsuallySafe) + FlagsUnsafeGreedy NormalizationFlags = FlagsUsuallySafeGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagRemoveWWW | FlagSortQuery + FlagsUnsafeNonGreedy NormalizationFlags = FlagsUsuallySafeNonGreedy | FlagRemoveDirectoryIndex | FlagRemoveFragment | FlagForceHTTP | FlagRemoveDuplicateSlashes | FlagAddWWW | FlagSortQuery + + // Convenience set of all available flags + FlagsAllGreedy = FlagsUnsafeGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator + FlagsAllNonGreedy = FlagsUnsafeNonGreedy | FlagDecodeDWORDHost | FlagDecodeOctalHost | FlagDecodeHexHost | FlagRemoveUnnecessaryHostDots | FlagRemoveEmptyPortSeparator +) + +const ( + defaultHttpPort = ":80" + defaultHttpsPort = ":443" +) + +// Regular expressions used by the normalizations +var rxPort = regexp.MustCompile(`(:\d+)/?$`) +var rxDirIndex = regexp.MustCompile(`(^|/)((?:default|index)\.\w{1,4})$`) +var rxDupSlashes = regexp.MustCompile(`/{2,}`) +var rxDWORDHost = regexp.MustCompile(`^(\d+)((?:\.+)?(?:\:\d*)?)$`) +var rxOctalHost = regexp.MustCompile(`^(0\d*)\.(0\d*)\.(0\d*)\.(0\d*)((?:\.+)?(?:\:\d*)?)$`) +var rxHexHost = regexp.MustCompile(`^0x([0-9A-Fa-f]+)((?:\.+)?(?:\:\d*)?)$`) +var rxHostDots = regexp.MustCompile(`^(.+?)(:\d+)?$`) +var rxEmptyPort = regexp.MustCompile(`:+$`) + +// Map of flags to implementation function. +// FlagDecodeUnnecessaryEscapes has no action, since it is done automatically +// by parsing the string as an URL. Same for FlagUppercaseEscapes and FlagRemoveEmptyQuerySeparator. + +// Since maps have undefined traversing order, make a slice of ordered keys +var flagsOrder = []NormalizationFlags{ + FlagLowercaseScheme, + FlagLowercaseHost, + FlagRemoveDefaultPort, + FlagRemoveDirectoryIndex, + FlagRemoveDotSegments, + FlagRemoveFragment, + FlagForceHTTP, // Must be after remove default port (because https=443/http=80) + FlagRemoveDuplicateSlashes, + FlagRemoveWWW, + FlagAddWWW, + FlagSortQuery, + FlagDecodeDWORDHost, + FlagDecodeOctalHost, + FlagDecodeHexHost, + FlagRemoveUnnecessaryHostDots, + FlagRemoveEmptyPortSeparator, + FlagRemoveTrailingSlash, // These two (add/remove trailing slash) must be last + FlagAddTrailingSlash, +} + +// ... and then the map, where order is unimportant +var flags = map[NormalizationFlags]func(*url.URL){ + FlagLowercaseScheme: lowercaseScheme, + FlagLowercaseHost: lowercaseHost, + FlagRemoveDefaultPort: removeDefaultPort, + FlagRemoveDirectoryIndex: removeDirectoryIndex, + FlagRemoveDotSegments: removeDotSegments, + FlagRemoveFragment: removeFragment, + FlagForceHTTP: forceHTTP, + FlagRemoveDuplicateSlashes: removeDuplicateSlashes, + FlagRemoveWWW: removeWWW, + FlagAddWWW: addWWW, + FlagSortQuery: sortQuery, + FlagDecodeDWORDHost: decodeDWORDHost, + FlagDecodeOctalHost: decodeOctalHost, + FlagDecodeHexHost: decodeHexHost, + FlagRemoveUnnecessaryHostDots: removeUnncessaryHostDots, + FlagRemoveEmptyPortSeparator: removeEmptyPortSeparator, + FlagRemoveTrailingSlash: removeTrailingSlash, + FlagAddTrailingSlash: addTrailingSlash, +} + +// MustNormalizeURLString returns the normalized string, and panics if an error occurs. +// It takes an URL string as input, as well as the normalization flags. +func MustNormalizeURLString(u string, f NormalizationFlags) string { + result, e := NormalizeURLString(u, f) + if e != nil { + panic(e) + } + return result +} + +// NormalizeURLString returns the normalized string, or an error if it can't be parsed into an URL object. +// It takes an URL string as input, as well as the normalization flags. +func NormalizeURLString(u string, f NormalizationFlags) (string, error) { + parsed, err := url.Parse(u) + if err != nil { + return "", err + } + + if f&FlagLowercaseHost == FlagLowercaseHost { + parsed.Host = strings.ToLower(parsed.Host) + } + + // The idna package doesn't fully conform to RFC 5895 + // (https://tools.ietf.org/html/rfc5895), so we do it here. + // Taken from Go 1.8 cycle source, courtesy of bradfitz. + // TODO: Remove when (if?) idna package conforms to RFC 5895. + parsed.Host = width.Fold.String(parsed.Host) + parsed.Host = norm.NFC.String(parsed.Host) + if parsed.Host, err = idna.ToASCII(parsed.Host); err != nil { + return "", err + } + + return NormalizeURL(parsed, f), nil +} + +// NormalizeURL returns the normalized string. +// It takes a parsed URL object as input, as well as the normalization flags. +func NormalizeURL(u *url.URL, f NormalizationFlags) string { + for _, k := range flagsOrder { + if f&k == k { + flags[k](u) + } + } + return urlesc.Escape(u) +} + +func lowercaseScheme(u *url.URL) { + if len(u.Scheme) > 0 { + u.Scheme = strings.ToLower(u.Scheme) + } +} + +func lowercaseHost(u *url.URL) { + if len(u.Host) > 0 { + u.Host = strings.ToLower(u.Host) + } +} + +func removeDefaultPort(u *url.URL) { + if len(u.Host) > 0 { + scheme := strings.ToLower(u.Scheme) + u.Host = rxPort.ReplaceAllStringFunc(u.Host, func(val string) string { + if (scheme == "http" && val == defaultHttpPort) || (scheme == "https" && val == defaultHttpsPort) { + return "" + } + return val + }) + } +} + +func removeTrailingSlash(u *url.URL) { + if l := len(u.Path); l > 0 { + if strings.HasSuffix(u.Path, "/") { + u.Path = u.Path[:l-1] + } + } else if l = len(u.Host); l > 0 { + if strings.HasSuffix(u.Host, "/") { + u.Host = u.Host[:l-1] + } + } +} + +func addTrailingSlash(u *url.URL) { + if l := len(u.Path); l > 0 { + if !strings.HasSuffix(u.Path, "/") { + u.Path += "/" + } + } else if l = len(u.Host); l > 0 { + if !strings.HasSuffix(u.Host, "/") { + u.Host += "/" + } + } +} + +func removeDotSegments(u *url.URL) { + if len(u.Path) > 0 { + var dotFree []string + var lastIsDot bool + + sections := strings.Split(u.Path, "/") + for _, s := range sections { + if s == ".." { + if len(dotFree) > 0 { + dotFree = dotFree[:len(dotFree)-1] + } + } else if s != "." { + dotFree = append(dotFree, s) + } + lastIsDot = (s == "." || s == "..") + } + // Special case if host does not end with / and new path does not begin with / + u.Path = strings.Join(dotFree, "/") + if u.Host != "" && !strings.HasSuffix(u.Host, "/") && !strings.HasPrefix(u.Path, "/") { + u.Path = "/" + u.Path + } + // Special case if the last segment was a dot, make sure the path ends with a slash + if lastIsDot && !strings.HasSuffix(u.Path, "/") { + u.Path += "/" + } + } +} + +func removeDirectoryIndex(u *url.URL) { + if len(u.Path) > 0 { + u.Path = rxDirIndex.ReplaceAllString(u.Path, "$1") + } +} + +func removeFragment(u *url.URL) { + u.Fragment = "" +} + +func forceHTTP(u *url.URL) { + if strings.ToLower(u.Scheme) == "https" { + u.Scheme = "http" + } +} + +func removeDuplicateSlashes(u *url.URL) { + if len(u.Path) > 0 { + u.Path = rxDupSlashes.ReplaceAllString(u.Path, "/") + } +} + +func removeWWW(u *url.URL) { + if len(u.Host) > 0 && strings.HasPrefix(strings.ToLower(u.Host), "www.") { + u.Host = u.Host[4:] + } +} + +func addWWW(u *url.URL) { + if len(u.Host) > 0 && !strings.HasPrefix(strings.ToLower(u.Host), "www.") { + u.Host = "www." + u.Host + } +} + +func sortQuery(u *url.URL) { + q := u.Query() + + if len(q) > 0 { + arKeys := make([]string, len(q)) + i := 0 + for k := range q { + arKeys[i] = k + i++ + } + sort.Strings(arKeys) + buf := new(bytes.Buffer) + for _, k := range arKeys { + sort.Strings(q[k]) + for _, v := range q[k] { + if buf.Len() > 0 { + buf.WriteRune('&') + } + buf.WriteString(fmt.Sprintf("%s=%s", k, urlesc.QueryEscape(v))) + } + } + + // Rebuild the raw query string + u.RawQuery = buf.String() + } +} + +func decodeDWORDHost(u *url.URL) { + if len(u.Host) > 0 { + if matches := rxDWORDHost.FindStringSubmatch(u.Host); len(matches) > 2 { + var parts [4]int64 + + dword, _ := strconv.ParseInt(matches[1], 10, 0) + for i, shift := range []uint{24, 16, 8, 0} { + parts[i] = dword >> shift & 0xFF + } + u.Host = fmt.Sprintf("%d.%d.%d.%d%s", parts[0], parts[1], parts[2], parts[3], matches[2]) + } + } +} + +func decodeOctalHost(u *url.URL) { + if len(u.Host) > 0 { + if matches := rxOctalHost.FindStringSubmatch(u.Host); len(matches) > 5 { + var parts [4]int64 + + for i := 1; i <= 4; i++ { + parts[i-1], _ = strconv.ParseInt(matches[i], 8, 0) + } + u.Host = fmt.Sprintf("%d.%d.%d.%d%s", parts[0], parts[1], parts[2], parts[3], matches[5]) + } + } +} + +func decodeHexHost(u *url.URL) { + if len(u.Host) > 0 { + if matches := rxHexHost.FindStringSubmatch(u.Host); len(matches) > 2 { + // Conversion is safe because of regex validation + parsed, _ := strconv.ParseInt(matches[1], 16, 0) + // Set host as DWORD (base 10) encoded host + u.Host = fmt.Sprintf("%d%s", parsed, matches[2]) + // The rest is the same as decoding a DWORD host + decodeDWORDHost(u) + } + } +} + +func removeUnncessaryHostDots(u *url.URL) { + if len(u.Host) > 0 { + if matches := rxHostDots.FindStringSubmatch(u.Host); len(matches) > 1 { + // Trim the leading and trailing dots + u.Host = strings.Trim(matches[1], ".") + if len(matches) > 2 { + u.Host += matches[2] + } + } + } +} + +func removeEmptyPortSeparator(u *url.URL) { + if len(u.Host) > 0 { + u.Host = rxEmptyPort.ReplaceAllString(u.Host, "") + } +} diff --git a/vendor/github.com/PuerkitoBio/urlesc/.travis.yml b/vendor/github.com/PuerkitoBio/urlesc/.travis.yml new file mode 100644 index 00000000000..ba6b225f91e --- /dev/null +++ b/vendor/github.com/PuerkitoBio/urlesc/.travis.yml @@ -0,0 +1,15 @@ +language: go + +go: + - 1.4.x + - 1.5.x + - 1.6.x + - 1.7.x + - 1.8.x + - tip + +install: + - go build . + +script: + - go test -v diff --git a/vendor/github.com/PuerkitoBio/urlesc/LICENSE b/vendor/github.com/PuerkitoBio/urlesc/LICENSE new file mode 100644 index 00000000000..74487567632 --- /dev/null +++ b/vendor/github.com/PuerkitoBio/urlesc/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2012 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/PuerkitoBio/urlesc/README.md b/vendor/github.com/PuerkitoBio/urlesc/README.md new file mode 100644 index 00000000000..57aff0a5396 --- /dev/null +++ b/vendor/github.com/PuerkitoBio/urlesc/README.md @@ -0,0 +1,16 @@ +urlesc [![Build Status](https://travis-ci.org/PuerkitoBio/urlesc.svg?branch=master)](https://travis-ci.org/PuerkitoBio/urlesc) [![GoDoc](http://godoc.org/github.com/PuerkitoBio/urlesc?status.svg)](http://godoc.org/github.com/PuerkitoBio/urlesc) +====== + +Package urlesc implements query escaping as per RFC 3986. + +It contains some parts of the net/url package, modified so as to allow +some reserved characters incorrectly escaped by net/url (see [issue 5684](https://github.com/golang/go/issues/5684)). + +## Install + + go get github.com/PuerkitoBio/urlesc + +## License + +Go license (BSD-3-Clause) + diff --git a/vendor/github.com/PuerkitoBio/urlesc/urlesc.go b/vendor/github.com/PuerkitoBio/urlesc/urlesc.go new file mode 100644 index 00000000000..1b84624594d --- /dev/null +++ b/vendor/github.com/PuerkitoBio/urlesc/urlesc.go @@ -0,0 +1,180 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package urlesc implements query escaping as per RFC 3986. +// It contains some parts of the net/url package, modified so as to allow +// some reserved characters incorrectly escaped by net/url. +// See https://github.com/golang/go/issues/5684 +package urlesc + +import ( + "bytes" + "net/url" + "strings" +) + +type encoding int + +const ( + encodePath encoding = 1 + iota + encodeUserPassword + encodeQueryComponent + encodeFragment +) + +// Return true if the specified character should be escaped when +// appearing in a URL string, according to RFC 3986. +func shouldEscape(c byte, mode encoding) bool { + // §2.3 Unreserved characters (alphanum) + if 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' { + return false + } + + switch c { + case '-', '.', '_', '~': // §2.3 Unreserved characters (mark) + return false + + // §2.2 Reserved characters (reserved) + case ':', '/', '?', '#', '[', ']', '@', // gen-delims + '!', '$', '&', '\'', '(', ')', '*', '+', ',', ';', '=': // sub-delims + // Different sections of the URL allow a few of + // the reserved characters to appear unescaped. + switch mode { + case encodePath: // §3.3 + // The RFC allows sub-delims and : @. + // '/', '[' and ']' can be used to assign meaning to individual path + // segments. This package only manipulates the path as a whole, + // so we allow those as well. That leaves only ? and # to escape. + return c == '?' || c == '#' + + case encodeUserPassword: // §3.2.1 + // The RFC allows : and sub-delims in + // userinfo. The parsing of userinfo treats ':' as special so we must escape + // all the gen-delims. + return c == ':' || c == '/' || c == '?' || c == '#' || c == '[' || c == ']' || c == '@' + + case encodeQueryComponent: // §3.4 + // The RFC allows / and ?. + return c != '/' && c != '?' + + case encodeFragment: // §4.1 + // The RFC text is silent but the grammar allows + // everything, so escape nothing but # + return c == '#' + } + } + + // Everything else must be escaped. + return true +} + +// QueryEscape escapes the string so it can be safely placed +// inside a URL query. +func QueryEscape(s string) string { + return escape(s, encodeQueryComponent) +} + +func escape(s string, mode encoding) string { + spaceCount, hexCount := 0, 0 + for i := 0; i < len(s); i++ { + c := s[i] + if shouldEscape(c, mode) { + if c == ' ' && mode == encodeQueryComponent { + spaceCount++ + } else { + hexCount++ + } + } + } + + if spaceCount == 0 && hexCount == 0 { + return s + } + + t := make([]byte, len(s)+2*hexCount) + j := 0 + for i := 0; i < len(s); i++ { + switch c := s[i]; { + case c == ' ' && mode == encodeQueryComponent: + t[j] = '+' + j++ + case shouldEscape(c, mode): + t[j] = '%' + t[j+1] = "0123456789ABCDEF"[c>>4] + t[j+2] = "0123456789ABCDEF"[c&15] + j += 3 + default: + t[j] = s[i] + j++ + } + } + return string(t) +} + +var uiReplacer = strings.NewReplacer( + "%21", "!", + "%27", "'", + "%28", "(", + "%29", ")", + "%2A", "*", +) + +// unescapeUserinfo unescapes some characters that need not to be escaped as per RFC3986. +func unescapeUserinfo(s string) string { + return uiReplacer.Replace(s) +} + +// Escape reassembles the URL into a valid URL string. +// The general form of the result is one of: +// +// scheme:opaque +// scheme://userinfo@host/path?query#fragment +// +// If u.Opaque is non-empty, String uses the first form; +// otherwise it uses the second form. +// +// In the second form, the following rules apply: +// - if u.Scheme is empty, scheme: is omitted. +// - if u.User is nil, userinfo@ is omitted. +// - if u.Host is empty, host/ is omitted. +// - if u.Scheme and u.Host are empty and u.User is nil, +// the entire scheme://userinfo@host/ is omitted. +// - if u.Host is non-empty and u.Path begins with a /, +// the form host/path does not add its own /. +// - if u.RawQuery is empty, ?query is omitted. +// - if u.Fragment is empty, #fragment is omitted. +func Escape(u *url.URL) string { + var buf bytes.Buffer + if u.Scheme != "" { + buf.WriteString(u.Scheme) + buf.WriteByte(':') + } + if u.Opaque != "" { + buf.WriteString(u.Opaque) + } else { + if u.Scheme != "" || u.Host != "" || u.User != nil { + buf.WriteString("//") + if ui := u.User; ui != nil { + buf.WriteString(unescapeUserinfo(ui.String())) + buf.WriteByte('@') + } + if h := u.Host; h != "" { + buf.WriteString(h) + } + } + if u.Path != "" && u.Path[0] != '/' && u.Host != "" { + buf.WriteByte('/') + } + buf.WriteString(escape(u.Path, encodePath)) + } + if u.RawQuery != "" { + buf.WriteByte('?') + buf.WriteString(u.RawQuery) + } + if u.Fragment != "" { + buf.WriteByte('#') + buf.WriteString(escape(u.Fragment, encodeFragment)) + } + return buf.String() +} diff --git a/vendor/github.com/go-openapi/analysis/.codecov.yml b/vendor/github.com/go-openapi/analysis/.codecov.yml new file mode 100644 index 00000000000..841c4281e23 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/.codecov.yml @@ -0,0 +1,5 @@ +coverage: + status: + patch: + default: + target: 80% diff --git a/vendor/github.com/go-openapi/analysis/.gitattributes b/vendor/github.com/go-openapi/analysis/.gitattributes new file mode 100644 index 00000000000..d020be8ea4e --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/.gitattributes @@ -0,0 +1,2 @@ +*.go text eol=lf + diff --git a/vendor/github.com/go-openapi/analysis/.gitignore b/vendor/github.com/go-openapi/analysis/.gitignore new file mode 100644 index 00000000000..87c3bd3e66e --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/.gitignore @@ -0,0 +1,5 @@ +secrets.yml +coverage.out +coverage.txt +*.cov +.idea diff --git a/vendor/github.com/go-openapi/analysis/.golangci.yml b/vendor/github.com/go-openapi/analysis/.golangci.yml new file mode 100644 index 00000000000..8cad2987919 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/.golangci.yml @@ -0,0 +1,53 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 40 + gocognit: + min-complexity: 40 + maligned: + suggest-new: true + dupl: + threshold: 150 + goconst: + min-len: 2 + min-occurrences: 4 + +linters: + enable-all: true + disable: + - maligned + - lll + - gochecknoglobals + - gochecknoinits + # scopelint is useful, but also reports false positives + # that unfortunately can't be disabled. So we disable the + # linter rather than changing code that works. + # see: https://github.com/kyoh86/scopelint/issues/4 + - scopelint + - godox + - gocognit + #- whitespace + - wsl + - funlen + - testpackage + - wrapcheck + #- nlreturn + - gomnd + - goerr113 + - exhaustivestruct + #- errorlint + #- nestif + - gofumpt + - godot + - gci + - dogsled + - paralleltest + - tparallel + - thelper + - ifshort + - forbidigo + - cyclop + - varnamelen diff --git a/vendor/github.com/go-openapi/analysis/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/analysis/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..9322b065e37 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/analysis/LICENSE b/vendor/github.com/go-openapi/analysis/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/analysis/README.md b/vendor/github.com/go-openapi/analysis/README.md new file mode 100644 index 00000000000..aad6da10fe7 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/README.md @@ -0,0 +1,31 @@ +# OpenAPI initiative analysis + +[![Build Status](https://travis-ci.org/go-openapi/analysis.svg?branch=master)](https://travis-ci.org/go-openapi/analysis) +[![Build status](https://ci.appveyor.com/api/projects/status/x377t5o9ennm847o/branch/master?svg=true)](https://ci.appveyor.com/project/casualjim/go-openapi/analysis/branch/master) +[![codecov](https://codecov.io/gh/go-openapi/analysis/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/analysis) +[![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/analysis/master/LICENSE) +[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/analysis.svg)](https://pkg.go.dev/github.com/go-openapi/analysis) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/analysis)](https://goreportcard.com/report/github.com/go-openapi/analysis) + + +A foundational library to analyze an OAI specification document for easier reasoning about the content. + +## What's inside? + +* A analyzer providing methods to walk the functional content of a specification +* A spec flattener producing a self-contained document bundle, while preserving `$ref`s +* A spec merger ("mixin") to merge several spec documents into a primary spec +* A spec "fixer" ensuring that response descriptions are non empty + +[Documentation](https://godoc.org/github.com/go-openapi/analysis) + +## FAQ + +* Does this library support OpenAPI 3? + +> No. +> This package currently only supports OpenAPI 2.0 (aka Swagger 2.0). +> There is no plan to make it evolve toward supporting OpenAPI 3.x. +> This [discussion thread](https://github.com/go-openapi/spec/issues/21) relates the full story. +> diff --git a/vendor/github.com/go-openapi/analysis/analyzer.go b/vendor/github.com/go-openapi/analysis/analyzer.go new file mode 100644 index 00000000000..c17aee1b617 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/analyzer.go @@ -0,0 +1,1064 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package analysis + +import ( + "fmt" + slashpath "path" + "strconv" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/spec" + "github.com/go-openapi/swag" +) + +type referenceAnalysis struct { + schemas map[string]spec.Ref + responses map[string]spec.Ref + parameters map[string]spec.Ref + items map[string]spec.Ref + headerItems map[string]spec.Ref + parameterItems map[string]spec.Ref + allRefs map[string]spec.Ref + pathItems map[string]spec.Ref +} + +func (r *referenceAnalysis) addRef(key string, ref spec.Ref) { + r.allRefs["#"+key] = ref +} + +func (r *referenceAnalysis) addItemsRef(key string, items *spec.Items, location string) { + r.items["#"+key] = items.Ref + r.addRef(key, items.Ref) + if location == "header" { + // NOTE: in swagger 2.0, headers and parameters (but not body param schemas) are simple schemas + // and $ref are not supported here. However it is possible to analyze this. + r.headerItems["#"+key] = items.Ref + } else { + r.parameterItems["#"+key] = items.Ref + } +} + +func (r *referenceAnalysis) addSchemaRef(key string, ref SchemaRef) { + r.schemas["#"+key] = ref.Schema.Ref + r.addRef(key, ref.Schema.Ref) +} + +func (r *referenceAnalysis) addResponseRef(key string, resp *spec.Response) { + r.responses["#"+key] = resp.Ref + r.addRef(key, resp.Ref) +} + +func (r *referenceAnalysis) addParamRef(key string, param *spec.Parameter) { + r.parameters["#"+key] = param.Ref + r.addRef(key, param.Ref) +} + +func (r *referenceAnalysis) addPathItemRef(key string, pathItem *spec.PathItem) { + r.pathItems["#"+key] = pathItem.Ref + r.addRef(key, pathItem.Ref) +} + +type patternAnalysis struct { + parameters map[string]string + headers map[string]string + items map[string]string + schemas map[string]string + allPatterns map[string]string +} + +func (p *patternAnalysis) addPattern(key, pattern string) { + p.allPatterns["#"+key] = pattern +} + +func (p *patternAnalysis) addParameterPattern(key, pattern string) { + p.parameters["#"+key] = pattern + p.addPattern(key, pattern) +} + +func (p *patternAnalysis) addHeaderPattern(key, pattern string) { + p.headers["#"+key] = pattern + p.addPattern(key, pattern) +} + +func (p *patternAnalysis) addItemsPattern(key, pattern string) { + p.items["#"+key] = pattern + p.addPattern(key, pattern) +} + +func (p *patternAnalysis) addSchemaPattern(key, pattern string) { + p.schemas["#"+key] = pattern + p.addPattern(key, pattern) +} + +type enumAnalysis struct { + parameters map[string][]interface{} + headers map[string][]interface{} + items map[string][]interface{} + schemas map[string][]interface{} + allEnums map[string][]interface{} +} + +func (p *enumAnalysis) addEnum(key string, enum []interface{}) { + p.allEnums["#"+key] = enum +} + +func (p *enumAnalysis) addParameterEnum(key string, enum []interface{}) { + p.parameters["#"+key] = enum + p.addEnum(key, enum) +} + +func (p *enumAnalysis) addHeaderEnum(key string, enum []interface{}) { + p.headers["#"+key] = enum + p.addEnum(key, enum) +} + +func (p *enumAnalysis) addItemsEnum(key string, enum []interface{}) { + p.items["#"+key] = enum + p.addEnum(key, enum) +} + +func (p *enumAnalysis) addSchemaEnum(key string, enum []interface{}) { + p.schemas["#"+key] = enum + p.addEnum(key, enum) +} + +// New takes a swagger spec object and returns an analyzed spec document. +// The analyzed document contains a number of indices that make it easier to +// reason about semantics of a swagger specification for use in code generation +// or validation etc. +func New(doc *spec.Swagger) *Spec { + a := &Spec{ + spec: doc, + references: referenceAnalysis{}, + patterns: patternAnalysis{}, + enums: enumAnalysis{}, + } + a.reset() + a.initialize() + + return a +} + +// Spec is an analyzed specification object. It takes a swagger spec object and turns it into a registry +// with a bunch of utility methods to act on the information in the spec. +type Spec struct { + spec *spec.Swagger + consumes map[string]struct{} + produces map[string]struct{} + authSchemes map[string]struct{} + operations map[string]map[string]*spec.Operation + references referenceAnalysis + patterns patternAnalysis + enums enumAnalysis + allSchemas map[string]SchemaRef + allOfs map[string]SchemaRef +} + +func (s *Spec) reset() { + s.consumes = make(map[string]struct{}, 150) + s.produces = make(map[string]struct{}, 150) + s.authSchemes = make(map[string]struct{}, 150) + s.operations = make(map[string]map[string]*spec.Operation, 150) + s.allSchemas = make(map[string]SchemaRef, 150) + s.allOfs = make(map[string]SchemaRef, 150) + s.references.schemas = make(map[string]spec.Ref, 150) + s.references.pathItems = make(map[string]spec.Ref, 150) + s.references.responses = make(map[string]spec.Ref, 150) + s.references.parameters = make(map[string]spec.Ref, 150) + s.references.items = make(map[string]spec.Ref, 150) + s.references.headerItems = make(map[string]spec.Ref, 150) + s.references.parameterItems = make(map[string]spec.Ref, 150) + s.references.allRefs = make(map[string]spec.Ref, 150) + s.patterns.parameters = make(map[string]string, 150) + s.patterns.headers = make(map[string]string, 150) + s.patterns.items = make(map[string]string, 150) + s.patterns.schemas = make(map[string]string, 150) + s.patterns.allPatterns = make(map[string]string, 150) + s.enums.parameters = make(map[string][]interface{}, 150) + s.enums.headers = make(map[string][]interface{}, 150) + s.enums.items = make(map[string][]interface{}, 150) + s.enums.schemas = make(map[string][]interface{}, 150) + s.enums.allEnums = make(map[string][]interface{}, 150) +} + +func (s *Spec) reload() { + s.reset() + s.initialize() +} + +func (s *Spec) initialize() { + for _, c := range s.spec.Consumes { + s.consumes[c] = struct{}{} + } + for _, c := range s.spec.Produces { + s.produces[c] = struct{}{} + } + for _, ss := range s.spec.Security { + for k := range ss { + s.authSchemes[k] = struct{}{} + } + } + for path, pathItem := range s.AllPaths() { + s.analyzeOperations(path, &pathItem) //#nosec + } + + for name, parameter := range s.spec.Parameters { + refPref := slashpath.Join("/parameters", jsonpointer.Escape(name)) + if parameter.Items != nil { + s.analyzeItems("items", parameter.Items, refPref, "parameter") + } + if parameter.In == "body" && parameter.Schema != nil { + s.analyzeSchema("schema", parameter.Schema, refPref) + } + if parameter.Pattern != "" { + s.patterns.addParameterPattern(refPref, parameter.Pattern) + } + if len(parameter.Enum) > 0 { + s.enums.addParameterEnum(refPref, parameter.Enum) + } + } + + for name, response := range s.spec.Responses { + refPref := slashpath.Join("/responses", jsonpointer.Escape(name)) + for k, v := range response.Headers { + hRefPref := slashpath.Join(refPref, "headers", k) + if v.Items != nil { + s.analyzeItems("items", v.Items, hRefPref, "header") + } + if v.Pattern != "" { + s.patterns.addHeaderPattern(hRefPref, v.Pattern) + } + if len(v.Enum) > 0 { + s.enums.addHeaderEnum(hRefPref, v.Enum) + } + } + if response.Schema != nil { + s.analyzeSchema("schema", response.Schema, refPref) + } + } + + for name := range s.spec.Definitions { + schema := s.spec.Definitions[name] + s.analyzeSchema(name, &schema, "/definitions") + } + // TODO: after analyzing all things and flattening schemas etc + // resolve all the collected references to their final representations + // best put in a separate method because this could get expensive +} + +func (s *Spec) analyzeOperations(path string, pi *spec.PathItem) { + // TODO: resolve refs here? + // Currently, operations declared via pathItem $ref are known only after expansion + op := pi + if pi.Ref.String() != "" { + key := slashpath.Join("/paths", jsonpointer.Escape(path)) + s.references.addPathItemRef(key, pi) + } + s.analyzeOperation("GET", path, op.Get) + s.analyzeOperation("PUT", path, op.Put) + s.analyzeOperation("POST", path, op.Post) + s.analyzeOperation("PATCH", path, op.Patch) + s.analyzeOperation("DELETE", path, op.Delete) + s.analyzeOperation("HEAD", path, op.Head) + s.analyzeOperation("OPTIONS", path, op.Options) + for i, param := range op.Parameters { + refPref := slashpath.Join("/paths", jsonpointer.Escape(path), "parameters", strconv.Itoa(i)) + if param.Ref.String() != "" { + s.references.addParamRef(refPref, ¶m) //#nosec + } + if param.Pattern != "" { + s.patterns.addParameterPattern(refPref, param.Pattern) + } + if len(param.Enum) > 0 { + s.enums.addParameterEnum(refPref, param.Enum) + } + if param.Items != nil { + s.analyzeItems("items", param.Items, refPref, "parameter") + } + if param.Schema != nil { + s.analyzeSchema("schema", param.Schema, refPref) + } + } +} + +func (s *Spec) analyzeItems(name string, items *spec.Items, prefix, location string) { + if items == nil { + return + } + refPref := slashpath.Join(prefix, name) + s.analyzeItems(name, items.Items, refPref, location) + if items.Ref.String() != "" { + s.references.addItemsRef(refPref, items, location) + } + if items.Pattern != "" { + s.patterns.addItemsPattern(refPref, items.Pattern) + } + if len(items.Enum) > 0 { + s.enums.addItemsEnum(refPref, items.Enum) + } +} + +func (s *Spec) analyzeParameter(prefix string, i int, param spec.Parameter) { + refPref := slashpath.Join(prefix, "parameters", strconv.Itoa(i)) + if param.Ref.String() != "" { + s.references.addParamRef(refPref, ¶m) //#nosec + } + + if param.Pattern != "" { + s.patterns.addParameterPattern(refPref, param.Pattern) + } + + if len(param.Enum) > 0 { + s.enums.addParameterEnum(refPref, param.Enum) + } + + s.analyzeItems("items", param.Items, refPref, "parameter") + if param.In == "body" && param.Schema != nil { + s.analyzeSchema("schema", param.Schema, refPref) + } +} + +func (s *Spec) analyzeOperation(method, path string, op *spec.Operation) { + if op == nil { + return + } + + for _, c := range op.Consumes { + s.consumes[c] = struct{}{} + } + + for _, c := range op.Produces { + s.produces[c] = struct{}{} + } + + for _, ss := range op.Security { + for k := range ss { + s.authSchemes[k] = struct{}{} + } + } + + if _, ok := s.operations[method]; !ok { + s.operations[method] = make(map[string]*spec.Operation) + } + + s.operations[method][path] = op + prefix := slashpath.Join("/paths", jsonpointer.Escape(path), strings.ToLower(method)) + for i, param := range op.Parameters { + s.analyzeParameter(prefix, i, param) + } + + if op.Responses == nil { + return + } + + if op.Responses.Default != nil { + s.analyzeDefaultResponse(prefix, op.Responses.Default) + } + + for k, res := range op.Responses.StatusCodeResponses { + s.analyzeResponse(prefix, k, res) + } +} + +func (s *Spec) analyzeDefaultResponse(prefix string, res *spec.Response) { + refPref := slashpath.Join(prefix, "responses", "default") + if res.Ref.String() != "" { + s.references.addResponseRef(refPref, res) + } + + for k, v := range res.Headers { + hRefPref := slashpath.Join(refPref, "headers", k) + s.analyzeItems("items", v.Items, hRefPref, "header") + if v.Pattern != "" { + s.patterns.addHeaderPattern(hRefPref, v.Pattern) + } + } + + if res.Schema != nil { + s.analyzeSchema("schema", res.Schema, refPref) + } +} + +func (s *Spec) analyzeResponse(prefix string, k int, res spec.Response) { + refPref := slashpath.Join(prefix, "responses", strconv.Itoa(k)) + if res.Ref.String() != "" { + s.references.addResponseRef(refPref, &res) //#nosec + } + + for k, v := range res.Headers { + hRefPref := slashpath.Join(refPref, "headers", k) + s.analyzeItems("items", v.Items, hRefPref, "header") + if v.Pattern != "" { + s.patterns.addHeaderPattern(hRefPref, v.Pattern) + } + + if len(v.Enum) > 0 { + s.enums.addHeaderEnum(hRefPref, v.Enum) + } + } + + if res.Schema != nil { + s.analyzeSchema("schema", res.Schema, refPref) + } +} + +func (s *Spec) analyzeSchema(name string, schema *spec.Schema, prefix string) { + refURI := slashpath.Join(prefix, jsonpointer.Escape(name)) + schRef := SchemaRef{ + Name: name, + Schema: schema, + Ref: spec.MustCreateRef("#" + refURI), + TopLevel: prefix == "/definitions", + } + + s.allSchemas["#"+refURI] = schRef + + if schema.Ref.String() != "" { + s.references.addSchemaRef(refURI, schRef) + } + + if schema.Pattern != "" { + s.patterns.addSchemaPattern(refURI, schema.Pattern) + } + + if len(schema.Enum) > 0 { + s.enums.addSchemaEnum(refURI, schema.Enum) + } + + for k, v := range schema.Definitions { + v := v + s.analyzeSchema(k, &v, slashpath.Join(refURI, "definitions")) + } + + for k, v := range schema.Properties { + v := v + s.analyzeSchema(k, &v, slashpath.Join(refURI, "properties")) + } + + for k, v := range schema.PatternProperties { + v := v + // NOTE: swagger 2.0 does not support PatternProperties. + // However it is possible to analyze this in a schema + s.analyzeSchema(k, &v, slashpath.Join(refURI, "patternProperties")) + } + + for i := range schema.AllOf { + v := &schema.AllOf[i] + s.analyzeSchema(strconv.Itoa(i), v, slashpath.Join(refURI, "allOf")) + } + + if len(schema.AllOf) > 0 { + s.allOfs["#"+refURI] = schRef + } + + for i := range schema.AnyOf { + v := &schema.AnyOf[i] + // NOTE: swagger 2.0 does not support anyOf constructs. + // However it is possible to analyze this in a schema + s.analyzeSchema(strconv.Itoa(i), v, slashpath.Join(refURI, "anyOf")) + } + + for i := range schema.OneOf { + v := &schema.OneOf[i] + // NOTE: swagger 2.0 does not support oneOf constructs. + // However it is possible to analyze this in a schema + s.analyzeSchema(strconv.Itoa(i), v, slashpath.Join(refURI, "oneOf")) + } + + if schema.Not != nil { + // NOTE: swagger 2.0 does not support "not" constructs. + // However it is possible to analyze this in a schema + s.analyzeSchema("not", schema.Not, refURI) + } + + if schema.AdditionalProperties != nil && schema.AdditionalProperties.Schema != nil { + s.analyzeSchema("additionalProperties", schema.AdditionalProperties.Schema, refURI) + } + + if schema.AdditionalItems != nil && schema.AdditionalItems.Schema != nil { + // NOTE: swagger 2.0 does not support AdditionalItems. + // However it is possible to analyze this in a schema + s.analyzeSchema("additionalItems", schema.AdditionalItems.Schema, refURI) + } + + if schema.Items != nil { + if schema.Items.Schema != nil { + s.analyzeSchema("items", schema.Items.Schema, refURI) + } + + for i := range schema.Items.Schemas { + sch := &schema.Items.Schemas[i] + s.analyzeSchema(strconv.Itoa(i), sch, slashpath.Join(refURI, "items")) + } + } +} + +// SecurityRequirement is a representation of a security requirement for an operation +type SecurityRequirement struct { + Name string + Scopes []string +} + +// SecurityRequirementsFor gets the security requirements for the operation +func (s *Spec) SecurityRequirementsFor(operation *spec.Operation) [][]SecurityRequirement { + if s.spec.Security == nil && operation.Security == nil { + return nil + } + + schemes := s.spec.Security + if operation.Security != nil { + schemes = operation.Security + } + + result := [][]SecurityRequirement{} + for _, scheme := range schemes { + if len(scheme) == 0 { + // append a zero object for anonymous + result = append(result, []SecurityRequirement{{}}) + + continue + } + + var reqs []SecurityRequirement + for k, v := range scheme { + if v == nil { + v = []string{} + } + reqs = append(reqs, SecurityRequirement{Name: k, Scopes: v}) + } + + result = append(result, reqs) + } + + return result +} + +// SecurityDefinitionsForRequirements gets the matching security definitions for a set of requirements +func (s *Spec) SecurityDefinitionsForRequirements(requirements []SecurityRequirement) map[string]spec.SecurityScheme { + result := make(map[string]spec.SecurityScheme) + + for _, v := range requirements { + if definition, ok := s.spec.SecurityDefinitions[v.Name]; ok { + if definition != nil { + result[v.Name] = *definition + } + } + } + + return result +} + +// SecurityDefinitionsFor gets the matching security definitions for a set of requirements +func (s *Spec) SecurityDefinitionsFor(operation *spec.Operation) map[string]spec.SecurityScheme { + requirements := s.SecurityRequirementsFor(operation) + if len(requirements) == 0 { + return nil + } + + result := make(map[string]spec.SecurityScheme) + for _, reqs := range requirements { + for _, v := range reqs { + if v.Name == "" { + // optional requirement + continue + } + + if _, ok := result[v.Name]; ok { + // duplicate requirement + continue + } + + if definition, ok := s.spec.SecurityDefinitions[v.Name]; ok { + if definition != nil { + result[v.Name] = *definition + } + } + } + } + + return result +} + +// ConsumesFor gets the mediatypes for the operation +func (s *Spec) ConsumesFor(operation *spec.Operation) []string { + if len(operation.Consumes) == 0 { + cons := make(map[string]struct{}, len(s.spec.Consumes)) + for _, k := range s.spec.Consumes { + cons[k] = struct{}{} + } + + return s.structMapKeys(cons) + } + + cons := make(map[string]struct{}, len(operation.Consumes)) + for _, c := range operation.Consumes { + cons[c] = struct{}{} + } + + return s.structMapKeys(cons) +} + +// ProducesFor gets the mediatypes for the operation +func (s *Spec) ProducesFor(operation *spec.Operation) []string { + if len(operation.Produces) == 0 { + prod := make(map[string]struct{}, len(s.spec.Produces)) + for _, k := range s.spec.Produces { + prod[k] = struct{}{} + } + + return s.structMapKeys(prod) + } + + prod := make(map[string]struct{}, len(operation.Produces)) + for _, c := range operation.Produces { + prod[c] = struct{}{} + } + + return s.structMapKeys(prod) +} + +func mapKeyFromParam(param *spec.Parameter) string { + return fmt.Sprintf("%s#%s", param.In, fieldNameFromParam(param)) +} + +func fieldNameFromParam(param *spec.Parameter) string { + // TODO: this should be x-go-name + if nm, ok := param.Extensions.GetString("go-name"); ok { + return nm + } + + return swag.ToGoName(param.Name) +} + +// ErrorOnParamFunc is a callback function to be invoked +// whenever an error is encountered while resolving references +// on parameters. +// +// This function takes as input the spec.Parameter which triggered the +// error and the error itself. +// +// If the callback function returns false, the calling function should bail. +// +// If it returns true, the calling function should continue evaluating parameters. +// A nil ErrorOnParamFunc must be evaluated as equivalent to panic(). +type ErrorOnParamFunc func(spec.Parameter, error) bool + +func (s *Spec) paramsAsMap(parameters []spec.Parameter, res map[string]spec.Parameter, callmeOnError ErrorOnParamFunc) { + for _, param := range parameters { + pr := param + if pr.Ref.String() == "" { + res[mapKeyFromParam(&pr)] = pr + + continue + } + + // resolve $ref + if callmeOnError == nil { + callmeOnError = func(_ spec.Parameter, err error) bool { + panic(err) + } + } + + obj, _, err := pr.Ref.GetPointer().Get(s.spec) + if err != nil { + if callmeOnError(param, fmt.Errorf("invalid reference: %q", pr.Ref.String())) { + continue + } + + break + } + + objAsParam, ok := obj.(spec.Parameter) + if !ok { + if callmeOnError(param, fmt.Errorf("resolved reference is not a parameter: %q", pr.Ref.String())) { + continue + } + + break + } + + pr = objAsParam + res[mapKeyFromParam(&pr)] = pr + } +} + +// ParametersFor the specified operation id. +// +// Assumes parameters properly resolve references if any and that +// such references actually resolve to a parameter object. +// Otherwise, panics. +func (s *Spec) ParametersFor(operationID string) []spec.Parameter { + return s.SafeParametersFor(operationID, nil) +} + +// SafeParametersFor the specified operation id. +// +// Does not assume parameters properly resolve references or that +// such references actually resolve to a parameter object. +// +// Upon error, invoke a ErrorOnParamFunc callback with the erroneous +// parameters. If the callback is set to nil, panics upon errors. +func (s *Spec) SafeParametersFor(operationID string, callmeOnError ErrorOnParamFunc) []spec.Parameter { + gatherParams := func(pi *spec.PathItem, op *spec.Operation) []spec.Parameter { + bag := make(map[string]spec.Parameter) + s.paramsAsMap(pi.Parameters, bag, callmeOnError) + s.paramsAsMap(op.Parameters, bag, callmeOnError) + + var res []spec.Parameter + for _, v := range bag { + res = append(res, v) + } + + return res + } + + for _, pi := range s.spec.Paths.Paths { + if pi.Get != nil && pi.Get.ID == operationID { + return gatherParams(&pi, pi.Get) //#nosec + } + if pi.Head != nil && pi.Head.ID == operationID { + return gatherParams(&pi, pi.Head) //#nosec + } + if pi.Options != nil && pi.Options.ID == operationID { + return gatherParams(&pi, pi.Options) //#nosec + } + if pi.Post != nil && pi.Post.ID == operationID { + return gatherParams(&pi, pi.Post) //#nosec + } + if pi.Patch != nil && pi.Patch.ID == operationID { + return gatherParams(&pi, pi.Patch) //#nosec + } + if pi.Put != nil && pi.Put.ID == operationID { + return gatherParams(&pi, pi.Put) //#nosec + } + if pi.Delete != nil && pi.Delete.ID == operationID { + return gatherParams(&pi, pi.Delete) //#nosec + } + } + + return nil +} + +// ParamsFor the specified method and path. Aggregates them with the defaults etc, so it's all the params that +// apply for the method and path. +// +// Assumes parameters properly resolve references if any and that +// such references actually resolve to a parameter object. +// Otherwise, panics. +func (s *Spec) ParamsFor(method, path string) map[string]spec.Parameter { + return s.SafeParamsFor(method, path, nil) +} + +// SafeParamsFor the specified method and path. Aggregates them with the defaults etc, so it's all the params that +// apply for the method and path. +// +// Does not assume parameters properly resolve references or that +// such references actually resolve to a parameter object. +// +// Upon error, invoke a ErrorOnParamFunc callback with the erroneous +// parameters. If the callback is set to nil, panics upon errors. +func (s *Spec) SafeParamsFor(method, path string, callmeOnError ErrorOnParamFunc) map[string]spec.Parameter { + res := make(map[string]spec.Parameter) + if pi, ok := s.spec.Paths.Paths[path]; ok { + s.paramsAsMap(pi.Parameters, res, callmeOnError) + s.paramsAsMap(s.operations[strings.ToUpper(method)][path].Parameters, res, callmeOnError) + } + + return res +} + +// OperationForName gets the operation for the given id +func (s *Spec) OperationForName(operationID string) (string, string, *spec.Operation, bool) { + for method, pathItem := range s.operations { + for path, op := range pathItem { + if operationID == op.ID { + return method, path, op, true + } + } + } + + return "", "", nil, false +} + +// OperationFor the given method and path +func (s *Spec) OperationFor(method, path string) (*spec.Operation, bool) { + if mp, ok := s.operations[strings.ToUpper(method)]; ok { + op, fn := mp[path] + + return op, fn + } + + return nil, false +} + +// Operations gathers all the operations specified in the spec document +func (s *Spec) Operations() map[string]map[string]*spec.Operation { + return s.operations +} + +func (s *Spec) structMapKeys(mp map[string]struct{}) []string { + if len(mp) == 0 { + return nil + } + + result := make([]string, 0, len(mp)) + for k := range mp { + result = append(result, k) + } + + return result +} + +// AllPaths returns all the paths in the swagger spec +func (s *Spec) AllPaths() map[string]spec.PathItem { + if s.spec == nil || s.spec.Paths == nil { + return nil + } + + return s.spec.Paths.Paths +} + +// OperationIDs gets all the operation ids based on method an dpath +func (s *Spec) OperationIDs() []string { + if len(s.operations) == 0 { + return nil + } + + result := make([]string, 0, len(s.operations)) + for method, v := range s.operations { + for p, o := range v { + if o.ID != "" { + result = append(result, o.ID) + } else { + result = append(result, fmt.Sprintf("%s %s", strings.ToUpper(method), p)) + } + } + } + + return result +} + +// OperationMethodPaths gets all the operation ids based on method an dpath +func (s *Spec) OperationMethodPaths() []string { + if len(s.operations) == 0 { + return nil + } + + result := make([]string, 0, len(s.operations)) + for method, v := range s.operations { + for p := range v { + result = append(result, fmt.Sprintf("%s %s", strings.ToUpper(method), p)) + } + } + + return result +} + +// RequiredConsumes gets all the distinct consumes that are specified in the specification document +func (s *Spec) RequiredConsumes() []string { + return s.structMapKeys(s.consumes) +} + +// RequiredProduces gets all the distinct produces that are specified in the specification document +func (s *Spec) RequiredProduces() []string { + return s.structMapKeys(s.produces) +} + +// RequiredSecuritySchemes gets all the distinct security schemes that are specified in the swagger spec +func (s *Spec) RequiredSecuritySchemes() []string { + return s.structMapKeys(s.authSchemes) +} + +// SchemaRef is a reference to a schema +type SchemaRef struct { + Name string + Ref spec.Ref + Schema *spec.Schema + TopLevel bool +} + +// SchemasWithAllOf returns schema references to all schemas that are defined +// with an allOf key +func (s *Spec) SchemasWithAllOf() (result []SchemaRef) { + for _, v := range s.allOfs { + result = append(result, v) + } + + return +} + +// AllDefinitions returns schema references for all the definitions that were discovered +func (s *Spec) AllDefinitions() (result []SchemaRef) { + for _, v := range s.allSchemas { + result = append(result, v) + } + + return +} + +// AllDefinitionReferences returns json refs for all the discovered schemas +func (s *Spec) AllDefinitionReferences() (result []string) { + for _, v := range s.references.schemas { + result = append(result, v.String()) + } + + return +} + +// AllParameterReferences returns json refs for all the discovered parameters +func (s *Spec) AllParameterReferences() (result []string) { + for _, v := range s.references.parameters { + result = append(result, v.String()) + } + + return +} + +// AllResponseReferences returns json refs for all the discovered responses +func (s *Spec) AllResponseReferences() (result []string) { + for _, v := range s.references.responses { + result = append(result, v.String()) + } + + return +} + +// AllPathItemReferences returns the references for all the items +func (s *Spec) AllPathItemReferences() (result []string) { + for _, v := range s.references.pathItems { + result = append(result, v.String()) + } + + return +} + +// AllItemsReferences returns the references for all the items in simple schemas (parameters or headers). +// +// NOTE: since Swagger 2.0 forbids $ref in simple params, this should always yield an empty slice for a valid +// Swagger 2.0 spec. +func (s *Spec) AllItemsReferences() (result []string) { + for _, v := range s.references.items { + result = append(result, v.String()) + } + + return +} + +// AllReferences returns all the references found in the document, with possible duplicates +func (s *Spec) AllReferences() (result []string) { + for _, v := range s.references.allRefs { + result = append(result, v.String()) + } + + return +} + +// AllRefs returns all the unique references found in the document +func (s *Spec) AllRefs() (result []spec.Ref) { + set := make(map[string]struct{}) + for _, v := range s.references.allRefs { + a := v.String() + if a == "" { + continue + } + + if _, ok := set[a]; !ok { + set[a] = struct{}{} + result = append(result, v) + } + } + + return +} + +func cloneStringMap(source map[string]string) map[string]string { + res := make(map[string]string, len(source)) + for k, v := range source { + res[k] = v + } + + return res +} + +func cloneEnumMap(source map[string][]interface{}) map[string][]interface{} { + res := make(map[string][]interface{}, len(source)) + for k, v := range source { + res[k] = v + } + + return res +} + +// ParameterPatterns returns all the patterns found in parameters +// the map is cloned to avoid accidental changes +func (s *Spec) ParameterPatterns() map[string]string { + return cloneStringMap(s.patterns.parameters) +} + +// HeaderPatterns returns all the patterns found in response headers +// the map is cloned to avoid accidental changes +func (s *Spec) HeaderPatterns() map[string]string { + return cloneStringMap(s.patterns.headers) +} + +// ItemsPatterns returns all the patterns found in simple array items +// the map is cloned to avoid accidental changes +func (s *Spec) ItemsPatterns() map[string]string { + return cloneStringMap(s.patterns.items) +} + +// SchemaPatterns returns all the patterns found in schemas +// the map is cloned to avoid accidental changes +func (s *Spec) SchemaPatterns() map[string]string { + return cloneStringMap(s.patterns.schemas) +} + +// AllPatterns returns all the patterns found in the spec +// the map is cloned to avoid accidental changes +func (s *Spec) AllPatterns() map[string]string { + return cloneStringMap(s.patterns.allPatterns) +} + +// ParameterEnums returns all the enums found in parameters +// the map is cloned to avoid accidental changes +func (s *Spec) ParameterEnums() map[string][]interface{} { + return cloneEnumMap(s.enums.parameters) +} + +// HeaderEnums returns all the enums found in response headers +// the map is cloned to avoid accidental changes +func (s *Spec) HeaderEnums() map[string][]interface{} { + return cloneEnumMap(s.enums.headers) +} + +// ItemsEnums returns all the enums found in simple array items +// the map is cloned to avoid accidental changes +func (s *Spec) ItemsEnums() map[string][]interface{} { + return cloneEnumMap(s.enums.items) +} + +// SchemaEnums returns all the enums found in schemas +// the map is cloned to avoid accidental changes +func (s *Spec) SchemaEnums() map[string][]interface{} { + return cloneEnumMap(s.enums.schemas) +} + +// AllEnums returns all the enums found in the spec +// the map is cloned to avoid accidental changes +func (s *Spec) AllEnums() map[string][]interface{} { + return cloneEnumMap(s.enums.allEnums) +} diff --git a/vendor/github.com/go-openapi/analysis/appveyor.yml b/vendor/github.com/go-openapi/analysis/appveyor.yml new file mode 100644 index 00000000000..c2f6fd733a9 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/appveyor.yml @@ -0,0 +1,32 @@ +version: "0.1.{build}" + +clone_folder: C:\go-openapi\analysis +shallow_clone: true # for startup speed +pull_requests: + do_not_increment_build_number: true + +#skip_tags: true +#skip_branch_with_pr: true + +# appveyor.yml +build: off + +environment: + GOPATH: c:\gopath + +stack: go 1.16 + +test_script: + - go test -v -timeout 20m ./... + +deploy: off + +notifications: + - provider: Slack + incoming_webhook: https://hooks.slack.com/services/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 + auth_token: + secure: Sf7kZf7ZGbnwWUMpffHwMu5A0cHkLK2MYY32LNTPj4+/3qC3Ghl7+9v4TSLOqOlCwdRNjOGblAq7s+GDJed6/xgRQl1JtCi1klzZNrYX4q01pgTPvvGcwbBkIYgeMaPeIRcK9OZnud7sRXdttozgTOpytps2U6Js32ip7uj5mHSg2ub0FwoSJwlS6dbezZ8+eDhoha0F/guY99BEwx8Bd+zROrT2TFGsSGOFGN6wFc7moCqTHO/YkWib13a2QNXqOxCCVBy/lt76Wp+JkeFppjHlzs/2lP3EAk13RIUAaesdEUHvIHrzCyNJEd3/+KO2DzsWOYfpktd+KBCvgaYOsoo7ubdT3IROeAegZdCgo/6xgCEsmFc9ZcqCfN5yNx2A+BZ2Vwmpws+bQ1E1+B5HDzzaiLcYfG4X2O210QVGVDLWsv1jqD+uPYeHY2WRfh5ZsIUFvaqgUEnwHwrK44/8REAhQavt1QAj5uJpsRd7CkRVPWRNK+yIky+wgbVUFEchRNmS55E7QWf+W4+4QZkQi7vUTMc9nbTUu2Es9NfvfudOpM2wZbn98fjpb/qq/nRv6Bk+ca+7XD5/IgNLMbWp2ouDdzbiHLCOfDUiHiDJhLfFZx9Bwo7ZwfzeOlbrQX66bx7xRKYmOe4DLrXhNcpbsMa8qbfxlZRCmYbubB/Y8h4= + channel: bots + on_build_success: false + on_build_failure: true + on_build_status_changed: true diff --git a/vendor/github.com/go-openapi/analysis/debug.go b/vendor/github.com/go-openapi/analysis/debug.go new file mode 100644 index 00000000000..33c15704ecb --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/debug.go @@ -0,0 +1,23 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package analysis + +import ( + "os" + + "github.com/go-openapi/analysis/internal/debug" +) + +var debugLog = debug.GetLogger("analysis", os.Getenv("SWAGGER_DEBUG") != "") diff --git a/vendor/github.com/go-openapi/analysis/doc.go b/vendor/github.com/go-openapi/analysis/doc.go new file mode 100644 index 00000000000..d5294c0950b --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/doc.go @@ -0,0 +1,43 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package analysis provides methods to work with a Swagger specification document from +package go-openapi/spec. + +Analyzing a specification + +An analysed specification object (type Spec) provides methods to work with swagger definition. + +Flattening or expanding a specification + +Flattening a specification bundles all remote $ref in the main spec document. +Depending on flattening options, additional preprocessing may take place: + - full flattening: replacing all inline complex constructs by a named entry in #/definitions + - expand: replace all $ref's in the document by their expanded content + +Merging several specifications + +Mixin several specifications merges all Swagger constructs, and warns about found conflicts. + +Fixing a specification + +Unmarshalling a specification with golang json unmarshalling may lead to +some unwanted result on present but empty fields. + +Analyzing a Swagger schema + +Swagger schemas are analyzed to determine their complexity and qualify their content. +*/ +package analysis diff --git a/vendor/github.com/go-openapi/analysis/fixer.go b/vendor/github.com/go-openapi/analysis/fixer.go new file mode 100644 index 00000000000..7c2ca084162 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/fixer.go @@ -0,0 +1,79 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package analysis + +import "github.com/go-openapi/spec" + +// FixEmptyResponseDescriptions replaces empty ("") response +// descriptions in the input with "(empty)" to ensure that the +// resulting Swagger is stays valid. The problem appears to arise +// from reading in valid specs that have a explicit response +// description of "" (valid, response.description is required), but +// due to zero values being omitted upon re-serializing (omitempty) we +// lose them unless we stick some chars in there. +func FixEmptyResponseDescriptions(s *spec.Swagger) { + for k, v := range s.Responses { + FixEmptyDesc(&v) //#nosec + s.Responses[k] = v + } + + if s.Paths == nil { + return + } + + for _, v := range s.Paths.Paths { + if v.Get != nil { + FixEmptyDescs(v.Get.Responses) + } + if v.Put != nil { + FixEmptyDescs(v.Put.Responses) + } + if v.Post != nil { + FixEmptyDescs(v.Post.Responses) + } + if v.Delete != nil { + FixEmptyDescs(v.Delete.Responses) + } + if v.Options != nil { + FixEmptyDescs(v.Options.Responses) + } + if v.Head != nil { + FixEmptyDescs(v.Head.Responses) + } + if v.Patch != nil { + FixEmptyDescs(v.Patch.Responses) + } + } +} + +// FixEmptyDescs adds "(empty)" as the description for any Response in +// the given Responses object that doesn't already have one. +func FixEmptyDescs(rs *spec.Responses) { + FixEmptyDesc(rs.Default) + for k, v := range rs.StatusCodeResponses { + FixEmptyDesc(&v) //#nosec + rs.StatusCodeResponses[k] = v + } +} + +// FixEmptyDesc adds "(empty)" as the description to the given +// Response object if it doesn't already have one and isn't a +// ref. No-op on nil input. +func FixEmptyDesc(rs *spec.Response) { + if rs == nil || rs.Description != "" || rs.Ref.Ref.GetURL() != nil { + return + } + rs.Description = "(empty)" +} diff --git a/vendor/github.com/go-openapi/analysis/flatten.go b/vendor/github.com/go-openapi/analysis/flatten.go new file mode 100644 index 00000000000..0576220fb3d --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/flatten.go @@ -0,0 +1,802 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package analysis + +import ( + "fmt" + "log" + "path" + "sort" + "strings" + + "github.com/go-openapi/analysis/internal/flatten/normalize" + "github.com/go-openapi/analysis/internal/flatten/operations" + "github.com/go-openapi/analysis/internal/flatten/replace" + "github.com/go-openapi/analysis/internal/flatten/schutils" + "github.com/go-openapi/analysis/internal/flatten/sortref" + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/spec" +) + +const definitionsPath = "#/definitions" + +// newRef stores information about refs created during the flattening process +type newRef struct { + key string + newName string + path string + isOAIGen bool + resolved bool + schema *spec.Schema + parents []string +} + +// context stores intermediary results from flatten +type context struct { + newRefs map[string]*newRef + warnings []string + resolved map[string]string +} + +func newContext() *context { + return &context{ + newRefs: make(map[string]*newRef, 150), + warnings: make([]string, 0), + resolved: make(map[string]string, 50), + } +} + +// Flatten an analyzed spec and produce a self-contained spec bundle. +// +// There is a minimal and a full flattening mode. +// +// +// Minimally flattening a spec means: +// - Expanding parameters, responses, path items, parameter items and header items (references to schemas are left +// unscathed) +// - Importing external (http, file) references so they become internal to the document +// - Moving every JSON pointer to a $ref to a named definition (i.e. the reworked spec does not contain pointers +// like "$ref": "#/definitions/myObject/allOfs/1") +// +// A minimally flattened spec thus guarantees the following properties: +// - all $refs point to a local definition (i.e. '#/definitions/...') +// - definitions are unique +// +// NOTE: arbitrary JSON pointers (other than $refs to top level definitions) are rewritten as definitions if they +// represent a complex schema or express commonality in the spec. +// Otherwise, they are simply expanded. +// Self-referencing JSON pointers cannot resolve to a type and trigger an error. +// +// +// Minimal flattening is necessary and sufficient for codegen rendering using go-swagger. +// +// Fully flattening a spec means: +// - Moving every complex inline schema to be a definition with an auto-generated name in a depth-first fashion. +// +// By complex, we mean every JSON object with some properties. +// Arrays, when they do not define a tuple, +// or empty objects with or without additionalProperties, are not considered complex and remain inline. +// +// NOTE: rewritten schemas get a vendor extension x-go-gen-location so we know from which part of the spec definitions +// have been created. +// +// Available flattening options: +// - Minimal: stops flattening after minimal $ref processing, leaving schema constructs untouched +// - Expand: expand all $ref's in the document (inoperant if Minimal set to true) +// - Verbose: croaks about name conflicts detected +// - RemoveUnused: removes unused parameters, responses and definitions after expansion/flattening +// +// NOTE: expansion removes all $ref save circular $ref, which remain in place +// +// TODO: additional options +// - ProgagateNameExtensions: ensure that created entries properly follow naming rules when their parent have set a +// x-go-name extension +// - LiftAllOfs: +// - limit the flattening of allOf members when simple objects +// - merge allOf with validation only +// - merge allOf with extensions only +// - ... +// +func Flatten(opts FlattenOpts) error { + debugLog("FlattenOpts: %#v", opts) + + opts.flattenContext = newContext() + + // 1. Recursively expand responses, parameters, path items and items in simple schemas. + // + // This simplifies the spec and leaves only the $ref's in schema objects. + if err := expand(&opts); err != nil { + return err + } + + // 2. Strip the current document from absolute $ref's that actually a in the root, + // so we can recognize them as proper definitions + // + // In particular, this works around issue go-openapi/spec#76: leading absolute file in $ref is stripped + if err := normalizeRef(&opts); err != nil { + return err + } + + // 3. Optionally remove shared parameters and responses already expanded (now unused). + // + // Operation parameters (i.e. under paths) remain. + if opts.RemoveUnused { + removeUnusedShared(&opts) + } + + // 4. Import all remote references. + if err := importReferences(&opts); err != nil { + return err + } + + // 5. full flattening: rewrite inline schemas (schemas that aren't simple types or arrays or maps) + if !opts.Minimal && !opts.Expand { + if err := nameInlinedSchemas(&opts); err != nil { + return err + } + } + + // 6. Rewrite JSON pointers other than $ref to named definitions + // and attempt to resolve conflicting names whenever possible. + if err := stripPointersAndOAIGen(&opts); err != nil { + return err + } + + // 7. Strip the spec from unused definitions + if opts.RemoveUnused { + removeUnused(&opts) + } + + // 8. Issue warning notifications, if any + opts.croak() + + // TODO: simplify known schema patterns to flat objects with properties + // examples: + // - lift simple allOf object, + // - empty allOf with validation only or extensions only + // - rework allOf arrays + // - rework allOf additionalProperties + + return nil +} + +func expand(opts *FlattenOpts) error { + if err := spec.ExpandSpec(opts.Swagger(), opts.ExpandOpts(!opts.Expand)); err != nil { + return err + } + + opts.Spec.reload() // re-analyze + + return nil +} + +// normalizeRef strips the current file from any absolute file $ref. This works around issue go-openapi/spec#76: +// leading absolute file in $ref is stripped +func normalizeRef(opts *FlattenOpts) error { + debugLog("normalizeRef") + + altered := false + for k, w := range opts.Spec.references.allRefs { + if !strings.HasPrefix(w.String(), opts.BasePath+definitionsPath) { // may be a mix of / and \, depending on OS + continue + } + + altered = true + debugLog("stripping absolute path for: %s", w.String()) + + // strip the base path from definition + if err := replace.UpdateRef(opts.Swagger(), k, + spec.MustCreateRef(path.Join(definitionsPath, path.Base(w.String())))); err != nil { + return err + } + } + + if altered { + opts.Spec.reload() // re-analyze + } + + return nil +} + +func removeUnusedShared(opts *FlattenOpts) { + opts.Swagger().Parameters = nil + opts.Swagger().Responses = nil + + opts.Spec.reload() // re-analyze +} + +func importReferences(opts *FlattenOpts) error { + var ( + imported bool + err error + ) + + for !imported && err == nil { + // iteratively import remote references until none left. + // This inlining deals with name conflicts by introducing auto-generated names ("OAIGen") + imported, err = importExternalReferences(opts) + + opts.Spec.reload() // re-analyze + } + + return err +} + +// nameInlinedSchemas replaces every complex inline construct by a named definition. +func nameInlinedSchemas(opts *FlattenOpts) error { + debugLog("nameInlinedSchemas") + + namer := &InlineSchemaNamer{ + Spec: opts.Swagger(), + Operations: operations.AllOpRefsByRef(opts.Spec, nil), + flattenContext: opts.flattenContext, + opts: opts, + } + + depthFirst := sortref.DepthFirst(opts.Spec.allSchemas) + for _, key := range depthFirst { + sch := opts.Spec.allSchemas[key] + if sch.Schema == nil || sch.Schema.Ref.String() != "" || sch.TopLevel { + continue + } + + asch, err := Schema(SchemaOpts{Schema: sch.Schema, Root: opts.Swagger(), BasePath: opts.BasePath}) + if err != nil { + return fmt.Errorf("schema analysis [%s]: %w", key, err) + } + + if asch.isAnalyzedAsComplex() { // move complex schemas to definitions + if err := namer.Name(key, sch.Schema, asch); err != nil { + return err + } + } + } + + opts.Spec.reload() // re-analyze + + return nil +} + +func removeUnused(opts *FlattenOpts) { + expected := make(map[string]struct{}) + for k := range opts.Swagger().Definitions { + expected[path.Join(definitionsPath, jsonpointer.Escape(k))] = struct{}{} + } + + for _, k := range opts.Spec.AllDefinitionReferences() { + delete(expected, k) + } + + for k := range expected { + debugLog("removing unused definition %s", path.Base(k)) + if opts.Verbose { + log.Printf("info: removing unused definition: %s", path.Base(k)) + } + delete(opts.Swagger().Definitions, path.Base(k)) + } + + opts.Spec.reload() // re-analyze +} + +func importKnownRef(entry sortref.RefRevIdx, refStr, newName string, opts *FlattenOpts) error { + // rewrite ref with already resolved external ref (useful for cyclical refs): + // rewrite external refs to local ones + debugLog("resolving known ref [%s] to %s", refStr, newName) + + for _, key := range entry.Keys { + if err := replace.UpdateRef(opts.Swagger(), key, spec.MustCreateRef(path.Join(definitionsPath, newName))); err != nil { + return err + } + } + + return nil +} + +func importNewRef(entry sortref.RefRevIdx, refStr string, opts *FlattenOpts) error { + var ( + isOAIGen bool + newName string + ) + + debugLog("resolving schema from remote $ref [%s]", refStr) + + sch, err := spec.ResolveRefWithBase(opts.Swagger(), &entry.Ref, opts.ExpandOpts(false)) + if err != nil { + return fmt.Errorf("could not resolve schema: %w", err) + } + + // at this stage only $ref analysis matters + partialAnalyzer := &Spec{ + references: referenceAnalysis{}, + patterns: patternAnalysis{}, + enums: enumAnalysis{}, + } + partialAnalyzer.reset() + partialAnalyzer.analyzeSchema("", sch, "/") + + // now rewrite those refs with rebase + for key, ref := range partialAnalyzer.references.allRefs { + if err := replace.UpdateRef(sch, key, spec.MustCreateRef(normalize.RebaseRef(entry.Ref.String(), ref.String()))); err != nil { + return fmt.Errorf("failed to rewrite ref for key %q at %s: %w", key, entry.Ref.String(), err) + } + } + + // generate a unique name - isOAIGen means that a naming conflict was resolved by changing the name + newName, isOAIGen = uniqifyName(opts.Swagger().Definitions, nameFromRef(entry.Ref)) + debugLog("new name for [%s]: %s - with name conflict:%t", strings.Join(entry.Keys, ", "), newName, isOAIGen) + + opts.flattenContext.resolved[refStr] = newName + + // rewrite the external refs to local ones + for _, key := range entry.Keys { + if err := replace.UpdateRef(opts.Swagger(), key, + spec.MustCreateRef(path.Join(definitionsPath, newName))); err != nil { + return err + } + + // keep track of created refs + resolved := false + if _, ok := opts.flattenContext.newRefs[key]; ok { + resolved = opts.flattenContext.newRefs[key].resolved + } + + debugLog("keeping track of ref: %s (%s), resolved: %t", key, newName, resolved) + opts.flattenContext.newRefs[key] = &newRef{ + key: key, + newName: newName, + path: path.Join(definitionsPath, newName), + isOAIGen: isOAIGen, + resolved: resolved, + schema: sch, + } + } + + // add the resolved schema to the definitions + schutils.Save(opts.Swagger(), newName, sch) + + return nil +} + +// importExternalReferences iteratively digs remote references and imports them into the main schema. +// +// At every iteration, new remotes may be found when digging deeper: they are rebased to the current schema before being imported. +// +// This returns true when no more remote references can be found. +func importExternalReferences(opts *FlattenOpts) (bool, error) { + debugLog("importExternalReferences") + + groupedRefs := sortref.ReverseIndex(opts.Spec.references.schemas, opts.BasePath) + sortedRefStr := make([]string, 0, len(groupedRefs)) + if opts.flattenContext == nil { + opts.flattenContext = newContext() + } + + // sort $ref resolution to ensure deterministic name conflict resolution + for refStr := range groupedRefs { + sortedRefStr = append(sortedRefStr, refStr) + } + sort.Strings(sortedRefStr) + + complete := true + + for _, refStr := range sortedRefStr { + entry := groupedRefs[refStr] + if entry.Ref.HasFragmentOnly { + continue + } + + complete = false + + newName := opts.flattenContext.resolved[refStr] + if newName != "" { + if err := importKnownRef(entry, refStr, newName, opts); err != nil { + return false, err + } + + continue + } + + // resolve schemas + if err := importNewRef(entry, refStr, opts); err != nil { + return false, err + } + } + + // maintains ref index entries + for k := range opts.flattenContext.newRefs { + r := opts.flattenContext.newRefs[k] + + // update tracking with resolved schemas + if r.schema.Ref.String() != "" { + ref := spec.MustCreateRef(r.path) + sch, err := spec.ResolveRefWithBase(opts.Swagger(), &ref, opts.ExpandOpts(false)) + if err != nil { + return false, fmt.Errorf("could not resolve schema: %w", err) + } + + r.schema = sch + } + + if r.path == k { + continue + } + + // update tracking with renamed keys: got a cascade of refs + renamed := *r + renamed.key = r.path + opts.flattenContext.newRefs[renamed.path] = &renamed + + // indirect ref + r.newName = path.Base(k) + r.schema = spec.RefSchema(r.path) + r.path = k + r.isOAIGen = strings.Contains(k, "OAIGen") + } + + return complete, nil +} + +// stripPointersAndOAIGen removes anonymous JSON pointers from spec and chain with name conflicts handler. +// This loops until the spec has no such pointer and all name conflicts have been reduced as much as possible. +func stripPointersAndOAIGen(opts *FlattenOpts) error { + // name all JSON pointers to anonymous documents + if err := namePointers(opts); err != nil { + return err + } + + // remove unnecessary OAIGen ref (created when flattening external refs creates name conflicts) + hasIntroducedPointerOrInline, ers := stripOAIGen(opts) + if ers != nil { + return ers + } + + // iterate as pointer or OAIGen resolution may introduce inline schemas or pointers + for hasIntroducedPointerOrInline { + if !opts.Minimal { + opts.Spec.reload() // re-analyze + if err := nameInlinedSchemas(opts); err != nil { + return err + } + } + + if err := namePointers(opts); err != nil { + return err + } + + // restrip and re-analyze + var err error + if hasIntroducedPointerOrInline, err = stripOAIGen(opts); err != nil { + return err + } + } + + return nil +} + +// stripOAIGen strips the spec from unnecessary OAIGen constructs, initially created to dedupe flattened definitions. +// +// A dedupe is deemed unnecessary whenever: +// - the only conflict is with its (single) parent: OAIGen is merged into its parent (reinlining) +// - there is a conflict with multiple parents: merge OAIGen in first parent, the rewrite other parents to point to +// the first parent. +// +// This function returns true whenever it re-inlined a complex schema, so the caller may chose to iterate +// pointer and name resolution again. +func stripOAIGen(opts *FlattenOpts) (bool, error) { + debugLog("stripOAIGen") + replacedWithComplex := false + + // figure out referers of OAIGen definitions (doing it before the ref start mutating) + for _, r := range opts.flattenContext.newRefs { + updateRefParents(opts.Spec.references.allRefs, r) + } + + for k := range opts.flattenContext.newRefs { + r := opts.flattenContext.newRefs[k] + debugLog("newRefs[%s]: isOAIGen: %t, resolved: %t, name: %s, path:%s, #parents: %d, parents: %v, ref: %s", + k, r.isOAIGen, r.resolved, r.newName, r.path, len(r.parents), r.parents, r.schema.Ref.String()) + + if !r.isOAIGen || len(r.parents) == 0 { + continue + } + + hasReplacedWithComplex, err := stripOAIGenForRef(opts, k, r) + if err != nil { + return replacedWithComplex, err + } + + replacedWithComplex = replacedWithComplex || hasReplacedWithComplex + } + + debugLog("replacedWithComplex: %t", replacedWithComplex) + opts.Spec.reload() // re-analyze + + return replacedWithComplex, nil +} + +// updateRefParents updates all parents of an updated $ref +func updateRefParents(allRefs map[string]spec.Ref, r *newRef) { + if !r.isOAIGen || r.resolved { // bail on already resolved entries (avoid looping) + return + } + for k, v := range allRefs { + if r.path != v.String() { + continue + } + + found := false + for _, p := range r.parents { + if p == k { + found = true + + break + } + } + if !found { + r.parents = append(r.parents, k) + } + } +} + +func stripOAIGenForRef(opts *FlattenOpts, k string, r *newRef) (bool, error) { + replacedWithComplex := false + + pr := sortref.TopmostFirst(r.parents) + + // rewrite first parent schema in hierarchical then lexicographical order + debugLog("rewrite first parent %s with schema", pr[0]) + if err := replace.UpdateRefWithSchema(opts.Swagger(), pr[0], r.schema); err != nil { + return false, err + } + + if pa, ok := opts.flattenContext.newRefs[pr[0]]; ok && pa.isOAIGen { + // update parent in ref index entry + debugLog("update parent entry: %s", pr[0]) + pa.schema = r.schema + pa.resolved = false + replacedWithComplex = true + } + + // rewrite other parents to point to first parent + if len(pr) > 1 { + for _, p := range pr[1:] { + replacingRef := spec.MustCreateRef(pr[0]) + + // set complex when replacing ref is an anonymous jsonpointer: further processing may be required + replacedWithComplex = replacedWithComplex || path.Dir(replacingRef.String()) != definitionsPath + debugLog("rewrite parent with ref: %s", replacingRef.String()) + + // NOTE: it is possible at this stage to introduce json pointers (to non-definitions places). + // Those are stripped later on. + if err := replace.UpdateRef(opts.Swagger(), p, replacingRef); err != nil { + return false, err + } + + if pa, ok := opts.flattenContext.newRefs[p]; ok && pa.isOAIGen { + // update parent in ref index + debugLog("update parent entry: %s", p) + pa.schema = r.schema + pa.resolved = false + replacedWithComplex = true + } + } + } + + // remove OAIGen definition + debugLog("removing definition %s", path.Base(r.path)) + delete(opts.Swagger().Definitions, path.Base(r.path)) + + // propagate changes in ref index for keys which have this one as a parent + for kk, value := range opts.flattenContext.newRefs { + if kk == k || !value.isOAIGen || value.resolved { + continue + } + + found := false + newParents := make([]string, 0, len(value.parents)) + for _, parent := range value.parents { + switch { + case parent == r.path: + found = true + parent = pr[0] + case strings.HasPrefix(parent, r.path+"/"): + found = true + parent = path.Join(pr[0], strings.TrimPrefix(parent, r.path)) + } + + newParents = append(newParents, parent) + } + + if found { + value.parents = newParents + } + } + + // mark naming conflict as resolved + debugLog("marking naming conflict resolved for key: %s", r.key) + opts.flattenContext.newRefs[r.key].isOAIGen = false + opts.flattenContext.newRefs[r.key].resolved = true + + // determine if the previous substitution did inline a complex schema + if r.schema != nil && r.schema.Ref.String() == "" { // inline schema + asch, err := Schema(SchemaOpts{Schema: r.schema, Root: opts.Swagger(), BasePath: opts.BasePath}) + if err != nil { + return false, err + } + + debugLog("re-inlined schema: parent: %s, %t", pr[0], asch.isAnalyzedAsComplex()) + replacedWithComplex = replacedWithComplex || !(path.Dir(pr[0]) == definitionsPath) && asch.isAnalyzedAsComplex() + } + + return replacedWithComplex, nil +} + +// namePointers replaces all JSON pointers to anonymous documents by a $ref to a new named definitions. +// +// This is carried on depth-first. Pointers to $refs which are top level definitions are replaced by the $ref itself. +// Pointers to simple types are expanded, unless they express commonality (i.e. several such $ref are used). +func namePointers(opts *FlattenOpts) error { + debugLog("name pointers") + + refsToReplace := make(map[string]SchemaRef, len(opts.Spec.references.schemas)) + for k, ref := range opts.Spec.references.allRefs { + if path.Dir(ref.String()) == definitionsPath { + // this a ref to a top-level definition: ok + continue + } + + result, err := replace.DeepestRef(opts.Swagger(), opts.ExpandOpts(false), ref) + if err != nil { + return fmt.Errorf("at %s, %w", k, err) + } + + replacingRef := result.Ref + sch := result.Schema + if opts.flattenContext != nil { + opts.flattenContext.warnings = append(opts.flattenContext.warnings, result.Warnings...) + } + + debugLog("planning pointer to replace at %s: %s, resolved to: %s", k, ref.String(), replacingRef.String()) + refsToReplace[k] = SchemaRef{ + Name: k, // caller + Ref: replacingRef, // called + Schema: sch, + TopLevel: path.Dir(replacingRef.String()) == definitionsPath, + } + } + + depthFirst := sortref.DepthFirst(refsToReplace) + namer := &InlineSchemaNamer{ + Spec: opts.Swagger(), + Operations: operations.AllOpRefsByRef(opts.Spec, nil), + flattenContext: opts.flattenContext, + opts: opts, + } + + for _, key := range depthFirst { + v := refsToReplace[key] + // update current replacement, which may have been updated by previous changes of deeper elements + result, erd := replace.DeepestRef(opts.Swagger(), opts.ExpandOpts(false), v.Ref) + if erd != nil { + return fmt.Errorf("at %s, %w", key, erd) + } + + if opts.flattenContext != nil { + opts.flattenContext.warnings = append(opts.flattenContext.warnings, result.Warnings...) + } + + v.Ref = result.Ref + v.Schema = result.Schema + v.TopLevel = path.Dir(result.Ref.String()) == definitionsPath + debugLog("replacing pointer at %s: resolved to: %s", key, v.Ref.String()) + + if v.TopLevel { + debugLog("replace pointer %s by canonical definition: %s", key, v.Ref.String()) + + // if the schema is a $ref to a top level definition, just rewrite the pointer to this $ref + if err := replace.UpdateRef(opts.Swagger(), key, v.Ref); err != nil { + return err + } + + continue + } + + if err := flattenAnonPointer(key, v, refsToReplace, namer, opts); err != nil { + return err + } + } + + opts.Spec.reload() // re-analyze + + return nil +} + +func flattenAnonPointer(key string, v SchemaRef, refsToReplace map[string]SchemaRef, namer *InlineSchemaNamer, opts *FlattenOpts) error { + // this is a JSON pointer to an anonymous document (internal or external): + // create a definition for this schema when: + // - it is a complex schema + // - or it is pointed by more than one $ref (i.e. expresses commonality) + // otherwise, expand the pointer (single reference to a simple type) + // + // The named definition for this follows the target's key, not the caller's + debugLog("namePointers at %s for %s", key, v.Ref.String()) + + // qualify the expanded schema + asch, ers := Schema(SchemaOpts{Schema: v.Schema, Root: opts.Swagger(), BasePath: opts.BasePath}) + if ers != nil { + return fmt.Errorf("schema analysis [%s]: %w", key, ers) + } + callers := make([]string, 0, 64) + + debugLog("looking for callers") + + an := New(opts.Swagger()) + for k, w := range an.references.allRefs { + r, err := replace.DeepestRef(opts.Swagger(), opts.ExpandOpts(false), w) + if err != nil { + return fmt.Errorf("at %s, %w", key, err) + } + + if opts.flattenContext != nil { + opts.flattenContext.warnings = append(opts.flattenContext.warnings, r.Warnings...) + } + + if r.Ref.String() == v.Ref.String() { + callers = append(callers, k) + } + } + + debugLog("callers for %s: %d", v.Ref.String(), len(callers)) + if len(callers) == 0 { + // has already been updated and resolved + return nil + } + + parts := sortref.KeyParts(v.Ref.String()) + debugLog("number of callers for %s: %d", v.Ref.String(), len(callers)) + + // identifying edge case when the namer did nothing because we point to a non-schema object + // no definition is created and we expand the $ref for all callers + if (!asch.IsSimpleSchema || len(callers) > 1) && !parts.IsSharedParam() && !parts.IsSharedResponse() { + debugLog("replace JSON pointer at [%s] by definition: %s", key, v.Ref.String()) + if err := namer.Name(v.Ref.String(), v.Schema, asch); err != nil { + return err + } + + // regular case: we named the $ref as a definition, and we move all callers to this new $ref + for _, caller := range callers { + if caller == key { + continue + } + + // move $ref for next to resolve + debugLog("identified caller of %s at [%s]", v.Ref.String(), caller) + c := refsToReplace[caller] + c.Ref = v.Ref + refsToReplace[caller] = c + } + + return nil + } + + debugLog("expand JSON pointer for key=%s", key) + + if err := replace.UpdateRefWithSchema(opts.Swagger(), key, v.Schema); err != nil { + return err + } + // NOTE: there is no other caller to update + + return nil +} diff --git a/vendor/github.com/go-openapi/analysis/flatten_name.go b/vendor/github.com/go-openapi/analysis/flatten_name.go new file mode 100644 index 00000000000..3ad2ccfbfd5 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/flatten_name.go @@ -0,0 +1,293 @@ +package analysis + +import ( + "fmt" + "path" + "sort" + "strings" + + "github.com/go-openapi/analysis/internal/flatten/operations" + "github.com/go-openapi/analysis/internal/flatten/replace" + "github.com/go-openapi/analysis/internal/flatten/schutils" + "github.com/go-openapi/analysis/internal/flatten/sortref" + "github.com/go-openapi/spec" + "github.com/go-openapi/swag" +) + +// InlineSchemaNamer finds a new name for an inlined type +type InlineSchemaNamer struct { + Spec *spec.Swagger + Operations map[string]operations.OpRef + flattenContext *context + opts *FlattenOpts +} + +// Name yields a new name for the inline schema +func (isn *InlineSchemaNamer) Name(key string, schema *spec.Schema, aschema *AnalyzedSchema) error { + debugLog("naming inlined schema at %s", key) + + parts := sortref.KeyParts(key) + for _, name := range namesFromKey(parts, aschema, isn.Operations) { + if name == "" { + continue + } + + // create unique name + newName, isOAIGen := uniqifyName(isn.Spec.Definitions, swag.ToJSONName(name)) + + // clone schema + sch := schutils.Clone(schema) + + // replace values on schema + if err := replace.RewriteSchemaToRef(isn.Spec, key, + spec.MustCreateRef(path.Join(definitionsPath, newName))); err != nil { + return fmt.Errorf("error while creating definition %q from inline schema: %w", newName, err) + } + + // rewrite any dependent $ref pointing to this place, + // when not already pointing to a top-level definition. + // + // NOTE: this is important if such referers use arbitrary JSON pointers. + an := New(isn.Spec) + for k, v := range an.references.allRefs { + r, erd := replace.DeepestRef(isn.opts.Swagger(), isn.opts.ExpandOpts(false), v) + if erd != nil { + return fmt.Errorf("at %s, %w", k, erd) + } + + if isn.opts.flattenContext != nil { + isn.opts.flattenContext.warnings = append(isn.opts.flattenContext.warnings, r.Warnings...) + } + + if r.Ref.String() != key && (r.Ref.String() != path.Join(definitionsPath, newName) || path.Dir(v.String()) == definitionsPath) { + continue + } + + debugLog("found a $ref to a rewritten schema: %s points to %s", k, v.String()) + + // rewrite $ref to the new target + if err := replace.UpdateRef(isn.Spec, k, + spec.MustCreateRef(path.Join(definitionsPath, newName))); err != nil { + return err + } + } + + // NOTE: this extension is currently not used by go-swagger (provided for information only) + sch.AddExtension("x-go-gen-location", GenLocation(parts)) + + // save cloned schema to definitions + schutils.Save(isn.Spec, newName, sch) + + // keep track of created refs + if isn.flattenContext == nil { + continue + } + + debugLog("track created ref: key=%s, newName=%s, isOAIGen=%t", key, newName, isOAIGen) + resolved := false + + if _, ok := isn.flattenContext.newRefs[key]; ok { + resolved = isn.flattenContext.newRefs[key].resolved + } + + isn.flattenContext.newRefs[key] = &newRef{ + key: key, + newName: newName, + path: path.Join(definitionsPath, newName), + isOAIGen: isOAIGen, + resolved: resolved, + schema: sch, + } + } + + return nil +} + +// uniqifyName yields a unique name for a definition +func uniqifyName(definitions spec.Definitions, name string) (string, bool) { + isOAIGen := false + if name == "" { + name = "oaiGen" + isOAIGen = true + } + + if len(definitions) == 0 { + return name, isOAIGen + } + + unq := true + for k := range definitions { + if strings.EqualFold(k, name) { + unq = false + + break + } + } + + if unq { + return name, isOAIGen + } + + name += "OAIGen" + isOAIGen = true + var idx int + unique := name + _, known := definitions[unique] + + for known { + idx++ + unique = fmt.Sprintf("%s%d", name, idx) + _, known = definitions[unique] + } + + return unique, isOAIGen +} + +func namesFromKey(parts sortref.SplitKey, aschema *AnalyzedSchema, operations map[string]operations.OpRef) []string { + var ( + baseNames [][]string + startIndex int + ) + + if parts.IsOperation() { + baseNames, startIndex = namesForOperation(parts, operations) + } + + // definitions + if parts.IsDefinition() { + baseNames, startIndex = namesForDefinition(parts) + } + + result := make([]string, 0, len(baseNames)) + for _, segments := range baseNames { + nm := parts.BuildName(segments, startIndex, partAdder(aschema)) + if nm == "" { + continue + } + + result = append(result, nm) + } + sort.Strings(result) + + return result +} + +func namesForParam(parts sortref.SplitKey, operations map[string]operations.OpRef) ([][]string, int) { + var ( + baseNames [][]string + startIndex int + ) + + piref := parts.PathItemRef() + if piref.String() != "" && parts.IsOperationParam() { + if op, ok := operations[piref.String()]; ok { + startIndex = 5 + baseNames = append(baseNames, []string{op.ID, "params", "body"}) + } + } else if parts.IsSharedOperationParam() { + pref := parts.PathRef() + for k, v := range operations { + if strings.HasPrefix(k, pref.String()) { + startIndex = 4 + baseNames = append(baseNames, []string{v.ID, "params", "body"}) + } + } + } + + return baseNames, startIndex +} + +func namesForOperation(parts sortref.SplitKey, operations map[string]operations.OpRef) ([][]string, int) { + var ( + baseNames [][]string + startIndex int + ) + + // params + if parts.IsOperationParam() || parts.IsSharedOperationParam() { + baseNames, startIndex = namesForParam(parts, operations) + } + + // responses + if parts.IsOperationResponse() { + piref := parts.PathItemRef() + if piref.String() != "" { + if op, ok := operations[piref.String()]; ok { + startIndex = 6 + baseNames = append(baseNames, []string{op.ID, parts.ResponseName(), "body"}) + } + } + } + + return baseNames, startIndex +} + +func namesForDefinition(parts sortref.SplitKey) ([][]string, int) { + nm := parts.DefinitionName() + if nm != "" { + return [][]string{{parts.DefinitionName()}}, 2 + } + + return [][]string{}, 0 +} + +// partAdder knows how to interpret a schema when it comes to build a name from parts +func partAdder(aschema *AnalyzedSchema) sortref.PartAdder { + return func(part string) []string { + segments := make([]string, 0, 2) + + if part == "items" || part == "additionalItems" { + if aschema.IsTuple || aschema.IsTupleWithExtra { + segments = append(segments, "tuple") + } else { + segments = append(segments, "items") + } + + if part == "additionalItems" { + segments = append(segments, part) + } + + return segments + } + + segments = append(segments, part) + + return segments + } +} + +func nameFromRef(ref spec.Ref) string { + u := ref.GetURL() + if u.Fragment != "" { + return swag.ToJSONName(path.Base(u.Fragment)) + } + + if u.Path != "" { + bn := path.Base(u.Path) + if bn != "" && bn != "/" { + ext := path.Ext(bn) + if ext != "" { + return swag.ToJSONName(bn[:len(bn)-len(ext)]) + } + + return swag.ToJSONName(bn) + } + } + + return swag.ToJSONName(strings.ReplaceAll(u.Host, ".", " ")) +} + +// GenLocation indicates from which section of the specification (models or operations) a definition has been created. +// +// This is reflected in the output spec with a "x-go-gen-location" extension. At the moment, this is is provided +// for information only. +func GenLocation(parts sortref.SplitKey) string { + switch { + case parts.IsOperation(): + return "operations" + case parts.IsDefinition(): + return "models" + default: + return "" + } +} diff --git a/vendor/github.com/go-openapi/analysis/flatten_options.go b/vendor/github.com/go-openapi/analysis/flatten_options.go new file mode 100644 index 00000000000..c5bb97b0a69 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/flatten_options.go @@ -0,0 +1,78 @@ +package analysis + +import ( + "log" + + "github.com/go-openapi/spec" +) + +// FlattenOpts configuration for flattening a swagger specification. +// +// The BasePath parameter is used to locate remote relative $ref found in the specification. +// This path is a file: it points to the location of the root document and may be either a local +// file path or a URL. +// +// If none specified, relative references (e.g. "$ref": "folder/schema.yaml#/definitions/...") +// found in the spec are searched from the current working directory. +type FlattenOpts struct { + Spec *Spec // The analyzed spec to work with + flattenContext *context // Internal context to track flattening activity + + BasePath string // The location of the root document for this spec to resolve relative $ref + + // Flattening options + Expand bool // When true, skip flattening the spec and expand it instead (if Minimal is false) + Minimal bool // When true, do not decompose complex structures such as allOf + Verbose bool // enable some reporting on possible name conflicts detected + RemoveUnused bool // When true, remove unused parameters, responses and definitions after expansion/flattening + ContinueOnError bool // Continue when spec expansion issues are found + + /* Extra keys */ + _ struct{} // require keys +} + +// ExpandOpts creates a spec.ExpandOptions to configure expanding a specification document. +func (f *FlattenOpts) ExpandOpts(skipSchemas bool) *spec.ExpandOptions { + return &spec.ExpandOptions{ + RelativeBase: f.BasePath, + SkipSchemas: skipSchemas, + ContinueOnError: f.ContinueOnError, + } +} + +// Swagger gets the swagger specification for this flatten operation +func (f *FlattenOpts) Swagger() *spec.Swagger { + return f.Spec.spec +} + +// croak logs notifications and warnings about valid, but possibly unwanted constructs resulting +// from flattening a spec +func (f *FlattenOpts) croak() { + if !f.Verbose { + return + } + + reported := make(map[string]bool, len(f.flattenContext.newRefs)) + for _, v := range f.Spec.references.allRefs { + // warns about duplicate handling + for _, r := range f.flattenContext.newRefs { + if r.isOAIGen && r.path == v.String() { + reported[r.newName] = true + } + } + } + + for k := range reported { + log.Printf("warning: duplicate flattened definition name resolved as %s", k) + } + + // warns about possible type mismatches + uniqueMsg := make(map[string]bool) + for _, msg := range f.flattenContext.warnings { + if _, ok := uniqueMsg[msg]; ok { + continue + } + log.Printf("warning: %s", msg) + uniqueMsg[msg] = true + } +} diff --git a/vendor/github.com/go-openapi/analysis/internal/debug/debug.go b/vendor/github.com/go-openapi/analysis/internal/debug/debug.go new file mode 100644 index 00000000000..ec0fec02298 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/internal/debug/debug.go @@ -0,0 +1,41 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package debug + +import ( + "fmt" + "log" + "os" + "path/filepath" + "runtime" +) + +var ( + output = os.Stdout +) + +// GetLogger provides a prefix debug logger +func GetLogger(prefix string, debug bool) func(string, ...interface{}) { + if debug { + logger := log.New(output, fmt.Sprintf("%s:", prefix), log.LstdFlags) + + return func(msg string, args ...interface{}) { + _, file1, pos1, _ := runtime.Caller(1) + logger.Printf("%s:%d: %s", filepath.Base(file1), pos1, fmt.Sprintf(msg, args...)) + } + } + + return func(msg string, args ...interface{}) {} +} diff --git a/vendor/github.com/go-openapi/analysis/internal/flatten/normalize/normalize.go b/vendor/github.com/go-openapi/analysis/internal/flatten/normalize/normalize.go new file mode 100644 index 00000000000..8c9df0580da --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/internal/flatten/normalize/normalize.go @@ -0,0 +1,87 @@ +package normalize + +import ( + "net/url" + "path" + "path/filepath" + "strings" + + "github.com/go-openapi/spec" +) + +// RebaseRef rebases a remote ref relative to a base ref. +// +// NOTE: does not support JSONschema ID for $ref (we assume we are working with swagger specs here). +// +// NOTE(windows): +// * refs are assumed to have been normalized with drive letter lower cased (from go-openapi/spec) +// * "/ in paths may appear as escape sequences +func RebaseRef(baseRef string, ref string) string { + baseRef, _ = url.PathUnescape(baseRef) + ref, _ = url.PathUnescape(ref) + + if baseRef == "" || baseRef == "." || strings.HasPrefix(baseRef, "#") { + return ref + } + + parts := strings.Split(ref, "#") + + baseParts := strings.Split(baseRef, "#") + baseURL, _ := url.Parse(baseParts[0]) + if strings.HasPrefix(ref, "#") { + if baseURL.Host == "" { + return strings.Join([]string{baseParts[0], parts[1]}, "#") + } + + return strings.Join([]string{baseParts[0], parts[1]}, "#") + } + + refURL, _ := url.Parse(parts[0]) + if refURL.Host != "" || filepath.IsAbs(parts[0]) { + // not rebasing an absolute path + return ref + } + + // there is a relative path + var basePath string + if baseURL.Host != "" { + // when there is a host, standard URI rules apply (with "/") + baseURL.Path = path.Dir(baseURL.Path) + baseURL.Path = path.Join(baseURL.Path, "/"+parts[0]) + + return baseURL.String() + } + + // this is a local relative path + // basePart[0] and parts[0] are local filesystem directories/files + basePath = filepath.Dir(baseParts[0]) + relPath := filepath.Join(basePath, string(filepath.Separator)+parts[0]) + if len(parts) > 1 { + return strings.Join([]string{relPath, parts[1]}, "#") + } + + return relPath +} + +// Path renders absolute path on remote file refs +// +// NOTE(windows): +// * refs are assumed to have been normalized with drive letter lower cased (from go-openapi/spec) +// * "/ in paths may appear as escape sequences +func Path(ref spec.Ref, basePath string) string { + uri, _ := url.PathUnescape(ref.String()) + if ref.HasFragmentOnly || filepath.IsAbs(uri) { + return uri + } + + refURL, _ := url.Parse(uri) + if refURL.Host != "" { + return uri + } + + parts := strings.Split(uri, "#") + // BasePath, parts[0] are local filesystem directories, guaranteed to be absolute at this stage + parts[0] = filepath.Join(filepath.Dir(basePath), parts[0]) + + return strings.Join(parts, "#") +} diff --git a/vendor/github.com/go-openapi/analysis/internal/flatten/operations/operations.go b/vendor/github.com/go-openapi/analysis/internal/flatten/operations/operations.go new file mode 100644 index 00000000000..7f3a2b8717f --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/internal/flatten/operations/operations.go @@ -0,0 +1,90 @@ +package operations + +import ( + "path" + "sort" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/spec" + "github.com/go-openapi/swag" +) + +// AllOpRefsByRef returns an index of sortable operations +func AllOpRefsByRef(specDoc Provider, operationIDs []string) map[string]OpRef { + return OpRefsByRef(GatherOperations(specDoc, operationIDs)) +} + +// OpRefsByRef indexes a map of sortable operations +func OpRefsByRef(oprefs map[string]OpRef) map[string]OpRef { + result := make(map[string]OpRef, len(oprefs)) + for _, v := range oprefs { + result[v.Ref.String()] = v + } + + return result +} + +// OpRef is an indexable, sortable operation +type OpRef struct { + Method string + Path string + Key string + ID string + Op *spec.Operation + Ref spec.Ref +} + +// OpRefs is a sortable collection of operations +type OpRefs []OpRef + +func (o OpRefs) Len() int { return len(o) } +func (o OpRefs) Swap(i, j int) { o[i], o[j] = o[j], o[i] } +func (o OpRefs) Less(i, j int) bool { return o[i].Key < o[j].Key } + +// Provider knows how to collect operations from a spec +type Provider interface { + Operations() map[string]map[string]*spec.Operation +} + +// GatherOperations builds a map of sorted operations from a spec +func GatherOperations(specDoc Provider, operationIDs []string) map[string]OpRef { + var oprefs OpRefs + + for method, pathItem := range specDoc.Operations() { + for pth, operation := range pathItem { + vv := *operation + oprefs = append(oprefs, OpRef{ + Key: swag.ToGoName(strings.ToLower(method) + " " + pth), + Method: method, + Path: pth, + ID: vv.ID, + Op: &vv, + Ref: spec.MustCreateRef("#" + path.Join("/paths", jsonpointer.Escape(pth), method)), + }) + } + } + + sort.Sort(oprefs) + + operations := make(map[string]OpRef) + for _, opr := range oprefs { + nm := opr.ID + if nm == "" { + nm = opr.Key + } + + oo, found := operations[nm] + if found && oo.Method != opr.Method && oo.Path != opr.Path { + nm = opr.Key + } + + if len(operationIDs) == 0 || swag.ContainsStrings(operationIDs, opr.ID) || swag.ContainsStrings(operationIDs, nm) { + opr.ID = nm + opr.Op.ID = nm + operations[nm] = opr + } + } + + return operations +} diff --git a/vendor/github.com/go-openapi/analysis/internal/flatten/replace/replace.go b/vendor/github.com/go-openapi/analysis/internal/flatten/replace/replace.go new file mode 100644 index 00000000000..26c2a05a310 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/internal/flatten/replace/replace.go @@ -0,0 +1,434 @@ +package replace + +import ( + "fmt" + "net/url" + "os" + "path" + "strconv" + + "github.com/go-openapi/analysis/internal/debug" + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/spec" +) + +const definitionsPath = "#/definitions" + +var debugLog = debug.GetLogger("analysis/flatten/replace", os.Getenv("SWAGGER_DEBUG") != "") + +// RewriteSchemaToRef replaces a schema with a Ref +func RewriteSchemaToRef(sp *spec.Swagger, key string, ref spec.Ref) error { + debugLog("rewriting schema to ref for %s with %s", key, ref.String()) + _, value, err := getPointerFromKey(sp, key) + if err != nil { + return err + } + + switch refable := value.(type) { + case *spec.Schema: + return rewriteParentRef(sp, key, ref) + + case spec.Schema: + return rewriteParentRef(sp, key, ref) + + case *spec.SchemaOrArray: + if refable.Schema != nil { + refable.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + } + + case *spec.SchemaOrBool: + if refable.Schema != nil { + refable.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + } + default: + return fmt.Errorf("no schema with ref found at %s for %T", key, value) + } + + return nil +} + +func rewriteParentRef(sp *spec.Swagger, key string, ref spec.Ref) error { + parent, entry, pvalue, err := getParentFromKey(sp, key) + if err != nil { + return err + } + + debugLog("rewriting holder for %T", pvalue) + switch container := pvalue.(type) { + case spec.Response: + if err := rewriteParentRef(sp, "#"+parent, ref); err != nil { + return err + } + + case *spec.Response: + container.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case *spec.Responses: + statusCode, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", key[1:], err) + } + resp := container.StatusCodeResponses[statusCode] + resp.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + container.StatusCodeResponses[statusCode] = resp + + case map[string]spec.Response: + resp := container[entry] + resp.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + container[entry] = resp + + case spec.Parameter: + if err := rewriteParentRef(sp, "#"+parent, ref); err != nil { + return err + } + + case map[string]spec.Parameter: + param := container[entry] + param.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + container[entry] = param + + case []spec.Parameter: + idx, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", key[1:], err) + } + param := container[idx] + param.Schema = &spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + container[idx] = param + + case spec.Definitions: + container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case map[string]spec.Schema: + container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case []spec.Schema: + idx, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", key[1:], err) + } + container[idx] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case *spec.SchemaOrArray: + // NOTE: this is necessarily an array - otherwise, the parent would be *Schema + idx, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", key[1:], err) + } + container.Schemas[idx] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case spec.SchemaProperties: + container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + // NOTE: can't have case *spec.SchemaOrBool = parent in this case is *Schema + + default: + return fmt.Errorf("unhandled parent schema rewrite %s (%T)", key, pvalue) + } + + return nil +} + +// getPointerFromKey retrieves the content of the JSON pointer "key" +func getPointerFromKey(sp interface{}, key string) (string, interface{}, error) { + switch sp.(type) { + case *spec.Schema: + case *spec.Swagger: + default: + panic("unexpected type used in getPointerFromKey") + } + if key == "#/" { + return "", sp, nil + } + // unescape chars in key, e.g. "{}" from path params + pth, _ := url.PathUnescape(key[1:]) + ptr, err := jsonpointer.New(pth) + if err != nil { + return "", nil, err + } + + value, _, err := ptr.Get(sp) + if err != nil { + debugLog("error when getting key: %s with path: %s", key, pth) + + return "", nil, err + } + + return pth, value, nil +} + +// getParentFromKey retrieves the container of the JSON pointer "key" +func getParentFromKey(sp interface{}, key string) (string, string, interface{}, error) { + switch sp.(type) { + case *spec.Schema: + case *spec.Swagger: + default: + panic("unexpected type used in getPointerFromKey") + } + // unescape chars in key, e.g. "{}" from path params + pth, _ := url.PathUnescape(key[1:]) + + parent, entry := path.Dir(pth), path.Base(pth) + debugLog("getting schema holder at: %s, with entry: %s", parent, entry) + + pptr, err := jsonpointer.New(parent) + if err != nil { + return "", "", nil, err + } + pvalue, _, err := pptr.Get(sp) + if err != nil { + return "", "", nil, fmt.Errorf("can't get parent for %s: %w", parent, err) + } + + return parent, entry, pvalue, nil +} + +// UpdateRef replaces a ref by another one +func UpdateRef(sp interface{}, key string, ref spec.Ref) error { + switch sp.(type) { + case *spec.Schema: + case *spec.Swagger: + default: + panic("unexpected type used in getPointerFromKey") + } + debugLog("updating ref for %s with %s", key, ref.String()) + pth, value, err := getPointerFromKey(sp, key) + if err != nil { + return err + } + + switch refable := value.(type) { + case *spec.Schema: + refable.Ref = ref + case *spec.SchemaOrArray: + if refable.Schema != nil { + refable.Schema.Ref = ref + } + case *spec.SchemaOrBool: + if refable.Schema != nil { + refable.Schema.Ref = ref + } + case spec.Schema: + debugLog("rewriting holder for %T", refable) + _, entry, pvalue, erp := getParentFromKey(sp, key) + if erp != nil { + return err + } + switch container := pvalue.(type) { + case spec.Definitions: + container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case map[string]spec.Schema: + container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case []spec.Schema: + idx, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", pth, err) + } + container[idx] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case *spec.SchemaOrArray: + // NOTE: this is necessarily an array - otherwise, the parent would be *Schema + idx, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", pth, err) + } + container.Schemas[idx] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + case spec.SchemaProperties: + container[entry] = spec.Schema{SchemaProps: spec.SchemaProps{Ref: ref}} + + // NOTE: can't have case *spec.SchemaOrBool = parent in this case is *Schema + + default: + return fmt.Errorf("unhandled container type at %s: %T", key, value) + } + + default: + return fmt.Errorf("no schema with ref found at %s for %T", key, value) + } + + return nil +} + +// UpdateRefWithSchema replaces a ref with a schema (i.e. re-inline schema) +func UpdateRefWithSchema(sp *spec.Swagger, key string, sch *spec.Schema) error { + debugLog("updating ref for %s with schema", key) + pth, value, err := getPointerFromKey(sp, key) + if err != nil { + return err + } + + switch refable := value.(type) { + case *spec.Schema: + *refable = *sch + case spec.Schema: + _, entry, pvalue, erp := getParentFromKey(sp, key) + if erp != nil { + return err + } + switch container := pvalue.(type) { + case spec.Definitions: + container[entry] = *sch + + case map[string]spec.Schema: + container[entry] = *sch + + case []spec.Schema: + idx, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", pth, err) + } + container[idx] = *sch + + case *spec.SchemaOrArray: + // NOTE: this is necessarily an array - otherwise, the parent would be *Schema + idx, err := strconv.Atoi(entry) + if err != nil { + return fmt.Errorf("%s not a number: %w", pth, err) + } + container.Schemas[idx] = *sch + + case spec.SchemaProperties: + container[entry] = *sch + + // NOTE: can't have case *spec.SchemaOrBool = parent in this case is *Schema + + default: + return fmt.Errorf("unhandled type for parent of [%s]: %T", key, value) + } + case *spec.SchemaOrArray: + *refable.Schema = *sch + // NOTE: can't have case *spec.SchemaOrBool = parent in this case is *Schema + case *spec.SchemaOrBool: + *refable.Schema = *sch + default: + return fmt.Errorf("no schema with ref found at %s for %T", key, value) + } + + return nil +} + +// DeepestRefResult holds the results from DeepestRef analysis +type DeepestRefResult struct { + Ref spec.Ref + Schema *spec.Schema + Warnings []string +} + +// DeepestRef finds the first definition ref, from a cascade of nested refs which are not definitions. +// - if no definition is found, returns the deepest ref. +// - pointers to external files are expanded +// +// NOTE: all external $ref's are assumed to be already expanded at this stage. +func DeepestRef(sp *spec.Swagger, opts *spec.ExpandOptions, ref spec.Ref) (*DeepestRefResult, error) { + if !ref.HasFragmentOnly { + // we found an external $ref, which is odd at this stage: + // do nothing on external $refs + return &DeepestRefResult{Ref: ref}, nil + } + + currentRef := ref + visited := make(map[string]bool, 64) + warnings := make([]string, 0, 2) + +DOWNREF: + for currentRef.String() != "" { + if path.Dir(currentRef.String()) == definitionsPath { + // this is a top-level definition: stop here and return this ref + return &DeepestRefResult{Ref: currentRef}, nil + } + + if _, beenThere := visited[currentRef.String()]; beenThere { + return nil, + fmt.Errorf("cannot resolve cyclic chain of pointers under %s", currentRef.String()) + } + + visited[currentRef.String()] = true + value, _, err := currentRef.GetPointer().Get(sp) + if err != nil { + return nil, err + } + + switch refable := value.(type) { + case *spec.Schema: + if refable.Ref.String() == "" { + break DOWNREF + } + currentRef = refable.Ref + + case spec.Schema: + if refable.Ref.String() == "" { + break DOWNREF + } + currentRef = refable.Ref + + case *spec.SchemaOrArray: + if refable.Schema == nil || refable.Schema != nil && refable.Schema.Ref.String() == "" { + break DOWNREF + } + currentRef = refable.Schema.Ref + + case *spec.SchemaOrBool: + if refable.Schema == nil || refable.Schema != nil && refable.Schema.Ref.String() == "" { + break DOWNREF + } + currentRef = refable.Schema.Ref + + case spec.Response: + // a pointer points to a schema initially marshalled in responses section... + // Attempt to convert this to a schema. If this fails, the spec is invalid + asJSON, _ := refable.MarshalJSON() + var asSchema spec.Schema + + err := asSchema.UnmarshalJSON(asJSON) + if err != nil { + return nil, + fmt.Errorf("invalid type for resolved JSON pointer %s. Expected a schema a, got: %T", + currentRef.String(), value) + } + warnings = append(warnings, fmt.Sprintf("found $ref %q (response) interpreted as schema", currentRef.String())) + + if asSchema.Ref.String() == "" { + break DOWNREF + } + currentRef = asSchema.Ref + + case spec.Parameter: + // a pointer points to a schema initially marshalled in parameters section... + // Attempt to convert this to a schema. If this fails, the spec is invalid + asJSON, _ := refable.MarshalJSON() + var asSchema spec.Schema + if err := asSchema.UnmarshalJSON(asJSON); err != nil { + return nil, + fmt.Errorf("invalid type for resolved JSON pointer %s. Expected a schema a, got: %T", + currentRef.String(), value) + } + + warnings = append(warnings, fmt.Sprintf("found $ref %q (parameter) interpreted as schema", currentRef.String())) + + if asSchema.Ref.String() == "" { + break DOWNREF + } + currentRef = asSchema.Ref + + default: + return nil, + fmt.Errorf("unhandled type to resolve JSON pointer %s. Expected a Schema, got: %T", + currentRef.String(), value) + } + } + + // assess what schema we're ending with + sch, erv := spec.ResolveRefWithBase(sp, ¤tRef, opts) + if erv != nil { + return nil, erv + } + + if sch == nil { + return nil, fmt.Errorf("no schema found at %s", currentRef.String()) + } + + return &DeepestRefResult{Ref: currentRef, Schema: sch, Warnings: warnings}, nil +} diff --git a/vendor/github.com/go-openapi/analysis/internal/flatten/schutils/flatten_schema.go b/vendor/github.com/go-openapi/analysis/internal/flatten/schutils/flatten_schema.go new file mode 100644 index 00000000000..4590236e683 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/internal/flatten/schutils/flatten_schema.go @@ -0,0 +1,29 @@ +// Package schutils provides tools to save or clone a schema +// when flattening a spec. +package schutils + +import ( + "github.com/go-openapi/spec" + "github.com/go-openapi/swag" +) + +// Save registers a schema as an entry in spec #/definitions +func Save(sp *spec.Swagger, name string, schema *spec.Schema) { + if schema == nil { + return + } + + if sp.Definitions == nil { + sp.Definitions = make(map[string]spec.Schema, 150) + } + + sp.Definitions[name] = *schema +} + +// Clone deep-clones a schema +func Clone(schema *spec.Schema) *spec.Schema { + var sch spec.Schema + _ = swag.FromDynamicJSON(schema, &sch) + + return &sch +} diff --git a/vendor/github.com/go-openapi/analysis/internal/flatten/sortref/keys.go b/vendor/github.com/go-openapi/analysis/internal/flatten/sortref/keys.go new file mode 100644 index 00000000000..18e552eadce --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/internal/flatten/sortref/keys.go @@ -0,0 +1,201 @@ +package sortref + +import ( + "net/http" + "path" + "strconv" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/spec" +) + +const ( + paths = "paths" + responses = "responses" + parameters = "parameters" + definitions = "definitions" +) + +var ( + ignoredKeys map[string]struct{} + validMethods map[string]struct{} +) + +func init() { + ignoredKeys = map[string]struct{}{ + "schema": {}, + "properties": {}, + "not": {}, + "anyOf": {}, + "oneOf": {}, + } + + validMethods = map[string]struct{}{ + "GET": {}, + "HEAD": {}, + "OPTIONS": {}, + "PATCH": {}, + "POST": {}, + "PUT": {}, + "DELETE": {}, + } +} + +// Key represent a key item constructed from /-separated segments +type Key struct { + Segments int + Key string +} + +// Keys is a sortable collable collection of Keys +type Keys []Key + +func (k Keys) Len() int { return len(k) } +func (k Keys) Swap(i, j int) { k[i], k[j] = k[j], k[i] } +func (k Keys) Less(i, j int) bool { + return k[i].Segments > k[j].Segments || (k[i].Segments == k[j].Segments && k[i].Key < k[j].Key) +} + +// KeyParts construct a SplitKey with all its /-separated segments decomposed. It is sortable. +func KeyParts(key string) SplitKey { + var res []string + for _, part := range strings.Split(key[1:], "/") { + if part != "" { + res = append(res, jsonpointer.Unescape(part)) + } + } + + return res +} + +// SplitKey holds of the parts of a /-separated key, soi that their location may be determined. +type SplitKey []string + +// IsDefinition is true when the split key is in the #/definitions section of a spec +func (s SplitKey) IsDefinition() bool { + return len(s) > 1 && s[0] == definitions +} + +// DefinitionName yields the name of the definition +func (s SplitKey) DefinitionName() string { + if !s.IsDefinition() { + return "" + } + + return s[1] +} + +func (s SplitKey) isKeyName(i int) bool { + if i <= 0 { + return false + } + + count := 0 + for idx := i - 1; idx > 0; idx-- { + if s[idx] != "properties" { + break + } + count++ + } + + return count%2 != 0 +} + +// PartAdder know how to construct the components of a new name +type PartAdder func(string) []string + +// BuildName builds a name from segments +func (s SplitKey) BuildName(segments []string, startIndex int, adder PartAdder) string { + for i, part := range s[startIndex:] { + if _, ignored := ignoredKeys[part]; !ignored || s.isKeyName(startIndex+i) { + segments = append(segments, adder(part)...) + } + } + + return strings.Join(segments, " ") +} + +// IsOperation is true when the split key is in the operations section +func (s SplitKey) IsOperation() bool { + return len(s) > 1 && s[0] == paths +} + +// IsSharedOperationParam is true when the split key is in the parameters section of a path +func (s SplitKey) IsSharedOperationParam() bool { + return len(s) > 2 && s[0] == paths && s[2] == parameters +} + +// IsSharedParam is true when the split key is in the #/parameters section of a spec +func (s SplitKey) IsSharedParam() bool { + return len(s) > 1 && s[0] == parameters +} + +// IsOperationParam is true when the split key is in the parameters section of an operation +func (s SplitKey) IsOperationParam() bool { + return len(s) > 3 && s[0] == paths && s[3] == parameters +} + +// IsOperationResponse is true when the split key is in the responses section of an operation +func (s SplitKey) IsOperationResponse() bool { + return len(s) > 3 && s[0] == paths && s[3] == responses +} + +// IsSharedResponse is true when the split key is in the #/responses section of a spec +func (s SplitKey) IsSharedResponse() bool { + return len(s) > 1 && s[0] == responses +} + +// IsDefaultResponse is true when the split key is the default response for an operation +func (s SplitKey) IsDefaultResponse() bool { + return len(s) > 4 && s[0] == paths && s[3] == responses && s[4] == "default" +} + +// IsStatusCodeResponse is true when the split key is an operation response with a status code +func (s SplitKey) IsStatusCodeResponse() bool { + isInt := func() bool { + _, err := strconv.Atoi(s[4]) + + return err == nil + } + + return len(s) > 4 && s[0] == paths && s[3] == responses && isInt() +} + +// ResponseName yields either the status code or "Default" for a response +func (s SplitKey) ResponseName() string { + if s.IsStatusCodeResponse() { + code, _ := strconv.Atoi(s[4]) + + return http.StatusText(code) + } + + if s.IsDefaultResponse() { + return "Default" + } + + return "" +} + +// PathItemRef constructs a $ref object from a split key of the form /{path}/{method} +func (s SplitKey) PathItemRef() spec.Ref { + if len(s) < 3 { + return spec.Ref{} + } + + pth, method := s[1], s[2] + if _, isValidMethod := validMethods[strings.ToUpper(method)]; !isValidMethod && !strings.HasPrefix(method, "x-") { + return spec.Ref{} + } + + return spec.MustCreateRef("#" + path.Join("/", paths, jsonpointer.Escape(pth), strings.ToUpper(method))) +} + +// PathRef constructs a $ref object from a split key of the form /paths/{reference} +func (s SplitKey) PathRef() spec.Ref { + if !s.IsOperation() { + return spec.Ref{} + } + + return spec.MustCreateRef("#" + path.Join("/", paths, jsonpointer.Escape(s[1]))) +} diff --git a/vendor/github.com/go-openapi/analysis/internal/flatten/sortref/sort_ref.go b/vendor/github.com/go-openapi/analysis/internal/flatten/sortref/sort_ref.go new file mode 100644 index 00000000000..73243df87f0 --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/internal/flatten/sortref/sort_ref.go @@ -0,0 +1,141 @@ +package sortref + +import ( + "reflect" + "sort" + "strings" + + "github.com/go-openapi/analysis/internal/flatten/normalize" + "github.com/go-openapi/spec" +) + +var depthGroupOrder = []string{ + "sharedParam", "sharedResponse", "sharedOpParam", "opParam", "codeResponse", "defaultResponse", "definition", +} + +type mapIterator struct { + len int + mapIter *reflect.MapIter +} + +func (i *mapIterator) Next() bool { + return i.mapIter.Next() +} + +func (i *mapIterator) Len() int { + return i.len +} + +func (i *mapIterator) Key() string { + return i.mapIter.Key().String() +} + +func mustMapIterator(anyMap interface{}) *mapIterator { + val := reflect.ValueOf(anyMap) + + return &mapIterator{mapIter: val.MapRange(), len: val.Len()} +} + +// DepthFirst sorts a map of anything. It groups keys by category +// (shared params, op param, statuscode response, default response, definitions) +// sort groups internally by number of parts in the key and lexical names +// flatten groups into a single list of keys +func DepthFirst(in interface{}) []string { + iterator := mustMapIterator(in) + sorted := make([]string, 0, iterator.Len()) + grouped := make(map[string]Keys, iterator.Len()) + + for iterator.Next() { + k := iterator.Key() + split := KeyParts(k) + var pk string + + if split.IsSharedOperationParam() { + pk = "sharedOpParam" + } + if split.IsOperationParam() { + pk = "opParam" + } + if split.IsStatusCodeResponse() { + pk = "codeResponse" + } + if split.IsDefaultResponse() { + pk = "defaultResponse" + } + if split.IsDefinition() { + pk = "definition" + } + if split.IsSharedParam() { + pk = "sharedParam" + } + if split.IsSharedResponse() { + pk = "sharedResponse" + } + grouped[pk] = append(grouped[pk], Key{Segments: len(split), Key: k}) + } + + for _, pk := range depthGroupOrder { + res := grouped[pk] + sort.Sort(res) + + for _, v := range res { + sorted = append(sorted, v.Key) + } + } + + return sorted +} + +// topMostRefs is able to sort refs by hierarchical then lexicographic order, +// yielding refs ordered breadth-first. +type topmostRefs []string + +func (k topmostRefs) Len() int { return len(k) } +func (k topmostRefs) Swap(i, j int) { k[i], k[j] = k[j], k[i] } +func (k topmostRefs) Less(i, j int) bool { + li, lj := len(strings.Split(k[i], "/")), len(strings.Split(k[j], "/")) + if li == lj { + return k[i] < k[j] + } + + return li < lj +} + +// TopmostFirst sorts references by depth +func TopmostFirst(refs []string) []string { + res := topmostRefs(refs) + sort.Sort(res) + + return res +} + +// RefRevIdx is a reverse index for references +type RefRevIdx struct { + Ref spec.Ref + Keys []string +} + +// ReverseIndex builds a reverse index for references in schemas +func ReverseIndex(schemas map[string]spec.Ref, basePath string) map[string]RefRevIdx { + collected := make(map[string]RefRevIdx) + for key, schRef := range schemas { + // normalize paths before sorting, + // so we get together keys that are from the same external file + normalizedPath := normalize.Path(schRef, basePath) + + entry, ok := collected[normalizedPath] + if ok { + entry.Keys = append(entry.Keys, key) + collected[normalizedPath] = entry + + continue + } + + collected[normalizedPath] = RefRevIdx{ + Ref: schRef, + Keys: []string{key}, + } + } + + return collected +} diff --git a/vendor/github.com/go-openapi/analysis/mixin.go b/vendor/github.com/go-openapi/analysis/mixin.go new file mode 100644 index 00000000000..b253052648c --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/mixin.go @@ -0,0 +1,515 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package analysis + +import ( + "fmt" + "reflect" + + "github.com/go-openapi/spec" +) + +// Mixin modifies the primary swagger spec by adding the paths and +// definitions from the mixin specs. Top level parameters and +// responses from the mixins are also carried over. Operation id +// collisions are avoided by appending "Mixin" but only if +// needed. +// +// The following parts of primary are subject to merge, filling empty details +// - Info +// - BasePath +// - Host +// - ExternalDocs +// +// Consider calling FixEmptyResponseDescriptions() on the modified primary +// if you read them from storage and they are valid to start with. +// +// Entries in "paths", "definitions", "parameters" and "responses" are +// added to the primary in the order of the given mixins. If the entry +// already exists in primary it is skipped with a warning message. +// +// The count of skipped entries (from collisions) is returned so any +// deviation from the number expected can flag a warning in your build +// scripts. Carefully review the collisions before accepting them; +// consider renaming things if possible. +// +// No key normalization takes place (paths, type defs, +// etc). Ensure they are canonical if your downstream tools do +// key normalization of any form. +// +// Merging schemes (http, https), and consumers/producers do not account for +// collisions. +func Mixin(primary *spec.Swagger, mixins ...*spec.Swagger) []string { + skipped := make([]string, 0, len(mixins)) + opIds := getOpIds(primary) + initPrimary(primary) + + for i, m := range mixins { + skipped = append(skipped, mergeSwaggerProps(primary, m)...) + + skipped = append(skipped, mergeConsumes(primary, m)...) + + skipped = append(skipped, mergeProduces(primary, m)...) + + skipped = append(skipped, mergeTags(primary, m)...) + + skipped = append(skipped, mergeSchemes(primary, m)...) + + skipped = append(skipped, mergeSecurityDefinitions(primary, m)...) + + skipped = append(skipped, mergeSecurityRequirements(primary, m)...) + + skipped = append(skipped, mergeDefinitions(primary, m)...) + + // merging paths requires a map of operationIDs to work with + skipped = append(skipped, mergePaths(primary, m, opIds, i)...) + + skipped = append(skipped, mergeParameters(primary, m)...) + + skipped = append(skipped, mergeResponses(primary, m)...) + } + + return skipped +} + +// getOpIds extracts all the paths..operationIds from the given +// spec and returns them as the keys in a map with 'true' values. +func getOpIds(s *spec.Swagger) map[string]bool { + rv := make(map[string]bool) + if s.Paths == nil { + return rv + } + + for _, v := range s.Paths.Paths { + piops := pathItemOps(v) + + for _, op := range piops { + rv[op.ID] = true + } + } + + return rv +} + +func pathItemOps(p spec.PathItem) []*spec.Operation { + var rv []*spec.Operation + rv = appendOp(rv, p.Get) + rv = appendOp(rv, p.Put) + rv = appendOp(rv, p.Post) + rv = appendOp(rv, p.Delete) + rv = appendOp(rv, p.Head) + rv = appendOp(rv, p.Patch) + + return rv +} + +func appendOp(ops []*spec.Operation, op *spec.Operation) []*spec.Operation { + if op == nil { + return ops + } + + return append(ops, op) +} + +func mergeSecurityDefinitions(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { + for k, v := range m.SecurityDefinitions { + if _, exists := primary.SecurityDefinitions[k]; exists { + warn := fmt.Sprintf( + "SecurityDefinitions entry '%v' already exists in primary or higher priority mixin, skipping\n", k) + skipped = append(skipped, warn) + + continue + } + + primary.SecurityDefinitions[k] = v + } + + return +} + +func mergeSecurityRequirements(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { + for _, v := range m.Security { + found := false + for _, vv := range primary.Security { + if reflect.DeepEqual(v, vv) { + found = true + + break + } + } + + if found { + warn := fmt.Sprintf( + "Security requirement: '%v' already exists in primary or higher priority mixin, skipping\n", v) + skipped = append(skipped, warn) + + continue + } + primary.Security = append(primary.Security, v) + } + + return +} + +func mergeDefinitions(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { + for k, v := range m.Definitions { + // assume name collisions represent IDENTICAL type. careful. + if _, exists := primary.Definitions[k]; exists { + warn := fmt.Sprintf( + "definitions entry '%v' already exists in primary or higher priority mixin, skipping\n", k) + skipped = append(skipped, warn) + + continue + } + primary.Definitions[k] = v + } + + return +} + +func mergePaths(primary *spec.Swagger, m *spec.Swagger, opIds map[string]bool, mixIndex int) (skipped []string) { + if m.Paths != nil { + for k, v := range m.Paths.Paths { + if _, exists := primary.Paths.Paths[k]; exists { + warn := fmt.Sprintf( + "paths entry '%v' already exists in primary or higher priority mixin, skipping\n", k) + skipped = append(skipped, warn) + + continue + } + + // Swagger requires that operationIds be + // unique within a spec. If we find a + // collision we append "Mixin0" to the + // operatoinId we are adding, where 0 is mixin + // index. We assume that operationIds with + // all the proivded specs are already unique. + piops := pathItemOps(v) + for _, piop := range piops { + if opIds[piop.ID] { + piop.ID = fmt.Sprintf("%v%v%v", piop.ID, "Mixin", mixIndex) + } + opIds[piop.ID] = true + } + primary.Paths.Paths[k] = v + } + } + + return +} + +func mergeParameters(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { + for k, v := range m.Parameters { + // could try to rename on conflict but would + // have to fix $refs in the mixin. Complain + // for now + if _, exists := primary.Parameters[k]; exists { + warn := fmt.Sprintf( + "top level parameters entry '%v' already exists in primary or higher priority mixin, skipping\n", k) + skipped = append(skipped, warn) + + continue + } + primary.Parameters[k] = v + } + + return +} + +func mergeResponses(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { + for k, v := range m.Responses { + // could try to rename on conflict but would + // have to fix $refs in the mixin. Complain + // for now + if _, exists := primary.Responses[k]; exists { + warn := fmt.Sprintf( + "top level responses entry '%v' already exists in primary or higher priority mixin, skipping\n", k) + skipped = append(skipped, warn) + + continue + } + primary.Responses[k] = v + } + + return skipped +} + +func mergeConsumes(primary *spec.Swagger, m *spec.Swagger) []string { + for _, v := range m.Consumes { + found := false + for _, vv := range primary.Consumes { + if v == vv { + found = true + + break + } + } + + if found { + // no warning here: we just skip it + continue + } + primary.Consumes = append(primary.Consumes, v) + } + + return []string{} +} + +func mergeProduces(primary *spec.Swagger, m *spec.Swagger) []string { + for _, v := range m.Produces { + found := false + for _, vv := range primary.Produces { + if v == vv { + found = true + + break + } + } + + if found { + // no warning here: we just skip it + continue + } + primary.Produces = append(primary.Produces, v) + } + + return []string{} +} + +func mergeTags(primary *spec.Swagger, m *spec.Swagger) (skipped []string) { + for _, v := range m.Tags { + found := false + for _, vv := range primary.Tags { + if v.Name == vv.Name { + found = true + + break + } + } + + if found { + warn := fmt.Sprintf( + "top level tags entry with name '%v' already exists in primary or higher priority mixin, skipping\n", + v.Name, + ) + skipped = append(skipped, warn) + + continue + } + + primary.Tags = append(primary.Tags, v) + } + + return +} + +func mergeSchemes(primary *spec.Swagger, m *spec.Swagger) []string { + for _, v := range m.Schemes { + found := false + for _, vv := range primary.Schemes { + if v == vv { + found = true + + break + } + } + + if found { + // no warning here: we just skip it + continue + } + primary.Schemes = append(primary.Schemes, v) + } + + return []string{} +} + +func mergeSwaggerProps(primary *spec.Swagger, m *spec.Swagger) []string { + var skipped, skippedInfo, skippedDocs []string + + primary.Extensions, skipped = mergeExtensions(primary.Extensions, m.Extensions) + + // merging details in swagger top properties + if primary.Host == "" { + primary.Host = m.Host + } + + if primary.BasePath == "" { + primary.BasePath = m.BasePath + } + + if primary.Info == nil { + primary.Info = m.Info + } else if m.Info != nil { + skippedInfo = mergeInfo(primary.Info, m.Info) + skipped = append(skipped, skippedInfo...) + } + + if primary.ExternalDocs == nil { + primary.ExternalDocs = m.ExternalDocs + } else if m != nil { + skippedDocs = mergeExternalDocs(primary.ExternalDocs, m.ExternalDocs) + skipped = append(skipped, skippedDocs...) + } + + return skipped +} + +// nolint: unparam +func mergeExternalDocs(primary *spec.ExternalDocumentation, m *spec.ExternalDocumentation) []string { + if primary.Description == "" { + primary.Description = m.Description + } + + if primary.URL == "" { + primary.URL = m.URL + } + + return nil +} + +func mergeInfo(primary *spec.Info, m *spec.Info) []string { + var sk, skipped []string + + primary.Extensions, sk = mergeExtensions(primary.Extensions, m.Extensions) + skipped = append(skipped, sk...) + + if primary.Description == "" { + primary.Description = m.Description + } + + if primary.Title == "" { + primary.Description = m.Description + } + + if primary.TermsOfService == "" { + primary.TermsOfService = m.TermsOfService + } + + if primary.Version == "" { + primary.Version = m.Version + } + + if primary.Contact == nil { + primary.Contact = m.Contact + } else if m.Contact != nil { + var csk []string + primary.Contact.Extensions, csk = mergeExtensions(primary.Contact.Extensions, m.Contact.Extensions) + skipped = append(skipped, csk...) + + if primary.Contact.Name == "" { + primary.Contact.Name = m.Contact.Name + } + + if primary.Contact.URL == "" { + primary.Contact.URL = m.Contact.URL + } + + if primary.Contact.Email == "" { + primary.Contact.Email = m.Contact.Email + } + } + + if primary.License == nil { + primary.License = m.License + } else if m.License != nil { + var lsk []string + primary.License.Extensions, lsk = mergeExtensions(primary.License.Extensions, m.License.Extensions) + skipped = append(skipped, lsk...) + + if primary.License.Name == "" { + primary.License.Name = m.License.Name + } + + if primary.License.URL == "" { + primary.License.URL = m.License.URL + } + } + + return skipped +} + +func mergeExtensions(primary spec.Extensions, m spec.Extensions) (result spec.Extensions, skipped []string) { + if primary == nil { + result = m + + return + } + + if m == nil { + result = primary + + return + } + + result = primary + for k, v := range m { + if _, found := primary[k]; found { + skipped = append(skipped, k) + + continue + } + + primary[k] = v + } + + return +} + +func initPrimary(primary *spec.Swagger) { + if primary.SecurityDefinitions == nil { + primary.SecurityDefinitions = make(map[string]*spec.SecurityScheme) + } + + if primary.Security == nil { + primary.Security = make([]map[string][]string, 0, 10) + } + + if primary.Produces == nil { + primary.Produces = make([]string, 0, 10) + } + + if primary.Consumes == nil { + primary.Consumes = make([]string, 0, 10) + } + + if primary.Tags == nil { + primary.Tags = make([]spec.Tag, 0, 10) + } + + if primary.Schemes == nil { + primary.Schemes = make([]string, 0, 10) + } + + if primary.Paths == nil { + primary.Paths = &spec.Paths{Paths: make(map[string]spec.PathItem)} + } + + if primary.Paths.Paths == nil { + primary.Paths.Paths = make(map[string]spec.PathItem) + } + + if primary.Definitions == nil { + primary.Definitions = make(spec.Definitions) + } + + if primary.Parameters == nil { + primary.Parameters = make(map[string]spec.Parameter) + } + + if primary.Responses == nil { + primary.Responses = make(map[string]spec.Response) + } +} diff --git a/vendor/github.com/go-openapi/analysis/schema.go b/vendor/github.com/go-openapi/analysis/schema.go new file mode 100644 index 00000000000..fc055095cbb --- /dev/null +++ b/vendor/github.com/go-openapi/analysis/schema.go @@ -0,0 +1,256 @@ +package analysis + +import ( + "fmt" + + "github.com/go-openapi/spec" + "github.com/go-openapi/strfmt" +) + +// SchemaOpts configures the schema analyzer +type SchemaOpts struct { + Schema *spec.Schema + Root interface{} + BasePath string + _ struct{} +} + +// Schema analysis, will classify the schema according to known +// patterns. +func Schema(opts SchemaOpts) (*AnalyzedSchema, error) { + if opts.Schema == nil { + return nil, fmt.Errorf("no schema to analyze") + } + + a := &AnalyzedSchema{ + schema: opts.Schema, + root: opts.Root, + basePath: opts.BasePath, + } + + a.initializeFlags() + a.inferKnownType() + a.inferEnum() + a.inferBaseType() + + if err := a.inferMap(); err != nil { + return nil, err + } + if err := a.inferArray(); err != nil { + return nil, err + } + + a.inferTuple() + + if err := a.inferFromRef(); err != nil { + return nil, err + } + + a.inferSimpleSchema() + + return a, nil +} + +// AnalyzedSchema indicates what the schema represents +type AnalyzedSchema struct { + schema *spec.Schema + root interface{} + basePath string + + hasProps bool + hasAllOf bool + hasItems bool + hasAdditionalProps bool + hasAdditionalItems bool + hasRef bool + + IsKnownType bool + IsSimpleSchema bool + IsArray bool + IsSimpleArray bool + IsMap bool + IsSimpleMap bool + IsExtendedObject bool + IsTuple bool + IsTupleWithExtra bool + IsBaseType bool + IsEnum bool +} + +// Inherits copies value fields from other onto this schema +func (a *AnalyzedSchema) inherits(other *AnalyzedSchema) { + if other == nil { + return + } + a.hasProps = other.hasProps + a.hasAllOf = other.hasAllOf + a.hasItems = other.hasItems + a.hasAdditionalItems = other.hasAdditionalItems + a.hasAdditionalProps = other.hasAdditionalProps + a.hasRef = other.hasRef + + a.IsKnownType = other.IsKnownType + a.IsSimpleSchema = other.IsSimpleSchema + a.IsArray = other.IsArray + a.IsSimpleArray = other.IsSimpleArray + a.IsMap = other.IsMap + a.IsSimpleMap = other.IsSimpleMap + a.IsExtendedObject = other.IsExtendedObject + a.IsTuple = other.IsTuple + a.IsTupleWithExtra = other.IsTupleWithExtra + a.IsBaseType = other.IsBaseType + a.IsEnum = other.IsEnum +} + +func (a *AnalyzedSchema) inferFromRef() error { + if a.hasRef { + sch := new(spec.Schema) + sch.Ref = a.schema.Ref + err := spec.ExpandSchema(sch, a.root, nil) + if err != nil { + return err + } + rsch, err := Schema(SchemaOpts{ + Schema: sch, + Root: a.root, + BasePath: a.basePath, + }) + if err != nil { + // NOTE(fredbi): currently the only cause for errors is + // unresolved ref. Since spec.ExpandSchema() expands the + // schema recursively, there is no chance to get there, + // until we add more causes for error in this schema analysis. + return err + } + a.inherits(rsch) + } + + return nil +} + +func (a *AnalyzedSchema) inferSimpleSchema() { + a.IsSimpleSchema = a.IsKnownType || a.IsSimpleArray || a.IsSimpleMap +} + +func (a *AnalyzedSchema) inferKnownType() { + tpe := a.schema.Type + format := a.schema.Format + a.IsKnownType = tpe.Contains("boolean") || + tpe.Contains("integer") || + tpe.Contains("number") || + tpe.Contains("string") || + (format != "" && strfmt.Default.ContainsName(format)) || + (a.isObjectType() && !a.hasProps && !a.hasAllOf && !a.hasAdditionalProps && !a.hasAdditionalItems) +} + +func (a *AnalyzedSchema) inferMap() error { + if !a.isObjectType() { + return nil + } + + hasExtra := a.hasProps || a.hasAllOf + a.IsMap = a.hasAdditionalProps && !hasExtra + a.IsExtendedObject = a.hasAdditionalProps && hasExtra + + if !a.IsMap { + return nil + } + + // maps + if a.schema.AdditionalProperties.Schema != nil { + msch, err := Schema(SchemaOpts{ + Schema: a.schema.AdditionalProperties.Schema, + Root: a.root, + BasePath: a.basePath, + }) + if err != nil { + return err + } + a.IsSimpleMap = msch.IsSimpleSchema + } else if a.schema.AdditionalProperties.Allows { + a.IsSimpleMap = true + } + + return nil +} + +func (a *AnalyzedSchema) inferArray() error { + // an array has Items defined as an object schema, otherwise we qualify this JSON array as a tuple + // (yes, even if the Items array contains only one element). + // arrays in JSON schema may be unrestricted (i.e no Items specified). + // Note that arrays in Swagger MUST have Items. Nonetheless, we analyze unrestricted arrays. + // + // NOTE: the spec package misses the distinction between: + // items: [] and items: {}, so we consider both arrays here. + a.IsArray = a.isArrayType() && (a.schema.Items == nil || a.schema.Items.Schemas == nil) + if a.IsArray && a.hasItems { + if a.schema.Items.Schema != nil { + itsch, err := Schema(SchemaOpts{ + Schema: a.schema.Items.Schema, + Root: a.root, + BasePath: a.basePath, + }) + if err != nil { + return err + } + + a.IsSimpleArray = itsch.IsSimpleSchema + } + } + + if a.IsArray && !a.hasItems { + a.IsSimpleArray = true + } + + return nil +} + +func (a *AnalyzedSchema) inferTuple() { + tuple := a.hasItems && a.schema.Items.Schemas != nil + a.IsTuple = tuple && !a.hasAdditionalItems + a.IsTupleWithExtra = tuple && a.hasAdditionalItems +} + +func (a *AnalyzedSchema) inferBaseType() { + if a.isObjectType() { + a.IsBaseType = a.schema.Discriminator != "" + } +} + +func (a *AnalyzedSchema) inferEnum() { + a.IsEnum = len(a.schema.Enum) > 0 +} + +func (a *AnalyzedSchema) initializeFlags() { + a.hasProps = len(a.schema.Properties) > 0 + a.hasAllOf = len(a.schema.AllOf) > 0 + a.hasRef = a.schema.Ref.String() != "" + + a.hasItems = a.schema.Items != nil && + (a.schema.Items.Schema != nil || len(a.schema.Items.Schemas) > 0) + + a.hasAdditionalProps = a.schema.AdditionalProperties != nil && + (a.schema.AdditionalProperties.Schema != nil || a.schema.AdditionalProperties.Allows) + + a.hasAdditionalItems = a.schema.AdditionalItems != nil && + (a.schema.AdditionalItems.Schema != nil || a.schema.AdditionalItems.Allows) +} + +func (a *AnalyzedSchema) isObjectType() bool { + return !a.hasRef && (a.schema.Type == nil || a.schema.Type.Contains("") || a.schema.Type.Contains("object")) +} + +func (a *AnalyzedSchema) isArrayType() bool { + return !a.hasRef && (a.schema.Type != nil && a.schema.Type.Contains("array")) +} + +// isAnalyzedAsComplex determines if an analyzed schema is eligible to flattening (i.e. it is "complex"). +// +// Complex means the schema is any of: +// - a simple type (primitive) +// - an array of something (items are possibly complex ; if this is the case, items will generate a definition) +// - a map of something (additionalProperties are possibly complex ; if this is the case, additionalProperties will +// generate a definition) +func (a *AnalyzedSchema) isAnalyzedAsComplex() bool { + return !a.IsSimpleSchema && !a.IsArray && !a.IsMap +} diff --git a/vendor/github.com/go-openapi/errors/.gitattributes b/vendor/github.com/go-openapi/errors/.gitattributes new file mode 100644 index 00000000000..a0717e4b3b9 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/.gitattributes @@ -0,0 +1 @@ +*.go text eol=lf \ No newline at end of file diff --git a/vendor/github.com/go-openapi/errors/.gitignore b/vendor/github.com/go-openapi/errors/.gitignore new file mode 100644 index 00000000000..dd91ed6a04e --- /dev/null +++ b/vendor/github.com/go-openapi/errors/.gitignore @@ -0,0 +1,2 @@ +secrets.yml +coverage.out diff --git a/vendor/github.com/go-openapi/errors/.golangci.yml b/vendor/github.com/go-openapi/errors/.golangci.yml new file mode 100644 index 00000000000..449a43c2bc8 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/.golangci.yml @@ -0,0 +1,46 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 30 + maligned: + suggest-new: true + dupl: + threshold: 100 + goconst: + min-len: 2 + min-occurrences: 4 +linters: + enable-all: true + disable: + - maligned + - lll + - gochecknoglobals + - godox + - gocognit + - whitespace + - wsl + - funlen + - gochecknoglobals + - gochecknoinits + - scopelint + - wrapcheck + - exhaustivestruct + - exhaustive + - nlreturn + - testpackage + - gci + - gofumpt + - goerr113 + - gomnd + - tparallel + - nestif + - godot + - errorlint + - paralleltest + - tparallel + - cyclop + - errname + - varnamelen diff --git a/vendor/github.com/go-openapi/errors/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/errors/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..9322b065e37 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/errors/LICENSE b/vendor/github.com/go-openapi/errors/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/errors/README.md b/vendor/github.com/go-openapi/errors/README.md new file mode 100644 index 00000000000..4aac049e608 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/README.md @@ -0,0 +1,11 @@ +# OpenAPI errors + +[![Build Status](https://travis-ci.org/go-openapi/errors.svg?branch=master)](https://travis-ci.org/go-openapi/errors) +[![codecov](https://codecov.io/gh/go-openapi/errors/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/errors) +[![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/errors/master/LICENSE) +[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/errors.svg)](https://pkg.go.dev/github.com/go-openapi/errors) +[![GolangCI](https://golangci.com/badges/github.com/go-openapi/errors.svg)](https://golangci.com) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/errors)](https://goreportcard.com/report/github.com/go-openapi/errors) + +Shared errors and error interface used throughout the various libraries found in the go-openapi toolkit. diff --git a/vendor/github.com/go-openapi/errors/api.go b/vendor/github.com/go-openapi/errors/api.go new file mode 100644 index 00000000000..854d6eec1e1 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/api.go @@ -0,0 +1,181 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errors + +import ( + "encoding/json" + "fmt" + "net/http" + "reflect" + "strings" +) + +// DefaultHTTPCode is used when the error Code cannot be used as an HTTP code. +var DefaultHTTPCode = http.StatusUnprocessableEntity + +// Error represents a error interface all swagger framework errors implement +type Error interface { + error + Code() int32 +} + +type apiError struct { + code int32 + message string +} + +func (a *apiError) Error() string { + return a.message +} + +func (a *apiError) Code() int32 { + return a.code +} + +// MarshalJSON implements the JSON encoding interface +func (a apiError) MarshalJSON() ([]byte, error) { + return json.Marshal(map[string]interface{}{ + "code": a.code, + "message": a.message, + }) +} + +// New creates a new API error with a code and a message +func New(code int32, message string, args ...interface{}) Error { + if len(args) > 0 { + return &apiError{code, fmt.Sprintf(message, args...)} + } + return &apiError{code, message} +} + +// NotFound creates a new not found error +func NotFound(message string, args ...interface{}) Error { + if message == "" { + message = "Not found" + } + return New(http.StatusNotFound, fmt.Sprintf(message, args...)) +} + +// NotImplemented creates a new not implemented error +func NotImplemented(message string) Error { + return New(http.StatusNotImplemented, message) +} + +// MethodNotAllowedError represents an error for when the path matches but the method doesn't +type MethodNotAllowedError struct { + code int32 + Allowed []string + message string +} + +func (m *MethodNotAllowedError) Error() string { + return m.message +} + +// Code the error code +func (m *MethodNotAllowedError) Code() int32 { + return m.code +} + +// MarshalJSON implements the JSON encoding interface +func (m MethodNotAllowedError) MarshalJSON() ([]byte, error) { + return json.Marshal(map[string]interface{}{ + "code": m.code, + "message": m.message, + "allowed": m.Allowed, + }) +} + +func errorAsJSON(err Error) []byte { + b, _ := json.Marshal(struct { + Code int32 `json:"code"` + Message string `json:"message"` + }{err.Code(), err.Error()}) + return b +} + +func flattenComposite(errs *CompositeError) *CompositeError { + var res []error + for _, er := range errs.Errors { + switch e := er.(type) { + case *CompositeError: + if len(e.Errors) > 0 { + flat := flattenComposite(e) + if len(flat.Errors) > 0 { + res = append(res, flat.Errors...) + } + } + default: + if e != nil { + res = append(res, e) + } + } + } + return CompositeValidationError(res...) +} + +// MethodNotAllowed creates a new method not allowed error +func MethodNotAllowed(requested string, allow []string) Error { + msg := fmt.Sprintf("method %s is not allowed, but [%s] are", requested, strings.Join(allow, ",")) + return &MethodNotAllowedError{code: http.StatusMethodNotAllowed, Allowed: allow, message: msg} +} + +// ServeError the error handler interface implementation +func ServeError(rw http.ResponseWriter, r *http.Request, err error) { + rw.Header().Set("Content-Type", "application/json") + switch e := err.(type) { + case *CompositeError: + er := flattenComposite(e) + // strips composite errors to first element only + if len(er.Errors) > 0 { + ServeError(rw, r, er.Errors[0]) + } else { + // guard against empty CompositeError (invalid construct) + ServeError(rw, r, nil) + } + case *MethodNotAllowedError: + rw.Header().Add("Allow", strings.Join(err.(*MethodNotAllowedError).Allowed, ",")) + rw.WriteHeader(asHTTPCode(int(e.Code()))) + if r == nil || r.Method != http.MethodHead { + _, _ = rw.Write(errorAsJSON(e)) + } + case Error: + value := reflect.ValueOf(e) + if value.Kind() == reflect.Ptr && value.IsNil() { + rw.WriteHeader(http.StatusInternalServerError) + _, _ = rw.Write(errorAsJSON(New(http.StatusInternalServerError, "Unknown error"))) + return + } + rw.WriteHeader(asHTTPCode(int(e.Code()))) + if r == nil || r.Method != http.MethodHead { + _, _ = rw.Write(errorAsJSON(e)) + } + case nil: + rw.WriteHeader(http.StatusInternalServerError) + _, _ = rw.Write(errorAsJSON(New(http.StatusInternalServerError, "Unknown error"))) + default: + rw.WriteHeader(http.StatusInternalServerError) + if r == nil || r.Method != http.MethodHead { + _, _ = rw.Write(errorAsJSON(New(http.StatusInternalServerError, err.Error()))) + } + } +} + +func asHTTPCode(input int) int { + if input >= 600 { + return DefaultHTTPCode + } + return input +} diff --git a/vendor/github.com/go-openapi/errors/auth.go b/vendor/github.com/go-openapi/errors/auth.go new file mode 100644 index 00000000000..0545b501bd7 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/auth.go @@ -0,0 +1,22 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errors + +import "net/http" + +// Unauthenticated returns an unauthenticated error +func Unauthenticated(scheme string) Error { + return New(http.StatusUnauthorized, "unauthenticated for %s", scheme) +} diff --git a/vendor/github.com/go-openapi/errors/doc.go b/vendor/github.com/go-openapi/errors/doc.go new file mode 100644 index 00000000000..963d4274078 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/doc.go @@ -0,0 +1,28 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* + +Package errors provides an Error interface and several concrete types +implementing this interface to manage API errors and JSON-schema validation +errors. + +A middleware handler ServeError() is provided to serve the errors types +it defines. + +It is used throughout the various go-openapi toolkit libraries +(https://github.com/go-openapi). + +*/ +package errors diff --git a/vendor/github.com/go-openapi/errors/headers.go b/vendor/github.com/go-openapi/errors/headers.go new file mode 100644 index 00000000000..dfebe8f95f0 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/headers.go @@ -0,0 +1,103 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errors + +import ( + "encoding/json" + "fmt" + "net/http" +) + +// Validation represents a failure of a precondition +type Validation struct { + code int32 + Name string + In string + Value interface{} + message string + Values []interface{} +} + +func (e *Validation) Error() string { + return e.message +} + +// Code the error code +func (e *Validation) Code() int32 { + return e.code +} + +// MarshalJSON implements the JSON encoding interface +func (e Validation) MarshalJSON() ([]byte, error) { + return json.Marshal(map[string]interface{}{ + "code": e.code, + "message": e.message, + "in": e.In, + "name": e.Name, + "value": e.Value, + "values": e.Values, + }) +} + +// ValidateName sets the name for a validation or updates it for a nested property +func (e *Validation) ValidateName(name string) *Validation { + if name != "" { + if e.Name == "" { + e.Name = name + e.message = name + e.message + } else { + e.Name = name + "." + e.Name + e.message = name + "." + e.message + } + } + return e +} + +const ( + contentTypeFail = `unsupported media type %q, only %v are allowed` + responseFormatFail = `unsupported media type requested, only %v are available` +) + +// InvalidContentType error for an invalid content type +func InvalidContentType(value string, allowed []string) *Validation { + values := make([]interface{}, 0, len(allowed)) + for _, v := range allowed { + values = append(values, v) + } + return &Validation{ + code: http.StatusUnsupportedMediaType, + Name: "Content-Type", + In: "header", + Value: value, + Values: values, + message: fmt.Sprintf(contentTypeFail, value, allowed), + } +} + +// InvalidResponseFormat error for an unacceptable response format request +func InvalidResponseFormat(value string, allowed []string) *Validation { + values := make([]interface{}, 0, len(allowed)) + for _, v := range allowed { + values = append(values, v) + } + return &Validation{ + code: http.StatusNotAcceptable, + Name: "Accept", + In: "header", + Value: value, + Values: values, + message: fmt.Sprintf(responseFormatFail, allowed), + } +} diff --git a/vendor/github.com/go-openapi/errors/middleware.go b/vendor/github.com/go-openapi/errors/middleware.go new file mode 100644 index 00000000000..c26ad484ebc --- /dev/null +++ b/vendor/github.com/go-openapi/errors/middleware.go @@ -0,0 +1,51 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errors + +import ( + "bytes" + "fmt" + "strings" +) + +// APIVerificationFailed is an error that contains all the missing info for a mismatched section +// between the api registrations and the api spec +type APIVerificationFailed struct { + Section string `json:"section,omitempty"` + MissingSpecification []string `json:"missingSpecification,omitempty"` + MissingRegistration []string `json:"missingRegistration,omitempty"` +} + +// +func (v *APIVerificationFailed) Error() string { + buf := bytes.NewBuffer(nil) + + hasRegMissing := len(v.MissingRegistration) > 0 + hasSpecMissing := len(v.MissingSpecification) > 0 + + if hasRegMissing { + buf.WriteString(fmt.Sprintf("missing [%s] %s registrations", strings.Join(v.MissingRegistration, ", "), v.Section)) + } + + if hasRegMissing && hasSpecMissing { + buf.WriteString("\n") + } + + if hasSpecMissing { + buf.WriteString(fmt.Sprintf("missing from spec file [%s] %s", strings.Join(v.MissingSpecification, ", "), v.Section)) + } + + return buf.String() +} diff --git a/vendor/github.com/go-openapi/errors/parsing.go b/vendor/github.com/go-openapi/errors/parsing.go new file mode 100644 index 00000000000..5096e1ea7be --- /dev/null +++ b/vendor/github.com/go-openapi/errors/parsing.go @@ -0,0 +1,78 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errors + +import ( + "encoding/json" + "fmt" +) + +// ParseError represents a parsing error +type ParseError struct { + code int32 + Name string + In string + Value string + Reason error + message string +} + +func (e *ParseError) Error() string { + return e.message +} + +// Code returns the http status code for this error +func (e *ParseError) Code() int32 { + return e.code +} + +// MarshalJSON implements the JSON encoding interface +func (e ParseError) MarshalJSON() ([]byte, error) { + var reason string + if e.Reason != nil { + reason = e.Reason.Error() + } + return json.Marshal(map[string]interface{}{ + "code": e.code, + "message": e.message, + "in": e.In, + "name": e.Name, + "value": e.Value, + "reason": reason, + }) +} + +const ( + parseErrorTemplContent = `parsing %s %s from %q failed, because %s` + parseErrorTemplContentNoIn = `parsing %s from %q failed, because %s` +) + +// NewParseError creates a new parse error +func NewParseError(name, in, value string, reason error) *ParseError { + var msg string + if in == "" { + msg = fmt.Sprintf(parseErrorTemplContentNoIn, name, value, reason) + } else { + msg = fmt.Sprintf(parseErrorTemplContent, name, in, value, reason) + } + return &ParseError{ + code: 400, + Name: name, + In: in, + Value: value, + Reason: reason, + message: msg, + } +} diff --git a/vendor/github.com/go-openapi/errors/schema.go b/vendor/github.com/go-openapi/errors/schema.go new file mode 100644 index 00000000000..da5f6c78cb5 --- /dev/null +++ b/vendor/github.com/go-openapi/errors/schema.go @@ -0,0 +1,611 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errors + +import ( + "encoding/json" + "fmt" + "strings" +) + +const ( + invalidType = "%s is an invalid type name" + typeFail = "%s in %s must be of type %s" + typeFailWithData = "%s in %s must be of type %s: %q" + typeFailWithError = "%s in %s must be of type %s, because: %s" + requiredFail = "%s in %s is required" + readOnlyFail = "%s in %s is readOnly" + tooLongMessage = "%s in %s should be at most %d chars long" + tooShortMessage = "%s in %s should be at least %d chars long" + patternFail = "%s in %s should match '%s'" + enumFail = "%s in %s should be one of %v" + multipleOfFail = "%s in %s should be a multiple of %v" + maxIncFail = "%s in %s should be less than or equal to %v" + maxExcFail = "%s in %s should be less than %v" + minIncFail = "%s in %s should be greater than or equal to %v" + minExcFail = "%s in %s should be greater than %v" + uniqueFail = "%s in %s shouldn't contain duplicates" + maxItemsFail = "%s in %s should have at most %d items" + minItemsFail = "%s in %s should have at least %d items" + typeFailNoIn = "%s must be of type %s" + typeFailWithDataNoIn = "%s must be of type %s: %q" + typeFailWithErrorNoIn = "%s must be of type %s, because: %s" + requiredFailNoIn = "%s is required" + readOnlyFailNoIn = "%s is readOnly" + tooLongMessageNoIn = "%s should be at most %d chars long" + tooShortMessageNoIn = "%s should be at least %d chars long" + patternFailNoIn = "%s should match '%s'" + enumFailNoIn = "%s should be one of %v" + multipleOfFailNoIn = "%s should be a multiple of %v" + maxIncFailNoIn = "%s should be less than or equal to %v" + maxExcFailNoIn = "%s should be less than %v" + minIncFailNoIn = "%s should be greater than or equal to %v" + minExcFailNoIn = "%s should be greater than %v" + uniqueFailNoIn = "%s shouldn't contain duplicates" + maxItemsFailNoIn = "%s should have at most %d items" + minItemsFailNoIn = "%s should have at least %d items" + noAdditionalItems = "%s in %s can't have additional items" + noAdditionalItemsNoIn = "%s can't have additional items" + tooFewProperties = "%s in %s should have at least %d properties" + tooFewPropertiesNoIn = "%s should have at least %d properties" + tooManyProperties = "%s in %s should have at most %d properties" + tooManyPropertiesNoIn = "%s should have at most %d properties" + unallowedProperty = "%s.%s in %s is a forbidden property" + unallowedPropertyNoIn = "%s.%s is a forbidden property" + failedAllPatternProps = "%s.%s in %s failed all pattern properties" + failedAllPatternPropsNoIn = "%s.%s failed all pattern properties" + multipleOfMustBePositive = "factor MultipleOf declared for %s must be positive: %v" +) + +// All code responses can be used to differentiate errors for different handling +// by the consuming program +const ( + // CompositeErrorCode remains 422 for backwards-compatibility + // and to separate it from validation errors with cause + CompositeErrorCode = 422 + // InvalidTypeCode is used for any subclass of invalid types + InvalidTypeCode = 600 + iota + RequiredFailCode + TooLongFailCode + TooShortFailCode + PatternFailCode + EnumFailCode + MultipleOfFailCode + MaxFailCode + MinFailCode + UniqueFailCode + MaxItemsFailCode + MinItemsFailCode + NoAdditionalItemsCode + TooFewPropertiesCode + TooManyPropertiesCode + UnallowedPropertyCode + FailedAllPatternPropsCode + MultipleOfMustBePositiveCode + ReadOnlyFailCode +) + +// CompositeError is an error that groups several errors together +type CompositeError struct { + Errors []error + code int32 + message string +} + +// Code for this error +func (c *CompositeError) Code() int32 { + return c.code +} + +func (c *CompositeError) Error() string { + if len(c.Errors) > 0 { + msgs := []string{c.message + ":"} + for _, e := range c.Errors { + msgs = append(msgs, e.Error()) + } + return strings.Join(msgs, "\n") + } + return c.message +} + +// MarshalJSON implements the JSON encoding interface +func (c CompositeError) MarshalJSON() ([]byte, error) { + return json.Marshal(map[string]interface{}{ + "code": c.code, + "message": c.message, + "errors": c.Errors, + }) +} + +// CompositeValidationError an error to wrap a bunch of other errors +func CompositeValidationError(errors ...error) *CompositeError { + return &CompositeError{ + code: CompositeErrorCode, + Errors: append([]error{}, errors...), + message: "validation failure list", + } +} + +// ValidateName recursively sets the name for all validations or updates them for nested properties +func (c *CompositeError) ValidateName(name string) *CompositeError { + for i, e := range c.Errors { + if ve, ok := e.(*Validation); ok { + c.Errors[i] = ve.ValidateName(name) + } else if ce, ok := e.(*CompositeError); ok { + c.Errors[i] = ce.ValidateName(name) + } + } + + return c +} + +// FailedAllPatternProperties an error for when the property doesn't match a pattern +func FailedAllPatternProperties(name, in, key string) *Validation { + msg := fmt.Sprintf(failedAllPatternProps, name, key, in) + if in == "" { + msg = fmt.Sprintf(failedAllPatternPropsNoIn, name, key) + } + return &Validation{ + code: FailedAllPatternPropsCode, + Name: name, + In: in, + Value: key, + message: msg, + } +} + +// PropertyNotAllowed an error for when the property doesn't match a pattern +func PropertyNotAllowed(name, in, key string) *Validation { + msg := fmt.Sprintf(unallowedProperty, name, key, in) + if in == "" { + msg = fmt.Sprintf(unallowedPropertyNoIn, name, key) + } + return &Validation{ + code: UnallowedPropertyCode, + Name: name, + In: in, + Value: key, + message: msg, + } +} + +// TooFewProperties an error for an object with too few properties +func TooFewProperties(name, in string, n int64) *Validation { + msg := fmt.Sprintf(tooFewProperties, name, in, n) + if in == "" { + msg = fmt.Sprintf(tooFewPropertiesNoIn, name, n) + } + return &Validation{ + code: TooFewPropertiesCode, + Name: name, + In: in, + Value: n, + message: msg, + } +} + +// TooManyProperties an error for an object with too many properties +func TooManyProperties(name, in string, n int64) *Validation { + msg := fmt.Sprintf(tooManyProperties, name, in, n) + if in == "" { + msg = fmt.Sprintf(tooManyPropertiesNoIn, name, n) + } + return &Validation{ + code: TooManyPropertiesCode, + Name: name, + In: in, + Value: n, + message: msg, + } +} + +// AdditionalItemsNotAllowed an error for invalid additional items +func AdditionalItemsNotAllowed(name, in string) *Validation { + msg := fmt.Sprintf(noAdditionalItems, name, in) + if in == "" { + msg = fmt.Sprintf(noAdditionalItemsNoIn, name) + } + return &Validation{ + code: NoAdditionalItemsCode, + Name: name, + In: in, + message: msg, + } +} + +// InvalidCollectionFormat another flavor of invalid type error +func InvalidCollectionFormat(name, in, format string) *Validation { + return &Validation{ + code: InvalidTypeCode, + Name: name, + In: in, + Value: format, + message: fmt.Sprintf("the collection format %q is not supported for the %s param %q", format, in, name), + } +} + +// InvalidTypeName an error for when the type is invalid +func InvalidTypeName(typeName string) *Validation { + return &Validation{ + code: InvalidTypeCode, + Value: typeName, + message: fmt.Sprintf(invalidType, typeName), + } +} + +// InvalidType creates an error for when the type is invalid +func InvalidType(name, in, typeName string, value interface{}) *Validation { + var message string + + if in != "" { + switch value.(type) { + case string: + message = fmt.Sprintf(typeFailWithData, name, in, typeName, value) + case error: + message = fmt.Sprintf(typeFailWithError, name, in, typeName, value) + default: + message = fmt.Sprintf(typeFail, name, in, typeName) + } + } else { + switch value.(type) { + case string: + message = fmt.Sprintf(typeFailWithDataNoIn, name, typeName, value) + case error: + message = fmt.Sprintf(typeFailWithErrorNoIn, name, typeName, value) + default: + message = fmt.Sprintf(typeFailNoIn, name, typeName) + } + } + + return &Validation{ + code: InvalidTypeCode, + Name: name, + In: in, + Value: value, + message: message, + } + +} + +// DuplicateItems error for when an array contains duplicates +func DuplicateItems(name, in string) *Validation { + msg := fmt.Sprintf(uniqueFail, name, in) + if in == "" { + msg = fmt.Sprintf(uniqueFailNoIn, name) + } + return &Validation{ + code: UniqueFailCode, + Name: name, + In: in, + message: msg, + } +} + +// TooManyItems error for when an array contains too many items +func TooManyItems(name, in string, max int64, value interface{}) *Validation { + msg := fmt.Sprintf(maxItemsFail, name, in, max) + if in == "" { + msg = fmt.Sprintf(maxItemsFailNoIn, name, max) + } + + return &Validation{ + code: MaxItemsFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// TooFewItems error for when an array contains too few items +func TooFewItems(name, in string, min int64, value interface{}) *Validation { + msg := fmt.Sprintf(minItemsFail, name, in, min) + if in == "" { + msg = fmt.Sprintf(minItemsFailNoIn, name, min) + } + return &Validation{ + code: MinItemsFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// ExceedsMaximumInt error for when maximum validation fails +func ExceedsMaximumInt(name, in string, max int64, exclusive bool, value interface{}) *Validation { + var message string + if in == "" { + m := maxIncFailNoIn + if exclusive { + m = maxExcFailNoIn + } + message = fmt.Sprintf(m, name, max) + } else { + m := maxIncFail + if exclusive { + m = maxExcFail + } + message = fmt.Sprintf(m, name, in, max) + } + return &Validation{ + code: MaxFailCode, + Name: name, + In: in, + Value: value, + message: message, + } +} + +// ExceedsMaximumUint error for when maximum validation fails +func ExceedsMaximumUint(name, in string, max uint64, exclusive bool, value interface{}) *Validation { + var message string + if in == "" { + m := maxIncFailNoIn + if exclusive { + m = maxExcFailNoIn + } + message = fmt.Sprintf(m, name, max) + } else { + m := maxIncFail + if exclusive { + m = maxExcFail + } + message = fmt.Sprintf(m, name, in, max) + } + return &Validation{ + code: MaxFailCode, + Name: name, + In: in, + Value: value, + message: message, + } +} + +// ExceedsMaximum error for when maximum validation fails +func ExceedsMaximum(name, in string, max float64, exclusive bool, value interface{}) *Validation { + var message string + if in == "" { + m := maxIncFailNoIn + if exclusive { + m = maxExcFailNoIn + } + message = fmt.Sprintf(m, name, max) + } else { + m := maxIncFail + if exclusive { + m = maxExcFail + } + message = fmt.Sprintf(m, name, in, max) + } + return &Validation{ + code: MaxFailCode, + Name: name, + In: in, + Value: value, + message: message, + } +} + +// ExceedsMinimumInt error for when minimum validation fails +func ExceedsMinimumInt(name, in string, min int64, exclusive bool, value interface{}) *Validation { + var message string + if in == "" { + m := minIncFailNoIn + if exclusive { + m = minExcFailNoIn + } + message = fmt.Sprintf(m, name, min) + } else { + m := minIncFail + if exclusive { + m = minExcFail + } + message = fmt.Sprintf(m, name, in, min) + } + return &Validation{ + code: MinFailCode, + Name: name, + In: in, + Value: value, + message: message, + } +} + +// ExceedsMinimumUint error for when minimum validation fails +func ExceedsMinimumUint(name, in string, min uint64, exclusive bool, value interface{}) *Validation { + var message string + if in == "" { + m := minIncFailNoIn + if exclusive { + m = minExcFailNoIn + } + message = fmt.Sprintf(m, name, min) + } else { + m := minIncFail + if exclusive { + m = minExcFail + } + message = fmt.Sprintf(m, name, in, min) + } + return &Validation{ + code: MinFailCode, + Name: name, + In: in, + Value: value, + message: message, + } +} + +// ExceedsMinimum error for when minimum validation fails +func ExceedsMinimum(name, in string, min float64, exclusive bool, value interface{}) *Validation { + var message string + if in == "" { + m := minIncFailNoIn + if exclusive { + m = minExcFailNoIn + } + message = fmt.Sprintf(m, name, min) + } else { + m := minIncFail + if exclusive { + m = minExcFail + } + message = fmt.Sprintf(m, name, in, min) + } + return &Validation{ + code: MinFailCode, + Name: name, + In: in, + Value: value, + message: message, + } +} + +// NotMultipleOf error for when multiple of validation fails +func NotMultipleOf(name, in string, multiple, value interface{}) *Validation { + var msg string + if in == "" { + msg = fmt.Sprintf(multipleOfFailNoIn, name, multiple) + } else { + msg = fmt.Sprintf(multipleOfFail, name, in, multiple) + } + return &Validation{ + code: MultipleOfFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// EnumFail error for when an enum validation fails +func EnumFail(name, in string, value interface{}, values []interface{}) *Validation { + var msg string + if in == "" { + msg = fmt.Sprintf(enumFailNoIn, name, values) + } else { + msg = fmt.Sprintf(enumFail, name, in, values) + } + + return &Validation{ + code: EnumFailCode, + Name: name, + In: in, + Value: value, + Values: values, + message: msg, + } +} + +// Required error for when a value is missing +func Required(name, in string, value interface{}) *Validation { + var msg string + if in == "" { + msg = fmt.Sprintf(requiredFailNoIn, name) + } else { + msg = fmt.Sprintf(requiredFail, name, in) + } + return &Validation{ + code: RequiredFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// ReadOnly error for when a value is present in request +func ReadOnly(name, in string, value interface{}) *Validation { + var msg string + if in == "" { + msg = fmt.Sprintf(readOnlyFailNoIn, name) + } else { + msg = fmt.Sprintf(readOnlyFail, name, in) + } + return &Validation{ + code: ReadOnlyFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// TooLong error for when a string is too long +func TooLong(name, in string, max int64, value interface{}) *Validation { + var msg string + if in == "" { + msg = fmt.Sprintf(tooLongMessageNoIn, name, max) + } else { + msg = fmt.Sprintf(tooLongMessage, name, in, max) + } + return &Validation{ + code: TooLongFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// TooShort error for when a string is too short +func TooShort(name, in string, min int64, value interface{}) *Validation { + var msg string + if in == "" { + msg = fmt.Sprintf(tooShortMessageNoIn, name, min) + } else { + msg = fmt.Sprintf(tooShortMessage, name, in, min) + } + + return &Validation{ + code: TooShortFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// FailedPattern error for when a string fails a regex pattern match +// the pattern that is returned is the ECMA syntax version of the pattern not the golang version. +func FailedPattern(name, in, pattern string, value interface{}) *Validation { + var msg string + if in == "" { + msg = fmt.Sprintf(patternFailNoIn, name, pattern) + } else { + msg = fmt.Sprintf(patternFail, name, in, pattern) + } + + return &Validation{ + code: PatternFailCode, + Name: name, + In: in, + Value: value, + message: msg, + } +} + +// MultipleOfMustBePositive error for when a +// multipleOf factor is negative +func MultipleOfMustBePositive(name, in string, factor interface{}) *Validation { + return &Validation{ + code: MultipleOfMustBePositiveCode, + Name: name, + In: in, + Value: factor, + message: fmt.Sprintf(multipleOfMustBePositive, name, factor), + } +} diff --git a/vendor/github.com/go-openapi/jsonpointer/.editorconfig b/vendor/github.com/go-openapi/jsonpointer/.editorconfig new file mode 100644 index 00000000000..3152da69a5d --- /dev/null +++ b/vendor/github.com/go-openapi/jsonpointer/.editorconfig @@ -0,0 +1,26 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +# Set default charset +[*.{js,py,go,scala,rb,java,html,css,less,sass,md}] +charset = utf-8 + +# Tab indentation (no size specified) +[*.go] +indent_style = tab + +[*.md] +trim_trailing_whitespace = false + +# Matches the exact files either package.json or .travis.yml +[{package.json,.travis.yml}] +indent_style = space +indent_size = 2 diff --git a/vendor/github.com/go-openapi/jsonpointer/.gitignore b/vendor/github.com/go-openapi/jsonpointer/.gitignore new file mode 100644 index 00000000000..769c244007b --- /dev/null +++ b/vendor/github.com/go-openapi/jsonpointer/.gitignore @@ -0,0 +1 @@ +secrets.yml diff --git a/vendor/github.com/go-openapi/jsonpointer/.travis.yml b/vendor/github.com/go-openapi/jsonpointer/.travis.yml new file mode 100644 index 00000000000..03a22fe06fd --- /dev/null +++ b/vendor/github.com/go-openapi/jsonpointer/.travis.yml @@ -0,0 +1,15 @@ +after_success: +- bash <(curl -s https://codecov.io/bash) +go: +- 1.14.x +- 1.15.x +install: +- GO111MODULE=off go get -u gotest.tools/gotestsum +env: +- GO111MODULE=on +language: go +notifications: + slack: + secure: a5VgoiwB1G/AZqzmephPZIhEB9avMlsWSlVnM1dSAtYAwdrQHGTQxAmpOxYIoSPDhWNN5bfZmjd29++UlTwLcHSR+e0kJhH6IfDlsHj/HplNCJ9tyI0zYc7XchtdKgeMxMzBKCzgwFXGSbQGydXTliDNBo0HOzmY3cou/daMFTP60K+offcjS+3LRAYb1EroSRXZqrk1nuF/xDL3792DZUdPMiFR/L/Df6y74D6/QP4sTkTDFQitz4Wy/7jbsfj8dG6qK2zivgV6/l+w4OVjFkxVpPXogDWY10vVXNVynqxfJ7to2d1I9lNCHE2ilBCkWMIPdyJF7hjF8pKW+82yP4EzRh0vu8Xn0HT5MZpQxdRY/YMxNrWaG7SxsoEaO4q5uhgdzAqLYY3TRa7MjIK+7Ur+aqOeTXn6OKwVi0CjvZ6mIU3WUKSwiwkFZMbjRAkSb5CYwMEfGFO/z964xz83qGt6WAtBXNotqCQpTIiKtDHQeLOMfksHImCg6JLhQcWBVxamVgu0G3Pdh8Y6DyPnxraXY95+QDavbjqv7TeYT9T/FNnrkXaTTK0s4iWE5H4ACU0Qvz0wUYgfQrZv0/Hp7V17+rabUwnzYySHCy9SWX/7OV9Cfh31iMp9ZIffr76xmmThtOEqs8TrTtU6BWI3rWwvA9cXQipZTVtL0oswrGw= +script: +- gotestsum -f short-verbose -- -race -coverprofile=coverage.txt -covermode=atomic ./... diff --git a/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..9322b065e37 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonpointer/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/jsonpointer/LICENSE b/vendor/github.com/go-openapi/jsonpointer/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonpointer/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/jsonpointer/README.md b/vendor/github.com/go-openapi/jsonpointer/README.md new file mode 100644 index 00000000000..813788aff1c --- /dev/null +++ b/vendor/github.com/go-openapi/jsonpointer/README.md @@ -0,0 +1,15 @@ +# gojsonpointer [![Build Status](https://travis-ci.org/go-openapi/jsonpointer.svg?branch=master)](https://travis-ci.org/go-openapi/jsonpointer) [![codecov](https://codecov.io/gh/go-openapi/jsonpointer/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/jsonpointer) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) + +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/jsonpointer/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/jsonpointer?status.svg)](http://godoc.org/github.com/go-openapi/jsonpointer) +An implementation of JSON Pointer - Go language + +## Status +Completed YES + +Tested YES + +## References +http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07 + +### Note +The 4.Evaluation part of the previous reference, starting with 'If the currently referenced value is a JSON array, the reference token MUST contain either...' is not implemented. diff --git a/vendor/github.com/go-openapi/jsonpointer/pointer.go b/vendor/github.com/go-openapi/jsonpointer/pointer.go new file mode 100644 index 00000000000..7df9853def6 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonpointer/pointer.go @@ -0,0 +1,390 @@ +// Copyright 2013 sigu-399 ( https://github.com/sigu-399 ) +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// author sigu-399 +// author-github https://github.com/sigu-399 +// author-mail sigu.399@gmail.com +// +// repository-name jsonpointer +// repository-desc An implementation of JSON Pointer - Go language +// +// description Main and unique file. +// +// created 25-02-2013 + +package jsonpointer + +import ( + "errors" + "fmt" + "reflect" + "strconv" + "strings" + + "github.com/go-openapi/swag" +) + +const ( + emptyPointer = `` + pointerSeparator = `/` + + invalidStart = `JSON pointer must be empty or start with a "` + pointerSeparator +) + +var jsonPointableType = reflect.TypeOf(new(JSONPointable)).Elem() +var jsonSetableType = reflect.TypeOf(new(JSONSetable)).Elem() + +// JSONPointable is an interface for structs to implement when they need to customize the +// json pointer process +type JSONPointable interface { + JSONLookup(string) (interface{}, error) +} + +// JSONSetable is an interface for structs to implement when they need to customize the +// json pointer process +type JSONSetable interface { + JSONSet(string, interface{}) error +} + +// New creates a new json pointer for the given string +func New(jsonPointerString string) (Pointer, error) { + + var p Pointer + err := p.parse(jsonPointerString) + return p, err + +} + +// Pointer the json pointer reprsentation +type Pointer struct { + referenceTokens []string +} + +// "Constructor", parses the given string JSON pointer +func (p *Pointer) parse(jsonPointerString string) error { + + var err error + + if jsonPointerString != emptyPointer { + if !strings.HasPrefix(jsonPointerString, pointerSeparator) { + err = errors.New(invalidStart) + } else { + referenceTokens := strings.Split(jsonPointerString, pointerSeparator) + for _, referenceToken := range referenceTokens[1:] { + p.referenceTokens = append(p.referenceTokens, referenceToken) + } + } + } + + return err +} + +// Get uses the pointer to retrieve a value from a JSON document +func (p *Pointer) Get(document interface{}) (interface{}, reflect.Kind, error) { + return p.get(document, swag.DefaultJSONNameProvider) +} + +// Set uses the pointer to set a value from a JSON document +func (p *Pointer) Set(document interface{}, value interface{}) (interface{}, error) { + return document, p.set(document, value, swag.DefaultJSONNameProvider) +} + +// GetForToken gets a value for a json pointer token 1 level deep +func GetForToken(document interface{}, decodedToken string) (interface{}, reflect.Kind, error) { + return getSingleImpl(document, decodedToken, swag.DefaultJSONNameProvider) +} + +// SetForToken gets a value for a json pointer token 1 level deep +func SetForToken(document interface{}, decodedToken string, value interface{}) (interface{}, error) { + return document, setSingleImpl(document, value, decodedToken, swag.DefaultJSONNameProvider) +} + +func getSingleImpl(node interface{}, decodedToken string, nameProvider *swag.NameProvider) (interface{}, reflect.Kind, error) { + rValue := reflect.Indirect(reflect.ValueOf(node)) + kind := rValue.Kind() + + if rValue.Type().Implements(jsonPointableType) { + r, err := node.(JSONPointable).JSONLookup(decodedToken) + if err != nil { + return nil, kind, err + } + return r, kind, nil + } + + switch kind { + case reflect.Struct: + nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken) + if !ok { + return nil, kind, fmt.Errorf("object has no field %q", decodedToken) + } + fld := rValue.FieldByName(nm) + return fld.Interface(), kind, nil + + case reflect.Map: + kv := reflect.ValueOf(decodedToken) + mv := rValue.MapIndex(kv) + + if mv.IsValid() { + return mv.Interface(), kind, nil + } + return nil, kind, fmt.Errorf("object has no key %q", decodedToken) + + case reflect.Slice: + tokenIndex, err := strconv.Atoi(decodedToken) + if err != nil { + return nil, kind, err + } + sLength := rValue.Len() + if tokenIndex < 0 || tokenIndex >= sLength { + return nil, kind, fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength-1, tokenIndex) + } + + elem := rValue.Index(tokenIndex) + return elem.Interface(), kind, nil + + default: + return nil, kind, fmt.Errorf("invalid token reference %q", decodedToken) + } + +} + +func setSingleImpl(node, data interface{}, decodedToken string, nameProvider *swag.NameProvider) error { + rValue := reflect.Indirect(reflect.ValueOf(node)) + + if ns, ok := node.(JSONSetable); ok { // pointer impl + return ns.JSONSet(decodedToken, data) + } + + if rValue.Type().Implements(jsonSetableType) { + return node.(JSONSetable).JSONSet(decodedToken, data) + } + + switch rValue.Kind() { + case reflect.Struct: + nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken) + if !ok { + return fmt.Errorf("object has no field %q", decodedToken) + } + fld := rValue.FieldByName(nm) + if fld.IsValid() { + fld.Set(reflect.ValueOf(data)) + } + return nil + + case reflect.Map: + kv := reflect.ValueOf(decodedToken) + rValue.SetMapIndex(kv, reflect.ValueOf(data)) + return nil + + case reflect.Slice: + tokenIndex, err := strconv.Atoi(decodedToken) + if err != nil { + return err + } + sLength := rValue.Len() + if tokenIndex < 0 || tokenIndex >= sLength { + return fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength, tokenIndex) + } + + elem := rValue.Index(tokenIndex) + if !elem.CanSet() { + return fmt.Errorf("can't set slice index %s to %v", decodedToken, data) + } + elem.Set(reflect.ValueOf(data)) + return nil + + default: + return fmt.Errorf("invalid token reference %q", decodedToken) + } + +} + +func (p *Pointer) get(node interface{}, nameProvider *swag.NameProvider) (interface{}, reflect.Kind, error) { + + if nameProvider == nil { + nameProvider = swag.DefaultJSONNameProvider + } + + kind := reflect.Invalid + + // Full document when empty + if len(p.referenceTokens) == 0 { + return node, kind, nil + } + + for _, token := range p.referenceTokens { + + decodedToken := Unescape(token) + + r, knd, err := getSingleImpl(node, decodedToken, nameProvider) + if err != nil { + return nil, knd, err + } + node, kind = r, knd + + } + + rValue := reflect.ValueOf(node) + kind = rValue.Kind() + + return node, kind, nil +} + +func (p *Pointer) set(node, data interface{}, nameProvider *swag.NameProvider) error { + knd := reflect.ValueOf(node).Kind() + + if knd != reflect.Ptr && knd != reflect.Struct && knd != reflect.Map && knd != reflect.Slice && knd != reflect.Array { + return fmt.Errorf("only structs, pointers, maps and slices are supported for setting values") + } + + if nameProvider == nil { + nameProvider = swag.DefaultJSONNameProvider + } + + // Full document when empty + if len(p.referenceTokens) == 0 { + return nil + } + + lastI := len(p.referenceTokens) - 1 + for i, token := range p.referenceTokens { + isLastToken := i == lastI + decodedToken := Unescape(token) + + if isLastToken { + + return setSingleImpl(node, data, decodedToken, nameProvider) + } + + rValue := reflect.Indirect(reflect.ValueOf(node)) + kind := rValue.Kind() + + if rValue.Type().Implements(jsonPointableType) { + r, err := node.(JSONPointable).JSONLookup(decodedToken) + if err != nil { + return err + } + fld := reflect.ValueOf(r) + if fld.CanAddr() && fld.Kind() != reflect.Interface && fld.Kind() != reflect.Map && fld.Kind() != reflect.Slice && fld.Kind() != reflect.Ptr { + node = fld.Addr().Interface() + continue + } + node = r + continue + } + + switch kind { + case reflect.Struct: + nm, ok := nameProvider.GetGoNameForType(rValue.Type(), decodedToken) + if !ok { + return fmt.Errorf("object has no field %q", decodedToken) + } + fld := rValue.FieldByName(nm) + if fld.CanAddr() && fld.Kind() != reflect.Interface && fld.Kind() != reflect.Map && fld.Kind() != reflect.Slice && fld.Kind() != reflect.Ptr { + node = fld.Addr().Interface() + continue + } + node = fld.Interface() + + case reflect.Map: + kv := reflect.ValueOf(decodedToken) + mv := rValue.MapIndex(kv) + + if !mv.IsValid() { + return fmt.Errorf("object has no key %q", decodedToken) + } + if mv.CanAddr() && mv.Kind() != reflect.Interface && mv.Kind() != reflect.Map && mv.Kind() != reflect.Slice && mv.Kind() != reflect.Ptr { + node = mv.Addr().Interface() + continue + } + node = mv.Interface() + + case reflect.Slice: + tokenIndex, err := strconv.Atoi(decodedToken) + if err != nil { + return err + } + sLength := rValue.Len() + if tokenIndex < 0 || tokenIndex >= sLength { + return fmt.Errorf("index out of bounds array[0,%d] index '%d'", sLength, tokenIndex) + } + + elem := rValue.Index(tokenIndex) + if elem.CanAddr() && elem.Kind() != reflect.Interface && elem.Kind() != reflect.Map && elem.Kind() != reflect.Slice && elem.Kind() != reflect.Ptr { + node = elem.Addr().Interface() + continue + } + node = elem.Interface() + + default: + return fmt.Errorf("invalid token reference %q", decodedToken) + } + + } + + return nil +} + +// DecodedTokens returns the decoded tokens +func (p *Pointer) DecodedTokens() []string { + result := make([]string, 0, len(p.referenceTokens)) + for _, t := range p.referenceTokens { + result = append(result, Unescape(t)) + } + return result +} + +// IsEmpty returns true if this is an empty json pointer +// this indicates that it points to the root document +func (p *Pointer) IsEmpty() bool { + return len(p.referenceTokens) == 0 +} + +// Pointer to string representation function +func (p *Pointer) String() string { + + if len(p.referenceTokens) == 0 { + return emptyPointer + } + + pointerString := pointerSeparator + strings.Join(p.referenceTokens, pointerSeparator) + + return pointerString +} + +// Specific JSON pointer encoding here +// ~0 => ~ +// ~1 => / +// ... and vice versa + +const ( + encRefTok0 = `~0` + encRefTok1 = `~1` + decRefTok0 = `~` + decRefTok1 = `/` +) + +// Unescape unescapes a json pointer reference token string to the original representation +func Unescape(token string) string { + step1 := strings.Replace(token, encRefTok1, decRefTok1, -1) + step2 := strings.Replace(step1, encRefTok0, decRefTok0, -1) + return step2 +} + +// Escape escapes a pointer reference token string +func Escape(token string) string { + step1 := strings.Replace(token, decRefTok0, encRefTok0, -1) + step2 := strings.Replace(step1, decRefTok1, encRefTok1, -1) + return step2 +} diff --git a/vendor/github.com/go-openapi/jsonreference/.gitignore b/vendor/github.com/go-openapi/jsonreference/.gitignore new file mode 100644 index 00000000000..769c244007b --- /dev/null +++ b/vendor/github.com/go-openapi/jsonreference/.gitignore @@ -0,0 +1 @@ +secrets.yml diff --git a/vendor/github.com/go-openapi/jsonreference/.golangci.yml b/vendor/github.com/go-openapi/jsonreference/.golangci.yml new file mode 100644 index 00000000000..f9381aee541 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonreference/.golangci.yml @@ -0,0 +1,41 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 30 + maligned: + suggest-new: true + dupl: + threshold: 100 + goconst: + min-len: 2 + min-occurrences: 4 +linters: + enable-all: true + disable: + - maligned + - lll + - gochecknoglobals + - godox + - gocognit + - whitespace + - wsl + - funlen + - gochecknoglobals + - gochecknoinits + - scopelint + - wrapcheck + - exhaustivestruct + - exhaustive + - nlreturn + - testpackage + - gci + - gofumpt + - goerr113 + - gomnd + - tparallel + - nestif + - godot + - errorlint diff --git a/vendor/github.com/go-openapi/jsonreference/.travis.yml b/vendor/github.com/go-openapi/jsonreference/.travis.yml new file mode 100644 index 00000000000..05482f4b90c --- /dev/null +++ b/vendor/github.com/go-openapi/jsonreference/.travis.yml @@ -0,0 +1,24 @@ +after_success: +- bash <(curl -s https://codecov.io/bash) +go: +- 1.14.x +- 1.x +install: +- go get gotest.tools/gotestsum +jobs: + include: + # include linting job, but only for latest go version and amd64 arch + - go: 1.x + arch: amd64 + install: + go get github.com/golangci/golangci-lint/cmd/golangci-lint + script: + - golangci-lint run --new-from-rev master +env: +- GO111MODULE=on +language: go +notifications: + slack: + secure: OpQG/36F7DSF00HLm9WZMhyqFCYYyYTsVDObW226cWiR8PWYiNfLZiSEvIzT1Gx4dDjhigKTIqcLhG34CkL5iNXDjm9Yyo2RYhQPlK8NErNqUEXuBqn4RqYHW48VGhEhOyDd4Ei0E2FN5ZbgpvHgtpkdZ6XDi64r3Ac89isP9aPHXQTuv2Jog6b4/OKKiUTftLcTIst0p4Cp3gqOJWf1wnoj+IadWiECNVQT6zb47IYjtyw6+uV8iUjTzdKcRB6Zc6b4Dq7JAg1Zd7Jfxkql3hlKp4PNlRf9Cy7y5iA3G7MLyg3FcPX5z2kmcyPt2jOTRMBWUJ5zIQpOxizAcN8WsT3WWBL5KbuYK6k0PzujrIDLqdxGpNmjkkMfDBT9cKmZpm2FdW+oZgPFJP+oKmAo4u4KJz/vjiPTXgQlN5bmrLuRMCp+AwC5wkIohTqWZVPE2TK6ZSnMYcg/W39s+RP/9mJoyryAvPSpBOLTI+biCgaUCTOAZxNTWpMFc3tPYntc41WWkdKcooZ9JA5DwfcaVFyTGQ3YXz+HvX6G1z/gW0Q/A4dBi9mj2iE1xm7tRTT+4VQ2AXFvSEI1HJpfPgYnwAtwOD1v3Qm2EUHk9sCdtEDR4wVGEPIVn44GnwFMnGKx9JWppMPYwFu3SVDdHt+E+LOlhZUply11Aa+IVrT2KUQ= +script: +- gotestsum -f short-verbose -- -race -coverprofile=coverage.txt -covermode=atomic ./... diff --git a/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..9322b065e37 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonreference/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/jsonreference/LICENSE b/vendor/github.com/go-openapi/jsonreference/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonreference/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/jsonreference/README.md b/vendor/github.com/go-openapi/jsonreference/README.md new file mode 100644 index 00000000000..b94753aa527 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonreference/README.md @@ -0,0 +1,15 @@ +# gojsonreference [![Build Status](https://travis-ci.org/go-openapi/jsonreference.svg?branch=master)](https://travis-ci.org/go-openapi/jsonreference) [![codecov](https://codecov.io/gh/go-openapi/jsonreference/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/jsonreference) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) + +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/jsonreference/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/jsonreference?status.svg)](http://godoc.org/github.com/go-openapi/jsonreference) +An implementation of JSON Reference - Go language + +## Status +Feature complete. Stable API + +## Dependencies +https://github.com/go-openapi/jsonpointer + +## References +http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-07 + +http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-03 diff --git a/vendor/github.com/go-openapi/jsonreference/reference.go b/vendor/github.com/go-openapi/jsonreference/reference.go new file mode 100644 index 00000000000..3bc0a6e26f8 --- /dev/null +++ b/vendor/github.com/go-openapi/jsonreference/reference.go @@ -0,0 +1,156 @@ +// Copyright 2013 sigu-399 ( https://github.com/sigu-399 ) +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// author sigu-399 +// author-github https://github.com/sigu-399 +// author-mail sigu.399@gmail.com +// +// repository-name jsonreference +// repository-desc An implementation of JSON Reference - Go language +// +// description Main and unique file. +// +// created 26-02-2013 + +package jsonreference + +import ( + "errors" + "net/url" + "strings" + + "github.com/PuerkitoBio/purell" + "github.com/go-openapi/jsonpointer" +) + +const ( + fragmentRune = `#` +) + +// New creates a new reference for the given string +func New(jsonReferenceString string) (Ref, error) { + + var r Ref + err := r.parse(jsonReferenceString) + return r, err + +} + +// MustCreateRef parses the ref string and panics when it's invalid. +// Use the New method for a version that returns an error +func MustCreateRef(ref string) Ref { + r, err := New(ref) + if err != nil { + panic(err) + } + return r +} + +// Ref represents a json reference object +type Ref struct { + referenceURL *url.URL + referencePointer jsonpointer.Pointer + + HasFullURL bool + HasURLPathOnly bool + HasFragmentOnly bool + HasFileScheme bool + HasFullFilePath bool +} + +// GetURL gets the URL for this reference +func (r *Ref) GetURL() *url.URL { + return r.referenceURL +} + +// GetPointer gets the json pointer for this reference +func (r *Ref) GetPointer() *jsonpointer.Pointer { + return &r.referencePointer +} + +// String returns the best version of the url for this reference +func (r *Ref) String() string { + + if r.referenceURL != nil { + return r.referenceURL.String() + } + + if r.HasFragmentOnly { + return fragmentRune + r.referencePointer.String() + } + + return r.referencePointer.String() +} + +// IsRoot returns true if this reference is a root document +func (r *Ref) IsRoot() bool { + return r.referenceURL != nil && + !r.IsCanonical() && + !r.HasURLPathOnly && + r.referenceURL.Fragment == "" +} + +// IsCanonical returns true when this pointer starts with http(s):// or file:// +func (r *Ref) IsCanonical() bool { + return (r.HasFileScheme && r.HasFullFilePath) || (!r.HasFileScheme && r.HasFullURL) +} + +// "Constructor", parses the given string JSON reference +func (r *Ref) parse(jsonReferenceString string) error { + + parsed, err := url.Parse(jsonReferenceString) + if err != nil { + return err + } + + r.referenceURL, _ = url.Parse(purell.NormalizeURL(parsed, purell.FlagsSafe|purell.FlagRemoveDuplicateSlashes)) + refURL := r.referenceURL + + if refURL.Scheme != "" && refURL.Host != "" { + r.HasFullURL = true + } else { + if refURL.Path != "" { + r.HasURLPathOnly = true + } else if refURL.RawQuery == "" && refURL.Fragment != "" { + r.HasFragmentOnly = true + } + } + + r.HasFileScheme = refURL.Scheme == "file" + r.HasFullFilePath = strings.HasPrefix(refURL.Path, "/") + + // invalid json-pointer error means url has no json-pointer fragment. simply ignore error + r.referencePointer, _ = jsonpointer.New(refURL.Fragment) + + return nil +} + +// Inherits creates a new reference from a parent and a child +// If the child cannot inherit from the parent, an error is returned +func (r *Ref) Inherits(child Ref) (*Ref, error) { + childURL := child.GetURL() + parentURL := r.GetURL() + if childURL == nil { + return nil, errors.New("child url is nil") + } + if parentURL == nil { + return &child, nil + } + + ref, err := New(parentURL.ResolveReference(childURL).String()) + if err != nil { + return nil, err + } + return &ref, nil +} diff --git a/vendor/github.com/go-openapi/loads/.editorconfig b/vendor/github.com/go-openapi/loads/.editorconfig new file mode 100644 index 00000000000..3152da69a5d --- /dev/null +++ b/vendor/github.com/go-openapi/loads/.editorconfig @@ -0,0 +1,26 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +# Set default charset +[*.{js,py,go,scala,rb,java,html,css,less,sass,md}] +charset = utf-8 + +# Tab indentation (no size specified) +[*.go] +indent_style = tab + +[*.md] +trim_trailing_whitespace = false + +# Matches the exact files either package.json or .travis.yml +[{package.json,.travis.yml}] +indent_style = space +indent_size = 2 diff --git a/vendor/github.com/go-openapi/loads/.gitignore b/vendor/github.com/go-openapi/loads/.gitignore new file mode 100644 index 00000000000..e4f15f17bfc --- /dev/null +++ b/vendor/github.com/go-openapi/loads/.gitignore @@ -0,0 +1,4 @@ +secrets.yml +coverage.out +profile.cov +profile.out diff --git a/vendor/github.com/go-openapi/loads/.golangci.yml b/vendor/github.com/go-openapi/loads/.golangci.yml new file mode 100644 index 00000000000..d48b4a5156e --- /dev/null +++ b/vendor/github.com/go-openapi/loads/.golangci.yml @@ -0,0 +1,44 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 30 + maligned: + suggest-new: true + dupl: + threshold: 100 + goconst: + min-len: 2 + min-occurrences: 4 + +linters: + enable-all: true + disable: + - maligned + - lll + - gochecknoglobals + - gochecknoinits + - godox + - gocognit + - whitespace + - wsl + - funlen + - gochecknoglobals + - gochecknoinits + - scopelint + - wrapcheck + - exhaustivestruct + - exhaustive + - nlreturn + - testpackage + - gci + - gofumpt + - goerr113 + - gomnd + - tparallel + - nestif + - godot + - errorlint + - paralleltest diff --git a/vendor/github.com/go-openapi/loads/.travis.yml b/vendor/github.com/go-openapi/loads/.travis.yml new file mode 100644 index 00000000000..cd4a7c331bc --- /dev/null +++ b/vendor/github.com/go-openapi/loads/.travis.yml @@ -0,0 +1,25 @@ +after_success: +- bash <(curl -s https://codecov.io/bash) +go: +- 1.16.x +- 1.x +install: +- go get gotest.tools/gotestsum +language: go +arch: +- amd64 +- ppc64le +jobs: + include: + # include linting job, but only for latest go version and amd64 arch + - go: 1.x + arch: amd64 + install: + go get github.com/golangci/golangci-lint/cmd/golangci-lint + script: + - golangci-lint run --new-from-rev master +notifications: + slack: + secure: OxkPwVp35qBTUilgWC8xykSj+sGMcj0h8IIOKD+Rflx2schZVlFfdYdyVBM+s9OqeOfvtuvnR9v1Ye2rPKAvcjWdC4LpRGUsgmItZaI6Um8Aj6+K9udCw5qrtZVfOVmRu8LieH//XznWWKdOultUuniW0MLqw5+II87Gd00RWbCGi0hk0PykHe7uK+PDA2BEbqyZ2WKKYCvfB3j+0nrFOHScXqnh0V05l2E83J4+Sgy1fsPy+1WdX58ZlNBG333ibaC1FS79XvKSmTgKRkx3+YBo97u6ZtUmJa5WZjf2OdLG3KIckGWAv6R5xgxeU31N0Ng8L332w/Edpp2O/M2bZwdnKJ8hJQikXIAQbICbr+lTDzsoNzMdEIYcHpJ5hjPbiUl3Bmd+Jnsjf5McgAZDiWIfpCKZ29tPCEkVwRsOCqkyPRMNMzHHmoja495P5jR+ODS7+J8RFg5xgcnOgpP9D4Wlhztlf5WyZMpkLxTUD+bZq2SRf50HfHFXTkfq22zPl3d1eq0yrLwh/Z/fWKkfb6SyysROL8y6s8u3dpFX1YHSg0BR6i913h4aoZw9B2BG27cafLLTwKYsp2dFo1PWl4O6u9giFJIeqwloZHLKKrwh0cBFhB7RH0I58asxkZpCH6uWjJierahmHe7iS+E6i+9oCHkOZ59hmCYNimIs3hM= +script: +- gotestsum -f short-verbose -- -race -timeout=20m -coverprofile=coverage.txt -covermode=atomic ./... diff --git a/vendor/github.com/go-openapi/loads/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/loads/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..9322b065e37 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/loads/LICENSE b/vendor/github.com/go-openapi/loads/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/loads/README.md b/vendor/github.com/go-openapi/loads/README.md new file mode 100644 index 00000000000..df1f6264623 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/README.md @@ -0,0 +1,6 @@ +# Loads OAI specs [![Build Status](https://travis-ci.org/go-openapi/loads.svg?branch=master)](https://travis-ci.org/go-openapi/loads) [![codecov](https://codecov.io/gh/go-openapi/loads/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/loads) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) [![Actions/Go Test Status](https://github.com/go-openapi/loads/workflows/Go%20Test/badge.svg)](https://github.com/go-openapi/loads/actions?query=workflow%3A"Go+Test") + +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/loads/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/loads?status.svg)](http://godoc.org/github.com/go-openapi/loads) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/loads)](https://goreportcard.com/report/github.com/go-openapi/loads) + +Loading of OAI specification documents from local or remote locations. Supports JSON and YAML documents. diff --git a/vendor/github.com/go-openapi/loads/doc.go b/vendor/github.com/go-openapi/loads/doc.go new file mode 100644 index 00000000000..3046da4cef3 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/doc.go @@ -0,0 +1,21 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* +Package loads provides document loading methods for swagger (OAI) specifications. + +It is used by other go-openapi packages to load and run analysis on local or remote spec documents. + +*/ +package loads diff --git a/vendor/github.com/go-openapi/loads/loaders.go b/vendor/github.com/go-openapi/loads/loaders.go new file mode 100644 index 00000000000..44bd32b5b88 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/loaders.go @@ -0,0 +1,134 @@ +package loads + +import ( + "encoding/json" + "errors" + "net/url" + + "github.com/go-openapi/spec" + "github.com/go-openapi/swag" +) + +var ( + // Default chain of loaders, defined at the package level. + // + // By default this matches json and yaml documents. + // + // May be altered with AddLoader(). + loaders *loader +) + +func init() { + jsonLoader := &loader{ + DocLoaderWithMatch: DocLoaderWithMatch{ + Match: func(pth string) bool { + return true + }, + Fn: JSONDoc, + }, + } + + loaders = jsonLoader.WithHead(&loader{ + DocLoaderWithMatch: DocLoaderWithMatch{ + Match: swag.YAMLMatcher, + Fn: swag.YAMLDoc, + }, + }) + + // sets the global default loader for go-openapi/spec + spec.PathLoader = loaders.Load +} + +// DocLoader represents a doc loader type +type DocLoader func(string) (json.RawMessage, error) + +// DocMatcher represents a predicate to check if a loader matches +type DocMatcher func(string) bool + +// DocLoaderWithMatch describes a loading function for a given extension match. +type DocLoaderWithMatch struct { + Fn DocLoader + Match DocMatcher +} + +// NewDocLoaderWithMatch builds a DocLoaderWithMatch to be used in load options +func NewDocLoaderWithMatch(fn DocLoader, matcher DocMatcher) DocLoaderWithMatch { + return DocLoaderWithMatch{ + Fn: fn, + Match: matcher, + } +} + +type loader struct { + DocLoaderWithMatch + Next *loader +} + +// WithHead adds a loader at the head of the current stack +func (l *loader) WithHead(head *loader) *loader { + if head == nil { + return l + } + head.Next = l + return head +} + +// WithNext adds a loader at the trail of the current stack +func (l *loader) WithNext(next *loader) *loader { + l.Next = next + return next +} + +// Load the raw document from path +func (l *loader) Load(path string) (json.RawMessage, error) { + _, erp := url.Parse(path) + if erp != nil { + return nil, erp + } + + var lastErr error = errors.New("no loader matched") // default error if no match was found + for ldr := l; ldr != nil; ldr = ldr.Next { + if ldr.Match != nil && !ldr.Match(path) { + continue + } + + // try then move to next one if there is an error + b, err := ldr.Fn(path) + if err == nil { + return b, nil + } + + lastErr = err + } + + return nil, lastErr +} + +// JSONDoc loads a json document from either a file or a remote url +func JSONDoc(path string) (json.RawMessage, error) { + data, err := swag.LoadFromFileOrHTTP(path) + if err != nil { + return nil, err + } + return json.RawMessage(data), nil +} + +// AddLoader for a document, executed before other previously set loaders. +// +// This sets the configuration at the package level. +// +// NOTE: +// * this updates the default loader used by github.com/go-openapi/spec +// * since this sets package level globals, you shouln't call this concurrently +// +func AddLoader(predicate DocMatcher, load DocLoader) { + loaders = loaders.WithHead(&loader{ + DocLoaderWithMatch: DocLoaderWithMatch{ + Match: predicate, + Fn: load, + }, + }) + + // sets the global default loader for go-openapi/spec + spec.PathLoader = loaders.Load +} diff --git a/vendor/github.com/go-openapi/loads/options.go b/vendor/github.com/go-openapi/loads/options.go new file mode 100644 index 00000000000..f8305d5607c --- /dev/null +++ b/vendor/github.com/go-openapi/loads/options.go @@ -0,0 +1,61 @@ +package loads + +type options struct { + loader *loader +} + +func defaultOptions() *options { + return &options{ + loader: loaders, + } +} + +func loaderFromOptions(options []LoaderOption) *loader { + opts := defaultOptions() + for _, apply := range options { + apply(opts) + } + + return opts.loader +} + +// LoaderOption allows to fine-tune the spec loader behavior +type LoaderOption func(*options) + +// WithDocLoader sets a custom loader for loading specs +func WithDocLoader(l DocLoader) LoaderOption { + return func(opt *options) { + if l == nil { + return + } + opt.loader = &loader{ + DocLoaderWithMatch: DocLoaderWithMatch{ + Fn: l, + }, + } + } +} + +// WithDocLoaderMatches sets a chain of custom loaders for loading specs +// for different extension matches. +// +// Loaders are executed in the order of provided DocLoaderWithMatch'es. +func WithDocLoaderMatches(l ...DocLoaderWithMatch) LoaderOption { + return func(opt *options) { + var final, prev *loader + for _, ldr := range l { + if ldr.Fn == nil { + continue + } + + if prev == nil { + final = &loader{DocLoaderWithMatch: ldr} + prev = final + continue + } + + prev = prev.WithNext(&loader{DocLoaderWithMatch: ldr}) + } + opt.loader = final + } +} diff --git a/vendor/github.com/go-openapi/loads/spec.go b/vendor/github.com/go-openapi/loads/spec.go new file mode 100644 index 00000000000..93c8d4b8955 --- /dev/null +++ b/vendor/github.com/go-openapi/loads/spec.go @@ -0,0 +1,266 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package loads + +import ( + "bytes" + "encoding/gob" + "encoding/json" + "fmt" + + "github.com/go-openapi/analysis" + "github.com/go-openapi/spec" + "github.com/go-openapi/swag" +) + +func init() { + gob.Register(map[string]interface{}{}) + gob.Register([]interface{}{}) +} + +// Document represents a swagger spec document +type Document struct { + // specAnalyzer + Analyzer *analysis.Spec + spec *spec.Swagger + specFilePath string + origSpec *spec.Swagger + schema *spec.Schema + raw json.RawMessage + pathLoader *loader +} + +// JSONSpec loads a spec from a json document +func JSONSpec(path string, options ...LoaderOption) (*Document, error) { + data, err := JSONDoc(path) + if err != nil { + return nil, err + } + // convert to json + return Analyzed(data, "", options...) +} + +// Embedded returns a Document based on embedded specs. No analysis is required +func Embedded(orig, flat json.RawMessage, options ...LoaderOption) (*Document, error) { + var origSpec, flatSpec spec.Swagger + if err := json.Unmarshal(orig, &origSpec); err != nil { + return nil, err + } + if err := json.Unmarshal(flat, &flatSpec); err != nil { + return nil, err + } + return &Document{ + raw: orig, + origSpec: &origSpec, + spec: &flatSpec, + pathLoader: loaderFromOptions(options), + }, nil +} + +// Spec loads a new spec document from a local or remote path +func Spec(path string, options ...LoaderOption) (*Document, error) { + + ldr := loaderFromOptions(options) + + b, err := ldr.Load(path) + if err != nil { + return nil, err + } + + document, err := Analyzed(b, "", options...) + if err != nil { + return nil, err + } + + if document != nil { + document.specFilePath = path + document.pathLoader = ldr + } + + return document, err +} + +// Analyzed creates a new analyzed spec document for a root json.RawMessage. +func Analyzed(data json.RawMessage, version string, options ...LoaderOption) (*Document, error) { + if version == "" { + version = "2.0" + } + if version != "2.0" { + return nil, fmt.Errorf("spec version %q is not supported", version) + } + + raw, err := trimData(data) // trim blanks, then convert yaml docs into json + if err != nil { + return nil, err + } + + swspec := new(spec.Swagger) + if err = json.Unmarshal(raw, swspec); err != nil { + return nil, err + } + + origsqspec, err := cloneSpec(swspec) + if err != nil { + return nil, err + } + + d := &Document{ + Analyzer: analysis.New(swspec), + schema: spec.MustLoadSwagger20Schema(), + spec: swspec, + raw: raw, + origSpec: origsqspec, + pathLoader: loaderFromOptions(options), + } + + return d, nil +} + +func trimData(in json.RawMessage) (json.RawMessage, error) { + trimmed := bytes.TrimSpace(in) + if len(trimmed) == 0 { + return in, nil + } + + if trimmed[0] == '{' || trimmed[0] == '[' { + return trimmed, nil + } + + // assume yaml doc: convert it to json + yml, err := swag.BytesToYAMLDoc(trimmed) + if err != nil { + return nil, fmt.Errorf("analyzed: %v", err) + } + + d, err := swag.YAMLToJSON(yml) + if err != nil { + return nil, fmt.Errorf("analyzed: %v", err) + } + + return d, nil +} + +// Expanded expands the ref fields in the spec document and returns a new spec document +func (d *Document) Expanded(options ...*spec.ExpandOptions) (*Document, error) { + + swspec := new(spec.Swagger) + if err := json.Unmarshal(d.raw, swspec); err != nil { + return nil, err + } + + var expandOptions *spec.ExpandOptions + if len(options) > 0 { + expandOptions = options[0] + } else { + expandOptions = &spec.ExpandOptions{ + RelativeBase: d.specFilePath, + } + } + + if expandOptions.PathLoader == nil { + if d.pathLoader != nil { + // use loader from Document options + expandOptions.PathLoader = d.pathLoader.Load + } else { + // use package level loader + expandOptions.PathLoader = loaders.Load + } + } + + if err := spec.ExpandSpec(swspec, expandOptions); err != nil { + return nil, err + } + + dd := &Document{ + Analyzer: analysis.New(swspec), + spec: swspec, + specFilePath: d.specFilePath, + schema: spec.MustLoadSwagger20Schema(), + raw: d.raw, + origSpec: d.origSpec, + } + return dd, nil +} + +// BasePath the base path for this spec +func (d *Document) BasePath() string { + return d.spec.BasePath +} + +// Version returns the version of this spec +func (d *Document) Version() string { + return d.spec.Swagger +} + +// Schema returns the swagger 2.0 schema +func (d *Document) Schema() *spec.Schema { + return d.schema +} + +// Spec returns the swagger spec object model +func (d *Document) Spec() *spec.Swagger { + return d.spec +} + +// Host returns the host for the API +func (d *Document) Host() string { + return d.spec.Host +} + +// Raw returns the raw swagger spec as json bytes +func (d *Document) Raw() json.RawMessage { + return d.raw +} + +// OrigSpec yields the original spec +func (d *Document) OrigSpec() *spec.Swagger { + return d.origSpec +} + +// ResetDefinitions gives a shallow copy with the models reset to the original spec +func (d *Document) ResetDefinitions() *Document { + defs := make(map[string]spec.Schema, len(d.origSpec.Definitions)) + for k, v := range d.origSpec.Definitions { + defs[k] = v + } + + d.spec.Definitions = defs + return d +} + +// Pristine creates a new pristine document instance based on the input data +func (d *Document) Pristine() *Document { + dd, _ := Analyzed(d.Raw(), d.Version()) + dd.pathLoader = d.pathLoader + return dd +} + +// SpecFilePath returns the file path of the spec if one is defined +func (d *Document) SpecFilePath() string { + return d.specFilePath +} + +func cloneSpec(src *spec.Swagger) (*spec.Swagger, error) { + var b bytes.Buffer + if err := gob.NewEncoder(&b).Encode(src); err != nil { + return nil, err + } + + var dst spec.Swagger + if err := gob.NewDecoder(&b).Decode(&dst); err != nil { + return nil, err + } + return &dst, nil +} diff --git a/vendor/github.com/go-openapi/runtime/.editorconfig b/vendor/github.com/go-openapi/runtime/.editorconfig new file mode 100644 index 00000000000..3152da69a5d --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/.editorconfig @@ -0,0 +1,26 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +# Set default charset +[*.{js,py,go,scala,rb,java,html,css,less,sass,md}] +charset = utf-8 + +# Tab indentation (no size specified) +[*.go] +indent_style = tab + +[*.md] +trim_trailing_whitespace = false + +# Matches the exact files either package.json or .travis.yml +[{package.json,.travis.yml}] +indent_style = space +indent_size = 2 diff --git a/vendor/github.com/go-openapi/runtime/.gitattributes b/vendor/github.com/go-openapi/runtime/.gitattributes new file mode 100644 index 00000000000..d207b1802b2 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/.gitattributes @@ -0,0 +1 @@ +*.go text eol=lf diff --git a/vendor/github.com/go-openapi/runtime/.gitignore b/vendor/github.com/go-openapi/runtime/.gitignore new file mode 100644 index 00000000000..fea8b84eca9 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/.gitignore @@ -0,0 +1,5 @@ +secrets.yml +coverage.out +*.cov +*.out +playground diff --git a/vendor/github.com/go-openapi/runtime/.golangci.yml b/vendor/github.com/go-openapi/runtime/.golangci.yml new file mode 100644 index 00000000000..b1aa7928a7c --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/.golangci.yml @@ -0,0 +1,44 @@ +linters-settings: + govet: + # Using err repeatedly considered as shadowing. + check-shadowing: false + golint: + min-confidence: 0 + gocyclo: + min-complexity: 30 + maligned: + suggest-new: true + dupl: + threshold: 100 + goconst: + min-len: 2 + min-occurrences: 4 +linters: + disable: + - maligned + - lll + - gochecknoglobals + - godox + - gocognit + - whitespace + - wsl + - funlen + - gochecknoglobals + - gochecknoinits + - scopelint + - wrapcheck + - exhaustivestruct + - exhaustive + - nlreturn + - testpackage + - gci + - gofumpt + - goerr113 + - gomnd + - tparallel + - nestif + - godot + - errorlint + - noctx + - interfacer + - nilerr diff --git a/vendor/github.com/go-openapi/runtime/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/runtime/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..9322b065e37 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/runtime/LICENSE b/vendor/github.com/go-openapi/runtime/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/runtime/README.md b/vendor/github.com/go-openapi/runtime/README.md new file mode 100644 index 00000000000..5b1ec649454 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/README.md @@ -0,0 +1,7 @@ +# runtime [![Build Status](https://travis-ci.org/go-openapi/runtime.svg?branch=client-context)](https://travis-ci.org/go-openapi/runtime) [![codecov](https://codecov.io/gh/go-openapi/runtime/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/runtime) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) + +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/runtime/master/LICENSE) [![GoDoc](https://godoc.org/github.com/go-openapi/runtime?status.svg)](http://godoc.org/github.com/go-openapi/runtime) + +# golang Open-API toolkit - runtime + +The runtime component for use in codegeneration or as untyped usage. diff --git a/vendor/github.com/go-openapi/runtime/bytestream.go b/vendor/github.com/go-openapi/runtime/bytestream.go new file mode 100644 index 00000000000..6eb6ceb5c5d --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/bytestream.go @@ -0,0 +1,169 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "bytes" + "encoding" + "errors" + "fmt" + "io" + "reflect" + + "github.com/go-openapi/swag" +) + +func defaultCloser() error { return nil } + +type byteStreamOpt func(opts *byteStreamOpts) + +// ClosesStream when the bytestream consumer or producer is finished +func ClosesStream(opts *byteStreamOpts) { + opts.Close = true +} + +type byteStreamOpts struct { + Close bool +} + +// ByteStreamConsumer creates a consumer for byte streams, +// takes a Writer/BinaryUnmarshaler interface or binary slice by reference, +// and reads from the provided reader +func ByteStreamConsumer(opts ...byteStreamOpt) Consumer { + var vals byteStreamOpts + for _, opt := range opts { + opt(&vals) + } + + return ConsumerFunc(func(reader io.Reader, data interface{}) error { + if reader == nil { + return errors.New("ByteStreamConsumer requires a reader") // early exit + } + + close := defaultCloser + if vals.Close { + if cl, ok := reader.(io.Closer); ok { + close = cl.Close + } + } + //nolint:errcheck // closing a reader wouldn't fail. + defer close() + + if wrtr, ok := data.(io.Writer); ok { + _, err := io.Copy(wrtr, reader) + return err + } + + buf := new(bytes.Buffer) + _, err := buf.ReadFrom(reader) + if err != nil { + return err + } + b := buf.Bytes() + + if bu, ok := data.(encoding.BinaryUnmarshaler); ok { + return bu.UnmarshalBinary(b) + } + + if data != nil { + if str, ok := data.(*string); ok { + *str = string(b) + return nil + } + } + + if t := reflect.TypeOf(data); data != nil && t.Kind() == reflect.Ptr { + v := reflect.Indirect(reflect.ValueOf(data)) + if t = v.Type(); t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Uint8 { + v.SetBytes(b) + return nil + } + } + + return fmt.Errorf("%v (%T) is not supported by the ByteStreamConsumer, %s", + data, data, "can be resolved by supporting Writer/BinaryUnmarshaler interface") + }) +} + +// ByteStreamProducer creates a producer for byte streams, +// takes a Reader/BinaryMarshaler interface or binary slice, +// and writes to a writer (essentially a pipe) +func ByteStreamProducer(opts ...byteStreamOpt) Producer { + var vals byteStreamOpts + for _, opt := range opts { + opt(&vals) + } + return ProducerFunc(func(writer io.Writer, data interface{}) error { + if writer == nil { + return errors.New("ByteStreamProducer requires a writer") // early exit + } + close := defaultCloser + if vals.Close { + if cl, ok := writer.(io.Closer); ok { + close = cl.Close + } + } + //nolint:errcheck // TODO: closing a writer would fail. + defer close() + + if rc, ok := data.(io.ReadCloser); ok { + defer rc.Close() + } + + if rdr, ok := data.(io.Reader); ok { + _, err := io.Copy(writer, rdr) + return err + } + + if bm, ok := data.(encoding.BinaryMarshaler); ok { + bytes, err := bm.MarshalBinary() + if err != nil { + return err + } + + _, err = writer.Write(bytes) + return err + } + + if data != nil { + if str, ok := data.(string); ok { + _, err := writer.Write([]byte(str)) + return err + } + + if e, ok := data.(error); ok { + _, err := writer.Write([]byte(e.Error())) + return err + } + + v := reflect.Indirect(reflect.ValueOf(data)) + if t := v.Type(); t.Kind() == reflect.Slice && t.Elem().Kind() == reflect.Uint8 { + _, err := writer.Write(v.Bytes()) + return err + } + if t := v.Type(); t.Kind() == reflect.Struct || t.Kind() == reflect.Slice { + b, err := swag.WriteJSON(data) + if err != nil { + return err + } + _, err = writer.Write(b) + return err + } + } + + return fmt.Errorf("%v (%T) is not supported by the ByteStreamProducer, %s", + data, data, "can be resolved by supporting Reader/BinaryMarshaler interface") + }) +} diff --git a/vendor/github.com/go-openapi/runtime/client/auth_info.go b/vendor/github.com/go-openapi/runtime/client/auth_info.go new file mode 100644 index 00000000000..d37e8f6b73f --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client/auth_info.go @@ -0,0 +1,77 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "encoding/base64" + + "github.com/go-openapi/strfmt" + + "github.com/go-openapi/runtime" +) + +// PassThroughAuth never manipulates the request +var PassThroughAuth runtime.ClientAuthInfoWriter + +func init() { + PassThroughAuth = runtime.ClientAuthInfoWriterFunc(func(_ runtime.ClientRequest, _ strfmt.Registry) error { return nil }) +} + +// BasicAuth provides a basic auth info writer +func BasicAuth(username, password string) runtime.ClientAuthInfoWriter { + return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { + encoded := base64.StdEncoding.EncodeToString([]byte(username + ":" + password)) + return r.SetHeaderParam("Authorization", "Basic "+encoded) + }) +} + +// APIKeyAuth provides an API key auth info writer +func APIKeyAuth(name, in, value string) runtime.ClientAuthInfoWriter { + if in == "query" { + return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { + return r.SetQueryParam(name, value) + }) + } + + if in == "header" { + return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { + return r.SetHeaderParam(name, value) + }) + } + return nil +} + +// BearerToken provides a header based oauth2 bearer access token auth info writer +func BearerToken(token string) runtime.ClientAuthInfoWriter { + return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { + return r.SetHeaderParam("Authorization", "Bearer "+token) + }) +} + +// Compose combines multiple ClientAuthInfoWriters into a single one. +// Useful when multiple auth headers are needed. +func Compose(auths ...runtime.ClientAuthInfoWriter) runtime.ClientAuthInfoWriter { + return runtime.ClientAuthInfoWriterFunc(func(r runtime.ClientRequest, _ strfmt.Registry) error { + for _, auth := range auths { + if auth == nil { + continue + } + if err := auth.AuthenticateRequest(r, nil); err != nil { + return err + } + } + return nil + }) +} diff --git a/vendor/github.com/go-openapi/runtime/client/keepalive.go b/vendor/github.com/go-openapi/runtime/client/keepalive.go new file mode 100644 index 00000000000..e9c250d6a8a --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client/keepalive.go @@ -0,0 +1,56 @@ +package client + +import ( + "io" + "io/ioutil" + "net/http" + "sync/atomic" +) + +// KeepAliveTransport drains the remaining body from a response +// so that go will reuse the TCP connections. +// This is not enabled by default because there are servers where +// the response never gets closed and that would make the code hang forever. +// So instead it's provided as a http client middleware that can be used to override +// any request. +func KeepAliveTransport(rt http.RoundTripper) http.RoundTripper { + return &keepAliveTransport{wrapped: rt} +} + +type keepAliveTransport struct { + wrapped http.RoundTripper +} + +func (k *keepAliveTransport) RoundTrip(r *http.Request) (*http.Response, error) { + resp, err := k.wrapped.RoundTrip(r) + if err != nil { + return resp, err + } + resp.Body = &drainingReadCloser{rdr: resp.Body} + return resp, nil +} + +type drainingReadCloser struct { + rdr io.ReadCloser + seenEOF uint32 +} + +func (d *drainingReadCloser) Read(p []byte) (n int, err error) { + n, err = d.rdr.Read(p) + if err == io.EOF || n == 0 { + atomic.StoreUint32(&d.seenEOF, 1) + } + return +} + +func (d *drainingReadCloser) Close() error { + // drain buffer + if atomic.LoadUint32(&d.seenEOF) != 1 { + // If the reader side (a HTTP server) is misbehaving, it still may send + // some bytes, but the closer ignores them to keep the underling + // connection open. + //nolint:errcheck + io.Copy(ioutil.Discard, d.rdr) + } + return d.rdr.Close() +} diff --git a/vendor/github.com/go-openapi/runtime/client/opentracing.go b/vendor/github.com/go-openapi/runtime/client/opentracing.go new file mode 100644 index 00000000000..627286d12fa --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client/opentracing.go @@ -0,0 +1,99 @@ +package client + +import ( + "fmt" + "net/http" + + "github.com/go-openapi/strfmt" + "github.com/opentracing/opentracing-go" + "github.com/opentracing/opentracing-go/ext" + "github.com/opentracing/opentracing-go/log" + + "github.com/go-openapi/runtime" +) + +type tracingTransport struct { + transport runtime.ClientTransport + host string + opts []opentracing.StartSpanOption +} + +func newOpenTracingTransport(transport runtime.ClientTransport, host string, opts []opentracing.StartSpanOption, +) runtime.ClientTransport { + return &tracingTransport{ + transport: transport, + host: host, + opts: opts, + } +} + +func (t *tracingTransport) Submit(op *runtime.ClientOperation) (interface{}, error) { + if op.Context == nil { + return t.transport.Submit(op) + } + + params := op.Params + reader := op.Reader + + var span opentracing.Span + defer func() { + if span != nil { + span.Finish() + } + }() + + op.Params = runtime.ClientRequestWriterFunc(func(req runtime.ClientRequest, reg strfmt.Registry) error { + span = createClientSpan(op, req.GetHeaderParams(), t.host, t.opts) + return params.WriteToRequest(req, reg) + }) + + op.Reader = runtime.ClientResponseReaderFunc(func(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + if span != nil { + code := response.Code() + ext.HTTPStatusCode.Set(span, uint16(code)) + if code >= 400 { + ext.Error.Set(span, true) + } + } + return reader.ReadResponse(response, consumer) + }) + + submit, err := t.transport.Submit(op) + if err != nil && span != nil { + ext.Error.Set(span, true) + span.LogFields(log.Error(err)) + } + return submit, err +} + +func createClientSpan(op *runtime.ClientOperation, header http.Header, host string, + opts []opentracing.StartSpanOption) opentracing.Span { + ctx := op.Context + span := opentracing.SpanFromContext(ctx) + + if span != nil { + opts = append(opts, ext.SpanKindRPCClient) + span, _ = opentracing.StartSpanFromContextWithTracer( + ctx, span.Tracer(), operationName(op), opts...) + + ext.Component.Set(span, "go-openapi") + ext.PeerHostname.Set(span, host) + span.SetTag("http.path", op.PathPattern) + ext.HTTPMethod.Set(span, op.Method) + + _ = span.Tracer().Inject( + span.Context(), + opentracing.HTTPHeaders, + opentracing.HTTPHeadersCarrier(header)) + + return span + } + return nil +} + +func operationName(op *runtime.ClientOperation) string { + if op.ID != "" { + return op.ID + } + return fmt.Sprintf("%s_%s", op.Method, op.PathPattern) +} diff --git a/vendor/github.com/go-openapi/runtime/client/request.go b/vendor/github.com/go-openapi/runtime/client/request.go new file mode 100644 index 00000000000..7d622eee93b --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client/request.go @@ -0,0 +1,474 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "bytes" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/textproto" + "net/url" + "os" + "path" + "path/filepath" + "strings" + "time" + + "github.com/go-openapi/strfmt" + + "github.com/go-openapi/runtime" +) + +// NewRequest creates a new swagger http client request +func newRequest(method, pathPattern string, writer runtime.ClientRequestWriter) (*request, error) { + return &request{ + pathPattern: pathPattern, + method: method, + writer: writer, + header: make(http.Header), + query: make(url.Values), + timeout: DefaultTimeout, + getBody: getRequestBuffer, + }, nil +} + +// Request represents a swagger client request. +// +// This Request struct converts to a HTTP request. +// There might be others that convert to other transports. +// There is no error checking here, it is assumed to be used after a spec has been validated. +// so impossible combinations should not arise (hopefully). +// +// The main purpose of this struct is to hide the machinery of adding params to a transport request. +// The generated code only implements what is necessary to turn a param into a valid value for these methods. +type request struct { + pathPattern string + method string + writer runtime.ClientRequestWriter + + pathParams map[string]string + header http.Header + query url.Values + formFields url.Values + fileFields map[string][]runtime.NamedReadCloser + payload interface{} + timeout time.Duration + buf *bytes.Buffer + + getBody func(r *request) []byte +} + +var ( + // ensure interface compliance + _ runtime.ClientRequest = new(request) +) + +func (r *request) isMultipart(mediaType string) bool { + if len(r.fileFields) > 0 { + return true + } + + return runtime.MultipartFormMime == mediaType +} + +// BuildHTTP creates a new http request based on the data from the params +func (r *request) BuildHTTP(mediaType, basePath string, producers map[string]runtime.Producer, registry strfmt.Registry) (*http.Request, error) { + return r.buildHTTP(mediaType, basePath, producers, registry, nil) +} +func escapeQuotes(s string) string { + return strings.NewReplacer("\\", "\\\\", `"`, "\\\"").Replace(s) +} + +func logClose(err error, pw *io.PipeWriter) { + log.Println(err) + closeErr := pw.CloseWithError(err) + if closeErr != nil { + log.Println(closeErr) + } +} + +func (r *request) buildHTTP(mediaType, basePath string, producers map[string]runtime.Producer, registry strfmt.Registry, auth runtime.ClientAuthInfoWriter) (*http.Request, error) { + // build the data + if err := r.writer.WriteToRequest(r, registry); err != nil { + return nil, err + } + + // Our body must be an io.Reader. + // When we create the http.Request, if we pass it a + // bytes.Buffer then it will wrap it in an io.ReadCloser + // and set the content length automatically. + var body io.Reader + var pr *io.PipeReader + var pw *io.PipeWriter + + r.buf = bytes.NewBuffer(nil) + if r.payload != nil || len(r.formFields) > 0 || len(r.fileFields) > 0 { + body = r.buf + if r.isMultipart(mediaType) { + pr, pw = io.Pipe() + body = pr + } + } + + // check if this is a form type request + if len(r.formFields) > 0 || len(r.fileFields) > 0 { + if !r.isMultipart(mediaType) { + r.header.Set(runtime.HeaderContentType, mediaType) + formString := r.formFields.Encode() + r.buf.WriteString(formString) + goto DoneChoosingBodySource + } + + mp := multipart.NewWriter(pw) + r.header.Set(runtime.HeaderContentType, mangleContentType(mediaType, mp.Boundary())) + + go func() { + defer func() { + mp.Close() + pw.Close() + }() + + for fn, v := range r.formFields { + for _, vi := range v { + if err := mp.WriteField(fn, vi); err != nil { + logClose(err, pw) + return + } + } + } + + defer func() { + for _, ff := range r.fileFields { + for _, ffi := range ff { + ffi.Close() + } + } + }() + for fn, f := range r.fileFields { + for _, fi := range f { + // Need to read the data so that we can detect the content type + buf := make([]byte, 512) + size, err := fi.Read(buf) + if err != nil { + logClose(err, pw) + return + } + fileContentType := http.DetectContentType(buf) + newFi := runtime.NamedReader(fi.Name(), io.MultiReader(bytes.NewReader(buf[:size]), fi)) + + // Create the MIME headers for the new part + h := make(textproto.MIMEHeader) + h.Set("Content-Disposition", + fmt.Sprintf(`form-data; name="%s"; filename="%s"`, + escapeQuotes(fn), escapeQuotes(filepath.Base(fi.Name())))) + h.Set("Content-Type", fileContentType) + + wrtr, err := mp.CreatePart(h) + if err != nil { + logClose(err, pw) + return + } + if _, err := io.Copy(wrtr, newFi); err != nil { + logClose(err, pw) + } + } + } + }() + + goto DoneChoosingBodySource + } + + // if there is payload, use the producer to write the payload, and then + // set the header to the content-type appropriate for the payload produced + if r.payload != nil { + // TODO: infer most appropriate content type based on the producer used, + // and the `consumers` section of the spec/operation + r.header.Set(runtime.HeaderContentType, mediaType) + if rdr, ok := r.payload.(io.ReadCloser); ok { + body = rdr + goto DoneChoosingBodySource + } + + if rdr, ok := r.payload.(io.Reader); ok { + body = rdr + goto DoneChoosingBodySource + } + + producer := producers[mediaType] + if err := producer.Produce(r.buf, r.payload); err != nil { + return nil, err + } + } + +DoneChoosingBodySource: + + if runtime.CanHaveBody(r.method) && body == nil && r.header.Get(runtime.HeaderContentType) == "" { + r.header.Set(runtime.HeaderContentType, mediaType) + } + + if auth != nil { + // If we're not using r.buf as our http.Request's body, + // either the payload is an io.Reader or io.ReadCloser, + // or we're doing a multipart form/file. + // + // In those cases, if the AuthenticateRequest call asks for the body, + // we must read it into a buffer and provide that, then use that buffer + // as the body of our http.Request. + // + // This is done in-line with the GetBody() request rather than ahead + // of time, because there's no way to know if the AuthenticateRequest + // will even ask for the body of the request. + // + // If for some reason the copy fails, there's no way to return that + // error to the GetBody() call, so return it afterwards. + // + // An error from the copy action is prioritized over any error + // from the AuthenticateRequest call, because the mis-read + // body may have interfered with the auth. + // + var copyErr error + if buf, ok := body.(*bytes.Buffer); body != nil && (!ok || buf != r.buf) { + var copied bool + r.getBody = func(r *request) []byte { + if copied { + return getRequestBuffer(r) + } + + defer func() { + copied = true + }() + + if _, copyErr = io.Copy(r.buf, body); copyErr != nil { + return nil + } + + if closer, ok := body.(io.ReadCloser); ok { + if copyErr = closer.Close(); copyErr != nil { + return nil + } + } + + body = r.buf + return getRequestBuffer(r) + } + } + + authErr := auth.AuthenticateRequest(r, registry) + + if copyErr != nil { + return nil, fmt.Errorf("error retrieving the response body: %v", copyErr) + } + + if authErr != nil { + return nil, authErr + } + } + + // In case the basePath or the request pathPattern include static query parameters, + // parse those out before constructing the final path. The parameters themselves + // will be merged with the ones set by the client, with the priority given first to + // the ones set by the client, then the path pattern, and lastly the base path. + basePathURL, err := url.Parse(basePath) + if err != nil { + return nil, err + } + staticQueryParams := basePathURL.Query() + + pathPatternURL, err := url.Parse(r.pathPattern) + if err != nil { + return nil, err + } + for name, values := range pathPatternURL.Query() { + if _, present := staticQueryParams[name]; present { + staticQueryParams.Del(name) + } + for _, value := range values { + staticQueryParams.Add(name, value) + } + } + + // create http request + var reinstateSlash bool + if pathPatternURL.Path != "" && pathPatternURL.Path != "/" && pathPatternURL.Path[len(pathPatternURL.Path)-1] == '/' { + reinstateSlash = true + } + + urlPath := path.Join(basePathURL.Path, pathPatternURL.Path) + for k, v := range r.pathParams { + urlPath = strings.Replace(urlPath, "{"+k+"}", url.PathEscape(v), -1) + } + if reinstateSlash { + urlPath = urlPath + "/" + } + + req, err := http.NewRequest(r.method, urlPath, body) + if err != nil { + return nil, err + } + + originalParams := r.GetQueryParams() + + // Merge the query parameters extracted from the basePath with the ones set by + // the client in this struct. In case of conflict, the client wins. + for k, v := range staticQueryParams { + _, present := originalParams[k] + if !present { + if err = r.SetQueryParam(k, v...); err != nil { + return nil, err + } + } + } + + req.URL.RawQuery = r.query.Encode() + req.Header = r.header + + return req, nil +} + +func mangleContentType(mediaType, boundary string) string { + if strings.ToLower(mediaType) == runtime.URLencodedFormMime { + return fmt.Sprintf("%s; boundary=%s", mediaType, boundary) + } + return "multipart/form-data; boundary=" + boundary +} + +func (r *request) GetMethod() string { + return r.method +} + +func (r *request) GetPath() string { + path := r.pathPattern + for k, v := range r.pathParams { + path = strings.Replace(path, "{"+k+"}", v, -1) + } + return path +} + +func (r *request) GetBody() []byte { + return r.getBody(r) +} + +func getRequestBuffer(r *request) []byte { + if r.buf == nil { + return nil + } + return r.buf.Bytes() +} + +// SetHeaderParam adds a header param to the request +// when there is only 1 value provided for the varargs, it will set it. +// when there are several values provided for the varargs it will add it (no overriding) +func (r *request) SetHeaderParam(name string, values ...string) error { + if r.header == nil { + r.header = make(http.Header) + } + r.header[http.CanonicalHeaderKey(name)] = values + return nil +} + +// GetHeaderParams returns the all headers currently set for the request +func (r *request) GetHeaderParams() http.Header { + return r.header +} + +// SetQueryParam adds a query param to the request +// when there is only 1 value provided for the varargs, it will set it. +// when there are several values provided for the varargs it will add it (no overriding) +func (r *request) SetQueryParam(name string, values ...string) error { + if r.query == nil { + r.query = make(url.Values) + } + r.query[name] = values + return nil +} + +// GetQueryParams returns a copy of all query params currently set for the request +func (r *request) GetQueryParams() url.Values { + var result = make(url.Values) + for key, value := range r.query { + result[key] = append([]string{}, value...) + } + return result +} + +// SetFormParam adds a forn param to the request +// when there is only 1 value provided for the varargs, it will set it. +// when there are several values provided for the varargs it will add it (no overriding) +func (r *request) SetFormParam(name string, values ...string) error { + if r.formFields == nil { + r.formFields = make(url.Values) + } + r.formFields[name] = values + return nil +} + +// SetPathParam adds a path param to the request +func (r *request) SetPathParam(name string, value string) error { + if r.pathParams == nil { + r.pathParams = make(map[string]string) + } + + r.pathParams[name] = value + return nil +} + +// SetFileParam adds a file param to the request +func (r *request) SetFileParam(name string, files ...runtime.NamedReadCloser) error { + for _, file := range files { + if actualFile, ok := file.(*os.File); ok { + fi, err := os.Stat(actualFile.Name()) + if err != nil { + return err + } + if fi.IsDir() { + return fmt.Errorf("%q is a directory, only files are supported", file.Name()) + } + } + } + + if r.fileFields == nil { + r.fileFields = make(map[string][]runtime.NamedReadCloser) + } + if r.formFields == nil { + r.formFields = make(url.Values) + } + + r.fileFields[name] = files + return nil +} + +func (r *request) GetFileParam() map[string][]runtime.NamedReadCloser { + return r.fileFields +} + +// SetBodyParam sets a body parameter on the request. +// This does not yet serialze the object, this happens as late as possible. +func (r *request) SetBodyParam(payload interface{}) error { + r.payload = payload + return nil +} + +func (r *request) GetBodyParam() interface{} { + return r.payload +} + +// SetTimeout sets the timeout for a request +func (r *request) SetTimeout(timeout time.Duration) error { + r.timeout = timeout + return nil +} diff --git a/vendor/github.com/go-openapi/runtime/client/response.go b/vendor/github.com/go-openapi/runtime/client/response.go new file mode 100644 index 00000000000..b297a12ff03 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client/response.go @@ -0,0 +1,48 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "io" + "net/http" + + "github.com/go-openapi/runtime" +) + +var _ runtime.ClientResponse = response{} + +type response struct { + resp *http.Response +} + +func (r response) Code() int { + return r.resp.StatusCode +} + +func (r response) Message() string { + return r.resp.Status +} + +func (r response) GetHeader(name string) string { + return r.resp.Header.Get(name) +} + +func (r response) GetHeaders(name string) []string { + return r.resp.Header.Values(name) +} + +func (r response) Body() io.ReadCloser { + return r.resp.Body +} diff --git a/vendor/github.com/go-openapi/runtime/client/runtime.go b/vendor/github.com/go-openapi/runtime/client/runtime.go new file mode 100644 index 00000000000..f6ea0fad3c5 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client/runtime.go @@ -0,0 +1,497 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package client + +import ( + "context" + "crypto" + "crypto/ecdsa" + "crypto/rsa" + "crypto/tls" + "crypto/x509" + "encoding/pem" + "fmt" + "io/ioutil" + "mime" + "net/http" + "net/http/httputil" + "strings" + "sync" + "time" + + "github.com/go-openapi/strfmt" + "github.com/opentracing/opentracing-go" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/logger" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/yamlpc" +) + +// TLSClientOptions to configure client authentication with mutual TLS +type TLSClientOptions struct { + // Certificate is the path to a PEM-encoded certificate to be used for + // client authentication. If set then Key must also be set. + Certificate string + + // LoadedCertificate is the certificate to be used for client authentication. + // This field is ignored if Certificate is set. If this field is set, LoadedKey + // is also required. + LoadedCertificate *x509.Certificate + + // Key is the path to an unencrypted PEM-encoded private key for client + // authentication. This field is required if Certificate is set. + Key string + + // LoadedKey is the key for client authentication. This field is required if + // LoadedCertificate is set. + LoadedKey crypto.PrivateKey + + // CA is a path to a PEM-encoded certificate that specifies the root certificate + // to use when validating the TLS certificate presented by the server. If this field + // (and LoadedCA) is not set, the system certificate pool is used. This field is ignored if LoadedCA + // is set. + CA string + + // LoadedCA specifies the root certificate to use when validating the server's TLS certificate. + // If this field (and CA) is not set, the system certificate pool is used. + LoadedCA *x509.Certificate + + // LoadedCAPool specifies a pool of RootCAs to use when validating the server's TLS certificate. + // If set, it will be combined with the the other loaded certificates (see LoadedCA and CA). + // If neither LoadedCA or CA is set, the provided pool with override the system + // certificate pool. + // The caller must not use the supplied pool after calling TLSClientAuth. + LoadedCAPool *x509.CertPool + + // ServerName specifies the hostname to use when verifying the server certificate. + // If this field is set then InsecureSkipVerify will be ignored and treated as + // false. + ServerName string + + // InsecureSkipVerify controls whether the certificate chain and hostname presented + // by the server are validated. If true, any certificate is accepted. + InsecureSkipVerify bool + + // VerifyPeerCertificate, if not nil, is called after normal + // certificate verification. It receives the raw ASN.1 certificates + // provided by the peer and also any verified chains that normal processing found. + // If it returns a non-nil error, the handshake is aborted and that error results. + // + // If normal verification fails then the handshake will abort before + // considering this callback. If normal verification is disabled by + // setting InsecureSkipVerify then this callback will be considered but + // the verifiedChains argument will always be nil. + VerifyPeerCertificate func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error + + // SessionTicketsDisabled may be set to true to disable session ticket and + // PSK (resumption) support. Note that on clients, session ticket support is + // also disabled if ClientSessionCache is nil. + SessionTicketsDisabled bool + + // ClientSessionCache is a cache of ClientSessionState entries for TLS + // session resumption. It is only used by clients. + ClientSessionCache tls.ClientSessionCache + + // Prevents callers using unkeyed fields. + _ struct{} +} + +// TLSClientAuth creates a tls.Config for mutual auth +func TLSClientAuth(opts TLSClientOptions) (*tls.Config, error) { + // create client tls config + cfg := &tls.Config{} + + // load client cert if specified + if opts.Certificate != "" { + cert, err := tls.LoadX509KeyPair(opts.Certificate, opts.Key) + if err != nil { + return nil, fmt.Errorf("tls client cert: %v", err) + } + cfg.Certificates = []tls.Certificate{cert} + } else if opts.LoadedCertificate != nil { + block := pem.Block{Type: "CERTIFICATE", Bytes: opts.LoadedCertificate.Raw} + certPem := pem.EncodeToMemory(&block) + + var keyBytes []byte + switch k := opts.LoadedKey.(type) { + case *rsa.PrivateKey: + keyBytes = x509.MarshalPKCS1PrivateKey(k) + case *ecdsa.PrivateKey: + var err error + keyBytes, err = x509.MarshalECPrivateKey(k) + if err != nil { + return nil, fmt.Errorf("tls client priv key: %v", err) + } + default: + return nil, fmt.Errorf("tls client priv key: unsupported key type") + } + + block = pem.Block{Type: "PRIVATE KEY", Bytes: keyBytes} + keyPem := pem.EncodeToMemory(&block) + + cert, err := tls.X509KeyPair(certPem, keyPem) + if err != nil { + return nil, fmt.Errorf("tls client cert: %v", err) + } + cfg.Certificates = []tls.Certificate{cert} + } + + cfg.InsecureSkipVerify = opts.InsecureSkipVerify + + cfg.VerifyPeerCertificate = opts.VerifyPeerCertificate + cfg.SessionTicketsDisabled = opts.SessionTicketsDisabled + cfg.ClientSessionCache = opts.ClientSessionCache + + // When no CA certificate is provided, default to the system cert pool + // that way when a request is made to a server known by the system trust store, + // the name is still verified + if opts.LoadedCA != nil { + caCertPool := basePool(opts.LoadedCAPool) + caCertPool.AddCert(opts.LoadedCA) + cfg.RootCAs = caCertPool + } else if opts.CA != "" { + // load ca cert + caCert, err := ioutil.ReadFile(opts.CA) + if err != nil { + return nil, fmt.Errorf("tls client ca: %v", err) + } + caCertPool := basePool(opts.LoadedCAPool) + caCertPool.AppendCertsFromPEM(caCert) + cfg.RootCAs = caCertPool + } else if opts.LoadedCAPool != nil { + cfg.RootCAs = opts.LoadedCAPool + } + + // apply servername overrride + if opts.ServerName != "" { + cfg.InsecureSkipVerify = false + cfg.ServerName = opts.ServerName + } + + cfg.BuildNameToCertificate() + + return cfg, nil +} + +func basePool(pool *x509.CertPool) *x509.CertPool { + if pool == nil { + return x509.NewCertPool() + } + return pool +} + +// TLSTransport creates a http client transport suitable for mutual tls auth +func TLSTransport(opts TLSClientOptions) (http.RoundTripper, error) { + cfg, err := TLSClientAuth(opts) + if err != nil { + return nil, err + } + + return &http.Transport{TLSClientConfig: cfg}, nil +} + +// TLSClient creates a http.Client for mutual auth +func TLSClient(opts TLSClientOptions) (*http.Client, error) { + transport, err := TLSTransport(opts) + if err != nil { + return nil, err + } + return &http.Client{Transport: transport}, nil +} + +// DefaultTimeout the default request timeout +var DefaultTimeout = 30 * time.Second + +// Runtime represents an API client that uses the transport +// to make http requests based on a swagger specification. +type Runtime struct { + DefaultMediaType string + DefaultAuthentication runtime.ClientAuthInfoWriter + Consumers map[string]runtime.Consumer + Producers map[string]runtime.Producer + + Transport http.RoundTripper + Jar http.CookieJar + //Spec *spec.Document + Host string + BasePath string + Formats strfmt.Registry + Context context.Context + + Debug bool + logger logger.Logger + + clientOnce *sync.Once + client *http.Client + schemes []string +} + +// New creates a new default runtime for a swagger api runtime.Client +func New(host, basePath string, schemes []string) *Runtime { + var rt Runtime + rt.DefaultMediaType = runtime.JSONMime + + // TODO: actually infer this stuff from the spec + rt.Consumers = map[string]runtime.Consumer{ + runtime.YAMLMime: yamlpc.YAMLConsumer(), + runtime.JSONMime: runtime.JSONConsumer(), + runtime.XMLMime: runtime.XMLConsumer(), + runtime.TextMime: runtime.TextConsumer(), + runtime.HTMLMime: runtime.TextConsumer(), + runtime.CSVMime: runtime.CSVConsumer(), + runtime.DefaultMime: runtime.ByteStreamConsumer(), + } + rt.Producers = map[string]runtime.Producer{ + runtime.YAMLMime: yamlpc.YAMLProducer(), + runtime.JSONMime: runtime.JSONProducer(), + runtime.XMLMime: runtime.XMLProducer(), + runtime.TextMime: runtime.TextProducer(), + runtime.HTMLMime: runtime.TextProducer(), + runtime.CSVMime: runtime.CSVProducer(), + runtime.DefaultMime: runtime.ByteStreamProducer(), + } + rt.Transport = http.DefaultTransport + rt.Jar = nil + rt.Host = host + rt.BasePath = basePath + rt.Context = context.Background() + rt.clientOnce = new(sync.Once) + if !strings.HasPrefix(rt.BasePath, "/") { + rt.BasePath = "/" + rt.BasePath + } + + rt.Debug = logger.DebugEnabled() + rt.logger = logger.StandardLogger{} + + if len(schemes) > 0 { + rt.schemes = schemes + } + return &rt +} + +// NewWithClient allows you to create a new transport with a configured http.Client +func NewWithClient(host, basePath string, schemes []string, client *http.Client) *Runtime { + rt := New(host, basePath, schemes) + if client != nil { + rt.clientOnce.Do(func() { + rt.client = client + }) + } + return rt +} + +// WithOpenTracing adds opentracing support to the provided runtime. +// A new client span is created for each request. +// If the context of the client operation does not contain an active span, no span is created. +// The provided opts are applied to each spans - for example to add global tags. +func (r *Runtime) WithOpenTracing(opts ...opentracing.StartSpanOption) runtime.ClientTransport { + return newOpenTracingTransport(r, r.Host, opts) +} + +func (r *Runtime) pickScheme(schemes []string) string { + if v := r.selectScheme(r.schemes); v != "" { + return v + } + if v := r.selectScheme(schemes); v != "" { + return v + } + return "http" +} + +func (r *Runtime) selectScheme(schemes []string) string { + schLen := len(schemes) + if schLen == 0 { + return "" + } + + scheme := schemes[0] + // prefer https, but skip when not possible + if scheme != "https" && schLen > 1 { + for _, sch := range schemes { + if sch == "https" { + scheme = sch + break + } + } + } + return scheme +} +func transportOrDefault(left, right http.RoundTripper) http.RoundTripper { + if left == nil { + return right + } + return left +} + +// EnableConnectionReuse drains the remaining body from a response +// so that go will reuse the TCP connections. +// +// This is not enabled by default because there are servers where +// the response never gets closed and that would make the code hang forever. +// So instead it's provided as a http client middleware that can be used to override +// any request. +func (r *Runtime) EnableConnectionReuse() { + if r.client == nil { + r.Transport = KeepAliveTransport( + transportOrDefault(r.Transport, http.DefaultTransport), + ) + return + } + + r.client.Transport = KeepAliveTransport( + transportOrDefault(r.client.Transport, + transportOrDefault(r.Transport, http.DefaultTransport), + ), + ) +} + +// Submit a request and when there is a body on success it will turn that into the result +// all other things are turned into an api error for swagger which retains the status code +func (r *Runtime) Submit(operation *runtime.ClientOperation) (interface{}, error) { + params, readResponse, auth := operation.Params, operation.Reader, operation.AuthInfo + + request, err := newRequest(operation.Method, operation.PathPattern, params) + if err != nil { + return nil, err + } + + var accept []string + accept = append(accept, operation.ProducesMediaTypes...) + if err = request.SetHeaderParam(runtime.HeaderAccept, accept...); err != nil { + return nil, err + } + + if auth == nil && r.DefaultAuthentication != nil { + auth = r.DefaultAuthentication + } + //if auth != nil { + // if err := auth.AuthenticateRequest(request, r.Formats); err != nil { + // return nil, err + // } + //} + + // TODO: pick appropriate media type + cmt := r.DefaultMediaType + for _, mediaType := range operation.ConsumesMediaTypes { + // Pick first non-empty media type + if mediaType != "" { + cmt = mediaType + break + } + } + + if _, ok := r.Producers[cmt]; !ok && cmt != runtime.MultipartFormMime && cmt != runtime.URLencodedFormMime { + return nil, fmt.Errorf("none of producers: %v registered. try %s", r.Producers, cmt) + } + + req, err := request.buildHTTP(cmt, r.BasePath, r.Producers, r.Formats, auth) + if err != nil { + return nil, err + } + req.URL.Scheme = r.pickScheme(operation.Schemes) + req.URL.Host = r.Host + req.Host = r.Host + + r.clientOnce.Do(func() { + r.client = &http.Client{ + Transport: r.Transport, + Jar: r.Jar, + } + }) + + if r.Debug { + b, err2 := httputil.DumpRequestOut(req, true) + if err2 != nil { + return nil, err2 + } + r.logger.Debugf("%s\n", string(b)) + } + + var hasTimeout bool + pctx := operation.Context + if pctx == nil { + pctx = r.Context + } else { + hasTimeout = true + } + if pctx == nil { + pctx = context.Background() + } + var ctx context.Context + var cancel context.CancelFunc + if hasTimeout { + ctx, cancel = context.WithCancel(pctx) + } else { + ctx, cancel = context.WithTimeout(pctx, request.timeout) + } + defer cancel() + + client := operation.Client + if client == nil { + client = r.client + } + req = req.WithContext(ctx) + res, err := client.Do(req) // make requests, by default follows 10 redirects before failing + if err != nil { + return nil, err + } + defer res.Body.Close() + + ct := res.Header.Get(runtime.HeaderContentType) + if ct == "" { // this should really really never occur + ct = r.DefaultMediaType + } + + if r.Debug { + printBody := true + if ct == runtime.DefaultMime { + printBody = false // Spare the terminal from a binary blob. + } + b, err2 := httputil.DumpResponse(res, printBody) + if err2 != nil { + return nil, err2 + } + r.logger.Debugf("%s\n", string(b)) + } + + mt, _, err := mime.ParseMediaType(ct) + if err != nil { + return nil, fmt.Errorf("parse content type: %s", err) + } + + cons, ok := r.Consumers[mt] + if !ok { + if cons, ok = r.Consumers["*/*"]; !ok { + // scream about not knowing what to do + return nil, fmt.Errorf("no consumer: %q", ct) + } + } + return readResponse.ReadResponse(response{res}, cons) +} + +// SetDebug changes the debug flag. +// It ensures that client and middlewares have the set debug level. +func (r *Runtime) SetDebug(debug bool) { + r.Debug = debug + middleware.Debug = debug +} + +// SetLogger changes the logger stream. +// It ensures that client and middlewares use the same logger. +func (r *Runtime) SetLogger(logger logger.Logger) { + r.logger = logger + middleware.Logger = logger +} diff --git a/vendor/github.com/go-openapi/runtime/client_auth_info.go b/vendor/github.com/go-openapi/runtime/client_auth_info.go new file mode 100644 index 00000000000..c6c97d9a7c3 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client_auth_info.go @@ -0,0 +1,30 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import "github.com/go-openapi/strfmt" + +// A ClientAuthInfoWriterFunc converts a function to a request writer interface +type ClientAuthInfoWriterFunc func(ClientRequest, strfmt.Registry) error + +// AuthenticateRequest adds authentication data to the request +func (fn ClientAuthInfoWriterFunc) AuthenticateRequest(req ClientRequest, reg strfmt.Registry) error { + return fn(req, reg) +} + +// A ClientAuthInfoWriter implementor knows how to write authentication info to a request +type ClientAuthInfoWriter interface { + AuthenticateRequest(ClientRequest, strfmt.Registry) error +} diff --git a/vendor/github.com/go-openapi/runtime/client_operation.go b/vendor/github.com/go-openapi/runtime/client_operation.go new file mode 100644 index 00000000000..fa21eacf330 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client_operation.go @@ -0,0 +1,41 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "context" + "net/http" +) + +// ClientOperation represents the context for a swagger operation to be submitted to the transport +type ClientOperation struct { + ID string + Method string + PathPattern string + ProducesMediaTypes []string + ConsumesMediaTypes []string + Schemes []string + AuthInfo ClientAuthInfoWriter + Params ClientRequestWriter + Reader ClientResponseReader + Context context.Context + Client *http.Client +} + +// A ClientTransport implementor knows how to submit Request objects to some destination +type ClientTransport interface { + //Submit(string, RequestWriter, ResponseReader, AuthInfoWriter) (interface{}, error) + Submit(*ClientOperation) (interface{}, error) +} diff --git a/vendor/github.com/go-openapi/runtime/client_request.go b/vendor/github.com/go-openapi/runtime/client_request.go new file mode 100644 index 00000000000..3efda348216 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client_request.go @@ -0,0 +1,153 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "io" + "io/ioutil" + "net/http" + "net/url" + "time" + + "github.com/go-openapi/strfmt" +) + +// ClientRequestWriterFunc converts a function to a request writer interface +type ClientRequestWriterFunc func(ClientRequest, strfmt.Registry) error + +// WriteToRequest adds data to the request +func (fn ClientRequestWriterFunc) WriteToRequest(req ClientRequest, reg strfmt.Registry) error { + return fn(req, reg) +} + +// ClientRequestWriter is an interface for things that know how to write to a request +type ClientRequestWriter interface { + WriteToRequest(ClientRequest, strfmt.Registry) error +} + +// ClientRequest is an interface for things that know how to +// add information to a swagger client request +type ClientRequest interface { + SetHeaderParam(string, ...string) error + + GetHeaderParams() http.Header + + SetQueryParam(string, ...string) error + + SetFormParam(string, ...string) error + + SetPathParam(string, string) error + + GetQueryParams() url.Values + + SetFileParam(string, ...NamedReadCloser) error + + SetBodyParam(interface{}) error + + SetTimeout(time.Duration) error + + GetMethod() string + + GetPath() string + + GetBody() []byte + + GetBodyParam() interface{} + + GetFileParam() map[string][]NamedReadCloser +} + +// NamedReadCloser represents a named ReadCloser interface +type NamedReadCloser interface { + io.ReadCloser + Name() string +} + +// NamedReader creates a NamedReadCloser for use as file upload +func NamedReader(name string, rdr io.Reader) NamedReadCloser { + rc, ok := rdr.(io.ReadCloser) + if !ok { + rc = ioutil.NopCloser(rdr) + } + return &namedReadCloser{ + name: name, + cr: rc, + } +} + +type namedReadCloser struct { + name string + cr io.ReadCloser +} + +func (n *namedReadCloser) Close() error { + return n.cr.Close() +} +func (n *namedReadCloser) Read(p []byte) (int, error) { + return n.cr.Read(p) +} +func (n *namedReadCloser) Name() string { + return n.name +} + +type TestClientRequest struct { + Headers http.Header + Body interface{} +} + +func (t *TestClientRequest) SetHeaderParam(name string, values ...string) error { + if t.Headers == nil { + t.Headers = make(http.Header) + } + t.Headers.Set(name, values[0]) + return nil +} + +func (t *TestClientRequest) SetQueryParam(_ string, _ ...string) error { return nil } + +func (t *TestClientRequest) SetFormParam(_ string, _ ...string) error { return nil } + +func (t *TestClientRequest) SetPathParam(_ string, _ string) error { return nil } + +func (t *TestClientRequest) SetFileParam(_ string, _ ...NamedReadCloser) error { return nil } + +func (t *TestClientRequest) SetBodyParam(body interface{}) error { + t.Body = body + return nil +} + +func (t *TestClientRequest) SetTimeout(time.Duration) error { + return nil +} + +func (t *TestClientRequest) GetQueryParams() url.Values { return nil } + +func (t *TestClientRequest) GetMethod() string { return "" } + +func (t *TestClientRequest) GetPath() string { return "" } + +func (t *TestClientRequest) GetBody() []byte { return nil } + +func (t *TestClientRequest) GetBodyParam() interface{} { + return t.Body +} + +func (t *TestClientRequest) GetFileParam() map[string][]NamedReadCloser { + return nil +} + +func (t *TestClientRequest) GetHeaderParams() http.Header { + return t.Headers +} diff --git a/vendor/github.com/go-openapi/runtime/client_response.go b/vendor/github.com/go-openapi/runtime/client_response.go new file mode 100644 index 00000000000..0b7e3824657 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/client_response.go @@ -0,0 +1,106 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "fmt" + "io" + + "encoding/json" +) + +// A ClientResponse represents a client response +// This bridges between responses obtained from different transports +type ClientResponse interface { + Code() int + Message() string + GetHeader(string) string + GetHeaders(string) []string + Body() io.ReadCloser +} + +// A ClientResponseReaderFunc turns a function into a ClientResponseReader interface implementation +type ClientResponseReaderFunc func(ClientResponse, Consumer) (interface{}, error) + +// ReadResponse reads the response +func (read ClientResponseReaderFunc) ReadResponse(resp ClientResponse, consumer Consumer) (interface{}, error) { + return read(resp, consumer) +} + +// A ClientResponseReader is an interface for things want to read a response. +// An application of this is to create structs from response values +type ClientResponseReader interface { + ReadResponse(ClientResponse, Consumer) (interface{}, error) +} + +// NewAPIError creates a new API error +func NewAPIError(opName string, payload interface{}, code int) *APIError { + return &APIError{ + OperationName: opName, + Response: payload, + Code: code, + } +} + +// APIError wraps an error model and captures the status code +type APIError struct { + OperationName string + Response interface{} + Code int +} + +func (a *APIError) Error() string { + resp, _ := json.Marshal(a.Response) + return fmt.Sprintf("%s (status %d): %s", a.OperationName, a.Code, resp) +} + +func (a *APIError) String() string { + return a.Error() +} + +// IsSuccess returns true when this elapse o k response returns a 2xx status code +func (o *APIError) IsSuccess() bool { + return o.Code/100 == 2 +} + +// IsRedirect returns true when this elapse o k response returns a 3xx status code +func (o *APIError) IsRedirect() bool { + return o.Code/100 == 3 +} + +// IsClientError returns true when this elapse o k response returns a 4xx status code +func (o *APIError) IsClientError() bool { + return o.Code/100 == 4 +} + +// IsServerError returns true when this elapse o k response returns a 5xx status code +func (o *APIError) IsServerError() bool { + return o.Code/100 == 5 +} + +// IsCode returns true when this elapse o k response returns a 4xx status code +func (o *APIError) IsCode(code int) bool { + return o.Code == code +} + +// A ClientResponseStatus is a common interface implemented by all responses on the generated code +// You can use this to treat any client response based on status code +type ClientResponseStatus interface { + IsSuccess() bool + IsRedirect() bool + IsClientError() bool + IsServerError() bool + IsCode(int) bool +} diff --git a/vendor/github.com/go-openapi/runtime/constants.go b/vendor/github.com/go-openapi/runtime/constants.go new file mode 100644 index 00000000000..a4de897adcd --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/constants.go @@ -0,0 +1,47 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +const ( + // HeaderContentType represents a http content-type header, it's value is supposed to be a mime type + HeaderContentType = "Content-Type" + + // HeaderTransferEncoding represents a http transfer-encoding header. + HeaderTransferEncoding = "Transfer-Encoding" + + // HeaderAccept the Accept header + HeaderAccept = "Accept" + + charsetKey = "charset" + + // DefaultMime the default fallback mime type + DefaultMime = "application/octet-stream" + // JSONMime the json mime type + JSONMime = "application/json" + // YAMLMime the yaml mime type + YAMLMime = "application/x-yaml" + // XMLMime the xml mime type + XMLMime = "application/xml" + // TextMime the text mime type + TextMime = "text/plain" + // HTMLMime the html mime type + HTMLMime = "text/html" + // CSVMime the csv mime type + CSVMime = "text/csv" + // MultipartFormMime the multipart form mime type + MultipartFormMime = "multipart/form-data" + // URLencodedFormMime the url encoded form mime type + URLencodedFormMime = "application/x-www-form-urlencoded" +) diff --git a/vendor/github.com/go-openapi/runtime/csv.go b/vendor/github.com/go-openapi/runtime/csv.go new file mode 100644 index 00000000000..d807bd915b4 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/csv.go @@ -0,0 +1,77 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "bytes" + "encoding/csv" + "errors" + "io" +) + +// CSVConsumer creates a new CSV consumer +func CSVConsumer() Consumer { + return ConsumerFunc(func(reader io.Reader, data interface{}) error { + if reader == nil { + return errors.New("CSVConsumer requires a reader") + } + + csvReader := csv.NewReader(reader) + writer, ok := data.(io.Writer) + if !ok { + return errors.New("data type must be io.Writer") + } + csvWriter := csv.NewWriter(writer) + records, err := csvReader.ReadAll() + if err != nil { + return err + } + for _, r := range records { + if err := csvWriter.Write(r); err != nil { + return err + } + } + csvWriter.Flush() + return nil + }) +} + +// CSVProducer creates a new CSV producer +func CSVProducer() Producer { + return ProducerFunc(func(writer io.Writer, data interface{}) error { + if writer == nil { + return errors.New("CSVProducer requires a writer") + } + + dataBytes, ok := data.([]byte) + if !ok { + return errors.New("data type must be byte array") + } + + csvReader := csv.NewReader(bytes.NewBuffer(dataBytes)) + records, err := csvReader.ReadAll() + if err != nil { + return err + } + csvWriter := csv.NewWriter(writer) + for _, r := range records { + if err := csvWriter.Write(r); err != nil { + return err + } + } + csvWriter.Flush() + return nil + }) +} diff --git a/vendor/github.com/go-openapi/runtime/discard.go b/vendor/github.com/go-openapi/runtime/discard.go new file mode 100644 index 00000000000..0d390cfd64c --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/discard.go @@ -0,0 +1,9 @@ +package runtime + +import "io" + +// DiscardConsumer does absolutely nothing, it's a black hole. +var DiscardConsumer = ConsumerFunc(func(_ io.Reader, _ interface{}) error { return nil }) + +// DiscardProducer does absolutely nothing, it's a black hole. +var DiscardProducer = ProducerFunc(func(_ io.Writer, _ interface{}) error { return nil }) diff --git a/vendor/github.com/go-openapi/runtime/file.go b/vendor/github.com/go-openapi/runtime/file.go new file mode 100644 index 00000000000..85971c18c4b --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/file.go @@ -0,0 +1,33 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import "mime/multipart" + +// File represents an uploaded file. +type File struct { + Data multipart.File + Header *multipart.FileHeader +} + +// Read bytes from the file +func (f *File) Read(p []byte) (n int, err error) { + return f.Data.Read(p) +} + +// Close the file +func (f *File) Close() error { + return f.Data.Close() +} diff --git a/vendor/github.com/go-openapi/runtime/headers.go b/vendor/github.com/go-openapi/runtime/headers.go new file mode 100644 index 00000000000..4d111db4fec --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/headers.go @@ -0,0 +1,45 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "mime" + "net/http" + + "github.com/go-openapi/errors" +) + +// ContentType parses a content type header +func ContentType(headers http.Header) (string, string, error) { + ct := headers.Get(HeaderContentType) + orig := ct + if ct == "" { + ct = DefaultMime + } + if ct == "" { + return "", "", nil + } + + mt, opts, err := mime.ParseMediaType(ct) + if err != nil { + return "", "", errors.NewParseError(HeaderContentType, "header", orig, err) + } + + if cs, ok := opts[charsetKey]; ok { + return mt, cs, nil + } + + return mt, "", nil +} diff --git a/vendor/github.com/go-openapi/runtime/interfaces.go b/vendor/github.com/go-openapi/runtime/interfaces.go new file mode 100644 index 00000000000..e3341286834 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/interfaces.go @@ -0,0 +1,112 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "context" + "io" + "net/http" + + "github.com/go-openapi/strfmt" +) + +// OperationHandlerFunc an adapter for a function to the OperationHandler interface +type OperationHandlerFunc func(interface{}) (interface{}, error) + +// Handle implements the operation handler interface +func (s OperationHandlerFunc) Handle(data interface{}) (interface{}, error) { + return s(data) +} + +// OperationHandler a handler for a swagger operation +type OperationHandler interface { + Handle(interface{}) (interface{}, error) +} + +// ConsumerFunc represents a function that can be used as a consumer +type ConsumerFunc func(io.Reader, interface{}) error + +// Consume consumes the reader into the data parameter +func (fn ConsumerFunc) Consume(reader io.Reader, data interface{}) error { + return fn(reader, data) +} + +// Consumer implementations know how to bind the values on the provided interface to +// data provided by the request body +type Consumer interface { + // Consume performs the binding of request values + Consume(io.Reader, interface{}) error +} + +// ProducerFunc represents a function that can be used as a producer +type ProducerFunc func(io.Writer, interface{}) error + +// Produce produces the response for the provided data +func (f ProducerFunc) Produce(writer io.Writer, data interface{}) error { + return f(writer, data) +} + +// Producer implementations know how to turn the provided interface into a valid +// HTTP response +type Producer interface { + // Produce writes to the http response + Produce(io.Writer, interface{}) error +} + +// AuthenticatorFunc turns a function into an authenticator +type AuthenticatorFunc func(interface{}) (bool, interface{}, error) + +// Authenticate authenticates the request with the provided data +func (f AuthenticatorFunc) Authenticate(params interface{}) (bool, interface{}, error) { + return f(params) +} + +// Authenticator represents an authentication strategy +// implementations of Authenticator know how to authenticate the +// request data and translate that into a valid principal object or an error +type Authenticator interface { + Authenticate(interface{}) (bool, interface{}, error) +} + +// AuthorizerFunc turns a function into an authorizer +type AuthorizerFunc func(*http.Request, interface{}) error + +// Authorize authorizes the processing of the request for the principal +func (f AuthorizerFunc) Authorize(r *http.Request, principal interface{}) error { + return f(r, principal) +} + +// Authorizer represents an authorization strategy +// implementations of Authorizer know how to authorize the principal object +// using the request data and returns error if unauthorized +type Authorizer interface { + Authorize(*http.Request, interface{}) error +} + +// Validatable types implementing this interface allow customizing their validation +// this will be used instead of the reflective validation based on the spec document. +// the implementations are assumed to have been generated by the swagger tool so they should +// contain all the validations obtained from the spec +type Validatable interface { + Validate(strfmt.Registry) error +} + +// ContextValidatable types implementing this interface allow customizing their validation +// this will be used instead of the reflective validation based on the spec document. +// the implementations are assumed to have been generated by the swagger tool so they should +// contain all the context validations obtained from the spec +type ContextValidatable interface { + ContextValidate(context.Context, strfmt.Registry) error +} diff --git a/vendor/github.com/go-openapi/runtime/json.go b/vendor/github.com/go-openapi/runtime/json.go new file mode 100644 index 00000000000..5a690559cc5 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/json.go @@ -0,0 +1,38 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "encoding/json" + "io" +) + +// JSONConsumer creates a new JSON consumer +func JSONConsumer() Consumer { + return ConsumerFunc(func(reader io.Reader, data interface{}) error { + dec := json.NewDecoder(reader) + dec.UseNumber() // preserve number formats + return dec.Decode(data) + }) +} + +// JSONProducer creates a new JSON producer +func JSONProducer() Producer { + return ProducerFunc(func(writer io.Writer, data interface{}) error { + enc := json.NewEncoder(writer) + enc.SetEscapeHTML(false) + return enc.Encode(data) + }) +} diff --git a/vendor/github.com/go-openapi/runtime/logger/logger.go b/vendor/github.com/go-openapi/runtime/logger/logger.go new file mode 100644 index 00000000000..6f4debcc145 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/logger/logger.go @@ -0,0 +1,20 @@ +package logger + +import "os" + +type Logger interface { + Printf(format string, args ...interface{}) + Debugf(format string, args ...interface{}) +} + +func DebugEnabled() bool { + d := os.Getenv("SWAGGER_DEBUG") + if d != "" && d != "false" && d != "0" { + return true + } + d = os.Getenv("DEBUG") + if d != "" && d != "false" && d != "0" { + return true + } + return false +} diff --git a/vendor/github.com/go-openapi/runtime/logger/standard.go b/vendor/github.com/go-openapi/runtime/logger/standard.go new file mode 100644 index 00000000000..f7e67ebb9e7 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/logger/standard.go @@ -0,0 +1,22 @@ +package logger + +import ( + "fmt" + "os" +) + +type StandardLogger struct{} + +func (StandardLogger) Printf(format string, args ...interface{}) { + if len(format) == 0 || format[len(format)-1] != '\n' { + format += "\n" + } + fmt.Fprintf(os.Stderr, format, args...) +} + +func (StandardLogger) Debugf(format string, args ...interface{}) { + if len(format) == 0 || format[len(format)-1] != '\n' { + format += "\n" + } + fmt.Fprintf(os.Stderr, format, args...) +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/context.go b/vendor/github.com/go-openapi/runtime/middleware/context.go new file mode 100644 index 00000000000..250e35fb0e1 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/context.go @@ -0,0 +1,622 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + stdContext "context" + "fmt" + "net/http" + "strings" + "sync" + + "github.com/go-openapi/analysis" + "github.com/go-openapi/errors" + "github.com/go-openapi/loads" + "github.com/go-openapi/spec" + "github.com/go-openapi/strfmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/logger" + "github.com/go-openapi/runtime/middleware/untyped" + "github.com/go-openapi/runtime/security" +) + +// Debug when true turns on verbose logging +var Debug = logger.DebugEnabled() +var Logger logger.Logger = logger.StandardLogger{} + +func debugLog(format string, args ...interface{}) { + if Debug { + Logger.Printf(format, args...) + } +} + +// A Builder can create middlewares +type Builder func(http.Handler) http.Handler + +// PassthroughBuilder returns the handler, aka the builder identity function +func PassthroughBuilder(handler http.Handler) http.Handler { return handler } + +// RequestBinder is an interface for types to implement +// when they want to be able to bind from a request +type RequestBinder interface { + BindRequest(*http.Request, *MatchedRoute) error +} + +// Responder is an interface for types to implement +// when they want to be considered for writing HTTP responses +type Responder interface { + WriteResponse(http.ResponseWriter, runtime.Producer) +} + +// ResponderFunc wraps a func as a Responder interface +type ResponderFunc func(http.ResponseWriter, runtime.Producer) + +// WriteResponse writes to the response +func (fn ResponderFunc) WriteResponse(rw http.ResponseWriter, pr runtime.Producer) { + fn(rw, pr) +} + +// Context is a type safe wrapper around an untyped request context +// used throughout to store request context with the standard context attached +// to the http.Request +type Context struct { + spec *loads.Document + analyzer *analysis.Spec + api RoutableAPI + router Router +} + +type routableUntypedAPI struct { + api *untyped.API + hlock *sync.Mutex + handlers map[string]map[string]http.Handler + defaultConsumes string + defaultProduces string +} + +func newRoutableUntypedAPI(spec *loads.Document, api *untyped.API, context *Context) *routableUntypedAPI { + var handlers map[string]map[string]http.Handler + if spec == nil || api == nil { + return nil + } + analyzer := analysis.New(spec.Spec()) + for method, hls := range analyzer.Operations() { + um := strings.ToUpper(method) + for path, op := range hls { + schemes := analyzer.SecurityRequirementsFor(op) + + if oh, ok := api.OperationHandlerFor(method, path); ok { + if handlers == nil { + handlers = make(map[string]map[string]http.Handler) + } + if b, ok := handlers[um]; !ok || b == nil { + handlers[um] = make(map[string]http.Handler) + } + + var handler http.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // lookup route info in the context + route, rCtx, _ := context.RouteInfo(r) + if rCtx != nil { + r = rCtx + } + + // bind and validate the request using reflection + var bound interface{} + var validation error + bound, r, validation = context.BindAndValidate(r, route) + if validation != nil { + context.Respond(w, r, route.Produces, route, validation) + return + } + + // actually handle the request + result, err := oh.Handle(bound) + if err != nil { + // respond with failure + context.Respond(w, r, route.Produces, route, err) + return + } + + // respond with success + context.Respond(w, r, route.Produces, route, result) + }) + + if len(schemes) > 0 { + handler = newSecureAPI(context, handler) + } + handlers[um][path] = handler + } + } + } + + return &routableUntypedAPI{ + api: api, + hlock: new(sync.Mutex), + handlers: handlers, + defaultProduces: api.DefaultProduces, + defaultConsumes: api.DefaultConsumes, + } +} + +func (r *routableUntypedAPI) HandlerFor(method, path string) (http.Handler, bool) { + r.hlock.Lock() + paths, ok := r.handlers[strings.ToUpper(method)] + if !ok { + r.hlock.Unlock() + return nil, false + } + handler, ok := paths[path] + r.hlock.Unlock() + return handler, ok +} +func (r *routableUntypedAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) { + return r.api.ServeError +} +func (r *routableUntypedAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer { + return r.api.ConsumersFor(mediaTypes) +} +func (r *routableUntypedAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer { + return r.api.ProducersFor(mediaTypes) +} +func (r *routableUntypedAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator { + return r.api.AuthenticatorsFor(schemes) +} +func (r *routableUntypedAPI) Authorizer() runtime.Authorizer { + return r.api.Authorizer() +} +func (r *routableUntypedAPI) Formats() strfmt.Registry { + return r.api.Formats() +} + +func (r *routableUntypedAPI) DefaultProduces() string { + return r.defaultProduces +} + +func (r *routableUntypedAPI) DefaultConsumes() string { + return r.defaultConsumes +} + +// NewRoutableContext creates a new context for a routable API +func NewRoutableContext(spec *loads.Document, routableAPI RoutableAPI, routes Router) *Context { + var an *analysis.Spec + if spec != nil { + an = analysis.New(spec.Spec()) + } + ctx := &Context{spec: spec, api: routableAPI, analyzer: an, router: routes} + return ctx +} + +// NewContext creates a new context wrapper +func NewContext(spec *loads.Document, api *untyped.API, routes Router) *Context { + var an *analysis.Spec + if spec != nil { + an = analysis.New(spec.Spec()) + } + ctx := &Context{spec: spec, analyzer: an} + ctx.api = newRoutableUntypedAPI(spec, api, ctx) + ctx.router = routes + return ctx +} + +// Serve serves the specified spec with the specified api registrations as a http.Handler +func Serve(spec *loads.Document, api *untyped.API) http.Handler { + return ServeWithBuilder(spec, api, PassthroughBuilder) +} + +// ServeWithBuilder serves the specified spec with the specified api registrations as a http.Handler that is decorated +// by the Builder +func ServeWithBuilder(spec *loads.Document, api *untyped.API, builder Builder) http.Handler { + context := NewContext(spec, api, nil) + return context.APIHandler(builder) +} + +type contextKey int8 + +const ( + _ contextKey = iota + ctxContentType + ctxResponseFormat + ctxMatchedRoute + ctxBoundParams + ctxSecurityPrincipal + ctxSecurityScopes +) + +// MatchedRouteFrom request context value. +func MatchedRouteFrom(req *http.Request) *MatchedRoute { + mr := req.Context().Value(ctxMatchedRoute) + if mr == nil { + return nil + } + if res, ok := mr.(*MatchedRoute); ok { + return res + } + return nil +} + +// SecurityPrincipalFrom request context value. +func SecurityPrincipalFrom(req *http.Request) interface{} { + return req.Context().Value(ctxSecurityPrincipal) +} + +// SecurityScopesFrom request context value. +func SecurityScopesFrom(req *http.Request) []string { + rs := req.Context().Value(ctxSecurityScopes) + if res, ok := rs.([]string); ok { + return res + } + return nil +} + +type contentTypeValue struct { + MediaType string + Charset string +} + +// BasePath returns the base path for this API +func (c *Context) BasePath() string { + return c.spec.BasePath() +} + +// RequiredProduces returns the accepted content types for responses +func (c *Context) RequiredProduces() []string { + return c.analyzer.RequiredProduces() +} + +// BindValidRequest binds a params object to a request but only when the request is valid +// if the request is not valid an error will be returned +func (c *Context) BindValidRequest(request *http.Request, route *MatchedRoute, binder RequestBinder) error { + var res []error + var requestContentType string + + // check and validate content type, select consumer + if runtime.HasBody(request) { + ct, _, err := runtime.ContentType(request.Header) + if err != nil { + res = append(res, err) + } else { + if err := validateContentType(route.Consumes, ct); err != nil { + res = append(res, err) + } + if len(res) == 0 { + cons, ok := route.Consumers[ct] + if !ok { + res = append(res, errors.New(500, "no consumer registered for %s", ct)) + } else { + route.Consumer = cons + requestContentType = ct + } + } + } + } + + // check and validate the response format + if len(res) == 0 { + // if the route does not provide Produces and a default contentType could not be identified + // based on a body, typical for GET and DELETE requests, then default contentType to. + if len(route.Produces) == 0 && requestContentType == "" { + requestContentType = "*/*" + } + + if str := NegotiateContentType(request, route.Produces, requestContentType); str == "" { + res = append(res, errors.InvalidResponseFormat(request.Header.Get(runtime.HeaderAccept), route.Produces)) + } + } + + // now bind the request with the provided binder + // it's assumed the binder will also validate the request and return an error if the + // request is invalid + if binder != nil && len(res) == 0 { + if err := binder.BindRequest(request, route); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContentType gets the parsed value of a content type +// Returns the media type, its charset and a shallow copy of the request +// when its context doesn't contain the content type value, otherwise it returns +// the same request +// Returns the error that runtime.ContentType may retunrs. +func (c *Context) ContentType(request *http.Request) (string, string, *http.Request, error) { + var rCtx = request.Context() + + if v, ok := rCtx.Value(ctxContentType).(*contentTypeValue); ok { + return v.MediaType, v.Charset, request, nil + } + + mt, cs, err := runtime.ContentType(request.Header) + if err != nil { + return "", "", nil, err + } + rCtx = stdContext.WithValue(rCtx, ctxContentType, &contentTypeValue{mt, cs}) + return mt, cs, request.WithContext(rCtx), nil +} + +// LookupRoute looks a route up and returns true when it is found +func (c *Context) LookupRoute(request *http.Request) (*MatchedRoute, bool) { + if route, ok := c.router.Lookup(request.Method, request.URL.EscapedPath()); ok { + return route, ok + } + return nil, false +} + +// RouteInfo tries to match a route for this request +// Returns the matched route, a shallow copy of the request if its context +// contains the matched router, otherwise the same request, and a bool to +// indicate if it the request matches one of the routes, if it doesn't +// then it returns false and nil for the other two return values +func (c *Context) RouteInfo(request *http.Request) (*MatchedRoute, *http.Request, bool) { + var rCtx = request.Context() + + if v, ok := rCtx.Value(ctxMatchedRoute).(*MatchedRoute); ok { + return v, request, ok + } + + if route, ok := c.LookupRoute(request); ok { + rCtx = stdContext.WithValue(rCtx, ctxMatchedRoute, route) + return route, request.WithContext(rCtx), ok + } + + return nil, nil, false +} + +// ResponseFormat negotiates the response content type +// Returns the response format and a shallow copy of the request if its context +// doesn't contain the response format, otherwise the same request +func (c *Context) ResponseFormat(r *http.Request, offers []string) (string, *http.Request) { + var rCtx = r.Context() + + if v, ok := rCtx.Value(ctxResponseFormat).(string); ok { + debugLog("[%s %s] found response format %q in context", r.Method, r.URL.Path, v) + return v, r + } + + format := NegotiateContentType(r, offers, "") + if format != "" { + debugLog("[%s %s] set response format %q in context", r.Method, r.URL.Path, format) + r = r.WithContext(stdContext.WithValue(rCtx, ctxResponseFormat, format)) + } + debugLog("[%s %s] negotiated response format %q", r.Method, r.URL.Path, format) + return format, r +} + +// AllowedMethods gets the allowed methods for the path of this request +func (c *Context) AllowedMethods(request *http.Request) []string { + return c.router.OtherMethods(request.Method, request.URL.EscapedPath()) +} + +// ResetAuth removes the current principal from the request context +func (c *Context) ResetAuth(request *http.Request) *http.Request { + rctx := request.Context() + rctx = stdContext.WithValue(rctx, ctxSecurityPrincipal, nil) + rctx = stdContext.WithValue(rctx, ctxSecurityScopes, nil) + return request.WithContext(rctx) +} + +// Authorize authorizes the request +// Returns the principal object and a shallow copy of the request when its +// context doesn't contain the principal, otherwise the same request or an error +// (the last) if one of the authenticators returns one or an Unauthenticated error +func (c *Context) Authorize(request *http.Request, route *MatchedRoute) (interface{}, *http.Request, error) { + if route == nil || !route.HasAuth() { + return nil, nil, nil + } + + var rCtx = request.Context() + if v := rCtx.Value(ctxSecurityPrincipal); v != nil { + return v, request, nil + } + + applies, usr, err := route.Authenticators.Authenticate(request, route) + if !applies || err != nil || !route.Authenticators.AllowsAnonymous() && usr == nil { + if err != nil { + return nil, nil, err + } + return nil, nil, errors.Unauthenticated("invalid credentials") + } + if route.Authorizer != nil { + if err := route.Authorizer.Authorize(request, usr); err != nil { + if _, ok := err.(errors.Error); ok { + return nil, nil, err + } + + return nil, nil, errors.New(http.StatusForbidden, err.Error()) + } + } + + rCtx = request.Context() + + rCtx = stdContext.WithValue(rCtx, ctxSecurityPrincipal, usr) + rCtx = stdContext.WithValue(rCtx, ctxSecurityScopes, route.Authenticator.AllScopes()) + return usr, request.WithContext(rCtx), nil +} + +// BindAndValidate binds and validates the request +// Returns the validation map and a shallow copy of the request when its context +// doesn't contain the validation, otherwise it returns the same request or an +// CompositeValidationError error +func (c *Context) BindAndValidate(request *http.Request, matched *MatchedRoute) (interface{}, *http.Request, error) { + var rCtx = request.Context() + + if v, ok := rCtx.Value(ctxBoundParams).(*validation); ok { + debugLog("got cached validation (valid: %t)", len(v.result) == 0) + if len(v.result) > 0 { + return v.bound, request, errors.CompositeValidationError(v.result...) + } + return v.bound, request, nil + } + result := validateRequest(c, request, matched) + rCtx = stdContext.WithValue(rCtx, ctxBoundParams, result) + request = request.WithContext(rCtx) + if len(result.result) > 0 { + return result.bound, request, errors.CompositeValidationError(result.result...) + } + debugLog("no validation errors found") + return result.bound, request, nil +} + +// NotFound the default not found responder for when no route has been matched yet +func (c *Context) NotFound(rw http.ResponseWriter, r *http.Request) { + c.Respond(rw, r, []string{c.api.DefaultProduces()}, nil, errors.NotFound("not found")) +} + +// Respond renders the response after doing some content negotiation +func (c *Context) Respond(rw http.ResponseWriter, r *http.Request, produces []string, route *MatchedRoute, data interface{}) { + debugLog("responding to %s %s with produces: %v", r.Method, r.URL.Path, produces) + offers := []string{} + for _, mt := range produces { + if mt != c.api.DefaultProduces() { + offers = append(offers, mt) + } + } + // the default producer is last so more specific producers take precedence + offers = append(offers, c.api.DefaultProduces()) + debugLog("offers: %v", offers) + + var format string + format, r = c.ResponseFormat(r, offers) + rw.Header().Set(runtime.HeaderContentType, format) + + if resp, ok := data.(Responder); ok { + producers := route.Producers + prod, ok := producers[format] + if !ok { + prods := c.api.ProducersFor(normalizeOffers([]string{c.api.DefaultProduces()})) + pr, ok := prods[c.api.DefaultProduces()] + if !ok { + panic(errors.New(http.StatusInternalServerError, "can't find a producer for "+format)) + } + prod = pr + } + resp.WriteResponse(rw, prod) + return + } + + if err, ok := data.(error); ok { + if format == "" { + rw.Header().Set(runtime.HeaderContentType, runtime.JSONMime) + } + + if realm := security.FailedBasicAuth(r); realm != "" { + rw.Header().Set("WWW-Authenticate", fmt.Sprintf("Basic realm=%q", realm)) + } + + if route == nil || route.Operation == nil { + c.api.ServeErrorFor("")(rw, r, err) + return + } + c.api.ServeErrorFor(route.Operation.ID)(rw, r, err) + return + } + + if route == nil || route.Operation == nil { + rw.WriteHeader(200) + if r.Method == "HEAD" { + return + } + producers := c.api.ProducersFor(normalizeOffers(offers)) + prod, ok := producers[format] + if !ok { + panic(errors.New(http.StatusInternalServerError, "can't find a producer for "+format)) + } + if err := prod.Produce(rw, data); err != nil { + panic(err) // let the recovery middleware deal with this + } + return + } + + if _, code, ok := route.Operation.SuccessResponse(); ok { + rw.WriteHeader(code) + if code == 204 || r.Method == "HEAD" { + return + } + + producers := route.Producers + prod, ok := producers[format] + if !ok { + if !ok { + prods := c.api.ProducersFor(normalizeOffers([]string{c.api.DefaultProduces()})) + pr, ok := prods[c.api.DefaultProduces()] + if !ok { + panic(errors.New(http.StatusInternalServerError, "can't find a producer for "+format)) + } + prod = pr + } + } + if err := prod.Produce(rw, data); err != nil { + panic(err) // let the recovery middleware deal with this + } + return + } + + c.api.ServeErrorFor(route.Operation.ID)(rw, r, errors.New(http.StatusInternalServerError, "can't produce response")) +} + +func (c *Context) APIHandlerSwaggerUI(builder Builder) http.Handler { + b := builder + if b == nil { + b = PassthroughBuilder + } + + var title string + sp := c.spec.Spec() + if sp != nil && sp.Info != nil && sp.Info.Title != "" { + title = sp.Info.Title + } + + swaggerUIOpts := SwaggerUIOpts{ + BasePath: c.BasePath(), + Title: title, + } + + return Spec("", c.spec.Raw(), SwaggerUI(swaggerUIOpts, c.RoutesHandler(b))) +} + +// APIHandler returns a handler to serve the API, this includes a swagger spec, router and the contract defined in the swagger spec +func (c *Context) APIHandler(builder Builder) http.Handler { + b := builder + if b == nil { + b = PassthroughBuilder + } + + var title string + sp := c.spec.Spec() + if sp != nil && sp.Info != nil && sp.Info.Title != "" { + title = sp.Info.Title + } + + redocOpts := RedocOpts{ + BasePath: c.BasePath(), + Title: title, + } + + return Spec("", c.spec.Raw(), Redoc(redocOpts, c.RoutesHandler(b))) +} + +// RoutesHandler returns a handler to serve the API, just the routes and the contract defined in the swagger spec +func (c *Context) RoutesHandler(builder Builder) http.Handler { + b := builder + if b == nil { + b = PassthroughBuilder + } + return NewRouter(c, b(NewOperationExecutor(c))) +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/denco/LICENSE b/vendor/github.com/go-openapi/runtime/middleware/denco/LICENSE new file mode 100644 index 00000000000..e65039ad84c --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/denco/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2014 Naoya Inada + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/github.com/go-openapi/runtime/middleware/denco/README.md b/vendor/github.com/go-openapi/runtime/middleware/denco/README.md new file mode 100644 index 00000000000..30109e17d5e --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/denco/README.md @@ -0,0 +1,180 @@ +# Denco [![Build Status](https://travis-ci.org/naoina/denco.png?branch=master)](https://travis-ci.org/naoina/denco) + +The fast and flexible HTTP request router for [Go](http://golang.org). + +Denco is based on Double-Array implementation of [Kocha-urlrouter](https://github.com/naoina/kocha-urlrouter). +However, Denco is optimized and some features added. + +## Features + +* Fast (See [go-http-routing-benchmark](https://github.com/naoina/go-http-routing-benchmark)) +* [URL patterns](#url-patterns) (`/foo/:bar` and `/foo/*wildcard`) +* Small (but enough) URL router API +* HTTP request multiplexer like `http.ServeMux` + +## Installation + + go get -u github.com/go-openapi/runtime/middleware/denco + +## Using as HTTP request multiplexer + +```go +package main + +import ( + "fmt" + "log" + "net/http" + + "github.com/go-openapi/runtime/middleware/denco" +) + +func Index(w http.ResponseWriter, r *http.Request, params denco.Params) { + fmt.Fprintf(w, "Welcome to Denco!\n") +} + +func User(w http.ResponseWriter, r *http.Request, params denco.Params) { + fmt.Fprintf(w, "Hello %s!\n", params.Get("name")) +} + +func main() { + mux := denco.NewMux() + handler, err := mux.Build([]denco.Handler{ + mux.GET("/", Index), + mux.GET("/user/:name", User), + mux.POST("/user/:name", User), + }) + if err != nil { + panic(err) + } + log.Fatal(http.ListenAndServe(":8080", handler)) +} +``` + +## Using as URL router + +```go +package main + +import ( + "fmt" + + "github.com/go-openapi/runtime/middleware/denco" +) + +type route struct { + name string +} + +func main() { + router := denco.New() + router.Build([]denco.Record{ + {"/", &route{"root"}}, + {"/user/:id", &route{"user"}}, + {"/user/:name/:id", &route{"username"}}, + {"/static/*filepath", &route{"static"}}, + }) + + data, params, found := router.Lookup("/") + // print `&main.route{name:"root"}, denco.Params(nil), true`. + fmt.Printf("%#v, %#v, %#v\n", data, params, found) + + data, params, found = router.Lookup("/user/hoge") + // print `&main.route{name:"user"}, denco.Params{denco.Param{Name:"id", Value:"hoge"}}, true`. + fmt.Printf("%#v, %#v, %#v\n", data, params, found) + + data, params, found = router.Lookup("/user/hoge/7") + // print `&main.route{name:"username"}, denco.Params{denco.Param{Name:"name", Value:"hoge"}, denco.Param{Name:"id", Value:"7"}}, true`. + fmt.Printf("%#v, %#v, %#v\n", data, params, found) + + data, params, found = router.Lookup("/static/path/to/file") + // print `&main.route{name:"static"}, denco.Params{denco.Param{Name:"filepath", Value:"path/to/file"}}, true`. + fmt.Printf("%#v, %#v, %#v\n", data, params, found) +} +``` + +See [Godoc](http://godoc.org/github.com/go-openapi/runtime/middleware/denco) for more details. + +## Getting the value of path parameter + +You can get the value of path parameter by 2 ways. + +1. Using [`denco.Params.Get`](http://godoc.org/github.com/go-openapi/runtime/middleware/denco#Params.Get) method +2. Find by loop + +```go +package main + +import ( + "fmt" + + "github.com/go-openapi/runtime/middleware/denco" +) + +func main() { + router := denco.New() + if err := router.Build([]denco.Record{ + {"/user/:name/:id", "route1"}, + }); err != nil { + panic(err) + } + + // 1. Using denco.Params.Get method. + _, params, _ := router.Lookup("/user/alice/1") + name := params.Get("name") + if name != "" { + fmt.Printf("Hello %s.\n", name) // prints "Hello alice.". + } + + // 2. Find by loop. + for _, param := range params { + if param.Name == "name" { + fmt.Printf("Hello %s.\n", name) // prints "Hello alice.". + } + } +} +``` + +## URL patterns + +Denco's route matching strategy is "most nearly matching". + +When routes `/:name` and `/alice` have been built, URI `/alice` matches the route `/alice`, not `/:name`. +Because URI `/alice` is more match with the route `/alice` than `/:name`. + +For more example, when routes below have been built: + +``` +/user/alice +/user/:name +/user/:name/:id +/user/alice/:id +/user/:id/bob +``` + +Routes matching are: + +``` +/user/alice => "/user/alice" (no match with "/user/:name") +/user/bob => "/user/:name" +/user/naoina/1 => "/user/:name/1" +/user/alice/1 => "/user/alice/:id" (no match with "/user/:name/:id") +/user/1/bob => "/user/:id/bob" (no match with "/user/:name/:id") +/user/alice/bob => "/user/alice/:id" (no match with "/user/:name/:id" and "/user/:id/bob") +``` + +## Limitation + +Denco has some limitations below. + +* Number of param records (such as `/:name`) must be less than 2^22 +* Number of elements of internal slice must be less than 2^22 + +## Benchmarks + + cd $GOPATH/github.com/go-openapi/runtime/middleware/denco + go test -bench . -benchmem + +## License + +Denco is licensed under the MIT License. diff --git a/vendor/github.com/go-openapi/runtime/middleware/denco/router.go b/vendor/github.com/go-openapi/runtime/middleware/denco/router.go new file mode 100644 index 00000000000..5d2691ec369 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/denco/router.go @@ -0,0 +1,460 @@ +// Package denco provides fast URL router. +package denco + +import ( + "fmt" + "sort" + "strings" +) + +const ( + // ParamCharacter is a special character for path parameter. + ParamCharacter = ':' + + // WildcardCharacter is a special character for wildcard path parameter. + WildcardCharacter = '*' + + // TerminationCharacter is a special character for end of path. + TerminationCharacter = '#' + + // SeparatorCharacter separates path segments. + SeparatorCharacter = '/' + + // PathParamCharacter indicates a RESTCONF path param + PathParamCharacter = '=' + + // MaxSize is max size of records and internal slice. + MaxSize = (1 << 22) - 1 +) + +// Router represents a URL router. +type Router struct { + // SizeHint expects the maximum number of path parameters in records to Build. + // SizeHint will be used to determine the capacity of the memory to allocate. + // By default, SizeHint will be determined from given records to Build. + SizeHint int + + static map[string]interface{} + param *doubleArray +} + +// New returns a new Router. +func New() *Router { + return &Router{ + SizeHint: -1, + static: make(map[string]interface{}), + param: newDoubleArray(), + } +} + +// Lookup returns data and path parameters that associated with path. +// params is a slice of the Param that arranged in the order in which parameters appeared. +// e.g. when built routing path is "/path/to/:id/:name" and given path is "/path/to/1/alice". params order is [{"id": "1"}, {"name": "alice"}], not [{"name": "alice"}, {"id": "1"}]. +func (rt *Router) Lookup(path string) (data interface{}, params Params, found bool) { + if data, found := rt.static[path]; found { + return data, nil, true + } + if len(rt.param.node) == 1 { + return nil, nil, false + } + nd, params, found := rt.param.lookup(path, make([]Param, 0, rt.SizeHint), 1) + if !found { + return nil, nil, false + } + for i := 0; i < len(params); i++ { + params[i].Name = nd.paramNames[i] + } + return nd.data, params, true +} + +// Build builds URL router from records. +func (rt *Router) Build(records []Record) error { + statics, params := makeRecords(records) + if len(params) > MaxSize { + return fmt.Errorf("denco: too many records") + } + if rt.SizeHint < 0 { + rt.SizeHint = 0 + for _, p := range params { + size := 0 + for _, k := range p.Key { + if k == ParamCharacter || k == WildcardCharacter { + size++ + } + } + if size > rt.SizeHint { + rt.SizeHint = size + } + } + } + for _, r := range statics { + rt.static[r.Key] = r.Value + } + if err := rt.param.build(params, 1, 0, make(map[int]struct{})); err != nil { + return err + } + return nil +} + +// Param represents name and value of path parameter. +type Param struct { + Name string + Value string +} + +// Params represents the name and value of path parameters. +type Params []Param + +// Get gets the first value associated with the given name. +// If there are no values associated with the key, Get returns "". +func (ps Params) Get(name string) string { + for _, p := range ps { + if p.Name == name { + return p.Value + } + } + return "" +} + +type doubleArray struct { + bc []baseCheck + node []*node +} + +func newDoubleArray() *doubleArray { + return &doubleArray{ + bc: []baseCheck{0}, + node: []*node{nil}, // A start index is adjusting to 1 because 0 will be used as a mark of non-existent node. + } +} + +// baseCheck contains BASE, CHECK and Extra flags. +// From the top, 22bits of BASE, 2bits of Extra flags and 8bits of CHECK. +// +// BASE (22bit) | Extra flags (2bit) | CHECK (8bit) +// |----------------------|--|--------| +// 32 10 8 0 +type baseCheck uint32 + +func (bc baseCheck) Base() int { + return int(bc >> 10) +} + +func (bc *baseCheck) SetBase(base int) { + *bc |= baseCheck(base) << 10 +} + +func (bc baseCheck) Check() byte { + return byte(bc) +} + +func (bc *baseCheck) SetCheck(check byte) { + *bc |= baseCheck(check) +} + +func (bc baseCheck) IsEmpty() bool { + return bc&0xfffffcff == 0 +} + +func (bc baseCheck) IsSingleParam() bool { + return bc¶mTypeSingle == paramTypeSingle +} + +func (bc baseCheck) IsWildcardParam() bool { + return bc¶mTypeWildcard == paramTypeWildcard +} + +func (bc baseCheck) IsAnyParam() bool { + return bc¶mTypeAny != 0 +} + +func (bc *baseCheck) SetSingleParam() { + *bc |= (1 << 8) +} + +func (bc *baseCheck) SetWildcardParam() { + *bc |= (1 << 9) +} + +const ( + paramTypeSingle = 0x0100 + paramTypeWildcard = 0x0200 + paramTypeAny = 0x0300 +) + +func (da *doubleArray) lookup(path string, params []Param, idx int) (*node, []Param, bool) { + indices := make([]uint64, 0, 1) + for i := 0; i < len(path); i++ { + if da.bc[idx].IsAnyParam() { + indices = append(indices, (uint64(i)<<32)|(uint64(idx)&0xffffffff)) + } + c := path[i] + if idx = nextIndex(da.bc[idx].Base(), c); idx >= len(da.bc) || da.bc[idx].Check() != c { + goto BACKTRACKING + } + } + if next := nextIndex(da.bc[idx].Base(), TerminationCharacter); next < len(da.bc) && da.bc[next].Check() == TerminationCharacter { + return da.node[da.bc[next].Base()], params, true + } +BACKTRACKING: + for j := len(indices) - 1; j >= 0; j-- { + i, idx := int(indices[j]>>32), int(indices[j]&0xffffffff) + if da.bc[idx].IsSingleParam() { + idx := nextIndex(da.bc[idx].Base(), ParamCharacter) + if idx >= len(da.bc) { + break + } + next := NextSeparator(path, i) + params := append(params, Param{Value: path[i:next]}) + if nd, params, found := da.lookup(path[next:], params, idx); found { + return nd, params, true + } + } + if da.bc[idx].IsWildcardParam() { + idx := nextIndex(da.bc[idx].Base(), WildcardCharacter) + params := append(params, Param{Value: path[i:]}) + return da.node[da.bc[idx].Base()], params, true + } + } + return nil, nil, false +} + +// build builds double-array from records. +func (da *doubleArray) build(srcs []*record, idx, depth int, usedBase map[int]struct{}) error { + sort.Stable(recordSlice(srcs)) + base, siblings, leaf, err := da.arrange(srcs, idx, depth, usedBase) + if err != nil { + return err + } + if leaf != nil { + nd, err := makeNode(leaf) + if err != nil { + return err + } + da.bc[idx].SetBase(len(da.node)) + da.node = append(da.node, nd) + } + for _, sib := range siblings { + da.setCheck(nextIndex(base, sib.c), sib.c) + } + for _, sib := range siblings { + records := srcs[sib.start:sib.end] + switch sib.c { + case ParamCharacter: + for _, r := range records { + next := NextSeparator(r.Key, depth+1) + name := r.Key[depth+1 : next] + r.paramNames = append(r.paramNames, name) + r.Key = r.Key[next:] + } + da.bc[idx].SetSingleParam() + if err := da.build(records, nextIndex(base, sib.c), 0, usedBase); err != nil { + return err + } + case WildcardCharacter: + r := records[0] + name := r.Key[depth+1 : len(r.Key)-1] + r.paramNames = append(r.paramNames, name) + r.Key = "" + da.bc[idx].SetWildcardParam() + if err := da.build(records, nextIndex(base, sib.c), 0, usedBase); err != nil { + return err + } + default: + if err := da.build(records, nextIndex(base, sib.c), depth+1, usedBase); err != nil { + return err + } + } + } + return nil +} + +// setBase sets BASE. +func (da *doubleArray) setBase(i, base int) { + da.bc[i].SetBase(base) +} + +// setCheck sets CHECK. +func (da *doubleArray) setCheck(i int, check byte) { + da.bc[i].SetCheck(check) +} + +// findEmptyIndex returns an index of unused BASE/CHECK node. +func (da *doubleArray) findEmptyIndex(start int) int { + i := start + for ; i < len(da.bc); i++ { + if da.bc[i].IsEmpty() { + break + } + } + return i +} + +// findBase returns good BASE. +func (da *doubleArray) findBase(siblings []sibling, start int, usedBase map[int]struct{}) (base int) { + for idx, firstChar := start+1, siblings[0].c; ; idx = da.findEmptyIndex(idx + 1) { + base = nextIndex(idx, firstChar) + if _, used := usedBase[base]; used { + continue + } + i := 0 + for ; i < len(siblings); i++ { + next := nextIndex(base, siblings[i].c) + if len(da.bc) <= next { + da.bc = append(da.bc, make([]baseCheck, next-len(da.bc)+1)...) + } + if !da.bc[next].IsEmpty() { + break + } + } + if i == len(siblings) { + break + } + } + usedBase[base] = struct{}{} + return base +} + +func (da *doubleArray) arrange(records []*record, idx, depth int, usedBase map[int]struct{}) (base int, siblings []sibling, leaf *record, err error) { + siblings, leaf, err = makeSiblings(records, depth) + if err != nil { + return -1, nil, nil, err + } + if len(siblings) < 1 { + return -1, nil, leaf, nil + } + base = da.findBase(siblings, idx, usedBase) + if base > MaxSize { + return -1, nil, nil, fmt.Errorf("denco: too many elements of internal slice") + } + da.setBase(idx, base) + return base, siblings, leaf, err +} + +// node represents a node of Double-Array. +type node struct { + data interface{} + + // Names of path parameters. + paramNames []string +} + +// makeNode returns a new node from record. +func makeNode(r *record) (*node, error) { + dups := make(map[string]bool) + for _, name := range r.paramNames { + if dups[name] { + return nil, fmt.Errorf("denco: path parameter `%v' is duplicated in the key `%v'", name, r.Key) + } + dups[name] = true + } + return &node{data: r.Value, paramNames: r.paramNames}, nil +} + +// sibling represents an intermediate data of build for Double-Array. +type sibling struct { + // An index of start of duplicated characters. + start int + + // An index of end of duplicated characters. + end int + + // A character of sibling. + c byte +} + +// nextIndex returns a next index of array of BASE/CHECK. +func nextIndex(base int, c byte) int { + return base ^ int(c) +} + +// makeSiblings returns slice of sibling. +func makeSiblings(records []*record, depth int) (sib []sibling, leaf *record, err error) { + var ( + pc byte + n int + ) + for i, r := range records { + if len(r.Key) <= depth { + leaf = r + continue + } + c := r.Key[depth] + switch { + case pc < c: + sib = append(sib, sibling{start: i, c: c}) + case pc == c: + continue + default: + return nil, nil, fmt.Errorf("denco: BUG: routing table hasn't been sorted") + } + if n > 0 { + sib[n-1].end = i + } + pc = c + n++ + } + if n == 0 { + return nil, leaf, nil + } + sib[n-1].end = len(records) + return sib, leaf, nil +} + +// Record represents a record data for router construction. +type Record struct { + // Key for router construction. + Key string + + // Result value for Key. + Value interface{} +} + +// NewRecord returns a new Record. +func NewRecord(key string, value interface{}) Record { + return Record{ + Key: key, + Value: value, + } +} + +// record represents a record that use to build the Double-Array. +type record struct { + Record + paramNames []string +} + +// makeRecords returns the records that use to build Double-Arrays. +func makeRecords(srcs []Record) (statics, params []*record) { + termChar := string(TerminationCharacter) + paramPrefix := string(SeparatorCharacter) + string(ParamCharacter) + wildcardPrefix := string(SeparatorCharacter) + string(WildcardCharacter) + restconfPrefix := string(PathParamCharacter) + string(ParamCharacter) + for _, r := range srcs { + if strings.Contains(r.Key, paramPrefix) || strings.Contains(r.Key, wildcardPrefix) ||strings.Contains(r.Key, restconfPrefix){ + r.Key += termChar + params = append(params, &record{Record: r}) + } else { + statics = append(statics, &record{Record: r}) + } + } + return statics, params +} + +// recordSlice represents a slice of Record for sort and implements the sort.Interface. +type recordSlice []*record + +// Len implements the sort.Interface.Len. +func (rs recordSlice) Len() int { + return len(rs) +} + +// Less implements the sort.Interface.Less. +func (rs recordSlice) Less(i, j int) bool { + return rs[i].Key < rs[j].Key +} + +// Swap implements the sort.Interface.Swap. +func (rs recordSlice) Swap(i, j int) { + rs[i], rs[j] = rs[j], rs[i] +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/denco/server.go b/vendor/github.com/go-openapi/runtime/middleware/denco/server.go new file mode 100644 index 00000000000..0886713c181 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/denco/server.go @@ -0,0 +1,106 @@ +package denco + +import ( + "net/http" +) + +// Mux represents a multiplexer for HTTP request. +type Mux struct{} + +// NewMux returns a new Mux. +func NewMux() *Mux { + return &Mux{} +} + +// GET is shorthand of Mux.Handler("GET", path, handler). +func (m *Mux) GET(path string, handler HandlerFunc) Handler { + return m.Handler("GET", path, handler) +} + +// POST is shorthand of Mux.Handler("POST", path, handler). +func (m *Mux) POST(path string, handler HandlerFunc) Handler { + return m.Handler("POST", path, handler) +} + +// PUT is shorthand of Mux.Handler("PUT", path, handler). +func (m *Mux) PUT(path string, handler HandlerFunc) Handler { + return m.Handler("PUT", path, handler) +} + +// HEAD is shorthand of Mux.Handler("HEAD", path, handler). +func (m *Mux) HEAD(path string, handler HandlerFunc) Handler { + return m.Handler("HEAD", path, handler) +} + +// Handler returns a handler for HTTP method. +func (m *Mux) Handler(method, path string, handler HandlerFunc) Handler { + return Handler{ + Method: method, + Path: path, + Func: handler, + } +} + +// Build builds a http.Handler. +func (m *Mux) Build(handlers []Handler) (http.Handler, error) { + recordMap := make(map[string][]Record) + for _, h := range handlers { + recordMap[h.Method] = append(recordMap[h.Method], NewRecord(h.Path, h.Func)) + } + mux := newServeMux() + for m, records := range recordMap { + router := New() + if err := router.Build(records); err != nil { + return nil, err + } + mux.routers[m] = router + } + return mux, nil +} + +// Handler represents a handler of HTTP request. +type Handler struct { + // Method is an HTTP method. + Method string + + // Path is a routing path for handler. + Path string + + // Func is a function of handler of HTTP request. + Func HandlerFunc +} + +// The HandlerFunc type is aliased to type of handler function. +type HandlerFunc func(w http.ResponseWriter, r *http.Request, params Params) + +type serveMux struct { + routers map[string]*Router +} + +func newServeMux() *serveMux { + return &serveMux{ + routers: make(map[string]*Router), + } +} + +// ServeHTTP implements http.Handler interface. +func (mux *serveMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { + handler, params := mux.handler(r.Method, r.URL.Path) + handler(w, r, params) +} + +func (mux *serveMux) handler(method, path string) (HandlerFunc, []Param) { + if router, found := mux.routers[method]; found { + if handler, params, found := router.Lookup(path); found { + return handler.(HandlerFunc), params + } + } + return NotFound, nil +} + +// NotFound replies to the request with an HTTP 404 not found error. +// NotFound is called when unknown HTTP method or a handler not found. +// If you want to use the your own NotFound handler, please overwrite this variable. +var NotFound = func(w http.ResponseWriter, r *http.Request, _ Params) { + http.NotFound(w, r) +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/denco/util.go b/vendor/github.com/go-openapi/runtime/middleware/denco/util.go new file mode 100644 index 00000000000..edc1f6ab80a --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/denco/util.go @@ -0,0 +1,12 @@ +package denco + +// NextSeparator returns an index of next separator in path. +func NextSeparator(path string, start int) int { + for start < len(path) { + if c := path[start]; c == '/' || c == TerminationCharacter { + break + } + start++ + } + return start +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/doc.go b/vendor/github.com/go-openapi/runtime/middleware/doc.go new file mode 100644 index 00000000000..eaf90606ac3 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/doc.go @@ -0,0 +1,62 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*Package middleware provides the library with helper functions for serving swagger APIs. + +Pseudo middleware handler + + import ( + "net/http" + + "github.com/go-openapi/errors" + ) + + func newCompleteMiddleware(ctx *Context) http.Handler { + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + // use context to lookup routes + if matched, ok := ctx.RouteInfo(r); ok { + + if matched.NeedsAuth() { + if _, err := ctx.Authorize(r, matched); err != nil { + ctx.Respond(rw, r, matched.Produces, matched, err) + return + } + } + + bound, validation := ctx.BindAndValidate(r, matched) + if validation != nil { + ctx.Respond(rw, r, matched.Produces, matched, validation) + return + } + + result, err := matched.Handler.Handle(bound) + if err != nil { + ctx.Respond(rw, r, matched.Produces, matched, err) + return + } + + ctx.Respond(rw, r, matched.Produces, matched, result) + return + } + + // Not found, check if it exists in the other methods first + if others := ctx.AllowedMethods(r); len(others) > 0 { + ctx.Respond(rw, r, ctx.spec.RequiredProduces(), nil, errors.MethodNotAllowed(r.Method, others)) + return + } + ctx.Respond(rw, r, ctx.spec.RequiredProduces(), nil, errors.NotFound("path %s was not found", r.URL.Path)) + }) + } +*/ +package middleware diff --git a/vendor/github.com/go-openapi/runtime/middleware/go18.go b/vendor/github.com/go-openapi/runtime/middleware/go18.go new file mode 100644 index 00000000000..75c762c0948 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/go18.go @@ -0,0 +1,9 @@ +// +build go1.8 + +package middleware + +import "net/url" + +func pathUnescape(path string) (string, error) { + return url.PathUnescape(path) +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/header/header.go b/vendor/github.com/go-openapi/runtime/middleware/header/header.go new file mode 100644 index 00000000000..e069743e30a --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/header/header.go @@ -0,0 +1,329 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd. + +// this file was taken from the github.com/golang/gddo repository + +// Package header provides functions for parsing HTTP headers. +package header + +import ( + "net/http" + "strings" + "time" +) + +// Octet types from RFC 2616. +var octetTypes [256]octetType + +type octetType byte + +const ( + isToken octetType = 1 << iota + isSpace +) + +func init() { + // OCTET = + // CHAR = + // CTL = + // CR = + // LF = + // SP = + // HT = + // <"> = + // CRLF = CR LF + // LWS = [CRLF] 1*( SP | HT ) + // TEXT = + // separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> + // | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT + // token = 1* + // qdtext = > + + for c := 0; c < 256; c++ { + var t octetType + isCtl := c <= 31 || c == 127 + isChar := 0 <= c && c <= 127 + isSeparator := strings.ContainsRune(" \t\"(),/:;<=>?@[]\\{}", rune(c)) + if strings.ContainsRune(" \t\r\n", rune(c)) { + t |= isSpace + } + if isChar && !isCtl && !isSeparator { + t |= isToken + } + octetTypes[c] = t + } +} + +// Copy returns a shallow copy of the header. +func Copy(header http.Header) http.Header { + h := make(http.Header) + for k, vs := range header { + h[k] = vs + } + return h +} + +var timeLayouts = []string{"Mon, 02 Jan 2006 15:04:05 GMT", time.RFC850, time.ANSIC} + +// ParseTime parses the header as time. The zero value is returned if the +// header is not present or there is an error parsing the +// header. +func ParseTime(header http.Header, key string) time.Time { + if s := header.Get(key); s != "" { + for _, layout := range timeLayouts { + if t, err := time.Parse(layout, s); err == nil { + return t.UTC() + } + } + } + return time.Time{} +} + +// ParseList parses a comma separated list of values. Commas are ignored in +// quoted strings. Quoted values are not unescaped or unquoted. Whitespace is +// trimmed. +func ParseList(header http.Header, key string) []string { + var result []string + for _, s := range header[http.CanonicalHeaderKey(key)] { + begin := 0 + end := 0 + escape := false + quote := false + for i := 0; i < len(s); i++ { + b := s[i] + switch { + case escape: + escape = false + end = i + 1 + case quote: + switch b { + case '\\': + escape = true + case '"': + quote = false + } + end = i + 1 + case b == '"': + quote = true + end = i + 1 + case octetTypes[b]&isSpace != 0: + if begin == end { + begin = i + 1 + end = begin + } + case b == ',': + if begin < end { + result = append(result, s[begin:end]) + } + begin = i + 1 + end = begin + default: + end = i + 1 + } + } + if begin < end { + result = append(result, s[begin:end]) + } + } + return result +} + +// ParseValueAndParams parses a comma separated list of values with optional +// semicolon separated name-value pairs. Content-Type and Content-Disposition +// headers are in this format. +func ParseValueAndParams(header http.Header, key string) (string, map[string]string) { + return parseValueAndParams(header.Get(key)) +} + +func parseValueAndParams(s string) (value string, params map[string]string) { + params = make(map[string]string) + value, s = expectTokenSlash(s) + if value == "" { + return + } + value = strings.ToLower(value) + s = skipSpace(s) + for strings.HasPrefix(s, ";") { + var pkey string + pkey, s = expectToken(skipSpace(s[1:])) + if pkey == "" { + return + } + if !strings.HasPrefix(s, "=") { + return + } + var pvalue string + pvalue, s = expectTokenOrQuoted(s[1:]) + if pvalue == "" { + return + } + pkey = strings.ToLower(pkey) + params[pkey] = pvalue + s = skipSpace(s) + } + return +} + +// AcceptSpec ... +type AcceptSpec struct { + Value string + Q float64 +} + +// ParseAccept2 ... +func ParseAccept2(header http.Header, key string) (specs []AcceptSpec) { + for _, en := range ParseList(header, key) { + v, p := parseValueAndParams(en) + var spec AcceptSpec + spec.Value = v + spec.Q = 1.0 + if p != nil { + if q, ok := p["q"]; ok { + spec.Q, _ = expectQuality(q) + } + } + if spec.Q < 0.0 { + continue + } + specs = append(specs, spec) + } + + return +} + +// ParseAccept parses Accept* headers. +func ParseAccept(header http.Header, key string) (specs []AcceptSpec) { +loop: + for _, s := range header[key] { + for { + var spec AcceptSpec + spec.Value, s = expectTokenSlash(s) + if spec.Value == "" { + continue loop + } + spec.Q = 1.0 + s = skipSpace(s) + if strings.HasPrefix(s, ";") { + s = skipSpace(s[1:]) + for !strings.HasPrefix(s, "q=") && s != "" && !strings.HasPrefix(s, ",") { + s = skipSpace(s[1:]) + } + if strings.HasPrefix(s, "q=") { + spec.Q, s = expectQuality(s[2:]) + if spec.Q < 0.0 { + continue loop + } + } + } + specs = append(specs, spec) + s = skipSpace(s) + if !strings.HasPrefix(s, ",") { + continue loop + } + s = skipSpace(s[1:]) + } + } + return +} + +func skipSpace(s string) (rest string) { + i := 0 + for ; i < len(s); i++ { + if octetTypes[s[i]]&isSpace == 0 { + break + } + } + return s[i:] +} + +func expectToken(s string) (token, rest string) { + i := 0 + for ; i < len(s); i++ { + if octetTypes[s[i]]&isToken == 0 { + break + } + } + return s[:i], s[i:] +} + +func expectTokenSlash(s string) (token, rest string) { + i := 0 + for ; i < len(s); i++ { + b := s[i] + if (octetTypes[b]&isToken == 0) && b != '/' { + break + } + } + return s[:i], s[i:] +} + +func expectQuality(s string) (q float64, rest string) { + switch { + case len(s) == 0: + return -1, "" + case s[0] == '0': + // q is already 0 + s = s[1:] + case s[0] == '1': + s = s[1:] + q = 1 + case s[0] == '.': + // q is already 0 + default: + return -1, "" + } + if !strings.HasPrefix(s, ".") { + return q, s + } + s = s[1:] + i := 0 + n := 0 + d := 1 + for ; i < len(s); i++ { + b := s[i] + if b < '0' || b > '9' { + break + } + n = n*10 + int(b) - '0' + d *= 10 + } + return q + float64(n)/float64(d), s[i:] +} + +func expectTokenOrQuoted(s string) (value string, rest string) { + if !strings.HasPrefix(s, "\"") { + return expectToken(s) + } + s = s[1:] + for i := 0; i < len(s); i++ { + switch s[i] { + case '"': + return s[:i], s[i+1:] + case '\\': + p := make([]byte, len(s)-1) + j := copy(p, s[:i]) + escape := true + for i = i + 1; i < len(s); i++ { + b := s[i] + switch { + case escape: + escape = false + p[j] = b + j++ + case b == '\\': + escape = true + case b == '"': + return string(p[:j]), s[i+1:] + default: + p[j] = b + j++ + } + } + return "", "" + } + } + return "", "" +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/negotiate.go b/vendor/github.com/go-openapi/runtime/middleware/negotiate.go new file mode 100644 index 00000000000..a9b6f27d3d3 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/negotiate.go @@ -0,0 +1,98 @@ +// Copyright 2013 The Go Authors. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd. + +// this file was taken from the github.com/golang/gddo repository + +package middleware + +import ( + "net/http" + "strings" + + "github.com/go-openapi/runtime/middleware/header" +) + +// NegotiateContentEncoding returns the best offered content encoding for the +// request's Accept-Encoding header. If two offers match with equal weight and +// then the offer earlier in the list is preferred. If no offers are +// acceptable, then "" is returned. +func NegotiateContentEncoding(r *http.Request, offers []string) string { + bestOffer := "identity" + bestQ := -1.0 + specs := header.ParseAccept(r.Header, "Accept-Encoding") + for _, offer := range offers { + for _, spec := range specs { + if spec.Q > bestQ && + (spec.Value == "*" || spec.Value == offer) { + bestQ = spec.Q + bestOffer = offer + } + } + } + if bestQ == 0 { + bestOffer = "" + } + return bestOffer +} + +// NegotiateContentType returns the best offered content type for the request's +// Accept header. If two offers match with equal weight, then the more specific +// offer is preferred. For example, text/* trumps */*. If two offers match +// with equal weight and specificity, then the offer earlier in the list is +// preferred. If no offers match, then defaultOffer is returned. +func NegotiateContentType(r *http.Request, offers []string, defaultOffer string) string { + bestOffer := defaultOffer + bestQ := -1.0 + bestWild := 3 + specs := header.ParseAccept(r.Header, "Accept") + for _, rawOffer := range offers { + offer := normalizeOffer(rawOffer) + // No Accept header: just return the first offer. + if len(specs) == 0 { + return rawOffer + } + for _, spec := range specs { + switch { + case spec.Q == 0.0: + // ignore + case spec.Q < bestQ: + // better match found + case spec.Value == "*/*": + if spec.Q > bestQ || bestWild > 2 { + bestQ = spec.Q + bestWild = 2 + bestOffer = rawOffer + } + case strings.HasSuffix(spec.Value, "/*"): + if strings.HasPrefix(offer, spec.Value[:len(spec.Value)-1]) && + (spec.Q > bestQ || bestWild > 1) { + bestQ = spec.Q + bestWild = 1 + bestOffer = rawOffer + } + default: + if spec.Value == offer && + (spec.Q > bestQ || bestWild > 0) { + bestQ = spec.Q + bestWild = 0 + bestOffer = rawOffer + } + } + } + } + return bestOffer +} + +func normalizeOffers(orig []string) (norm []string) { + for _, o := range orig { + norm = append(norm, normalizeOffer(o)) + } + return +} + +func normalizeOffer(orig string) string { + return strings.SplitN(orig, ";", 2)[0] +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/not_implemented.go b/vendor/github.com/go-openapi/runtime/middleware/not_implemented.go new file mode 100644 index 00000000000..bc6942a0f1b --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/not_implemented.go @@ -0,0 +1,67 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + "net/http" + + "github.com/go-openapi/runtime" +) + +type errorResp struct { + code int + response interface{} + headers http.Header +} + +func (e *errorResp) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { + for k, v := range e.headers { + for _, val := range v { + rw.Header().Add(k, val) + } + } + if e.code > 0 { + rw.WriteHeader(e.code) + } else { + rw.WriteHeader(http.StatusInternalServerError) + } + if err := producer.Produce(rw, e.response); err != nil { + Logger.Printf("failed to write error response: %v", err) + } +} + +// NotImplemented the error response when the response is not implemented +func NotImplemented(message string) Responder { + return Error(http.StatusNotImplemented, message) +} + +// Error creates a generic responder for returning errors, the data will be serialized +// with the matching producer for the request +func Error(code int, data interface{}, headers ...http.Header) Responder { + var hdr http.Header + for _, h := range headers { + for k, v := range h { + if hdr == nil { + hdr = make(http.Header) + } + hdr[k] = v + } + } + return &errorResp{ + code: code, + response: data, + headers: hdr, + } +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/operation.go b/vendor/github.com/go-openapi/runtime/middleware/operation.go new file mode 100644 index 00000000000..1175a63cf29 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/operation.go @@ -0,0 +1,30 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import "net/http" + +// NewOperationExecutor creates a context aware middleware that handles the operations after routing +func NewOperationExecutor(ctx *Context) http.Handler { + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + // use context to lookup routes + route, rCtx, _ := ctx.RouteInfo(r) + if rCtx != nil { + r = rCtx + } + + route.Handler.ServeHTTP(rw, r) + }) +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/parameter.go b/vendor/github.com/go-openapi/runtime/middleware/parameter.go new file mode 100644 index 00000000000..8fa0cf4e464 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/parameter.go @@ -0,0 +1,481 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + "encoding" + "encoding/base64" + "fmt" + "io" + "net/http" + "reflect" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/spec" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" + + "github.com/go-openapi/runtime" +) + +const defaultMaxMemory = 32 << 20 + +var textUnmarshalType = reflect.TypeOf(new(encoding.TextUnmarshaler)).Elem() + +func newUntypedParamBinder(param spec.Parameter, spec *spec.Swagger, formats strfmt.Registry) *untypedParamBinder { + binder := new(untypedParamBinder) + binder.Name = param.Name + binder.parameter = ¶m + binder.formats = formats + if param.In != "body" { + binder.validator = validate.NewParamValidator(¶m, formats) + } else { + binder.validator = validate.NewSchemaValidator(param.Schema, spec, param.Name, formats) + } + + return binder +} + +type untypedParamBinder struct { + parameter *spec.Parameter + formats strfmt.Registry + Name string + validator validate.EntityValidator +} + +func (p *untypedParamBinder) Type() reflect.Type { + return p.typeForSchema(p.parameter.Type, p.parameter.Format, p.parameter.Items) +} + +func (p *untypedParamBinder) typeForSchema(tpe, format string, items *spec.Items) reflect.Type { + switch tpe { + case "boolean": + return reflect.TypeOf(true) + + case "string": + if tt, ok := p.formats.GetType(format); ok { + return tt + } + return reflect.TypeOf("") + + case "integer": + switch format { + case "int8": + return reflect.TypeOf(int8(0)) + case "int16": + return reflect.TypeOf(int16(0)) + case "int32": + return reflect.TypeOf(int32(0)) + case "int64": + return reflect.TypeOf(int64(0)) + default: + return reflect.TypeOf(int64(0)) + } + + case "number": + switch format { + case "float": + return reflect.TypeOf(float32(0)) + case "double": + return reflect.TypeOf(float64(0)) + } + + case "array": + if items == nil { + return nil + } + itemsType := p.typeForSchema(items.Type, items.Format, items.Items) + if itemsType == nil { + return nil + } + return reflect.MakeSlice(reflect.SliceOf(itemsType), 0, 0).Type() + + case "file": + return reflect.TypeOf(&runtime.File{}).Elem() + + case "object": + return reflect.TypeOf(map[string]interface{}{}) + } + return nil +} + +func (p *untypedParamBinder) allowsMulti() bool { + return p.parameter.In == "query" || p.parameter.In == "formData" +} + +func (p *untypedParamBinder) readValue(values runtime.Gettable, target reflect.Value) ([]string, bool, bool, error) { + name, in, cf, tpe := p.parameter.Name, p.parameter.In, p.parameter.CollectionFormat, p.parameter.Type + if tpe == "array" { + if cf == "multi" { + if !p.allowsMulti() { + return nil, false, false, errors.InvalidCollectionFormat(name, in, cf) + } + vv, hasKey, _ := values.GetOK(name) + return vv, false, hasKey, nil + } + + v, hk, hv := values.GetOK(name) + if !hv { + return nil, false, hk, nil + } + d, c, e := p.readFormattedSliceFieldValue(v[len(v)-1], target) + return d, c, hk, e + } + + vv, hk, _ := values.GetOK(name) + return vv, false, hk, nil +} + +func (p *untypedParamBinder) Bind(request *http.Request, routeParams RouteParams, consumer runtime.Consumer, target reflect.Value) error { + // fmt.Println("binding", p.name, "as", p.Type()) + switch p.parameter.In { + case "query": + data, custom, hasKey, err := p.readValue(runtime.Values(request.URL.Query()), target) + if err != nil { + return err + } + if custom { + return nil + } + + return p.bindValue(data, hasKey, target) + + case "header": + data, custom, hasKey, err := p.readValue(runtime.Values(request.Header), target) + if err != nil { + return err + } + if custom { + return nil + } + return p.bindValue(data, hasKey, target) + + case "path": + data, custom, hasKey, err := p.readValue(routeParams, target) + if err != nil { + return err + } + if custom { + return nil + } + return p.bindValue(data, hasKey, target) + + case "formData": + var err error + var mt string + + mt, _, e := runtime.ContentType(request.Header) + if e != nil { + // because of the interface conversion go thinks the error is not nil + // so we first check for nil and then set the err var if it's not nil + err = e + } + + if err != nil { + return errors.InvalidContentType("", []string{"multipart/form-data", "application/x-www-form-urlencoded"}) + } + + if mt != "multipart/form-data" && mt != "application/x-www-form-urlencoded" { + return errors.InvalidContentType(mt, []string{"multipart/form-data", "application/x-www-form-urlencoded"}) + } + + if mt == "multipart/form-data" { + if err = request.ParseMultipartForm(defaultMaxMemory); err != nil { + return errors.NewParseError(p.Name, p.parameter.In, "", err) + } + } + + if err = request.ParseForm(); err != nil { + return errors.NewParseError(p.Name, p.parameter.In, "", err) + } + + if p.parameter.Type == "file" { + file, header, ffErr := request.FormFile(p.parameter.Name) + if ffErr != nil { + return errors.NewParseError(p.Name, p.parameter.In, "", ffErr) + } + target.Set(reflect.ValueOf(runtime.File{Data: file, Header: header})) + return nil + } + + if request.MultipartForm != nil { + data, custom, hasKey, rvErr := p.readValue(runtime.Values(request.MultipartForm.Value), target) + if rvErr != nil { + return rvErr + } + if custom { + return nil + } + return p.bindValue(data, hasKey, target) + } + data, custom, hasKey, err := p.readValue(runtime.Values(request.PostForm), target) + if err != nil { + return err + } + if custom { + return nil + } + return p.bindValue(data, hasKey, target) + + case "body": + newValue := reflect.New(target.Type()) + if !runtime.HasBody(request) { + if p.parameter.Default != nil { + target.Set(reflect.ValueOf(p.parameter.Default)) + } + + return nil + } + if err := consumer.Consume(request.Body, newValue.Interface()); err != nil { + if err == io.EOF && p.parameter.Default != nil { + target.Set(reflect.ValueOf(p.parameter.Default)) + return nil + } + tpe := p.parameter.Type + if p.parameter.Format != "" { + tpe = p.parameter.Format + } + return errors.InvalidType(p.Name, p.parameter.In, tpe, nil) + } + target.Set(reflect.Indirect(newValue)) + return nil + default: + return errors.New(500, fmt.Sprintf("invalid parameter location %q", p.parameter.In)) + } +} + +func (p *untypedParamBinder) bindValue(data []string, hasKey bool, target reflect.Value) error { + if p.parameter.Type == "array" { + return p.setSliceFieldValue(target, p.parameter.Default, data, hasKey) + } + var d string + if len(data) > 0 { + d = data[len(data)-1] + } + return p.setFieldValue(target, p.parameter.Default, d, hasKey) +} + +func (p *untypedParamBinder) setFieldValue(target reflect.Value, defaultValue interface{}, data string, hasKey bool) error { + tpe := p.parameter.Type + if p.parameter.Format != "" { + tpe = p.parameter.Format + } + + if (!hasKey || (!p.parameter.AllowEmptyValue && data == "")) && p.parameter.Required && p.parameter.Default == nil { + return errors.Required(p.Name, p.parameter.In, data) + } + + ok, err := p.tryUnmarshaler(target, defaultValue, data) + if err != nil { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + if ok { + return nil + } + + defVal := reflect.Zero(target.Type()) + if defaultValue != nil { + defVal = reflect.ValueOf(defaultValue) + } + + if tpe == "byte" { + if data == "" { + if target.CanSet() { + target.SetBytes(defVal.Bytes()) + } + return nil + } + + b, err := base64.StdEncoding.DecodeString(data) + if err != nil { + b, err = base64.URLEncoding.DecodeString(data) + if err != nil { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + } + if target.CanSet() { + target.SetBytes(b) + } + return nil + } + + switch target.Kind() { + case reflect.Bool: + if data == "" { + if target.CanSet() { + target.SetBool(defVal.Bool()) + } + return nil + } + b, err := swag.ConvertBool(data) + if err != nil { + return err + } + if target.CanSet() { + target.SetBool(b) + } + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + if data == "" { + if target.CanSet() { + rd := defVal.Convert(reflect.TypeOf(int64(0))) + target.SetInt(rd.Int()) + } + return nil + } + i, err := strconv.ParseInt(data, 10, 64) + if err != nil { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + if target.OverflowInt(i) { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + if target.CanSet() { + target.SetInt(i) + } + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + if data == "" { + if target.CanSet() { + rd := defVal.Convert(reflect.TypeOf(uint64(0))) + target.SetUint(rd.Uint()) + } + return nil + } + u, err := strconv.ParseUint(data, 10, 64) + if err != nil { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + if target.OverflowUint(u) { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + if target.CanSet() { + target.SetUint(u) + } + + case reflect.Float32, reflect.Float64: + if data == "" { + if target.CanSet() { + rd := defVal.Convert(reflect.TypeOf(float64(0))) + target.SetFloat(rd.Float()) + } + return nil + } + f, err := strconv.ParseFloat(data, 64) + if err != nil { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + if target.OverflowFloat(f) { + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + if target.CanSet() { + target.SetFloat(f) + } + + case reflect.String: + value := data + if value == "" { + value = defVal.String() + } + // validate string + if target.CanSet() { + target.SetString(value) + } + + case reflect.Ptr: + if data == "" && defVal.Kind() == reflect.Ptr { + if target.CanSet() { + target.Set(defVal) + } + return nil + } + newVal := reflect.New(target.Type().Elem()) + if err := p.setFieldValue(reflect.Indirect(newVal), defVal, data, hasKey); err != nil { + return err + } + if target.CanSet() { + target.Set(newVal) + } + + default: + return errors.InvalidType(p.Name, p.parameter.In, tpe, data) + } + return nil +} + +func (p *untypedParamBinder) tryUnmarshaler(target reflect.Value, defaultValue interface{}, data string) (bool, error) { + if !target.CanSet() { + return false, nil + } + // When a type implements encoding.TextUnmarshaler we'll use that instead of reflecting some more + if reflect.PtrTo(target.Type()).Implements(textUnmarshalType) { + if defaultValue != nil && len(data) == 0 { + target.Set(reflect.ValueOf(defaultValue)) + return true, nil + } + value := reflect.New(target.Type()) + if err := value.Interface().(encoding.TextUnmarshaler).UnmarshalText([]byte(data)); err != nil { + return true, err + } + target.Set(reflect.Indirect(value)) + return true, nil + } + return false, nil +} + +func (p *untypedParamBinder) readFormattedSliceFieldValue(data string, target reflect.Value) ([]string, bool, error) { + ok, err := p.tryUnmarshaler(target, p.parameter.Default, data) + if err != nil { + return nil, true, err + } + if ok { + return nil, true, nil + } + + return swag.SplitByFormat(data, p.parameter.CollectionFormat), false, nil +} + +func (p *untypedParamBinder) setSliceFieldValue(target reflect.Value, defaultValue interface{}, data []string, hasKey bool) error { + sz := len(data) + if (!hasKey || (!p.parameter.AllowEmptyValue && (sz == 0 || (sz == 1 && data[0] == "")))) && p.parameter.Required && defaultValue == nil { + return errors.Required(p.Name, p.parameter.In, data) + } + + defVal := reflect.Zero(target.Type()) + if defaultValue != nil { + defVal = reflect.ValueOf(defaultValue) + } + + if !target.CanSet() { + return nil + } + if sz == 0 { + target.Set(defVal) + return nil + } + + value := reflect.MakeSlice(reflect.SliceOf(target.Type().Elem()), sz, sz) + + for i := 0; i < sz; i++ { + if err := p.setFieldValue(value.Index(i), nil, data[i], hasKey); err != nil { + return err + } + } + + target.Set(value) + + return nil +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/pre_go18.go b/vendor/github.com/go-openapi/runtime/middleware/pre_go18.go new file mode 100644 index 00000000000..03385251e19 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/pre_go18.go @@ -0,0 +1,9 @@ +// +build !go1.8 + +package middleware + +import "net/url" + +func pathUnescape(path string) (string, error) { + return url.QueryUnescape(path) +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/rapidoc.go b/vendor/github.com/go-openapi/runtime/middleware/rapidoc.go new file mode 100644 index 00000000000..4be330d6dc3 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/rapidoc.go @@ -0,0 +1,90 @@ +package middleware + +import ( + "bytes" + "fmt" + "html/template" + "net/http" + "path" +) + +// RapiDocOpts configures the RapiDoc middlewares +type RapiDocOpts struct { + // BasePath for the UI path, defaults to: / + BasePath string + // Path combines with BasePath for the full UI path, defaults to: docs + Path string + // SpecURL the url to find the spec for + SpecURL string + // RapiDocURL for the js that generates the rapidoc site, defaults to: https://cdn.jsdelivr.net/npm/rapidoc/bundles/rapidoc.standalone.js + RapiDocURL string + // Title for the documentation site, default to: API documentation + Title string +} + +// EnsureDefaults in case some options are missing +func (r *RapiDocOpts) EnsureDefaults() { + if r.BasePath == "" { + r.BasePath = "/" + } + if r.Path == "" { + r.Path = "docs" + } + if r.SpecURL == "" { + r.SpecURL = "/swagger.json" + } + if r.RapiDocURL == "" { + r.RapiDocURL = rapidocLatest + } + if r.Title == "" { + r.Title = "API documentation" + } +} + +// RapiDoc creates a middleware to serve a documentation site for a swagger spec. +// This allows for altering the spec before starting the http listener. +// +func RapiDoc(opts RapiDocOpts, next http.Handler) http.Handler { + opts.EnsureDefaults() + + pth := path.Join(opts.BasePath, opts.Path) + tmpl := template.Must(template.New("rapidoc").Parse(rapidocTemplate)) + + buf := bytes.NewBuffer(nil) + _ = tmpl.Execute(buf, opts) + b := buf.Bytes() + + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + if r.URL.Path == pth { + rw.Header().Set("Content-Type", "text/html; charset=utf-8") + rw.WriteHeader(http.StatusOK) + + _, _ = rw.Write(b) + return + } + + if next == nil { + rw.Header().Set("Content-Type", "text/plain") + rw.WriteHeader(http.StatusNotFound) + _, _ = rw.Write([]byte(fmt.Sprintf("%q not found", pth))) + return + } + next.ServeHTTP(rw, r) + }) +} + +const ( + rapidocLatest = "https://unpkg.com/rapidoc/dist/rapidoc-min.js" + rapidocTemplate = ` + + + {{ .Title }} + + + + + + + +` +) diff --git a/vendor/github.com/go-openapi/runtime/middleware/redoc.go b/vendor/github.com/go-openapi/runtime/middleware/redoc.go new file mode 100644 index 00000000000..019c854295b --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/redoc.go @@ -0,0 +1,103 @@ +package middleware + +import ( + "bytes" + "fmt" + "html/template" + "net/http" + "path" +) + +// RedocOpts configures the Redoc middlewares +type RedocOpts struct { + // BasePath for the UI path, defaults to: / + BasePath string + // Path combines with BasePath for the full UI path, defaults to: docs + Path string + // SpecURL the url to find the spec for + SpecURL string + // RedocURL for the js that generates the redoc site, defaults to: https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js + RedocURL string + // Title for the documentation site, default to: API documentation + Title string +} + +// EnsureDefaults in case some options are missing +func (r *RedocOpts) EnsureDefaults() { + if r.BasePath == "" { + r.BasePath = "/" + } + if r.Path == "" { + r.Path = "docs" + } + if r.SpecURL == "" { + r.SpecURL = "/swagger.json" + } + if r.RedocURL == "" { + r.RedocURL = redocLatest + } + if r.Title == "" { + r.Title = "API documentation" + } +} + +// Redoc creates a middleware to serve a documentation site for a swagger spec. +// This allows for altering the spec before starting the http listener. +// +func Redoc(opts RedocOpts, next http.Handler) http.Handler { + opts.EnsureDefaults() + + pth := path.Join(opts.BasePath, opts.Path) + tmpl := template.Must(template.New("redoc").Parse(redocTemplate)) + + buf := bytes.NewBuffer(nil) + _ = tmpl.Execute(buf, opts) + b := buf.Bytes() + + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + if r.URL.Path == pth { + rw.Header().Set("Content-Type", "text/html; charset=utf-8") + rw.WriteHeader(http.StatusOK) + + _, _ = rw.Write(b) + return + } + + if next == nil { + rw.Header().Set("Content-Type", "text/plain") + rw.WriteHeader(http.StatusNotFound) + _, _ = rw.Write([]byte(fmt.Sprintf("%q not found", pth))) + return + } + next.ServeHTTP(rw, r) + }) +} + +const ( + redocLatest = "https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js" + redocTemplate = ` + + + {{ .Title }} + + + + + + + + + + + + + +` +) diff --git a/vendor/github.com/go-openapi/runtime/middleware/request.go b/vendor/github.com/go-openapi/runtime/middleware/request.go new file mode 100644 index 00000000000..760c37861d0 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/request.go @@ -0,0 +1,104 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + "net/http" + "reflect" + + "github.com/go-openapi/errors" + "github.com/go-openapi/spec" + "github.com/go-openapi/strfmt" + + "github.com/go-openapi/runtime" +) + +// UntypedRequestBinder binds and validates the data from a http request +type UntypedRequestBinder struct { + Spec *spec.Swagger + Parameters map[string]spec.Parameter + Formats strfmt.Registry + paramBinders map[string]*untypedParamBinder +} + +// NewUntypedRequestBinder creates a new binder for reading a request. +func NewUntypedRequestBinder(parameters map[string]spec.Parameter, spec *spec.Swagger, formats strfmt.Registry) *UntypedRequestBinder { + binders := make(map[string]*untypedParamBinder) + for fieldName, param := range parameters { + binders[fieldName] = newUntypedParamBinder(param, spec, formats) + } + return &UntypedRequestBinder{ + Parameters: parameters, + paramBinders: binders, + Spec: spec, + Formats: formats, + } +} + +// Bind perform the databinding and validation +func (o *UntypedRequestBinder) Bind(request *http.Request, routeParams RouteParams, consumer runtime.Consumer, data interface{}) error { + val := reflect.Indirect(reflect.ValueOf(data)) + isMap := val.Kind() == reflect.Map + var result []error + debugLog("binding %d parameters for %s %s", len(o.Parameters), request.Method, request.URL.EscapedPath()) + for fieldName, param := range o.Parameters { + binder := o.paramBinders[fieldName] + debugLog("binding parameter %s for %s %s", fieldName, request.Method, request.URL.EscapedPath()) + var target reflect.Value + if !isMap { + binder.Name = fieldName + target = val.FieldByName(fieldName) + } + + if isMap { + tpe := binder.Type() + if tpe == nil { + if param.Schema.Type.Contains("array") { + tpe = reflect.TypeOf([]interface{}{}) + } else { + tpe = reflect.TypeOf(map[string]interface{}{}) + } + } + target = reflect.Indirect(reflect.New(tpe)) + } + + if !target.IsValid() { + result = append(result, errors.New(500, "parameter name %q is an unknown field", binder.Name)) + continue + } + + if err := binder.Bind(request, routeParams, consumer, target); err != nil { + result = append(result, err) + continue + } + + if binder.validator != nil { + rr := binder.validator.Validate(target.Interface()) + if rr != nil && rr.HasErrors() { + result = append(result, rr.AsError()) + } + } + + if isMap { + val.SetMapIndex(reflect.ValueOf(param.Name), target) + } + } + + if len(result) > 0 { + return errors.CompositeValidationError(result...) + } + + return nil +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/router.go b/vendor/github.com/go-openapi/runtime/middleware/router.go new file mode 100644 index 00000000000..5052031c8d7 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/router.go @@ -0,0 +1,488 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + "fmt" + "net/http" + fpath "path" + "regexp" + "strings" + + "github.com/go-openapi/runtime/security" + "github.com/go-openapi/swag" + + "github.com/go-openapi/analysis" + "github.com/go-openapi/errors" + "github.com/go-openapi/loads" + "github.com/go-openapi/spec" + "github.com/go-openapi/strfmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware/denco" +) + +// RouteParam is a object to capture route params in a framework agnostic way. +// implementations of the muxer should use these route params to communicate with the +// swagger framework +type RouteParam struct { + Name string + Value string +} + +// RouteParams the collection of route params +type RouteParams []RouteParam + +// Get gets the value for the route param for the specified key +func (r RouteParams) Get(name string) string { + vv, _, _ := r.GetOK(name) + if len(vv) > 0 { + return vv[len(vv)-1] + } + return "" +} + +// GetOK gets the value but also returns booleans to indicate if a key or value +// is present. This aids in validation and satisfies an interface in use there +// +// The returned values are: data, has key, has value +func (r RouteParams) GetOK(name string) ([]string, bool, bool) { + for _, p := range r { + if p.Name == name { + return []string{p.Value}, true, p.Value != "" + } + } + return nil, false, false +} + +// NewRouter creates a new context aware router middleware +func NewRouter(ctx *Context, next http.Handler) http.Handler { + if ctx.router == nil { + ctx.router = DefaultRouter(ctx.spec, ctx.api) + } + + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + if _, rCtx, ok := ctx.RouteInfo(r); ok { + next.ServeHTTP(rw, rCtx) + return + } + + // Not found, check if it exists in the other methods first + if others := ctx.AllowedMethods(r); len(others) > 0 { + ctx.Respond(rw, r, ctx.analyzer.RequiredProduces(), nil, errors.MethodNotAllowed(r.Method, others)) + return + } + + ctx.Respond(rw, r, ctx.analyzer.RequiredProduces(), nil, errors.NotFound("path %s was not found", r.URL.EscapedPath())) + }) +} + +// RoutableAPI represents an interface for things that can serve +// as a provider of implementations for the swagger router +type RoutableAPI interface { + HandlerFor(string, string) (http.Handler, bool) + ServeErrorFor(string) func(http.ResponseWriter, *http.Request, error) + ConsumersFor([]string) map[string]runtime.Consumer + ProducersFor([]string) map[string]runtime.Producer + AuthenticatorsFor(map[string]spec.SecurityScheme) map[string]runtime.Authenticator + Authorizer() runtime.Authorizer + Formats() strfmt.Registry + DefaultProduces() string + DefaultConsumes() string +} + +// Router represents a swagger aware router +type Router interface { + Lookup(method, path string) (*MatchedRoute, bool) + OtherMethods(method, path string) []string +} + +type defaultRouteBuilder struct { + spec *loads.Document + analyzer *analysis.Spec + api RoutableAPI + records map[string][]denco.Record +} + +type defaultRouter struct { + spec *loads.Document + routers map[string]*denco.Router +} + +func newDefaultRouteBuilder(spec *loads.Document, api RoutableAPI) *defaultRouteBuilder { + return &defaultRouteBuilder{ + spec: spec, + analyzer: analysis.New(spec.Spec()), + api: api, + records: make(map[string][]denco.Record), + } +} + +// DefaultRouter creates a default implemenation of the router +func DefaultRouter(spec *loads.Document, api RoutableAPI) Router { + builder := newDefaultRouteBuilder(spec, api) + if spec != nil { + for method, paths := range builder.analyzer.Operations() { + for path, operation := range paths { + fp := fpath.Join(spec.BasePath(), path) + debugLog("adding route %s %s %q", method, fp, operation.ID) + builder.AddRoute(method, fp, operation) + } + } + } + return builder.Build() +} + +// RouteAuthenticator is an authenticator that can compose several authenticators together. +// It also knows when it contains an authenticator that allows for anonymous pass through. +// Contains a group of 1 or more authenticators that have a logical AND relationship +type RouteAuthenticator struct { + Authenticator map[string]runtime.Authenticator + Schemes []string + Scopes map[string][]string + allScopes []string + commonScopes []string + allowAnonymous bool +} + +func (ra *RouteAuthenticator) AllowsAnonymous() bool { + return ra.allowAnonymous +} + +// AllScopes returns a list of unique scopes that is the combination +// of all the scopes in the requirements +func (ra *RouteAuthenticator) AllScopes() []string { + return ra.allScopes +} + +// CommonScopes returns a list of unique scopes that are common in all the +// scopes in the requirements +func (ra *RouteAuthenticator) CommonScopes() []string { + return ra.commonScopes +} + +// Authenticate Authenticator interface implementation +func (ra *RouteAuthenticator) Authenticate(req *http.Request, route *MatchedRoute) (bool, interface{}, error) { + if ra.allowAnonymous { + route.Authenticator = ra + return true, nil, nil + } + // iterate in proper order + var lastResult interface{} + for _, scheme := range ra.Schemes { + if authenticator, ok := ra.Authenticator[scheme]; ok { + applies, princ, err := authenticator.Authenticate(&security.ScopedAuthRequest{ + Request: req, + RequiredScopes: ra.Scopes[scheme], + }) + if !applies { + return false, nil, nil + } + if err != nil { + route.Authenticator = ra + return true, nil, err + } + lastResult = princ + } + } + route.Authenticator = ra + return true, lastResult, nil +} + +func stringSliceUnion(slices ...[]string) []string { + unique := make(map[string]struct{}) + var result []string + for _, slice := range slices { + for _, entry := range slice { + if _, ok := unique[entry]; ok { + continue + } + unique[entry] = struct{}{} + result = append(result, entry) + } + } + return result +} + +func stringSliceIntersection(slices ...[]string) []string { + unique := make(map[string]int) + var intersection []string + + total := len(slices) + var emptyCnt int + for _, slice := range slices { + if len(slice) == 0 { + emptyCnt++ + continue + } + + for _, entry := range slice { + unique[entry]++ + if unique[entry] == total-emptyCnt { // this entry appeared in all the non-empty slices + intersection = append(intersection, entry) + } + } + } + + return intersection +} + +// RouteAuthenticators represents a group of authenticators that represent a logical OR +type RouteAuthenticators []RouteAuthenticator + +// AllowsAnonymous returns true when there is an authenticator that means optional auth +func (ras RouteAuthenticators) AllowsAnonymous() bool { + for _, ra := range ras { + if ra.AllowsAnonymous() { + return true + } + } + return false +} + +// Authenticate method implemention so this collection can be used as authenticator +func (ras RouteAuthenticators) Authenticate(req *http.Request, route *MatchedRoute) (bool, interface{}, error) { + var lastError error + var allowsAnon bool + var anonAuth RouteAuthenticator + + for _, ra := range ras { + if ra.AllowsAnonymous() { + anonAuth = ra + allowsAnon = true + continue + } + applies, usr, err := ra.Authenticate(req, route) + if !applies || err != nil || usr == nil { + if err != nil { + lastError = err + } + continue + } + return applies, usr, nil + } + + if allowsAnon && lastError == nil { + route.Authenticator = &anonAuth + return true, nil, lastError + } + return lastError != nil, nil, lastError +} + +type routeEntry struct { + PathPattern string + BasePath string + Operation *spec.Operation + Consumes []string + Consumers map[string]runtime.Consumer + Produces []string + Producers map[string]runtime.Producer + Parameters map[string]spec.Parameter + Handler http.Handler + Formats strfmt.Registry + Binder *UntypedRequestBinder + Authenticators RouteAuthenticators + Authorizer runtime.Authorizer +} + +// MatchedRoute represents the route that was matched in this request +type MatchedRoute struct { + routeEntry + Params RouteParams + Consumer runtime.Consumer + Producer runtime.Producer + Authenticator *RouteAuthenticator +} + +// HasAuth returns true when the route has a security requirement defined +func (m *MatchedRoute) HasAuth() bool { + return len(m.Authenticators) > 0 +} + +// NeedsAuth returns true when the request still +// needs to perform authentication +func (m *MatchedRoute) NeedsAuth() bool { + return m.HasAuth() && m.Authenticator == nil +} + +func (d *defaultRouter) Lookup(method, path string) (*MatchedRoute, bool) { + mth := strings.ToUpper(method) + debugLog("looking up route for %s %s", method, path) + if Debug { + if len(d.routers) == 0 { + debugLog("there are no known routers") + } + for meth := range d.routers { + debugLog("got a router for %s", meth) + } + } + if router, ok := d.routers[mth]; ok { + if m, rp, ok := router.Lookup(fpath.Clean(path)); ok && m != nil { + if entry, ok := m.(*routeEntry); ok { + debugLog("found a route for %s %s with %d parameters", method, path, len(entry.Parameters)) + var params RouteParams + for _, p := range rp { + v, err := pathUnescape(p.Value) + if err != nil { + debugLog("failed to escape %q: %v", p.Value, err) + v = p.Value + } + // a workaround to handle fragment/composing parameters until they are supported in denco router + // check if this parameter is a fragment within a path segment + if xpos := strings.Index(entry.PathPattern, fmt.Sprintf("{%s}", p.Name)) + len(p.Name) + 2; xpos < len(entry.PathPattern) && entry.PathPattern[xpos] != '/' { + // extract fragment parameters + ep := strings.Split(entry.PathPattern[xpos:], "/")[0] + pnames, pvalues := decodeCompositParams(p.Name, v, ep, nil, nil) + for i, pname := range pnames { + params = append(params, RouteParam{Name: pname, Value: pvalues[i]}) + } + } else { + // use the parameter directly + params = append(params, RouteParam{Name: p.Name, Value: v}) + } + } + return &MatchedRoute{routeEntry: *entry, Params: params}, true + } + } else { + debugLog("couldn't find a route by path for %s %s", method, path) + } + } else { + debugLog("couldn't find a route by method for %s %s", method, path) + } + return nil, false +} + +func (d *defaultRouter) OtherMethods(method, path string) []string { + mn := strings.ToUpper(method) + var methods []string + for k, v := range d.routers { + if k != mn { + if _, _, ok := v.Lookup(fpath.Clean(path)); ok { + methods = append(methods, k) + continue + } + } + } + return methods +} + +// convert swagger parameters per path segment into a denco parameter as multiple parameters per segment are not supported in denco +var pathConverter = regexp.MustCompile(`{(.+?)}([^/]*)`) + +func decodeCompositParams(name string, value string, pattern string, names []string, values []string) ([]string, []string) { + pleft := strings.Index(pattern, "{") + names = append(names, name) + if pleft < 0 { + if strings.HasSuffix(value, pattern) { + values = append(values, value[:len(value)-len(pattern)]) + } else { + values = append(values, "") + } + } else { + toskip := pattern[:pleft] + pright := strings.Index(pattern, "}") + vright := strings.Index(value, toskip) + if vright >= 0 { + values = append(values, value[:vright]) + } else { + values = append(values, "") + value = "" + } + return decodeCompositParams(pattern[pleft+1:pright], value[vright+len(toskip):], pattern[pright+1:], names, values) + } + return names, values +} + +func (d *defaultRouteBuilder) AddRoute(method, path string, operation *spec.Operation) { + mn := strings.ToUpper(method) + + bp := fpath.Clean(d.spec.BasePath()) + if len(bp) > 0 && bp[len(bp)-1] == '/' { + bp = bp[:len(bp)-1] + } + + debugLog("operation: %#v", *operation) + if handler, ok := d.api.HandlerFor(method, strings.TrimPrefix(path, bp)); ok { + consumes := d.analyzer.ConsumesFor(operation) + produces := d.analyzer.ProducesFor(operation) + parameters := d.analyzer.ParamsFor(method, strings.TrimPrefix(path, bp)) + + // add API defaults if not part of the spec + if defConsumes := d.api.DefaultConsumes(); defConsumes != "" && !swag.ContainsStringsCI(consumes, defConsumes) { + consumes = append(consumes, defConsumes) + } + + if defProduces := d.api.DefaultProduces(); defProduces != "" && !swag.ContainsStringsCI(produces, defProduces) { + produces = append(produces, defProduces) + } + + record := denco.NewRecord(pathConverter.ReplaceAllString(path, ":$1"), &routeEntry{ + BasePath: bp, + PathPattern: path, + Operation: operation, + Handler: handler, + Consumes: consumes, + Produces: produces, + Consumers: d.api.ConsumersFor(normalizeOffers(consumes)), + Producers: d.api.ProducersFor(normalizeOffers(produces)), + Parameters: parameters, + Formats: d.api.Formats(), + Binder: NewUntypedRequestBinder(parameters, d.spec.Spec(), d.api.Formats()), + Authenticators: d.buildAuthenticators(operation), + Authorizer: d.api.Authorizer(), + }) + d.records[mn] = append(d.records[mn], record) + } +} + +func (d *defaultRouteBuilder) buildAuthenticators(operation *spec.Operation) RouteAuthenticators { + requirements := d.analyzer.SecurityRequirementsFor(operation) + var auths []RouteAuthenticator + for _, reqs := range requirements { + var schemes []string + scopes := make(map[string][]string, len(reqs)) + var scopeSlices [][]string + for _, req := range reqs { + schemes = append(schemes, req.Name) + scopes[req.Name] = req.Scopes + scopeSlices = append(scopeSlices, req.Scopes) + } + + definitions := d.analyzer.SecurityDefinitionsForRequirements(reqs) + authenticators := d.api.AuthenticatorsFor(definitions) + auths = append(auths, RouteAuthenticator{ + Authenticator: authenticators, + Schemes: schemes, + Scopes: scopes, + allScopes: stringSliceUnion(scopeSlices...), + commonScopes: stringSliceIntersection(scopeSlices...), + allowAnonymous: len(reqs) == 1 && reqs[0].Name == "", + }) + } + return auths +} + +func (d *defaultRouteBuilder) Build() *defaultRouter { + routers := make(map[string]*denco.Router) + for method, records := range d.records { + router := denco.New() + _ = router.Build(records) + routers[method] = router + } + return &defaultRouter{ + spec: d.spec, + routers: routers, + } +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/security.go b/vendor/github.com/go-openapi/runtime/middleware/security.go new file mode 100644 index 00000000000..2b061caefcb --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/security.go @@ -0,0 +1,39 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import "net/http" + +func newSecureAPI(ctx *Context, next http.Handler) http.Handler { + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + route, rCtx, _ := ctx.RouteInfo(r) + if rCtx != nil { + r = rCtx + } + if route != nil && !route.NeedsAuth() { + next.ServeHTTP(rw, r) + return + } + + _, rCtx, err := ctx.Authorize(r, route) + if err != nil { + ctx.Respond(rw, r, route.Produces, route, err) + return + } + r = rCtx + + next.ServeHTTP(rw, r) + }) +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/spec.go b/vendor/github.com/go-openapi/runtime/middleware/spec.go new file mode 100644 index 00000000000..f0291429806 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/spec.go @@ -0,0 +1,48 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + "net/http" + "path" +) + +// Spec creates a middleware to serve a swagger spec. +// This allows for altering the spec before starting the http listener. +// This can be useful if you want to serve the swagger spec from another path than /swagger.json +// +func Spec(basePath string, b []byte, next http.Handler) http.Handler { + if basePath == "" { + basePath = "/" + } + pth := path.Join(basePath, "swagger.json") + + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + if r.URL.Path == pth { + rw.Header().Set("Content-Type", "application/json") + rw.WriteHeader(http.StatusOK) + //#nosec + _, _ = rw.Write(b) + return + } + + if next == nil { + rw.Header().Set("Content-Type", "application/json") + rw.WriteHeader(http.StatusNotFound) + return + } + next.ServeHTTP(rw, r) + }) +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/swaggerui.go b/vendor/github.com/go-openapi/runtime/middleware/swaggerui.go new file mode 100644 index 00000000000..2c92f5c91f3 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/swaggerui.go @@ -0,0 +1,162 @@ +package middleware + +import ( + "bytes" + "fmt" + "html/template" + "net/http" + "path" +) + +// SwaggerUIOpts configures the Swaggerui middlewares +type SwaggerUIOpts struct { + // BasePath for the UI path, defaults to: / + BasePath string + // Path combines with BasePath for the full UI path, defaults to: docs + Path string + // SpecURL the url to find the spec for + SpecURL string + + // The three components needed to embed swagger-ui + SwaggerURL string + SwaggerPresetURL string + SwaggerStylesURL string + + Favicon32 string + Favicon16 string + + // Title for the documentation site, default to: API documentation + Title string +} + +// EnsureDefaults in case some options are missing +func (r *SwaggerUIOpts) EnsureDefaults() { + if r.BasePath == "" { + r.BasePath = "/" + } + if r.Path == "" { + r.Path = "docs" + } + if r.SpecURL == "" { + r.SpecURL = "/swagger.json" + } + if r.SwaggerURL == "" { + r.SwaggerURL = swaggerLatest + } + if r.SwaggerPresetURL == "" { + r.SwaggerPresetURL = swaggerPresetLatest + } + if r.SwaggerStylesURL == "" { + r.SwaggerStylesURL = swaggerStylesLatest + } + if r.Favicon16 == "" { + r.Favicon16 = swaggerFavicon16Latest + } + if r.Favicon32 == "" { + r.Favicon32 = swaggerFavicon32Latest + } + if r.Title == "" { + r.Title = "API documentation" + } +} + +// SwaggerUI creates a middleware to serve a documentation site for a swagger spec. +// This allows for altering the spec before starting the http listener. +func SwaggerUI(opts SwaggerUIOpts, next http.Handler) http.Handler { + opts.EnsureDefaults() + + pth := path.Join(opts.BasePath, opts.Path) + tmpl := template.Must(template.New("swaggerui").Parse(swaggeruiTemplate)) + + buf := bytes.NewBuffer(nil) + _ = tmpl.Execute(buf, &opts) + b := buf.Bytes() + + return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { + if r.URL.Path == pth { + rw.Header().Set("Content-Type", "text/html; charset=utf-8") + rw.WriteHeader(http.StatusOK) + + _, _ = rw.Write(b) + return + } + + if next == nil { + rw.Header().Set("Content-Type", "text/plain") + rw.WriteHeader(http.StatusNotFound) + _, _ = rw.Write([]byte(fmt.Sprintf("%q not found", pth))) + return + } + next.ServeHTTP(rw, r) + }) +} + +const ( + swaggerLatest = "https://unpkg.com/swagger-ui-dist/swagger-ui-bundle.js" + swaggerPresetLatest = "https://unpkg.com/swagger-ui-dist/swagger-ui-standalone-preset.js" + swaggerStylesLatest = "https://unpkg.com/swagger-ui-dist/swagger-ui.css" + swaggerFavicon32Latest = "https://unpkg.com/swagger-ui-dist/favicon-32x32.png" + swaggerFavicon16Latest = "https://unpkg.com/swagger-ui-dist/favicon-16x16.png" + swaggeruiTemplate = ` + + + + + {{ .Title }} + + + + + + + + +

+ + + + + + +` +) diff --git a/vendor/github.com/go-openapi/runtime/middleware/untyped/api.go b/vendor/github.com/go-openapi/runtime/middleware/untyped/api.go new file mode 100644 index 00000000000..39a85f7d9e8 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/untyped/api.go @@ -0,0 +1,286 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package untyped + +import ( + "fmt" + "net/http" + "sort" + "strings" + + "github.com/go-openapi/analysis" + "github.com/go-openapi/errors" + "github.com/go-openapi/loads" + "github.com/go-openapi/spec" + "github.com/go-openapi/strfmt" + + "github.com/go-openapi/runtime" +) + +// NewAPI creates the default untyped API +func NewAPI(spec *loads.Document) *API { + var an *analysis.Spec + if spec != nil && spec.Spec() != nil { + an = analysis.New(spec.Spec()) + } + api := &API{ + spec: spec, + analyzer: an, + consumers: make(map[string]runtime.Consumer, 10), + producers: make(map[string]runtime.Producer, 10), + authenticators: make(map[string]runtime.Authenticator), + operations: make(map[string]map[string]runtime.OperationHandler), + ServeError: errors.ServeError, + Models: make(map[string]func() interface{}), + formats: strfmt.NewFormats(), + } + return api.WithJSONDefaults() +} + +// API represents an untyped mux for a swagger spec +type API struct { + spec *loads.Document + analyzer *analysis.Spec + DefaultProduces string + DefaultConsumes string + consumers map[string]runtime.Consumer + producers map[string]runtime.Producer + authenticators map[string]runtime.Authenticator + authorizer runtime.Authorizer + operations map[string]map[string]runtime.OperationHandler + ServeError func(http.ResponseWriter, *http.Request, error) + Models map[string]func() interface{} + formats strfmt.Registry +} + +// WithJSONDefaults loads the json defaults for this api +func (d *API) WithJSONDefaults() *API { + d.DefaultConsumes = runtime.JSONMime + d.DefaultProduces = runtime.JSONMime + d.consumers[runtime.JSONMime] = runtime.JSONConsumer() + d.producers[runtime.JSONMime] = runtime.JSONProducer() + return d +} + +// WithoutJSONDefaults clears the json defaults for this api +func (d *API) WithoutJSONDefaults() *API { + d.DefaultConsumes = "" + d.DefaultProduces = "" + delete(d.consumers, runtime.JSONMime) + delete(d.producers, runtime.JSONMime) + return d +} + +// Formats returns the registered string formats +func (d *API) Formats() strfmt.Registry { + if d.formats == nil { + d.formats = strfmt.NewFormats() + } + return d.formats +} + +// RegisterFormat registers a custom format validator +func (d *API) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) { + if d.formats == nil { + d.formats = strfmt.NewFormats() + } + d.formats.Add(name, format, validator) +} + +// RegisterAuth registers an auth handler in this api +func (d *API) RegisterAuth(scheme string, handler runtime.Authenticator) { + if d.authenticators == nil { + d.authenticators = make(map[string]runtime.Authenticator) + } + d.authenticators[scheme] = handler +} + +// RegisterAuthorizer registers an authorizer handler in this api +func (d *API) RegisterAuthorizer(handler runtime.Authorizer) { + d.authorizer = handler +} + +// RegisterConsumer registers a consumer for a media type. +func (d *API) RegisterConsumer(mediaType string, handler runtime.Consumer) { + if d.consumers == nil { + d.consumers = make(map[string]runtime.Consumer, 10) + } + d.consumers[strings.ToLower(mediaType)] = handler +} + +// RegisterProducer registers a producer for a media type +func (d *API) RegisterProducer(mediaType string, handler runtime.Producer) { + if d.producers == nil { + d.producers = make(map[string]runtime.Producer, 10) + } + d.producers[strings.ToLower(mediaType)] = handler +} + +// RegisterOperation registers an operation handler for an operation name +func (d *API) RegisterOperation(method, path string, handler runtime.OperationHandler) { + if d.operations == nil { + d.operations = make(map[string]map[string]runtime.OperationHandler, 30) + } + um := strings.ToUpper(method) + if b, ok := d.operations[um]; !ok || b == nil { + d.operations[um] = make(map[string]runtime.OperationHandler) + } + d.operations[um][path] = handler +} + +// OperationHandlerFor returns the operation handler for the specified id if it can be found +func (d *API) OperationHandlerFor(method, path string) (runtime.OperationHandler, bool) { + if d.operations == nil { + return nil, false + } + if pi, ok := d.operations[strings.ToUpper(method)]; ok { + h, ok := pi[path] + return h, ok + } + return nil, false +} + +// ConsumersFor gets the consumers for the specified media types +func (d *API) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer { + result := make(map[string]runtime.Consumer) + for _, mt := range mediaTypes { + if consumer, ok := d.consumers[mt]; ok { + result[mt] = consumer + } + } + return result +} + +// ProducersFor gets the producers for the specified media types +func (d *API) ProducersFor(mediaTypes []string) map[string]runtime.Producer { + result := make(map[string]runtime.Producer) + for _, mt := range mediaTypes { + if producer, ok := d.producers[mt]; ok { + result[mt] = producer + } + } + return result +} + +// AuthenticatorsFor gets the authenticators for the specified security schemes +func (d *API) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator { + result := make(map[string]runtime.Authenticator) + for k := range schemes { + if a, ok := d.authenticators[k]; ok { + result[k] = a + } + } + return result +} + +// Authorizer returns the registered authorizer +func (d *API) Authorizer() runtime.Authorizer { + return d.authorizer +} + +// Validate validates this API for any missing items +func (d *API) Validate() error { + return d.validate() +} + +// validateWith validates the registrations in this API against the provided spec analyzer +func (d *API) validate() error { + var consumes []string + for k := range d.consumers { + consumes = append(consumes, k) + } + + var produces []string + for k := range d.producers { + produces = append(produces, k) + } + + var authenticators []string + for k := range d.authenticators { + authenticators = append(authenticators, k) + } + + var operations []string + for m, v := range d.operations { + for p := range v { + operations = append(operations, fmt.Sprintf("%s %s", strings.ToUpper(m), p)) + } + } + + var definedAuths []string + for k := range d.spec.Spec().SecurityDefinitions { + definedAuths = append(definedAuths, k) + } + + if err := d.verify("consumes", consumes, d.analyzer.RequiredConsumes()); err != nil { + return err + } + if err := d.verify("produces", produces, d.analyzer.RequiredProduces()); err != nil { + return err + } + if err := d.verify("operation", operations, d.analyzer.OperationMethodPaths()); err != nil { + return err + } + + requiredAuths := d.analyzer.RequiredSecuritySchemes() + if err := d.verify("auth scheme", authenticators, requiredAuths); err != nil { + return err + } + if err := d.verify("security definitions", definedAuths, requiredAuths); err != nil { + return err + } + return nil +} + +func (d *API) verify(name string, registrations []string, expectations []string) error { + sort.Strings(registrations) + sort.Strings(expectations) + + expected := map[string]struct{}{} + seen := map[string]struct{}{} + + for _, v := range expectations { + expected[v] = struct{}{} + } + + var unspecified []string + for _, v := range registrations { + seen[v] = struct{}{} + if _, ok := expected[v]; !ok { + unspecified = append(unspecified, v) + } + } + + for k := range seen { + delete(expected, k) + } + + var unregistered []string + for k := range expected { + unregistered = append(unregistered, k) + } + sort.Strings(unspecified) + sort.Strings(unregistered) + + if len(unregistered) > 0 || len(unspecified) > 0 { + return &errors.APIVerificationFailed{ + Section: name, + MissingSpecification: unspecified, + MissingRegistration: unregistered, + } + } + + return nil +} diff --git a/vendor/github.com/go-openapi/runtime/middleware/validation.go b/vendor/github.com/go-openapi/runtime/middleware/validation.go new file mode 100644 index 00000000000..1f0135b5788 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/middleware/validation.go @@ -0,0 +1,126 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package middleware + +import ( + "mime" + "net/http" + "strings" + + "github.com/go-openapi/errors" + "github.com/go-openapi/swag" + + "github.com/go-openapi/runtime" +) + +type validation struct { + context *Context + result []error + request *http.Request + route *MatchedRoute + bound map[string]interface{} +} + +// ContentType validates the content type of a request +func validateContentType(allowed []string, actual string) error { + debugLog("validating content type for %q against [%s]", actual, strings.Join(allowed, ", ")) + if len(allowed) == 0 { + return nil + } + mt, _, err := mime.ParseMediaType(actual) + if err != nil { + return errors.InvalidContentType(actual, allowed) + } + if swag.ContainsStringsCI(allowed, mt) { + return nil + } + if swag.ContainsStringsCI(allowed, "*/*") { + return nil + } + parts := strings.Split(actual, "/") + if len(parts) == 2 && swag.ContainsStringsCI(allowed, parts[0]+"/*") { + return nil + } + return errors.InvalidContentType(actual, allowed) +} + +func validateRequest(ctx *Context, request *http.Request, route *MatchedRoute) *validation { + debugLog("validating request %s %s", request.Method, request.URL.EscapedPath()) + validate := &validation{ + context: ctx, + request: request, + route: route, + bound: make(map[string]interface{}), + } + + validate.contentType() + if len(validate.result) == 0 { + validate.responseFormat() + } + if len(validate.result) == 0 { + validate.parameters() + } + + return validate +} + +func (v *validation) parameters() { + debugLog("validating request parameters for %s %s", v.request.Method, v.request.URL.EscapedPath()) + if result := v.route.Binder.Bind(v.request, v.route.Params, v.route.Consumer, v.bound); result != nil { + if result.Error() == "validation failure list" { + for _, e := range result.(*errors.Validation).Value.([]interface{}) { + v.result = append(v.result, e.(error)) + } + return + } + v.result = append(v.result, result) + } +} + +func (v *validation) contentType() { + if len(v.result) == 0 && runtime.HasBody(v.request) { + debugLog("validating body content type for %s %s", v.request.Method, v.request.URL.EscapedPath()) + ct, _, req, err := v.context.ContentType(v.request) + if err != nil { + v.result = append(v.result, err) + } else { + v.request = req + } + + if len(v.result) == 0 { + if err := validateContentType(v.route.Consumes, ct); err != nil { + v.result = append(v.result, err) + } + } + if ct != "" && v.route.Consumer == nil { + cons, ok := v.route.Consumers[ct] + if !ok { + v.result = append(v.result, errors.New(500, "no consumer registered for %s", ct)) + } else { + v.route.Consumer = cons + } + } + } +} + +func (v *validation) responseFormat() { + // if the route provides values for Produces and no format could be identify then return an error. + // if the route does not specify values for Produces then treat request as valid since the API designer + // choose not to specify the format for responses. + if str, rCtx := v.context.ResponseFormat(v.request, v.route.Produces); str == "" && len(v.route.Produces) > 0 { + v.request = rCtx + v.result = append(v.result, errors.InvalidResponseFormat(v.request.Header.Get(runtime.HeaderAccept), v.route.Produces)) + } +} diff --git a/vendor/github.com/go-openapi/runtime/request.go b/vendor/github.com/go-openapi/runtime/request.go new file mode 100644 index 00000000000..078fda17396 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/request.go @@ -0,0 +1,139 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "bufio" + "io" + "net/http" + "strings" + + "github.com/go-openapi/swag" +) + +// CanHaveBody returns true if this method can have a body +func CanHaveBody(method string) bool { + mn := strings.ToUpper(method) + return mn == "POST" || mn == "PUT" || mn == "PATCH" || mn == "DELETE" +} + +// IsSafe returns true if this is a request with a safe method +func IsSafe(r *http.Request) bool { + mn := strings.ToUpper(r.Method) + return mn == "GET" || mn == "HEAD" +} + +// AllowsBody returns true if the request allows for a body +func AllowsBody(r *http.Request) bool { + mn := strings.ToUpper(r.Method) + return mn != "HEAD" +} + +// HasBody returns true if this method needs a content-type +func HasBody(r *http.Request) bool { + // happy case: we have a content length set + if r.ContentLength > 0 { + return true + } + + if r.Header.Get("content-length") != "" { + // in this case, no Transfer-Encoding should be present + // we have a header set but it was explicitly set to 0, so we assume no body + return false + } + + rdr := newPeekingReader(r.Body) + r.Body = rdr + return rdr.HasContent() +} + +func newPeekingReader(r io.ReadCloser) *peekingReader { + if r == nil { + return nil + } + return &peekingReader{ + underlying: bufio.NewReader(r), + orig: r, + } +} + +type peekingReader struct { + underlying interface { + Buffered() int + Peek(int) ([]byte, error) + Read([]byte) (int, error) + } + orig io.ReadCloser +} + +func (p *peekingReader) HasContent() bool { + if p == nil { + return false + } + if p.underlying.Buffered() > 0 { + return true + } + b, err := p.underlying.Peek(1) + if err != nil { + return false + } + return len(b) > 0 +} + +func (p *peekingReader) Read(d []byte) (int, error) { + if p == nil { + return 0, io.EOF + } + return p.underlying.Read(d) +} + +func (p *peekingReader) Close() error { + p.underlying = nil + if p.orig != nil { + return p.orig.Close() + } + return nil +} + +// JSONRequest creates a new http request with json headers set +func JSONRequest(method, urlStr string, body io.Reader) (*http.Request, error) { + req, err := http.NewRequest(method, urlStr, body) + if err != nil { + return nil, err + } + req.Header.Add(HeaderContentType, JSONMime) + req.Header.Add(HeaderAccept, JSONMime) + return req, nil +} + +// Gettable for things with a method GetOK(string) (data string, hasKey bool, hasValue bool) +type Gettable interface { + GetOK(string) ([]string, bool, bool) +} + +// ReadSingleValue reads a single value from the source +func ReadSingleValue(values Gettable, name string) string { + vv, _, hv := values.GetOK(name) + if hv { + return vv[len(vv)-1] + } + return "" +} + +// ReadCollectionValue reads a collection value from a string data source +func ReadCollectionValue(values Gettable, name, collectionFormat string) []string { + v := ReadSingleValue(values, name) + return swag.SplitByFormat(v, collectionFormat) +} diff --git a/vendor/github.com/go-openapi/runtime/security/authenticator.go b/vendor/github.com/go-openapi/runtime/security/authenticator.go new file mode 100644 index 00000000000..476d26c3e77 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/security/authenticator.go @@ -0,0 +1,276 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package security + +import ( + "context" + "net/http" + "strings" + + "github.com/go-openapi/errors" + + "github.com/go-openapi/runtime" +) + +const ( + query = "query" + header = "header" +) + +// HttpAuthenticator is a function that authenticates a HTTP request +func HttpAuthenticator(handler func(*http.Request) (bool, interface{}, error)) runtime.Authenticator { + return runtime.AuthenticatorFunc(func(params interface{}) (bool, interface{}, error) { + if request, ok := params.(*http.Request); ok { + return handler(request) + } + if scoped, ok := params.(*ScopedAuthRequest); ok { + return handler(scoped.Request) + } + return false, nil, nil + }) +} + +// ScopedAuthenticator is a function that authenticates a HTTP request against a list of valid scopes +func ScopedAuthenticator(handler func(*ScopedAuthRequest) (bool, interface{}, error)) runtime.Authenticator { + return runtime.AuthenticatorFunc(func(params interface{}) (bool, interface{}, error) { + if request, ok := params.(*ScopedAuthRequest); ok { + return handler(request) + } + return false, nil, nil + }) +} + +// UserPassAuthentication authentication function +type UserPassAuthentication func(string, string) (interface{}, error) + +// UserPassAuthenticationCtx authentication function with context.Context +type UserPassAuthenticationCtx func(context.Context, string, string) (context.Context, interface{}, error) + +// TokenAuthentication authentication function +type TokenAuthentication func(string) (interface{}, error) + +// TokenAuthenticationCtx authentication function with context.Context +type TokenAuthenticationCtx func(context.Context, string) (context.Context, interface{}, error) + +// ScopedTokenAuthentication authentication function +type ScopedTokenAuthentication func(string, []string) (interface{}, error) + +// ScopedTokenAuthenticationCtx authentication function with context.Context +type ScopedTokenAuthenticationCtx func(context.Context, string, []string) (context.Context, interface{}, error) + +var DefaultRealmName = "API" + +type secCtxKey uint8 + +const ( + failedBasicAuth secCtxKey = iota + oauth2SchemeName +) + +func FailedBasicAuth(r *http.Request) string { + return FailedBasicAuthCtx(r.Context()) +} + +func FailedBasicAuthCtx(ctx context.Context) string { + v, ok := ctx.Value(failedBasicAuth).(string) + if !ok { + return "" + } + return v +} + +func OAuth2SchemeName(r *http.Request) string { + return OAuth2SchemeNameCtx(r.Context()) +} + +func OAuth2SchemeNameCtx(ctx context.Context) string { + v, ok := ctx.Value(oauth2SchemeName).(string) + if !ok { + return "" + } + return v +} + +// BasicAuth creates a basic auth authenticator with the provided authentication function +func BasicAuth(authenticate UserPassAuthentication) runtime.Authenticator { + return BasicAuthRealm(DefaultRealmName, authenticate) +} + +// BasicAuthRealm creates a basic auth authenticator with the provided authentication function and realm name +func BasicAuthRealm(realm string, authenticate UserPassAuthentication) runtime.Authenticator { + if realm == "" { + realm = DefaultRealmName + } + + return HttpAuthenticator(func(r *http.Request) (bool, interface{}, error) { + if usr, pass, ok := r.BasicAuth(); ok { + p, err := authenticate(usr, pass) + if err != nil { + *r = *r.WithContext(context.WithValue(r.Context(), failedBasicAuth, realm)) + } + return true, p, err + } + *r = *r.WithContext(context.WithValue(r.Context(), failedBasicAuth, realm)) + return false, nil, nil + }) +} + +// BasicAuthCtx creates a basic auth authenticator with the provided authentication function with support for context.Context +func BasicAuthCtx(authenticate UserPassAuthenticationCtx) runtime.Authenticator { + return BasicAuthRealmCtx(DefaultRealmName, authenticate) +} + +// BasicAuthRealmCtx creates a basic auth authenticator with the provided authentication function and realm name with support for context.Context +func BasicAuthRealmCtx(realm string, authenticate UserPassAuthenticationCtx) runtime.Authenticator { + if realm == "" { + realm = DefaultRealmName + } + + return HttpAuthenticator(func(r *http.Request) (bool, interface{}, error) { + if usr, pass, ok := r.BasicAuth(); ok { + ctx, p, err := authenticate(r.Context(), usr, pass) + if err != nil { + ctx = context.WithValue(ctx, failedBasicAuth, realm) + } + *r = *r.WithContext(ctx) + return true, p, err + } + *r = *r.WithContext(context.WithValue(r.Context(), failedBasicAuth, realm)) + return false, nil, nil + }) +} + +// APIKeyAuth creates an authenticator that uses a token for authorization. +// This token can be obtained from either a header or a query string +func APIKeyAuth(name, in string, authenticate TokenAuthentication) runtime.Authenticator { + inl := strings.ToLower(in) + if inl != query && inl != header { + // panic because this is most likely a typo + panic(errors.New(500, "api key auth: in value needs to be either \"query\" or \"header\".")) + } + + var getToken func(*http.Request) string + switch inl { + case header: + getToken = func(r *http.Request) string { return r.Header.Get(name) } + case query: + getToken = func(r *http.Request) string { return r.URL.Query().Get(name) } + } + + return HttpAuthenticator(func(r *http.Request) (bool, interface{}, error) { + token := getToken(r) + if token == "" { + return false, nil, nil + } + + p, err := authenticate(token) + return true, p, err + }) +} + +// APIKeyAuthCtx creates an authenticator that uses a token for authorization with support for context.Context. +// This token can be obtained from either a header or a query string +func APIKeyAuthCtx(name, in string, authenticate TokenAuthenticationCtx) runtime.Authenticator { + inl := strings.ToLower(in) + if inl != query && inl != header { + // panic because this is most likely a typo + panic(errors.New(500, "api key auth: in value needs to be either \"query\" or \"header\".")) + } + + var getToken func(*http.Request) string + switch inl { + case header: + getToken = func(r *http.Request) string { return r.Header.Get(name) } + case query: + getToken = func(r *http.Request) string { return r.URL.Query().Get(name) } + } + + return HttpAuthenticator(func(r *http.Request) (bool, interface{}, error) { + token := getToken(r) + if token == "" { + return false, nil, nil + } + + ctx, p, err := authenticate(r.Context(), token) + *r = *r.WithContext(ctx) + return true, p, err + }) +} + +// ScopedAuthRequest contains both a http request and the required scopes for a particular operation +type ScopedAuthRequest struct { + Request *http.Request + RequiredScopes []string +} + +// BearerAuth for use with oauth2 flows +func BearerAuth(name string, authenticate ScopedTokenAuthentication) runtime.Authenticator { + const prefix = "Bearer " + return ScopedAuthenticator(func(r *ScopedAuthRequest) (bool, interface{}, error) { + var token string + hdr := r.Request.Header.Get("Authorization") + if strings.HasPrefix(hdr, prefix) { + token = strings.TrimPrefix(hdr, prefix) + } + if token == "" { + qs := r.Request.URL.Query() + token = qs.Get("access_token") + } + //#nosec + ct, _, _ := runtime.ContentType(r.Request.Header) + if token == "" && (ct == "application/x-www-form-urlencoded" || ct == "multipart/form-data") { + token = r.Request.FormValue("access_token") + } + + if token == "" { + return false, nil, nil + } + + rctx := context.WithValue(r.Request.Context(), oauth2SchemeName, name) + *r.Request = *r.Request.WithContext(rctx) + p, err := authenticate(token, r.RequiredScopes) + return true, p, err + }) +} + +// BearerAuthCtx for use with oauth2 flows with support for context.Context. +func BearerAuthCtx(name string, authenticate ScopedTokenAuthenticationCtx) runtime.Authenticator { + const prefix = "Bearer " + return ScopedAuthenticator(func(r *ScopedAuthRequest) (bool, interface{}, error) { + var token string + hdr := r.Request.Header.Get("Authorization") + if strings.HasPrefix(hdr, prefix) { + token = strings.TrimPrefix(hdr, prefix) + } + if token == "" { + qs := r.Request.URL.Query() + token = qs.Get("access_token") + } + //#nosec + ct, _, _ := runtime.ContentType(r.Request.Header) + if token == "" && (ct == "application/x-www-form-urlencoded" || ct == "multipart/form-data") { + token = r.Request.FormValue("access_token") + } + + if token == "" { + return false, nil, nil + } + + rctx := context.WithValue(r.Request.Context(), oauth2SchemeName, name) + ctx, p, err := authenticate(rctx, token, r.RequiredScopes) + *r.Request = *r.Request.WithContext(ctx) + return true, p, err + }) +} diff --git a/vendor/github.com/go-openapi/runtime/security/authorizer.go b/vendor/github.com/go-openapi/runtime/security/authorizer.go new file mode 100644 index 00000000000..00c1a4d6a4c --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/security/authorizer.go @@ -0,0 +1,27 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package security + +import ( + "net/http" + + "github.com/go-openapi/runtime" +) + +// Authorized provides a default implementation of the Authorizer interface where all +// requests are authorized (successful) +func Authorized() runtime.Authorizer { + return runtime.AuthorizerFunc(func(_ *http.Request, _ interface{}) error { return nil }) +} diff --git a/vendor/github.com/go-openapi/runtime/statuses.go b/vendor/github.com/go-openapi/runtime/statuses.go new file mode 100644 index 00000000000..3b011a0bff1 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/statuses.go @@ -0,0 +1,90 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +// Statuses lists the most common HTTP status codes to default message +// taken from https://httpstatuses.com/ +var Statuses = map[int]string{ + 100: "Continue", + 101: "Switching Protocols", + 102: "Processing", + 103: "Checkpoint", + 122: "URI too long", + 200: "OK", + 201: "Created", + 202: "Accepted", + 203: "Request Processed", + 204: "No Content", + 205: "Reset Content", + 206: "Partial Content", + 207: "Multi-Status", + 208: "Already Reported", + 226: "IM Used", + 300: "Multiple Choices", + 301: "Moved Permanently", + 302: "Found", + 303: "See Other", + 304: "Not Modified", + 305: "Use Proxy", + 306: "Switch Proxy", + 307: "Temporary Redirect", + 308: "Permanent Redirect", + 400: "Bad Request", + 401: "Unauthorized", + 402: "Payment Required", + 403: "Forbidden", + 404: "Not Found", + 405: "Method Not Allowed", + 406: "Not Acceptable", + 407: "Proxy Authentication Required", + 408: "Request Timeout", + 409: "Conflict", + 410: "Gone", + 411: "Length Required", + 412: "Precondition Failed", + 413: "Request Entity Too Large", + 414: "Request-URI Too Long", + 415: "Unsupported Media Type", + 416: "Request Range Not Satisfiable", + 417: "Expectation Failed", + 418: "I'm a teapot", + 420: "Enhance Your Calm", + 422: "Unprocessable Entity", + 423: "Locked", + 424: "Failed Dependency", + 426: "Upgrade Required", + 428: "Precondition Required", + 429: "Too Many Requests", + 431: "Request Header Fields Too Large", + 444: "No Response", + 449: "Retry With", + 450: "Blocked by Windows Parental Controls", + 451: "Wrong Exchange Server", + 499: "Client Closed Request", + 500: "Internal Server Error", + 501: "Not Implemented", + 502: "Bad Gateway", + 503: "Service Unavailable", + 504: "Gateway Timeout", + 505: "HTTP Version Not Supported", + 506: "Variant Also Negotiates", + 507: "Insufficient Storage", + 508: "Loop Detected", + 509: "Bandwidth Limit Exceeded", + 510: "Not Extended", + 511: "Network Authentication Required", + 598: "Network read timeout error", + 599: "Network connect timeout error", +} diff --git a/vendor/github.com/go-openapi/runtime/text.go b/vendor/github.com/go-openapi/runtime/text.go new file mode 100644 index 00000000000..f33320b7dd5 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/text.go @@ -0,0 +1,116 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "bytes" + "encoding" + "errors" + "fmt" + "io" + "reflect" + + "github.com/go-openapi/swag" +) + +// TextConsumer creates a new text consumer +func TextConsumer() Consumer { + return ConsumerFunc(func(reader io.Reader, data interface{}) error { + if reader == nil { + return errors.New("TextConsumer requires a reader") // early exit + } + + buf := new(bytes.Buffer) + _, err := buf.ReadFrom(reader) + if err != nil { + return err + } + b := buf.Bytes() + + // If the buffer is empty, no need to unmarshal it, which causes a panic. + if len(b) == 0 { + return nil + } + + if tu, ok := data.(encoding.TextUnmarshaler); ok { + err := tu.UnmarshalText(b) + if err != nil { + return fmt.Errorf("text consumer: %v", err) + } + + return nil + } + + t := reflect.TypeOf(data) + if data != nil && t.Kind() == reflect.Ptr { + v := reflect.Indirect(reflect.ValueOf(data)) + if t.Elem().Kind() == reflect.String { + v.SetString(string(b)) + return nil + } + } + + return fmt.Errorf("%v (%T) is not supported by the TextConsumer, %s", + data, data, "can be resolved by supporting TextUnmarshaler interface") + }) +} + +// TextProducer creates a new text producer +func TextProducer() Producer { + return ProducerFunc(func(writer io.Writer, data interface{}) error { + if writer == nil { + return errors.New("TextProducer requires a writer") // early exit + } + + if data == nil { + return errors.New("no data given to produce text from") + } + + if tm, ok := data.(encoding.TextMarshaler); ok { + txt, err := tm.MarshalText() + if err != nil { + return fmt.Errorf("text producer: %v", err) + } + _, err = writer.Write(txt) + return err + } + + if str, ok := data.(error); ok { + _, err := writer.Write([]byte(str.Error())) + return err + } + + if str, ok := data.(fmt.Stringer); ok { + _, err := writer.Write([]byte(str.String())) + return err + } + + v := reflect.Indirect(reflect.ValueOf(data)) + if t := v.Type(); t.Kind() == reflect.Struct || t.Kind() == reflect.Slice { + b, err := swag.WriteJSON(data) + if err != nil { + return err + } + _, err = writer.Write(b) + return err + } + if v.Kind() != reflect.String { + return fmt.Errorf("%T is not a supported type by the TextProducer", data) + } + + _, err := writer.Write([]byte(v.String())) + return err + }) +} diff --git a/vendor/github.com/go-openapi/runtime/values.go b/vendor/github.com/go-openapi/runtime/values.go new file mode 100644 index 00000000000..11f5732af4e --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/values.go @@ -0,0 +1,19 @@ +package runtime + +// Values typically represent parameters on a http request. +type Values map[string][]string + +// GetOK returns the values collection for the given key. +// When the key is present in the map it will return true for hasKey. +// When the value is not empty it will return true for hasValue. +func (v Values) GetOK(key string) (value []string, hasKey bool, hasValue bool) { + value, hasKey = v[key] + if !hasKey { + return + } + if len(value) == 0 { + return + } + hasValue = true + return +} diff --git a/vendor/github.com/go-openapi/runtime/xml.go b/vendor/github.com/go-openapi/runtime/xml.go new file mode 100644 index 00000000000..821c7393dfb --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/xml.go @@ -0,0 +1,36 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package runtime + +import ( + "encoding/xml" + "io" +) + +// XMLConsumer creates a new XML consumer +func XMLConsumer() Consumer { + return ConsumerFunc(func(reader io.Reader, data interface{}) error { + dec := xml.NewDecoder(reader) + return dec.Decode(data) + }) +} + +// XMLProducer creates a new XML producer +func XMLProducer() Producer { + return ProducerFunc(func(writer io.Writer, data interface{}) error { + enc := xml.NewEncoder(writer) + return enc.Encode(data) + }) +} diff --git a/vendor/github.com/go-openapi/runtime/yamlpc/yaml.go b/vendor/github.com/go-openapi/runtime/yamlpc/yaml.go new file mode 100644 index 00000000000..b30d3771263 --- /dev/null +++ b/vendor/github.com/go-openapi/runtime/yamlpc/yaml.go @@ -0,0 +1,40 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package yamlpc + +import ( + "io" + + "github.com/go-openapi/runtime" + + "gopkg.in/yaml.v2" +) + +// YAMLConsumer creates a consumer for yaml data +func YAMLConsumer() runtime.Consumer { + return runtime.ConsumerFunc(func(r io.Reader, v interface{}) error { + dec := yaml.NewDecoder(r) + return dec.Decode(v) + }) +} + +// YAMLProducer creates a producer for yaml data +func YAMLProducer() runtime.Producer { + return runtime.ProducerFunc(func(w io.Writer, v interface{}) error { + enc := yaml.NewEncoder(w) + defer enc.Close() + return enc.Encode(v) + }) +} diff --git a/vendor/github.com/go-openapi/spec/.editorconfig b/vendor/github.com/go-openapi/spec/.editorconfig new file mode 100644 index 00000000000..3152da69a5d --- /dev/null +++ b/vendor/github.com/go-openapi/spec/.editorconfig @@ -0,0 +1,26 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +# Set default charset +[*.{js,py,go,scala,rb,java,html,css,less,sass,md}] +charset = utf-8 + +# Tab indentation (no size specified) +[*.go] +indent_style = tab + +[*.md] +trim_trailing_whitespace = false + +# Matches the exact files either package.json or .travis.yml +[{package.json,.travis.yml}] +indent_style = space +indent_size = 2 diff --git a/vendor/github.com/go-openapi/spec/.gitignore b/vendor/github.com/go-openapi/spec/.gitignore new file mode 100644 index 00000000000..dd91ed6a04e --- /dev/null +++ b/vendor/github.com/go-openapi/spec/.gitignore @@ -0,0 +1,2 @@ +secrets.yml +coverage.out diff --git a/vendor/github.com/go-openapi/spec/.golangci.yml b/vendor/github.com/go-openapi/spec/.golangci.yml new file mode 100644 index 00000000000..835d55e7425 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/.golangci.yml @@ -0,0 +1,42 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 45 + maligned: + suggest-new: true + dupl: + threshold: 200 + goconst: + min-len: 2 + min-occurrences: 2 + +linters: + enable-all: true + disable: + - maligned + - unparam + - lll + - gochecknoinits + - gochecknoglobals + - funlen + - godox + - gocognit + - whitespace + - wsl + - wrapcheck + - testpackage + - nlreturn + - gomnd + - exhaustivestruct + - goerr113 + - errorlint + - nestif + - godot + - gofumpt + - paralleltest + - tparallel + - thelper + - ifshort diff --git a/vendor/github.com/go-openapi/spec/.travis.yml b/vendor/github.com/go-openapi/spec/.travis.yml new file mode 100644 index 00000000000..2281a07b057 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/.travis.yml @@ -0,0 +1,31 @@ +after_success: +- bash <(curl -s https://codecov.io/bash) +go: +- 1.16.x +- 1.x +arch: + - amd64 +jobs: + include: + # only run fast tests on ppc64le + - go: 1.x + arch: ppc64le + script: + - gotestsum -f short-verbose -- ./... + + # include linting job, but only for latest go version and amd64 arch + - go: 1.x + arch: amd64 + install: + go get github.com/golangci/golangci-lint/cmd/golangci-lint + script: + - golangci-lint run --new-from-rev master + +install: +- GO111MODULE=off go get -u gotest.tools/gotestsum +language: go +notifications: + slack: + secure: QUWvCkBBK09GF7YtEvHHVt70JOkdlNBG0nIKu/5qc4/nW5HP8I2w0SEf/XR2je0eED1Qe3L/AfMCWwrEj+IUZc3l4v+ju8X8R3Lomhme0Eb0jd1MTMCuPcBT47YCj0M7RON7vXtbFfm1hFJ/jLe5+9FXz0hpXsR24PJc5ZIi/ogNwkaPqG4BmndzecpSh0vc2FJPZUD9LT0I09REY/vXR0oQAalLkW0asGD5taHZTUZq/kBpsNxaAFrLM23i4mUcf33M5fjLpvx5LRICrX/57XpBrDh2TooBU6Qj3CgoY0uPRYUmSNxbVx1czNzl2JtEpb5yjoxfVPQeg0BvQM00G8LJINISR+ohrjhkZmAqchDupAX+yFrxTtORa78CtnIL6z/aTNlgwwVD8kvL/1pFA/JWYmKDmz93mV/+6wubGzNSQCstzjkFA4/iZEKewKUoRIAi/fxyscP6L/rCpmY/4llZZvrnyTqVbt6URWpopUpH4rwYqreXAtJxJsfBJIeSmUIiDIOMGkCTvyTEW3fWGmGoqWtSHLoaWDyAIGb7azb+KvfpWtEcoPFWfSWU+LGee0A/YsUhBl7ADB9A0CJEuR8q4BPpKpfLwPKSiKSAXL7zDkyjExyhtgqbSl2jS+rKIHOZNL8JkCcTP2MKMVd563C5rC5FMKqu3S9m2b6380E= +script: +- gotestsum -f short-verbose -- -race -coverprofile=coverage.txt -covermode=atomic ./... diff --git a/vendor/github.com/go-openapi/spec/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/spec/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..9322b065e37 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/spec/LICENSE b/vendor/github.com/go-openapi/spec/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/spec/README.md b/vendor/github.com/go-openapi/spec/README.md new file mode 100644 index 00000000000..18782c6dafe --- /dev/null +++ b/vendor/github.com/go-openapi/spec/README.md @@ -0,0 +1,34 @@ +# OAI object model + +[![Build Status](https://travis-ci.org/go-openapi/spec.svg?branch=master)](https://travis-ci.org/go-openapi/spec) + +[![codecov](https://codecov.io/gh/go-openapi/spec/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/spec) +[![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/spec/master/LICENSE) +[![Go Reference](https://pkg.go.dev/badge/github.com/go-openapi/spec.svg)](https://pkg.go.dev/github.com/go-openapi/spec) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/spec)](https://goreportcard.com/report/github.com/go-openapi/spec) + +The object model for OpenAPI specification documents. + +### FAQ + +* What does this do? + +> 1. This package knows how to marshal and unmarshal Swagger API specifications into a golang object model +> 2. It knows how to resolve $ref and expand them to make a single root document + +* How does it play with the rest of the go-openapi packages ? + +> 1. This package is at the core of the go-openapi suite of packages and [code generator](https://github.com/go-swagger/go-swagger) +> 2. There is a [spec loading package](https://github.com/go-openapi/loads) to fetch specs as JSON or YAML from local or remote locations +> 3. There is a [spec validation package](https://github.com/go-openapi/validate) built on top of it +> 4. There is a [spec analysis package](https://github.com/go-openapi/analysis) built on top of it, to analyze, flatten, fix and merge spec documents + +* Does this library support OpenAPI 3? + +> No. +> This package currently only supports OpenAPI 2.0 (aka Swagger 2.0). +> There is no plan to make it evolve toward supporting OpenAPI 3.x. +> This [discussion thread](https://github.com/go-openapi/spec/issues/21) relates the full story. +> +> An early attempt to support Swagger 3 may be found at: https://github.com/go-openapi/spec3 diff --git a/vendor/github.com/go-openapi/spec/appveyor.yml b/vendor/github.com/go-openapi/spec/appveyor.yml new file mode 100644 index 00000000000..0903593916e --- /dev/null +++ b/vendor/github.com/go-openapi/spec/appveyor.yml @@ -0,0 +1,32 @@ +version: "0.1.{build}" + +clone_folder: C:\go-openapi\spec +shallow_clone: true # for startup speed +pull_requests: + do_not_increment_build_number: true + +#skip_tags: true +#skip_branch_with_pr: true + +# appveyor.yml +build: off + +environment: + GOPATH: c:\gopath + +stack: go 1.15 + +test_script: + - go test -v -timeout 20m ./... + +deploy: off + +notifications: + - provider: Slack + incoming_webhook: https://hooks.slack.com/services/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 + auth_token: + secure: Sf7kZf7ZGbnwWUMpffHwMu5A0cHkLK2MYY32LNTPj4+/3qC3Ghl7+9v4TSLOqOlCwdRNjOGblAq7s+GDJed6/xgRQl1JtCi1klzZNrYX4q01pgTPvvGcwbBkIYgeMaPeIRcK9OZnud7sRXdttozgTOpytps2U6Js32ip7uj5mHSg2ub0FwoSJwlS6dbezZ8+eDhoha0F/guY99BEwx8Bd+zROrT2TFGsSGOFGN6wFc7moCqTHO/YkWib13a2QNXqOxCCVBy/lt76Wp+JkeFppjHlzs/2lP3EAk13RIUAaesdEUHvIHrzCyNJEd3/+KO2DzsWOYfpktd+KBCvgaYOsoo7ubdT3IROeAegZdCgo/6xgCEsmFc9ZcqCfN5yNx2A+BZ2Vwmpws+bQ1E1+B5HDzzaiLcYfG4X2O210QVGVDLWsv1jqD+uPYeHY2WRfh5ZsIUFvaqgUEnwHwrK44/8REAhQavt1QAj5uJpsRd7CkRVPWRNK+yIky+wgbVUFEchRNmS55E7QWf+W4+4QZkQi7vUTMc9nbTUu2Es9NfvfudOpM2wZbn98fjpb/qq/nRv6Bk+ca+7XD5/IgNLMbWp2ouDdzbiHLCOfDUiHiDJhLfFZx9Bwo7ZwfzeOlbrQX66bx7xRKYmOe4DLrXhNcpbsMa8qbfxlZRCmYbubB/Y8h4= + channel: bots + on_build_success: false + on_build_failure: true + on_build_status_changed: true diff --git a/vendor/github.com/go-openapi/spec/bindata.go b/vendor/github.com/go-openapi/spec/bindata.go new file mode 100644 index 00000000000..afc83850c2e --- /dev/null +++ b/vendor/github.com/go-openapi/spec/bindata.go @@ -0,0 +1,297 @@ +// Code generated by go-bindata. DO NOT EDIT. +// sources: +// schemas/jsonschema-draft-04.json (4.357kB) +// schemas/v2/schema.json (40.248kB) + +package spec + +import ( + "bytes" + "compress/gzip" + "crypto/sha256" + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" + "strings" + "time" +) + +func bindataRead(data []byte, name string) ([]byte, error) { + gz, err := gzip.NewReader(bytes.NewBuffer(data)) + if err != nil { + return nil, fmt.Errorf("read %q: %v", name, err) + } + + var buf bytes.Buffer + _, err = io.Copy(&buf, gz) + clErr := gz.Close() + + if err != nil { + return nil, fmt.Errorf("read %q: %v", name, err) + } + if clErr != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +type asset struct { + bytes []byte + info os.FileInfo + digest [sha256.Size]byte +} + +type bindataFileInfo struct { + name string + size int64 + mode os.FileMode + modTime time.Time +} + +func (fi bindataFileInfo) Name() string { + return fi.name +} +func (fi bindataFileInfo) Size() int64 { + return fi.size +} +func (fi bindataFileInfo) Mode() os.FileMode { + return fi.mode +} +func (fi bindataFileInfo) ModTime() time.Time { + return fi.modTime +} +func (fi bindataFileInfo) IsDir() bool { + return false +} +func (fi bindataFileInfo) Sys() interface{} { + return nil +} + +var _jsonschemaDraft04Json = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xc4\x57\x3d\x6f\xdb\x3c\x10\xde\xf3\x2b\x08\x26\x63\xf2\x2a\x2f\xd0\xc9\x5b\xd1\x2e\x01\x5a\x34\x43\x37\x23\x03\x6d\x9d\x6c\x06\x14\xa9\x50\x54\x60\xc3\xd0\x7f\x2f\x28\x4a\x14\x29\x91\x92\x2d\xa7\x8d\x97\x28\xbc\xaf\xe7\x8e\xf7\xc5\xd3\x0d\x42\x08\x61\x9a\xe2\x15\xc2\x7b\xa5\x8a\x55\x92\xbc\x96\x82\x3f\x94\xdb\x3d\xe4\xe4\x3f\x21\x77\x49\x2a\x49\xa6\x1e\x1e\xbf\x24\xe6\xec\x16\xdf\x1b\xa1\x3b\xf3\xff\x02\xc9\x14\xca\xad\xa4\x85\xa2\x82\x6b\xe9\x6f\x42\x02\x32\x2c\x28\x07\x45\x5a\x15\x3d\x77\x46\x39\xd5\xcc\x25\x5e\x21\x83\xb8\x21\x18\xb6\xaf\x52\x92\xa3\x47\x68\x88\xea\x58\x80\x56\x4e\x1a\xf2\xbd\x4f\xcc\x29\x7f\x52\x90\x6b\x7d\xff\x0f\x48\xb4\x3d\x3f\x21\x7c\x27\x21\xd3\x2a\x6e\x31\xaa\x2d\x53\xdd\xf3\xe3\x42\x94\x54\xd1\x77\x78\xe2\x0a\x76\x20\xe3\x20\x68\xcb\x30\x86\x41\xf3\x2a\xc7\x2b\xf4\x78\x8e\xfe\xef\x90\x91\x8a\xa9\xc7\xb1\x1d\xc2\xd8\x2f\x0d\x75\xed\xc1\x4e\x9c\xc8\x25\x43\xac\xa8\xbe\xd7\xcc\xa9\xd1\xa9\x21\xa0\x1a\xbd\x04\x61\x94\x34\x2f\x18\xfc\x3e\x16\x50\x8e\x4d\x03\x6f\x1c\x58\xdb\x48\x23\xbc\x11\x82\x01\xe1\xfa\xd3\x3a\x8e\x30\xaf\x18\x33\x7f\xf3\x8d\x39\x11\x9b\x57\xd8\x2a\xfd\x55\x2a\x49\xf9\x0e\xc7\xec\x37\xd4\x25\xf7\xec\x5c\x66\xc7\xd7\x99\xaa\xcf\x4f\x89\x8a\xd3\xb7\x0a\x3a\xaa\x92\x15\xf4\x30\x6f\x1c\xb0\xd6\x46\xe7\x98\x39\x2d\xa4\x28\x40\x2a\x3a\x88\x9e\x29\xba\x88\x37\x2d\xca\x60\x38\xfa\xba\x5b\x20\xac\xa8\x62\xb0\x4c\xd4\xaf\xda\x45\x0a\xba\x5c\x3b\xb9\xc7\x79\xc5\x14\x2d\x18\x34\x19\x1c\x51\xdb\x25\x4d\xb4\x7e\x06\x14\x38\x6c\x59\x55\xd2\x77\xf8\x69\x59\xfc\x7b\x73\xed\x93\x43\xcb\x32\x6d\x3c\x28\xdc\x1b\x9a\xd3\x62\xab\xc2\x27\xf7\x41\xc9\x08\x2b\x23\x08\xad\x13\x57\x21\x9c\xd3\x72\x0d\x42\x72\xf8\x01\x7c\xa7\xf6\x83\xce\x39\xd7\x82\x3c\x1f\x2f\xd6\x60\x1b\xa2\xdf\x35\x89\x52\x20\xe7\x73\x74\xe0\x66\x26\x64\x4e\xb4\x97\x58\xc2\x0e\x0e\xe1\x60\x92\x34\x6d\xa0\x10\xd6\xb5\x83\x61\x27\xe6\x47\xd3\x89\xbd\x63\xfd\x3b\x8d\x03\x3d\x6c\x42\x2d\x5b\x70\xee\xe8\xdf\x4b\xf4\x66\x4e\xe1\x01\x45\x17\x80\x74\xad\x4f\xc3\xf3\xae\xc6\x1d\xc6\xd7\xc2\xce\xc9\xe1\x29\x30\x86\x2f\x4a\xa6\x4b\x15\x84\x73\xc9\x6f\xfd\x7f\xa5\x6e\x9e\xbd\xf1\xb0\xd4\xdd\x45\x5a\xc2\x3e\x4b\x78\xab\xa8\x84\x74\x4a\x91\x3b\x92\x23\x05\xf2\x1c\x1e\x7b\xf3\x09\xf8\xcf\xab\x24\xb6\x60\xa2\xe8\x4c\x9f\x75\x77\xaa\x8c\xe6\x01\x45\x36\x86\xcf\xc3\x63\x3a\xea\xd4\x8d\x7e\x06\xac\x14\x0a\xe0\x29\xf0\xed\x07\x22\x1a\x65\xda\x44\xae\xa2\x73\x1a\xe6\x90\x69\xa2\x8c\x46\xb2\x2f\xde\x49\x38\x08\xed\xfe\xfd\x41\xaf\x9f\xa9\x55\xd7\xdd\x22\x8d\xfa\x45\x63\xc5\x0f\x80\xf3\xb4\x08\xd6\x79\x30\x9e\x93\xee\x59\xa6\xd0\x4b\xee\x22\xe3\x33\xc1\x3a\x27\x68\x36\x78\x7e\x87\x0a\x06\xd5\x2e\x20\xd3\xaf\x15\xfb\xd8\x3b\x73\x14\xbb\x92\xed\x05\x5d\x2e\x29\x38\x2c\x94\xe4\x42\x45\x5e\xd3\xb5\x7d\xdf\x47\xca\x38\xb4\x5c\xaf\xfb\x7d\xdd\x6d\xf4\xa1\x2d\x77\xdd\x2f\xce\x6d\xc4\x7b\x8b\x4e\x67\xa9\x6f\xfe\x04\x00\x00\xff\xff\xb1\xd1\x27\x78\x05\x11\x00\x00") + +func jsonschemaDraft04JsonBytes() ([]byte, error) { + return bindataRead( + _jsonschemaDraft04Json, + "jsonschema-draft-04.json", + ) +} + +func jsonschemaDraft04Json() (*asset, error) { + bytes, err := jsonschemaDraft04JsonBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "jsonschema-draft-04.json", size: 4357, mode: os.FileMode(0640), modTime: time.Unix(1568963823, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xe1, 0x48, 0x9d, 0xb, 0x47, 0x55, 0xf0, 0x27, 0x93, 0x30, 0x25, 0x91, 0xd3, 0xfc, 0xb8, 0xf0, 0x7b, 0x68, 0x93, 0xa8, 0x2a, 0x94, 0xf2, 0x48, 0x95, 0xf8, 0xe4, 0xed, 0xf1, 0x1b, 0x82, 0xe2}} + return a, nil +} + +var _v2SchemaJson = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\x5d\x4f\x93\xdb\x36\xb2\xbf\xfb\x53\xa0\x14\x57\xd9\xae\xd8\x92\xe3\xf7\x2e\xcf\x97\xd4\xbc\xd8\x49\x66\x37\x5e\x4f\x79\x26\xbb\x87\x78\x5c\x05\x91\x2d\x09\x09\x09\x30\x00\x38\x33\x5a\xef\x7c\xf7\x2d\xf0\x9f\x08\x02\x20\x41\x8a\xd2\xc8\x0e\x0f\xa9\x78\x28\xa0\xd1\xdd\x68\x34\x7e\xdd\xf8\xf7\xf9\x11\x42\x33\x49\x64\x04\xb3\xd7\x68\x76\x86\xfe\x76\xf9\xfe\x1f\xe8\x32\xd8\x40\x8c\xd1\x8a\x71\x74\x79\x8b\xd7\x6b\xe0\xe8\xd5\xfc\x25\x3a\xbb\x38\x9f\xcf\x9e\xab\x0a\x24\x54\xa5\x37\x52\x26\xaf\x17\x0b\x91\x17\x99\x13\xb6\xb8\x79\xb5\x10\x59\xdd\xf9\xef\x82\xd1\x6f\xf2\xc2\x8f\xf3\x4f\xb5\x1a\xea\xc7\x17\x45\x41\xc6\xd7\x8b\x90\xe3\x95\x7c\xf1\xf2\x7f\x8b\xca\x45\x3d\xb9\x4d\x32\xa6\xd8\xf2\x77\x08\x64\xfe\x8d\xc3\x9f\x29\xe1\xa0\x9a\xff\xed\x11\x42\x08\xcd\x8a\xd6\xb3\x9f\x15\x67\x74\xc5\xca\x7f\x27\x58\x6e\xc4\xec\x11\x42\xd7\x59\x5d\x1c\x86\x44\x12\x46\x71\x74\xc1\x59\x02\x5c\x12\x10\xb3\xd7\x68\x85\x23\x01\x59\x81\x04\x4b\x09\x9c\x6a\xbf\x7e\xce\x49\x7d\xba\x7b\x51\xfd\xa1\x44\xe2\xb0\x52\xac\x7d\xb3\x08\x61\x45\x68\x46\x56\x2c\x6e\x80\x86\x8c\xbf\xbd\x93\x40\x05\x61\x74\x96\x95\xbe\x7f\x84\xd0\x7d\x4e\xde\x42\xb7\xe4\xbe\x46\xbb\x14\x5b\x48\x4e\xe8\xba\x90\x05\xa1\x19\xd0\x34\xae\xc4\xce\xbe\xbc\x9a\xbf\x9c\x15\x7f\x5d\x57\xc5\x42\x10\x01\x27\x89\xe2\x48\x51\xb9\xda\x40\xd5\x87\x37\xc0\x15\x5f\x88\xad\x90\xdc\x10\x81\x42\x16\xa4\x31\x50\x39\x2f\x38\xad\xab\xb0\x53\xd8\xac\x94\x56\x6f\xc3\x84\xf4\x11\xa4\x50\xb3\xfa\xe9\xd3\x6f\x9f\x3e\xdf\x2f\xd0\xeb\x8f\x1f\x3f\x7e\xbc\xfe\xf6\xe9\xf7\xaf\x5f\x7f\xfc\x18\x7e\xfb\xec\xfb\xc7\xb3\x36\x79\x54\x43\xe8\x29\xc5\x31\x20\xc6\x11\x49\x9e\xe5\x12\x41\x66\xa0\xe8\xed\x1d\x8e\x93\x08\x5e\xa3\x27\x3b\xc3\x7c\xa2\x73\xba\xc4\x02\x2e\xb0\xdc\xf4\xe5\x76\xd1\xca\x96\xa2\x8a\x94\xcd\x21\xc9\x6c\xec\x2c\x70\x42\x9e\x34\x74\x9d\x19\x7c\xcd\x20\x9c\xea\x2e\x0a\xfe\x42\x84\xd4\x29\x04\x8c\x8a\xb4\x41\xa2\xc1\xdc\x19\x8a\x88\x90\x4a\x49\xef\xce\xdf\xbd\x45\x4a\x52\x81\x70\x10\x40\x22\x21\x44\xcb\x6d\xc5\xec\x4e\x3c\x1c\x45\xef\x57\x9a\xb5\x7d\xae\xfe\xe5\xe4\x31\x86\x90\xe0\xab\x6d\x02\x3b\x2e\xcb\x11\x90\xd9\xa8\xc6\x77\xc2\x59\x98\x06\xfd\xf9\x2e\x78\x45\x01\xa6\xa8\xa0\x71\x5c\xbe\x33\xa7\xd2\xd9\x5f\x95\xef\xd9\xd5\xac\xfd\xdc\x5d\xbf\x5e\xb8\xd1\x3e\xc7\x31\x48\xe0\x5e\x4c\x14\x65\xdf\xb8\xa8\x71\x10\x09\xa3\xc2\xc7\x02\xcb\xa2\x4e\x5a\x02\x82\x94\x13\xb9\xf5\x30\xe6\xb2\xa4\xb5\xfe\x9b\x3e\x7a\xb2\x55\xd2\xa8\x4a\xbc\x16\xb6\x71\x8e\x39\xc7\xdb\x9d\xe1\x10\x09\x71\xbd\x9c\xb3\x41\x89\xd7\xa5\x89\xdc\x57\xb5\x53\x4a\xfe\x4c\xe1\xbc\xa0\x21\x79\x0a\x1a\x0f\x70\xa7\x5c\x08\x8e\xde\xb0\xc0\x43\x24\xad\x74\x63\x0e\xb1\xd9\x90\xe1\xb0\x2d\x13\xa7\x6d\x78\xfd\x04\x14\x38\x8e\x90\xaa\xce\x63\xac\x3e\x23\xbc\x64\xa9\xb4\xf8\x03\x63\xde\xcd\xbe\x16\x13\x4a\x55\xac\x82\x12\xc6\xac\xd4\x35\xf7\x22\xd4\x3a\xff\x22\x73\x0e\x6e\x51\xa0\x75\x1e\xae\x8f\xe8\x5d\xc7\x59\xe6\xe4\x9a\x18\x8d\xd6\x1c\x53\x84\x4d\xb7\x67\x28\x37\x09\x84\x69\x88\x12\x0e\x01\x11\x80\x32\xa2\xf5\xb9\xaa\xc6\xd9\x73\x53\xab\xfb\xb4\x2e\x20\xc6\x54\x92\xa0\x9a\xf3\x69\x1a\x2f\x81\x77\x37\xae\x53\x1a\xce\x40\xc4\xa8\x82\x1c\xb5\xef\xda\x24\x7d\xb9\x61\x69\x14\xa2\x25\xa0\x90\xac\x56\xc0\x81\x4a\xb4\xe2\x2c\xce\x4a\x64\x7a\x9a\x23\xf4\x13\x91\x3f\xa7\x4b\xf4\x63\x84\x6f\x18\x87\x10\xbd\xc3\xfc\x8f\x90\xdd\x52\x44\x04\xc2\x51\xc4\x6e\x21\x74\x48\x21\x81\xc7\xe2\xfd\xea\x12\xf8\x0d\x09\xf6\xe9\x47\x35\xaf\x67\xc4\x14\xf7\x22\x27\x97\xe1\xe2\x76\x2d\x06\x8c\x4a\x1c\x48\x3f\x73\x2d\x0b\x5b\x29\x45\x24\x00\x2a\x0c\x11\xec\x94\xca\xc2\xa6\xc1\x37\x21\x43\x83\x3b\x5f\x97\xf1\x43\x5e\x53\x73\x19\xa5\x36\xd8\x2d\x05\x2e\x34\x0b\xeb\x39\xfc\x1d\x63\x51\x01\xbd\x3d\xbb\x90\x84\x40\x25\x59\x6d\x09\x5d\xa3\x1c\x37\xe6\x5c\x16\x9a\x40\x09\x70\xc1\xe8\x82\xf1\x35\xa6\xe4\xdf\x99\x5c\x8e\x9e\x4d\x79\xb4\x27\x2f\xbf\x7e\xf8\x05\x25\x8c\x50\xa9\x98\x29\x90\x62\x60\xea\x75\xae\x13\xca\xbf\x2b\x1a\x29\x27\x76\xd6\x20\xc6\x64\x5f\xe6\x32\x1a\x08\x87\x21\x07\x21\xbc\xb4\xe4\xe0\x32\x67\xa6\xcd\xf3\x1e\xcd\xd9\x6b\xb6\x6f\x8e\x27\xa7\xed\xdb\xe7\xbc\xcc\x1a\x07\xce\x6f\x87\x33\xf0\xba\x51\x17\x22\x66\x78\x79\x8e\xce\xe5\x13\x81\x80\x06\x2c\xe5\x78\x0d\xa1\xb2\xb8\x54\xa8\x79\x09\xbd\xbf\x3c\x47\x01\x8b\x13\x2c\xc9\x32\xaa\xaa\x1d\xd5\xee\xab\x36\xbd\x6c\xfd\x54\x6c\xc8\x08\x01\x3c\xbd\xe7\x07\x88\xb0\x24\x37\x79\x90\x28\x4a\x1d\x10\x1a\x92\x1b\x12\xa6\x38\x42\x40\xc3\x4c\x43\x62\x8e\xae\x36\xb0\x45\x71\x2a\xa4\x9a\x23\x79\x59\xb1\xa8\xf2\xa4\x0c\x60\x9f\xcc\x8d\x40\xf5\x80\xca\xa8\x99\xc3\xa7\x85\x1f\x31\x25\xa9\x82\xc5\x6d\xbd\xd8\x36\x76\x7c\x02\x28\x97\xf6\x1d\x74\x3b\x11\x7e\x91\xae\x32\xf8\x6c\xf4\xe6\x7b\x9a\xa5\x1f\x62\xc6\x21\xcf\x9a\xe5\xed\x8b\x02\xf3\x2c\x33\x33\xdf\x00\xca\xc9\x09\xb4\x04\xf5\xa5\x08\xd7\xc3\x02\x18\x66\xf1\xab\x1e\x83\x37\x4c\xcd\x12\xc1\x1d\x50\xf6\xaa\xbd\xfe\xe2\x73\x48\x38\x08\xa0\x32\x9b\x18\x44\x86\x0b\x6a\xc1\xaa\x26\x96\x2d\x96\x3c\xa0\x54\x65\x73\xe3\x08\xb5\x8b\x99\xbd\x82\xbc\x9e\xc2\xe8\x53\x46\x83\x3f\x33\x54\x2b\x5b\xad\x92\x79\xd9\x8f\x5d\x93\x98\xf2\xe6\xc6\x1c\xe6\x9a\x9e\xfc\x43\x82\x31\x66\x8e\x53\x77\xfe\x90\xe7\xf3\xf6\xe9\x62\x23\x3f\x10\x93\x18\xae\x72\x1a\x9d\xf9\x48\xcb\xcc\x5a\x65\xc7\x4a\x04\xf0\xf3\xd5\xd5\x05\x8a\x41\x08\xbc\x86\x86\x43\x51\x6c\xe0\x46\x57\xf6\x44\x40\x0d\xfb\xff\xa2\xc3\x7c\x3d\x39\x84\xdc\x09\x22\x64\x4f\x12\xd9\xba\xaa\xf6\xe3\xbd\x56\xdd\x91\x25\x6a\x14\x9c\x89\x34\x8e\x31\xdf\xee\x15\x7e\x2f\x39\x81\x15\x2a\x28\x95\x66\x51\xf5\xfd\x83\xc5\xfe\x15\x07\xcf\xf7\x08\xee\x1d\x8e\xb6\xc5\x52\xcc\x8c\x5a\x93\x66\xc5\xd8\x79\x38\x46\xd6\xa7\x88\x37\xc9\x2e\xe3\xd2\xa5\x7b\x4b\x3a\xdc\xa1\xdc\x9e\x29\xf1\x8c\x8a\x99\x16\x47\x8d\xd4\x78\x8b\xf6\x1c\xe9\x71\x54\x1b\x69\xa8\x4a\x93\x37\xe5\xb2\x2c\x4f\x0c\x92\xab\xa0\x73\x32\x72\x59\xd3\xf0\x2d\x8d\xed\xca\x37\x16\x19\x9e\xdb\x1c\xab\x17\x49\xc3\x0f\x37\xdc\x88\xb1\xb4\xd4\x42\xcb\x58\x5e\x6a\x52\x0b\x15\x10\x0a\xb0\x04\xe7\xf8\x58\x32\x16\x01\xa6\xcd\x01\xb2\xc2\x69\x24\x35\x38\x6f\x30\x6a\xae\x1b\xb4\x71\xaa\xad\x1d\xa0\xd6\x20\x2d\x8b\x3c\xc6\x82\x62\x27\x34\x6d\x15\x84\x7b\x43\xb1\x35\x78\xa6\x24\x77\x28\xc1\x6e\xfc\xe9\x48\x74\xf4\x15\xe3\xe1\x84\x42\x88\x40\x7a\x26\x49\x3b\x48\xb1\xa4\x19\x8e\x0c\xa7\xb5\x01\x6c\x0c\x97\x61\x8a\xc2\x32\xd8\x8c\x44\x69\x24\xbf\x65\x1d\x74\xd6\xe5\x44\xef\xec\x48\x5e\xb7\x8a\xa3\x29\x8e\x41\x64\xce\x1f\x88\xdc\x00\x47\x4b\x40\x98\x6e\xd1\x0d\x8e\x48\x98\x63\x5c\x21\xb1\x4c\x05\x0a\x58\x98\xc5\x6d\x4f\x0a\x77\x53\x4f\x8b\xc4\x44\x1f\xb2\xdf\x8d\x3b\xea\x9f\xfe\xf6\xf2\xc5\xff\x5d\x7f\xfe\x9f\xfb\x67\x8f\xff\xf3\xe9\x69\xd1\xfe\xb3\xc7\xfd\x3c\xf8\x3f\x71\x94\x82\x23\xd1\x72\x00\xb7\x42\x99\x6c\xc0\x60\x7b\x0f\x79\xea\xa8\x53\x4b\x56\x31\xfa\x0b\x52\x9f\x96\xdb\xcd\x2f\xd7\x67\xcd\x04\x19\x85\xfe\xdb\x02\x9a\x59\x03\xad\x63\x3c\xea\xff\x2e\x18\xfd\x00\xd9\xe2\x56\x60\x59\x93\xb9\xb6\xb2\x3e\x3c\x2c\xab\x0f\xa7\xb2\x89\x43\xc7\xf6\xd5\xce\x2e\xad\xa6\xa9\xed\xa6\xc6\x5a\xb4\xa6\x67\xdf\x8c\x26\x7b\x50\x5a\x91\x08\x2e\x6d\xd4\x3a\xc1\x9d\xf2\xdb\xde\x1e\xb2\x2c\x6c\xa5\x64\xc9\x16\xb4\x90\xaa\x4a\xb7\x0c\xde\x13\xc3\x2a\x9a\x11\x9b\x7a\x1b\x3d\x95\x97\x37\x31\x6b\x69\x7e\x34\xc0\x67\x1f\x66\x19\x49\xef\xf1\x25\xf5\xac\x0e\xea\x0a\x28\x8d\x4d\x7e\xd9\x57\x4b\x49\xe5\xc6\xb3\x25\xfd\xe6\x57\x42\x25\xac\xcd\xcf\x36\x74\x8e\xca\x24\x47\xe7\x80\xa8\x92\x72\xbd\x3d\x84\x2d\x65\xe2\x82\x1a\x9c\xc4\x44\x92\x1b\x10\x79\x8a\xc4\x4a\x2f\x60\x51\x04\x81\xaa\xf0\xa3\x95\x27\xd7\x12\x7b\xa3\x96\x03\x45\x96\xc1\x8a\x07\xc9\xb2\xb0\x95\x52\x8c\xef\x48\x9c\xc6\x7e\x94\xca\xc2\x0e\x07\x12\x44\xa9\x20\x37\xf0\xae\x0f\x49\xa3\x96\x9d\x4b\x42\x7b\x70\x59\x14\xee\xe0\xb2\x0f\x49\xa3\x96\x4b\x97\xbf\x00\x5d\x4b\x4f\xfc\xbb\x2b\xee\x92\xb9\x17\xb5\xaa\xb8\x0b\x97\x17\x9b\x43\xfd\xd6\xc2\xb2\xc2\x2e\x29\xcf\xfd\x87\x4a\x55\xda\x25\x63\x1f\x5a\x65\x69\x2b\x2d\x3d\x67\xe9\x41\xae\x5e\xc1\x6e\x2b\xd4\xdb\x3e\xa8\xd3\x26\xd2\x48\x92\x24\xca\x61\x86\x8f\x8c\xbb\xf2\x8e\x91\xdf\x1f\x06\x19\x33\xf3\x03\x4d\xba\xcd\xe2\x2d\xfb\x69\xe9\x16\x15\x13\xd5\x56\x85\x4e\x3c\x5b\x8a\xbf\x25\x72\x83\xee\x5e\x20\x22\xf2\xc8\xaa\x7b\xdb\x8e\xe4\x29\x58\xca\x38\xb7\x3f\x2e\x59\xb8\xbd\xa8\x16\x16\xf7\xdb\x79\x51\x9f\x5a\xb4\x8d\x87\x3a\x6e\xbc\x3e\xc5\xb4\xcd\x58\xf9\xf5\x3c\xb9\x6f\x49\xaf\x57\xc1\xfa\x1c\x5d\x6d\x88\x8a\x8b\xd3\x28\xcc\xb7\xef\x10\x8a\x4a\x74\xa9\x4a\xa7\x62\xbf\x0d\x76\x23\x6f\x59\xd9\x31\xee\x40\x11\xfb\x28\xec\x8d\x22\x1c\x13\x5a\x64\x94\x23\x16\x60\xbb\xd2\x7c\xa0\x98\xb2\xe5\x6e\xbc\x54\x33\xe0\x3e\xb9\x52\x17\xdb\xb7\x1b\xc8\x12\x20\x8c\x23\xca\x64\x7e\x78\xa3\x62\x5b\x75\x56\xd9\x9e\x2a\x91\x27\xb0\x70\x34\x1f\x90\x89\xb5\x86\x73\x7e\x71\xda\x1e\xfb\x3a\x72\xdc\x5e\x79\x88\xcb\x74\x79\xd9\x64\xe4\xd4\xc2\x9e\xce\xb1\xfe\x85\x5a\xc0\xe9\x0c\x34\x3d\xd0\x43\xce\xa1\x36\x39\xd5\xa1\x4e\xf5\xf8\xb1\xa9\x23\x08\x75\x84\xac\x53\x6c\x3a\xc5\xa6\x53\x6c\x3a\xc5\xa6\x7f\xc5\xd8\xf4\x51\xfd\xff\x25\x4e\xfa\x33\x05\xbe\x9d\x60\xd2\x04\x93\x6a\x5f\x33\x9b\x98\x50\xd2\xe1\x50\x52\xc6\xcc\xdb\x38\x91\xdb\xe6\xaa\xa2\x8f\xa1\x6a\xa6\xd4\xc6\x56\xd6\x8c\x40\x02\x68\x48\xe8\x1a\xe1\x9a\xd9\x2e\xb7\x05\xc3\x34\xda\x2a\xbb\xcd\x12\x36\x98\x22\x50\x4c\xa1\x1b\xc5\xd5\x84\xf0\xbe\x24\x84\xf7\x2f\x22\x37\xef\x94\xd7\x9f\xa0\xde\x04\xf5\x26\xa8\x37\x41\x3d\x64\x40\x3d\xe5\xf2\xde\x60\x89\x27\xb4\x37\xa1\xbd\xda\xd7\xd2\x2c\x26\xc0\x37\x01\x3e\x1b\xef\x5f\x06\xe0\x6b\x7c\x5c\x91\x08\x26\x10\x38\x81\xc0\x09\x04\x76\x4a\x3d\x81\xc0\xbf\x12\x08\x4c\xb0\xdc\x7c\x99\x00\xd0\x75\x70\xb4\xf8\x5a\x7c\xea\xde\x3e\x39\x08\x30\x5a\x27\x35\xed\xb4\x65\xad\x69\x74\x10\x88\x79\xe2\x30\x52\x19\xd6\x04\x21\xa7\x95\xd5\x0e\x03\xf8\xda\x20\xd7\x84\xb4\x26\xa4\x35\x21\xad\x09\x69\x21\x03\x69\x51\x46\xff\xff\x18\x9b\x54\xed\x87\x47\x06\x9d\x4e\x73\x6e\x9a\xb3\xa9\xce\x83\x5e\x4b\xc6\x71\x20\x45\xd7\x72\xf5\x40\x72\x0e\x34\x6c\xf4\x6c\xf3\xba\x5e\x4b\x97\x0e\x52\xb8\xbe\x8b\x79\xa0\x10\x86\xa1\x75\xb0\x6f\xec\xc8\xf4\x3d\x4d\x7b\x86\xc2\x02\x31\x12\x51\xbf\x07\x94\xad\x10\xd6\x2e\x79\xcf\xe9\x1c\xf5\x1e\x31\x23\x5c\x18\xfb\x9c\xfb\x70\xe0\x62\xbd\xf7\xb5\x94\xcf\xf3\xf6\xfa\xc5\x4e\x9c\x85\x76\x1d\xae\x37\xbc\xde\xa3\x41\xcb\x29\xd0\x5e\x70\x67\x50\x93\x6d\x98\xa8\xd3\x67\x0f\x68\xb1\xeb\x38\x47\x07\x10\x1b\xd2\xe2\x18\x68\x6d\x40\xbb\xa3\x40\xba\x21\xf2\x8e\x81\xfb\xf6\x92\x77\x2f\x70\xe8\xdb\xb2\x36\xbf\x30\x91\xc5\x21\xe7\x45\xcc\x34\x0c\x48\x8e\xd0\xf2\x9b\x7c\x3c\xbd\x1c\x04\x3e\x07\xe8\x7c\x2f\x84\x7a\x48\x4d\x1f\xba\xe1\x76\x45\x7b\x60\xe0\x01\xca\xee\x04\xca\x31\xbe\x73\x5f\xa3\x70\x0c\xad\x1f\xa5\xf5\x76\xd5\xbb\xd2\x7e\xfb\x30\x90\xcf\xfa\x67\x7a\xe6\xc3\x37\x42\x19\xe2\xc9\x9c\x61\x4c\xe7\xd1\x77\x55\x86\x6e\x8f\x7b\x85\x42\x33\xa3\xaa\x57\xae\xfd\xd5\xcc\x9c\x56\x68\xe2\xde\x0e\xa8\x2c\xa9\xb0\x7d\xf0\x54\x2d\x80\xf2\x48\x39\x3d\x98\x1a\x6d\x0b\x9d\xba\x53\xfb\xce\xf8\xd1\x7e\xbb\x60\x4f\x06\xf5\xce\xda\xab\xeb\xca\xcb\xd5\xac\x20\xda\x72\x3b\xa2\x4b\x38\xd7\xb5\x89\xbe\x42\xd9\xb9\x73\xc4\x0c\x6d\xb7\xd9\xf8\x8d\xbd\x3e\x9c\xf5\x53\x68\x48\x14\x36\x8f\x09\xc5\x92\xf1\x21\xd1\x09\x07\x1c\xbe\xa7\x91\xf3\x6a\xc8\xc1\x57\xb0\xdd\xc5\xc6\x1d\xad\x76\x1d\xa8\x82\x0e\x4c\x38\xfe\xa5\x8c\xc5\x0a\x40\x5d\xa1\xbb\x98\xd1\xfb\x74\x61\xed\x1a\x98\xaf\x3c\x8c\x1e\xe3\xc2\x92\x29\x74\x3e\x99\xd0\xf9\x41\x50\xd0\x38\x4b\x57\x7e\x5b\x7a\x0e\xe6\xce\x4e\xd7\x19\x35\x57\xbb\x3c\x3c\xd2\x5e\x4f\x4b\x4c\xf7\x0f\x4d\x2b\x91\x5d\x94\xa6\x95\xc8\x69\x25\x72\x5a\x89\x7c\xb8\x95\xc8\x07\x80\x8c\xda\x9c\x64\x7b\xb7\x71\xdf\x57\x12\x4b\x9a\x1f\x72\x0c\x13\x03\xad\x3c\xd5\x4e\xde\x8e\x57\x13\x6d\x34\x86\xcf\x97\xe6\xa4\x68\xc4\xb0\xf6\xc9\xc2\xeb\x8d\x0b\xd7\xcd\xfe\xba\xa6\xf5\x30\xeb\x30\x33\xbe\xc7\x56\x27\xab\x08\xd9\x6d\xbb\x09\xee\x7c\x2d\xcf\xee\x87\x38\xac\xc8\xdd\x90\x9a\x58\x4a\x4e\x96\xa9\x79\x79\xf3\xde\x20\xf0\x96\xe3\x24\x19\xeb\xba\xf2\x53\x19\xab\x12\xaf\x47\xb3\xa0\x3e\xef\x9b\x8d\x6d\x6d\x7b\xde\x3b\x3b\x1a\xc0\x3f\x95\x7e\xed\x78\xfb\x76\xb8\xaf\xb3\xdd\xc5\xeb\x95\xed\x5a\x62\x41\x82\xb3\x54\x6e\x80\x4a\x92\x6f\x36\xbd\x34\xae\xde\x6f\xa4\xc0\xbc\x08\xe3\x84\xfc\x1d\xb6\xe3\xd0\x62\x38\x95\x9b\x57\xe7\x71\x12\x91\x80\xc8\x31\x69\x5e\x60\x21\x6e\x19\x0f\xc7\xa4\x79\x96\x28\x3e\x47\x54\x65\x41\x36\x08\x40\x88\x1f\x58\x08\x56\xaa\xd5\xbf\xaf\xad\x96\xd7\xd6\xcf\x87\xf5\x34\x0f\x71\x93\x6e\x26\xed\x98\x5b\x9f\x4f\xcf\x95\x34\xc6\xd7\x11\xfa\xb0\x81\x22\x1a\xdb\xdf\x8e\xdc\xc3\xb9\xf8\xdd\x5d\x3c\x74\xe6\xea\xb7\x8b\xbf\xf5\x6e\xb3\x46\x2e\x64\xf4\xab\x3c\x4e\xcf\x36\x1d\xfe\xfa\xb8\x36\xba\x8a\xd8\xad\xf6\xc6\x41\x2a\x37\x8c\x17\x0f\xda\xfe\xda\xe7\x65\xbc\x71\x2c\x36\x57\x8a\x47\x12\x4c\xf1\xbd\x77\x6b\xa4\x50\x7e\x77\x7b\x22\x60\x89\xef\xcd\xf5\xb9\x0c\x97\x79\x0d\x2b\x35\x43\xcb\x3d\x24\xf1\x78\xfc\xf8\xcb\x1f\x15\x06\xe2\x78\xd8\x51\x21\xd9\x1f\xf0\xf5\x8f\x86\xa4\x50\xfa\xb1\x47\x43\xa5\xdd\x69\x14\xe8\xa3\xc0\x86\x91\xa7\x81\x50\xb4\x7c\xc0\x81\x80\x77\x7a\x9f\xc6\xc2\xa9\x8c\x05\x33\xb0\x3b\x31\xa4\xf4\xd7\x1b\x26\x55\x97\x7c\x65\xf8\x69\x1a\x84\x8e\x41\x78\xd9\xec\xc5\x11\x16\x1e\x74\x91\xf5\x56\xf5\x57\x49\x47\x5c\x92\xa9\x1e\x99\x36\xf4\xdb\xb1\x0e\xd3\x78\x02\xb0\x9b\x25\xcb\xe9\xe9\x1d\x0d\x44\x01\x42\x08\x91\x64\xd9\xdd\x37\x08\x17\xef\xf9\xe5\x0f\xbd\x46\x91\xf5\xf9\x89\x92\x37\xdd\x89\x59\x44\x1f\x9c\xee\x34\x1e\xbe\x47\x83\x32\x72\x8e\x37\xdf\xac\x69\x38\xef\x75\xb0\xda\xdb\xac\x83\x94\x2f\x39\xa6\x62\x05\x1c\x25\x9c\x49\x16\xb0\xa8\x3c\xc7\x7e\x76\x71\x3e\x6f\xb5\x24\xe7\xe8\xb7\xb9\xc7\x6c\x43\x92\xee\x21\xd4\x17\xa1\x7f\xba\x35\xfe\xae\x39\xbc\xde\xba\x69\xd9\x8e\xe1\x62\xde\x64\x7d\x16\x88\x1b\xed\x29\x11\xfd\x4f\xa9\xff\x99\x90\xc4\xf6\xf4\xf9\x6e\xe9\x28\x23\xd7\xca\xe5\xee\xee\x9f\x63\xb1\x5b\xfb\x10\xd7\x2f\x1d\xf2\xe3\xbf\xb9\xb5\x6f\xa4\x6d\x7d\x25\x79\xfb\x24\x31\xea\x56\xbe\x5d\x53\xcd\x2d\x36\xa3\x6d\xdf\xab\x1c\xb8\x6d\x6f\xc0\x98\xa7\xdd\xaa\x86\x8c\x1d\x39\xa3\x9d\x70\x2b\x9b\x68\xd9\xfd\x33\xfe\xa9\xb6\x4a\x2e\x63\x0f\xcf\x68\x27\xd9\x4c\xb9\x46\x6d\xcb\xbe\xa1\xa8\xd6\x5f\xc6\xd6\x9f\xf1\x4f\xf4\xd4\xb4\x78\xd0\xd6\xf4\x13\x3c\x3b\xac\xd0\xdc\x90\x34\xda\xc9\xb4\x9a\x1a\x8d\xbd\x93\x87\xd4\xe2\x21\x1b\xb3\x2b\xd1\xbe\xe7\x69\xd4\x53\x67\xd5\x40\xa0\xe3\x19\x3f\x6d\x1a\xbc\x0e\x86\x3c\x10\xb4\x3d\x2a\xcd\x78\x32\xe6\xab\xbd\x36\xc9\xf4\x3a\x58\xae\xc3\xf4\x47\xea\xbf\xfb\x47\xff\x0d\x00\x00\xff\xff\xd2\x32\x5a\x28\x38\x9d\x00\x00") + +func v2SchemaJsonBytes() ([]byte, error) { + return bindataRead( + _v2SchemaJson, + "v2/schema.json", + ) +} + +func v2SchemaJson() (*asset, error) { + bytes, err := v2SchemaJsonBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "v2/schema.json", size: 40248, mode: os.FileMode(0640), modTime: time.Unix(1568964748, 0)} + a := &asset{bytes: bytes, info: info, digest: [32]uint8{0xab, 0x88, 0x5e, 0xf, 0xbf, 0x17, 0x74, 0x0, 0xb2, 0x5a, 0x7f, 0xbc, 0x58, 0xcd, 0xc, 0x25, 0x73, 0xd5, 0x29, 0x1c, 0x7a, 0xd0, 0xce, 0x79, 0xd4, 0x89, 0x31, 0x27, 0x90, 0xf2, 0xff, 0xe6}} + return a, nil +} + +// Asset loads and returns the asset for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func Asset(name string) ([]byte, error) { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) + } + return a.bytes, nil + } + return nil, fmt.Errorf("Asset %s not found", name) +} + +// AssetString returns the asset contents as a string (instead of a []byte). +func AssetString(name string) (string, error) { + data, err := Asset(name) + return string(data), err +} + +// MustAsset is like Asset but panics when Asset would return an error. +// It simplifies safe initialization of global variables. +func MustAsset(name string) []byte { + a, err := Asset(name) + if err != nil { + panic("asset: Asset(" + name + "): " + err.Error()) + } + + return a +} + +// MustAssetString is like AssetString but panics when Asset would return an +// error. It simplifies safe initialization of global variables. +func MustAssetString(name string) string { + return string(MustAsset(name)) +} + +// AssetInfo loads and returns the asset info for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func AssetInfo(name string) (os.FileInfo, error) { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) + } + return a.info, nil + } + return nil, fmt.Errorf("AssetInfo %s not found", name) +} + +// AssetDigest returns the digest of the file with the given name. It returns an +// error if the asset could not be found or the digest could not be loaded. +func AssetDigest(name string) ([sha256.Size]byte, error) { + canonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[canonicalName]; ok { + a, err := f() + if err != nil { + return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s can't read by error: %v", name, err) + } + return a.digest, nil + } + return [sha256.Size]byte{}, fmt.Errorf("AssetDigest %s not found", name) +} + +// Digests returns a map of all known files and their checksums. +func Digests() (map[string][sha256.Size]byte, error) { + mp := make(map[string][sha256.Size]byte, len(_bindata)) + for name := range _bindata { + a, err := _bindata[name]() + if err != nil { + return nil, err + } + mp[name] = a.digest + } + return mp, nil +} + +// AssetNames returns the names of the assets. +func AssetNames() []string { + names := make([]string, 0, len(_bindata)) + for name := range _bindata { + names = append(names, name) + } + return names +} + +// _bindata is a table, holding each asset generator, mapped to its name. +var _bindata = map[string]func() (*asset, error){ + "jsonschema-draft-04.json": jsonschemaDraft04Json, + + "v2/schema.json": v2SchemaJson, +} + +// AssetDir returns the file names below a certain +// directory embedded in the file by go-bindata. +// For example if you run go-bindata on data/... and data contains the +// following hierarchy: +// data/ +// foo.txt +// img/ +// a.png +// b.png +// then AssetDir("data") would return []string{"foo.txt", "img"}, +// AssetDir("data/img") would return []string{"a.png", "b.png"}, +// AssetDir("foo.txt") and AssetDir("notexist") would return an error, and +// AssetDir("") will return []string{"data"}. +func AssetDir(name string) ([]string, error) { + node := _bintree + if len(name) != 0 { + canonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(canonicalName, "/") + for _, p := range pathList { + node = node.Children[p] + if node == nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + } + } + if node.Func != nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + rv := make([]string, 0, len(node.Children)) + for childName := range node.Children { + rv = append(rv, childName) + } + return rv, nil +} + +type bintree struct { + Func func() (*asset, error) + Children map[string]*bintree +} + +var _bintree = &bintree{nil, map[string]*bintree{ + "jsonschema-draft-04.json": {jsonschemaDraft04Json, map[string]*bintree{}}, + "v2": {nil, map[string]*bintree{ + "schema.json": {v2SchemaJson, map[string]*bintree{}}, + }}, +}} + +// RestoreAsset restores an asset under the given directory. +func RestoreAsset(dir, name string) error { + data, err := Asset(name) + if err != nil { + return err + } + info, err := AssetInfo(name) + if err != nil { + return err + } + err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) + if err != nil { + return err + } + err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + if err != nil { + return err + } + return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) +} + +// RestoreAssets restores an asset under the given directory recursively. +func RestoreAssets(dir, name string) error { + children, err := AssetDir(name) + // File + if err != nil { + return RestoreAsset(dir, name) + } + // Dir + for _, child := range children { + err = RestoreAssets(dir, filepath.Join(name, child)) + if err != nil { + return err + } + } + return nil +} + +func _filePath(dir, name string) string { + canonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(canonicalName, "/")...)...) +} diff --git a/vendor/github.com/go-openapi/spec/cache.go b/vendor/github.com/go-openapi/spec/cache.go new file mode 100644 index 00000000000..122993b44b4 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/cache.go @@ -0,0 +1,98 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "sync" +) + +// ResolutionCache a cache for resolving urls +type ResolutionCache interface { + Get(string) (interface{}, bool) + Set(string, interface{}) +} + +type simpleCache struct { + lock sync.RWMutex + store map[string]interface{} +} + +func (s *simpleCache) ShallowClone() ResolutionCache { + store := make(map[string]interface{}, len(s.store)) + s.lock.RLock() + for k, v := range s.store { + store[k] = v + } + s.lock.RUnlock() + + return &simpleCache{ + store: store, + } +} + +// Get retrieves a cached URI +func (s *simpleCache) Get(uri string) (interface{}, bool) { + s.lock.RLock() + v, ok := s.store[uri] + + s.lock.RUnlock() + return v, ok +} + +// Set caches a URI +func (s *simpleCache) Set(uri string, data interface{}) { + s.lock.Lock() + s.store[uri] = data + s.lock.Unlock() +} + +var ( + // resCache is a package level cache for $ref resolution and expansion. + // It is initialized lazily by methods that have the need for it: no + // memory is allocated unless some expander methods are called. + // + // It is initialized with JSON schema and swagger schema, + // which do not mutate during normal operations. + // + // All subsequent utilizations of this cache are produced from a shallow + // clone of this initial version. + resCache *simpleCache + onceCache sync.Once + + _ ResolutionCache = &simpleCache{} +) + +// initResolutionCache initializes the URI resolution cache. To be wrapped in a sync.Once.Do call. +func initResolutionCache() { + resCache = defaultResolutionCache() +} + +func defaultResolutionCache() *simpleCache { + return &simpleCache{store: map[string]interface{}{ + "http://swagger.io/v2/schema.json": MustLoadSwagger20Schema(), + "http://json-schema.org/draft-04/schema": MustLoadJSONSchemaDraft04(), + }} +} + +func cacheOrDefault(cache ResolutionCache) ResolutionCache { + onceCache.Do(initResolutionCache) + + if cache != nil { + return cache + } + + // get a shallow clone of the base cache with swagger and json schema + return resCache.ShallowClone() +} diff --git a/vendor/github.com/go-openapi/spec/contact_info.go b/vendor/github.com/go-openapi/spec/contact_info.go new file mode 100644 index 00000000000..2f7bb219b56 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/contact_info.go @@ -0,0 +1,57 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + + "github.com/go-openapi/swag" +) + +// ContactInfo contact information for the exposed API. +// +// For more information: http://goo.gl/8us55a#contactObject +type ContactInfo struct { + ContactInfoProps + VendorExtensible +} + +// ContactInfoProps hold the properties of a ContactInfo object +type ContactInfoProps struct { + Name string `json:"name,omitempty"` + URL string `json:"url,omitempty"` + Email string `json:"email,omitempty"` +} + +// UnmarshalJSON hydrates ContactInfo from json +func (c *ContactInfo) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &c.ContactInfoProps); err != nil { + return err + } + return json.Unmarshal(data, &c.VendorExtensible) +} + +// MarshalJSON produces ContactInfo as json +func (c ContactInfo) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(c.ContactInfoProps) + if err != nil { + return nil, err + } + b2, err := json.Marshal(c.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2), nil +} diff --git a/vendor/github.com/go-openapi/spec/debug.go b/vendor/github.com/go-openapi/spec/debug.go new file mode 100644 index 00000000000..fc889f6d0b0 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/debug.go @@ -0,0 +1,49 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "fmt" + "log" + "os" + "path" + "runtime" +) + +// Debug is true when the SWAGGER_DEBUG env var is not empty. +// +// It enables a more verbose logging of this package. +var Debug = os.Getenv("SWAGGER_DEBUG") != "" + +var ( + // specLogger is a debug logger for this package + specLogger *log.Logger +) + +func init() { + debugOptions() +} + +func debugOptions() { + specLogger = log.New(os.Stdout, "spec:", log.LstdFlags) +} + +func debugLog(msg string, args ...interface{}) { + // A private, trivial trace logger, based on go-openapi/spec/expander.go:debugLog() + if Debug { + _, file1, pos1, _ := runtime.Caller(1) + specLogger.Printf("%s:%d: %s", path.Base(file1), pos1, fmt.Sprintf(msg, args...)) + } +} diff --git a/vendor/github.com/go-openapi/spec/errors.go b/vendor/github.com/go-openapi/spec/errors.go new file mode 100644 index 00000000000..6992c7ba730 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/errors.go @@ -0,0 +1,19 @@ +package spec + +import "errors" + +// Error codes +var ( + // ErrUnknownTypeForReference indicates that a resolved reference was found in an unsupported container type + ErrUnknownTypeForReference = errors.New("unknown type for the resolved reference") + + // ErrResolveRefNeedsAPointer indicates that a $ref target must be a valid JSON pointer + ErrResolveRefNeedsAPointer = errors.New("resolve ref: target needs to be a pointer") + + // ErrDerefUnsupportedType indicates that a resolved reference was found in an unsupported container type. + // At the moment, $ref are supported only inside: schemas, parameters, responses, path items + ErrDerefUnsupportedType = errors.New("deref: unsupported type") + + // ErrExpandUnsupportedType indicates that $ref expansion is attempted on some invalid type + ErrExpandUnsupportedType = errors.New("expand: unsupported type. Input should be of type *Parameter or *Response") +) diff --git a/vendor/github.com/go-openapi/spec/expander.go b/vendor/github.com/go-openapi/spec/expander.go new file mode 100644 index 00000000000..d4ea889d44d --- /dev/null +++ b/vendor/github.com/go-openapi/spec/expander.go @@ -0,0 +1,594 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "fmt" +) + +// ExpandOptions provides options for the spec expander. +// +// RelativeBase is the path to the root document. This can be a remote URL or a path to a local file. +// +// If left empty, the root document is assumed to be located in the current working directory: +// all relative $ref's will be resolved from there. +// +// PathLoader injects a document loading method. By default, this resolves to the function provided by the SpecLoader package variable. +// +type ExpandOptions struct { + RelativeBase string // the path to the root document to expand. This is a file, not a directory + SkipSchemas bool // do not expand schemas, just paths, parameters and responses + ContinueOnError bool // continue expanding even after and error is found + PathLoader func(string) (json.RawMessage, error) `json:"-"` // the document loading method that takes a path as input and yields a json document + AbsoluteCircularRef bool // circular $ref remaining after expansion remain absolute URLs +} + +func optionsOrDefault(opts *ExpandOptions) *ExpandOptions { + if opts != nil { + clone := *opts // shallow clone to avoid internal changes to be propagated to the caller + if clone.RelativeBase != "" { + clone.RelativeBase = normalizeBase(clone.RelativeBase) + } + // if the relative base is empty, let the schema loader choose a pseudo root document + return &clone + } + return &ExpandOptions{} +} + +// ExpandSpec expands the references in a swagger spec +func ExpandSpec(spec *Swagger, options *ExpandOptions) error { + options = optionsOrDefault(options) + resolver := defaultSchemaLoader(spec, options, nil, nil) + + specBasePath := options.RelativeBase + + if !options.SkipSchemas { + for key, definition := range spec.Definitions { + parentRefs := make([]string, 0, 10) + parentRefs = append(parentRefs, fmt.Sprintf("#/definitions/%s", key)) + + def, err := expandSchema(definition, parentRefs, resolver, specBasePath) + if resolver.shouldStopOnError(err) { + return err + } + if def != nil { + spec.Definitions[key] = *def + } + } + } + + for key := range spec.Parameters { + parameter := spec.Parameters[key] + if err := expandParameterOrResponse(¶meter, resolver, specBasePath); resolver.shouldStopOnError(err) { + return err + } + spec.Parameters[key] = parameter + } + + for key := range spec.Responses { + response := spec.Responses[key] + if err := expandParameterOrResponse(&response, resolver, specBasePath); resolver.shouldStopOnError(err) { + return err + } + spec.Responses[key] = response + } + + if spec.Paths != nil { + for key := range spec.Paths.Paths { + pth := spec.Paths.Paths[key] + if err := expandPathItem(&pth, resolver, specBasePath); resolver.shouldStopOnError(err) { + return err + } + spec.Paths.Paths[key] = pth + } + } + + return nil +} + +const rootBase = ".root" + +// baseForRoot loads in the cache the root document and produces a fake ".root" base path entry +// for further $ref resolution +// +// Setting the cache is optional and this parameter may safely be left to nil. +func baseForRoot(root interface{}, cache ResolutionCache) string { + if root == nil { + return "" + } + + // cache the root document to resolve $ref's + normalizedBase := normalizeBase(rootBase) + cache.Set(normalizedBase, root) + + return normalizedBase +} + +// ExpandSchema expands the refs in the schema object with reference to the root object. +// +// go-openapi/validate uses this function. +// +// Notice that it is impossible to reference a json schema in a different document other than root +// (use ExpandSchemaWithBasePath to resolve external references). +// +// Setting the cache is optional and this parameter may safely be left to nil. +func ExpandSchema(schema *Schema, root interface{}, cache ResolutionCache) error { + cache = cacheOrDefault(cache) + if root == nil { + root = schema + } + + opts := &ExpandOptions{ + // when a root is specified, cache the root as an in-memory document for $ref retrieval + RelativeBase: baseForRoot(root, cache), + SkipSchemas: false, + ContinueOnError: false, + } + + return ExpandSchemaWithBasePath(schema, cache, opts) +} + +// ExpandSchemaWithBasePath expands the refs in the schema object, base path configured through expand options. +// +// Setting the cache is optional and this parameter may safely be left to nil. +func ExpandSchemaWithBasePath(schema *Schema, cache ResolutionCache, opts *ExpandOptions) error { + if schema == nil { + return nil + } + + cache = cacheOrDefault(cache) + + opts = optionsOrDefault(opts) + + resolver := defaultSchemaLoader(nil, opts, cache, nil) + + parentRefs := make([]string, 0, 10) + s, err := expandSchema(*schema, parentRefs, resolver, opts.RelativeBase) + if err != nil { + return err + } + if s != nil { + // guard for when continuing on error + *schema = *s + } + + return nil +} + +func expandItems(target Schema, parentRefs []string, resolver *schemaLoader, basePath string) (*Schema, error) { + if target.Items == nil { + return &target, nil + } + + // array + if target.Items.Schema != nil { + t, err := expandSchema(*target.Items.Schema, parentRefs, resolver, basePath) + if err != nil { + return nil, err + } + *target.Items.Schema = *t + } + + // tuple + for i := range target.Items.Schemas { + t, err := expandSchema(target.Items.Schemas[i], parentRefs, resolver, basePath) + if err != nil { + return nil, err + } + target.Items.Schemas[i] = *t + } + + return &target, nil +} + +func expandSchema(target Schema, parentRefs []string, resolver *schemaLoader, basePath string) (*Schema, error) { + if target.Ref.String() == "" && target.Ref.IsRoot() { + newRef := normalizeRef(&target.Ref, basePath) + target.Ref = *newRef + return &target, nil + } + + // change the base path of resolution when an ID is encountered + // otherwise the basePath should inherit the parent's + if target.ID != "" { + basePath, _ = resolver.setSchemaID(target, target.ID, basePath) + } + + if target.Ref.String() != "" { + return expandSchemaRef(target, parentRefs, resolver, basePath) + } + + for k := range target.Definitions { + tt, err := expandSchema(target.Definitions[k], parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if tt != nil { + target.Definitions[k] = *tt + } + } + + t, err := expandItems(target, parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + target = *t + } + + for i := range target.AllOf { + t, err := expandSchema(target.AllOf[i], parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + target.AllOf[i] = *t + } + } + + for i := range target.AnyOf { + t, err := expandSchema(target.AnyOf[i], parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + target.AnyOf[i] = *t + } + } + + for i := range target.OneOf { + t, err := expandSchema(target.OneOf[i], parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + target.OneOf[i] = *t + } + } + + if target.Not != nil { + t, err := expandSchema(*target.Not, parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + *target.Not = *t + } + } + + for k := range target.Properties { + t, err := expandSchema(target.Properties[k], parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + target.Properties[k] = *t + } + } + + if target.AdditionalProperties != nil && target.AdditionalProperties.Schema != nil { + t, err := expandSchema(*target.AdditionalProperties.Schema, parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + *target.AdditionalProperties.Schema = *t + } + } + + for k := range target.PatternProperties { + t, err := expandSchema(target.PatternProperties[k], parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + target.PatternProperties[k] = *t + } + } + + for k := range target.Dependencies { + if target.Dependencies[k].Schema != nil { + t, err := expandSchema(*target.Dependencies[k].Schema, parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + *target.Dependencies[k].Schema = *t + } + } + } + + if target.AdditionalItems != nil && target.AdditionalItems.Schema != nil { + t, err := expandSchema(*target.AdditionalItems.Schema, parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return &target, err + } + if t != nil { + *target.AdditionalItems.Schema = *t + } + } + return &target, nil +} + +func expandSchemaRef(target Schema, parentRefs []string, resolver *schemaLoader, basePath string) (*Schema, error) { + // if a Ref is found, all sibling fields are skipped + // Ref also changes the resolution scope of children expandSchema + + // here the resolution scope is changed because a $ref was encountered + normalizedRef := normalizeRef(&target.Ref, basePath) + normalizedBasePath := normalizedRef.RemoteURI() + + if resolver.isCircular(normalizedRef, basePath, parentRefs...) { + // this means there is a cycle in the recursion tree: return the Ref + // - circular refs cannot be expanded. We leave them as ref. + // - denormalization means that a new local file ref is set relative to the original basePath + debugLog("short circuit circular ref: basePath: %s, normalizedPath: %s, normalized ref: %s", + basePath, normalizedBasePath, normalizedRef.String()) + if !resolver.options.AbsoluteCircularRef { + target.Ref = denormalizeRef(normalizedRef, resolver.context.basePath, resolver.context.rootID) + } else { + target.Ref = *normalizedRef + } + return &target, nil + } + + var t *Schema + err := resolver.Resolve(&target.Ref, &t, basePath) + if resolver.shouldStopOnError(err) { + return nil, err + } + + if t == nil { + // guard for when continuing on error + return &target, nil + } + + parentRefs = append(parentRefs, normalizedRef.String()) + transitiveResolver := resolver.transitiveResolver(basePath, target.Ref) + + basePath = resolver.updateBasePath(transitiveResolver, normalizedBasePath) + + return expandSchema(*t, parentRefs, transitiveResolver, basePath) +} + +func expandPathItem(pathItem *PathItem, resolver *schemaLoader, basePath string) error { + if pathItem == nil { + return nil + } + + parentRefs := make([]string, 0, 10) + if err := resolver.deref(pathItem, parentRefs, basePath); resolver.shouldStopOnError(err) { + return err + } + + if pathItem.Ref.String() != "" { + transitiveResolver := resolver.transitiveResolver(basePath, pathItem.Ref) + basePath = transitiveResolver.updateBasePath(resolver, basePath) + resolver = transitiveResolver + } + + pathItem.Ref = Ref{} + for i := range pathItem.Parameters { + if err := expandParameterOrResponse(&(pathItem.Parameters[i]), resolver, basePath); resolver.shouldStopOnError(err) { + return err + } + } + + ops := []*Operation{ + pathItem.Get, + pathItem.Head, + pathItem.Options, + pathItem.Put, + pathItem.Post, + pathItem.Patch, + pathItem.Delete, + } + for _, op := range ops { + if err := expandOperation(op, resolver, basePath); resolver.shouldStopOnError(err) { + return err + } + } + + return nil +} + +func expandOperation(op *Operation, resolver *schemaLoader, basePath string) error { + if op == nil { + return nil + } + + for i := range op.Parameters { + param := op.Parameters[i] + if err := expandParameterOrResponse(¶m, resolver, basePath); resolver.shouldStopOnError(err) { + return err + } + op.Parameters[i] = param + } + + if op.Responses == nil { + return nil + } + + responses := op.Responses + if err := expandParameterOrResponse(responses.Default, resolver, basePath); resolver.shouldStopOnError(err) { + return err + } + + for code := range responses.StatusCodeResponses { + response := responses.StatusCodeResponses[code] + if err := expandParameterOrResponse(&response, resolver, basePath); resolver.shouldStopOnError(err) { + return err + } + responses.StatusCodeResponses[code] = response + } + + return nil +} + +// ExpandResponseWithRoot expands a response based on a root document, not a fetchable document +// +// Notice that it is impossible to reference a json schema in a different document other than root +// (use ExpandResponse to resolve external references). +// +// Setting the cache is optional and this parameter may safely be left to nil. +func ExpandResponseWithRoot(response *Response, root interface{}, cache ResolutionCache) error { + cache = cacheOrDefault(cache) + opts := &ExpandOptions{ + RelativeBase: baseForRoot(root, cache), + } + resolver := defaultSchemaLoader(root, opts, cache, nil) + + return expandParameterOrResponse(response, resolver, opts.RelativeBase) +} + +// ExpandResponse expands a response based on a basepath +// +// All refs inside response will be resolved relative to basePath +func ExpandResponse(response *Response, basePath string) error { + opts := optionsOrDefault(&ExpandOptions{ + RelativeBase: basePath, + }) + resolver := defaultSchemaLoader(nil, opts, nil, nil) + + return expandParameterOrResponse(response, resolver, opts.RelativeBase) +} + +// ExpandParameterWithRoot expands a parameter based on a root document, not a fetchable document. +// +// Notice that it is impossible to reference a json schema in a different document other than root +// (use ExpandParameter to resolve external references). +func ExpandParameterWithRoot(parameter *Parameter, root interface{}, cache ResolutionCache) error { + cache = cacheOrDefault(cache) + + opts := &ExpandOptions{ + RelativeBase: baseForRoot(root, cache), + } + resolver := defaultSchemaLoader(root, opts, cache, nil) + + return expandParameterOrResponse(parameter, resolver, opts.RelativeBase) +} + +// ExpandParameter expands a parameter based on a basepath. +// This is the exported version of expandParameter +// all refs inside parameter will be resolved relative to basePath +func ExpandParameter(parameter *Parameter, basePath string) error { + opts := optionsOrDefault(&ExpandOptions{ + RelativeBase: basePath, + }) + resolver := defaultSchemaLoader(nil, opts, nil, nil) + + return expandParameterOrResponse(parameter, resolver, opts.RelativeBase) +} + +func getRefAndSchema(input interface{}) (*Ref, *Schema, error) { + var ( + ref *Ref + sch *Schema + ) + + switch refable := input.(type) { + case *Parameter: + if refable == nil { + return nil, nil, nil + } + ref = &refable.Ref + sch = refable.Schema + case *Response: + if refable == nil { + return nil, nil, nil + } + ref = &refable.Ref + sch = refable.Schema + default: + return nil, nil, fmt.Errorf("unsupported type: %T: %w", input, ErrExpandUnsupportedType) + } + + return ref, sch, nil +} + +func expandParameterOrResponse(input interface{}, resolver *schemaLoader, basePath string) error { + ref, _, err := getRefAndSchema(input) + if err != nil { + return err + } + + if ref == nil { + return nil + } + + parentRefs := make([]string, 0, 10) + if err = resolver.deref(input, parentRefs, basePath); resolver.shouldStopOnError(err) { + return err + } + + ref, sch, _ := getRefAndSchema(input) + if ref.String() != "" { + transitiveResolver := resolver.transitiveResolver(basePath, *ref) + basePath = resolver.updateBasePath(transitiveResolver, basePath) + resolver = transitiveResolver + } + + if sch == nil { + // nothing to be expanded + if ref != nil { + *ref = Ref{} + } + return nil + } + + if sch.Ref.String() != "" { + rebasedRef, ern := NewRef(normalizeURI(sch.Ref.String(), basePath)) + if ern != nil { + return ern + } + + switch { + case resolver.isCircular(&rebasedRef, basePath, parentRefs...): + // this is a circular $ref: stop expansion + if !resolver.options.AbsoluteCircularRef { + sch.Ref = denormalizeRef(&rebasedRef, resolver.context.basePath, resolver.context.rootID) + } else { + sch.Ref = rebasedRef + } + case !resolver.options.SkipSchemas: + // schema expanded to a $ref in another root + sch.Ref = rebasedRef + debugLog("rebased to: %s", sch.Ref.String()) + default: + // skip schema expansion but rebase $ref to schema + sch.Ref = denormalizeRef(&rebasedRef, resolver.context.basePath, resolver.context.rootID) + } + } + + if ref != nil { + *ref = Ref{} + } + + // expand schema + if !resolver.options.SkipSchemas { + s, err := expandSchema(*sch, parentRefs, resolver, basePath) + if resolver.shouldStopOnError(err) { + return err + } + if s == nil { + // guard for when continuing on error + return nil + } + *sch = *s + } + + return nil +} diff --git a/vendor/github.com/go-openapi/spec/external_docs.go b/vendor/github.com/go-openapi/spec/external_docs.go new file mode 100644 index 00000000000..88add91b2b8 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/external_docs.go @@ -0,0 +1,24 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +// ExternalDocumentation allows referencing an external resource for +// extended documentation. +// +// For more information: http://goo.gl/8us55a#externalDocumentationObject +type ExternalDocumentation struct { + Description string `json:"description,omitempty"` + URL string `json:"url,omitempty"` +} diff --git a/vendor/github.com/go-openapi/spec/header.go b/vendor/github.com/go-openapi/spec/header.go new file mode 100644 index 00000000000..9dfd17b185f --- /dev/null +++ b/vendor/github.com/go-openapi/spec/header.go @@ -0,0 +1,203 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +const ( + jsonArray = "array" +) + +// HeaderProps describes a response header +type HeaderProps struct { + Description string `json:"description,omitempty"` +} + +// Header describes a header for a response of the API +// +// For more information: http://goo.gl/8us55a#headerObject +type Header struct { + CommonValidations + SimpleSchema + VendorExtensible + HeaderProps +} + +// ResponseHeader creates a new header instance for use in a response +func ResponseHeader() *Header { + return new(Header) +} + +// WithDescription sets the description on this response, allows for chaining +func (h *Header) WithDescription(description string) *Header { + h.Description = description + return h +} + +// Typed a fluent builder method for the type of parameter +func (h *Header) Typed(tpe, format string) *Header { + h.Type = tpe + h.Format = format + return h +} + +// CollectionOf a fluent builder method for an array item +func (h *Header) CollectionOf(items *Items, format string) *Header { + h.Type = jsonArray + h.Items = items + h.CollectionFormat = format + return h +} + +// WithDefault sets the default value on this item +func (h *Header) WithDefault(defaultValue interface{}) *Header { + h.Default = defaultValue + return h +} + +// WithMaxLength sets a max length value +func (h *Header) WithMaxLength(max int64) *Header { + h.MaxLength = &max + return h +} + +// WithMinLength sets a min length value +func (h *Header) WithMinLength(min int64) *Header { + h.MinLength = &min + return h +} + +// WithPattern sets a pattern value +func (h *Header) WithPattern(pattern string) *Header { + h.Pattern = pattern + return h +} + +// WithMultipleOf sets a multiple of value +func (h *Header) WithMultipleOf(number float64) *Header { + h.MultipleOf = &number + return h +} + +// WithMaximum sets a maximum number value +func (h *Header) WithMaximum(max float64, exclusive bool) *Header { + h.Maximum = &max + h.ExclusiveMaximum = exclusive + return h +} + +// WithMinimum sets a minimum number value +func (h *Header) WithMinimum(min float64, exclusive bool) *Header { + h.Minimum = &min + h.ExclusiveMinimum = exclusive + return h +} + +// WithEnum sets a the enum values (replace) +func (h *Header) WithEnum(values ...interface{}) *Header { + h.Enum = append([]interface{}{}, values...) + return h +} + +// WithMaxItems sets the max items +func (h *Header) WithMaxItems(size int64) *Header { + h.MaxItems = &size + return h +} + +// WithMinItems sets the min items +func (h *Header) WithMinItems(size int64) *Header { + h.MinItems = &size + return h +} + +// UniqueValues dictates that this array can only have unique items +func (h *Header) UniqueValues() *Header { + h.UniqueItems = true + return h +} + +// AllowDuplicates this array can have duplicates +func (h *Header) AllowDuplicates() *Header { + h.UniqueItems = false + return h +} + +// WithValidations is a fluent method to set header validations +func (h *Header) WithValidations(val CommonValidations) *Header { + h.SetValidations(SchemaValidations{CommonValidations: val}) + return h +} + +// MarshalJSON marshal this to JSON +func (h Header) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(h.CommonValidations) + if err != nil { + return nil, err + } + b2, err := json.Marshal(h.SimpleSchema) + if err != nil { + return nil, err + } + b3, err := json.Marshal(h.HeaderProps) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2, b3), nil +} + +// UnmarshalJSON unmarshals this header from JSON +func (h *Header) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &h.CommonValidations); err != nil { + return err + } + if err := json.Unmarshal(data, &h.SimpleSchema); err != nil { + return err + } + if err := json.Unmarshal(data, &h.VendorExtensible); err != nil { + return err + } + return json.Unmarshal(data, &h.HeaderProps) +} + +// JSONLookup look up a value by the json property name +func (h Header) JSONLookup(token string) (interface{}, error) { + if ex, ok := h.Extensions[token]; ok { + return &ex, nil + } + + r, _, err := jsonpointer.GetForToken(h.CommonValidations, token) + if err != nil && !strings.HasPrefix(err.Error(), "object has no field") { + return nil, err + } + if r != nil { + return r, nil + } + r, _, err = jsonpointer.GetForToken(h.SimpleSchema, token) + if err != nil && !strings.HasPrefix(err.Error(), "object has no field") { + return nil, err + } + if r != nil { + return r, nil + } + r, _, err = jsonpointer.GetForToken(h.HeaderProps, token) + return r, err +} diff --git a/vendor/github.com/go-openapi/spec/info.go b/vendor/github.com/go-openapi/spec/info.go new file mode 100644 index 00000000000..c458b49b216 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/info.go @@ -0,0 +1,165 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +// Extensions vendor specific extensions +type Extensions map[string]interface{} + +// Add adds a value to these extensions +func (e Extensions) Add(key string, value interface{}) { + realKey := strings.ToLower(key) + e[realKey] = value +} + +// GetString gets a string value from the extensions +func (e Extensions) GetString(key string) (string, bool) { + if v, ok := e[strings.ToLower(key)]; ok { + str, ok := v.(string) + return str, ok + } + return "", false +} + +// GetBool gets a string value from the extensions +func (e Extensions) GetBool(key string) (bool, bool) { + if v, ok := e[strings.ToLower(key)]; ok { + str, ok := v.(bool) + return str, ok + } + return false, false +} + +// GetStringSlice gets a string value from the extensions +func (e Extensions) GetStringSlice(key string) ([]string, bool) { + if v, ok := e[strings.ToLower(key)]; ok { + arr, isSlice := v.([]interface{}) + if !isSlice { + return nil, false + } + var strs []string + for _, iface := range arr { + str, isString := iface.(string) + if !isString { + return nil, false + } + strs = append(strs, str) + } + return strs, ok + } + return nil, false +} + +// VendorExtensible composition block. +type VendorExtensible struct { + Extensions Extensions +} + +// AddExtension adds an extension to this extensible object +func (v *VendorExtensible) AddExtension(key string, value interface{}) { + if value == nil { + return + } + if v.Extensions == nil { + v.Extensions = make(map[string]interface{}) + } + v.Extensions.Add(key, value) +} + +// MarshalJSON marshals the extensions to json +func (v VendorExtensible) MarshalJSON() ([]byte, error) { + toser := make(map[string]interface{}) + for k, v := range v.Extensions { + lk := strings.ToLower(k) + if strings.HasPrefix(lk, "x-") { + toser[k] = v + } + } + return json.Marshal(toser) +} + +// UnmarshalJSON for this extensible object +func (v *VendorExtensible) UnmarshalJSON(data []byte) error { + var d map[string]interface{} + if err := json.Unmarshal(data, &d); err != nil { + return err + } + for k, vv := range d { + lk := strings.ToLower(k) + if strings.HasPrefix(lk, "x-") { + if v.Extensions == nil { + v.Extensions = map[string]interface{}{} + } + v.Extensions[k] = vv + } + } + return nil +} + +// InfoProps the properties for an info definition +type InfoProps struct { + Description string `json:"description,omitempty"` + Title string `json:"title,omitempty"` + TermsOfService string `json:"termsOfService,omitempty"` + Contact *ContactInfo `json:"contact,omitempty"` + License *License `json:"license,omitempty"` + Version string `json:"version,omitempty"` +} + +// Info object provides metadata about the API. +// The metadata can be used by the clients if needed, and can be presented in the Swagger-UI for convenience. +// +// For more information: http://goo.gl/8us55a#infoObject +type Info struct { + VendorExtensible + InfoProps +} + +// JSONLookup look up a value by the json property name +func (i Info) JSONLookup(token string) (interface{}, error) { + if ex, ok := i.Extensions[token]; ok { + return &ex, nil + } + r, _, err := jsonpointer.GetForToken(i.InfoProps, token) + return r, err +} + +// MarshalJSON marshal this to JSON +func (i Info) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(i.InfoProps) + if err != nil { + return nil, err + } + b2, err := json.Marshal(i.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2), nil +} + +// UnmarshalJSON marshal this from JSON +func (i *Info) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &i.InfoProps); err != nil { + return err + } + return json.Unmarshal(data, &i.VendorExtensible) +} diff --git a/vendor/github.com/go-openapi/spec/items.go b/vendor/github.com/go-openapi/spec/items.go new file mode 100644 index 00000000000..e2afb2133b9 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/items.go @@ -0,0 +1,234 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +const ( + jsonRef = "$ref" +) + +// SimpleSchema describe swagger simple schemas for parameters and headers +type SimpleSchema struct { + Type string `json:"type,omitempty"` + Nullable bool `json:"nullable,omitempty"` + Format string `json:"format,omitempty"` + Items *Items `json:"items,omitempty"` + CollectionFormat string `json:"collectionFormat,omitempty"` + Default interface{} `json:"default,omitempty"` + Example interface{} `json:"example,omitempty"` +} + +// TypeName return the type (or format) of a simple schema +func (s *SimpleSchema) TypeName() string { + if s.Format != "" { + return s.Format + } + return s.Type +} + +// ItemsTypeName yields the type of items in a simple schema array +func (s *SimpleSchema) ItemsTypeName() string { + if s.Items == nil { + return "" + } + return s.Items.TypeName() +} + +// Items a limited subset of JSON-Schema's items object. +// It is used by parameter definitions that are not located in "body". +// +// For more information: http://goo.gl/8us55a#items-object +type Items struct { + Refable + CommonValidations + SimpleSchema + VendorExtensible +} + +// NewItems creates a new instance of items +func NewItems() *Items { + return &Items{} +} + +// Typed a fluent builder method for the type of item +func (i *Items) Typed(tpe, format string) *Items { + i.Type = tpe + i.Format = format + return i +} + +// AsNullable flags this schema as nullable. +func (i *Items) AsNullable() *Items { + i.Nullable = true + return i +} + +// CollectionOf a fluent builder method for an array item +func (i *Items) CollectionOf(items *Items, format string) *Items { + i.Type = jsonArray + i.Items = items + i.CollectionFormat = format + return i +} + +// WithDefault sets the default value on this item +func (i *Items) WithDefault(defaultValue interface{}) *Items { + i.Default = defaultValue + return i +} + +// WithMaxLength sets a max length value +func (i *Items) WithMaxLength(max int64) *Items { + i.MaxLength = &max + return i +} + +// WithMinLength sets a min length value +func (i *Items) WithMinLength(min int64) *Items { + i.MinLength = &min + return i +} + +// WithPattern sets a pattern value +func (i *Items) WithPattern(pattern string) *Items { + i.Pattern = pattern + return i +} + +// WithMultipleOf sets a multiple of value +func (i *Items) WithMultipleOf(number float64) *Items { + i.MultipleOf = &number + return i +} + +// WithMaximum sets a maximum number value +func (i *Items) WithMaximum(max float64, exclusive bool) *Items { + i.Maximum = &max + i.ExclusiveMaximum = exclusive + return i +} + +// WithMinimum sets a minimum number value +func (i *Items) WithMinimum(min float64, exclusive bool) *Items { + i.Minimum = &min + i.ExclusiveMinimum = exclusive + return i +} + +// WithEnum sets a the enum values (replace) +func (i *Items) WithEnum(values ...interface{}) *Items { + i.Enum = append([]interface{}{}, values...) + return i +} + +// WithMaxItems sets the max items +func (i *Items) WithMaxItems(size int64) *Items { + i.MaxItems = &size + return i +} + +// WithMinItems sets the min items +func (i *Items) WithMinItems(size int64) *Items { + i.MinItems = &size + return i +} + +// UniqueValues dictates that this array can only have unique items +func (i *Items) UniqueValues() *Items { + i.UniqueItems = true + return i +} + +// AllowDuplicates this array can have duplicates +func (i *Items) AllowDuplicates() *Items { + i.UniqueItems = false + return i +} + +// WithValidations is a fluent method to set Items validations +func (i *Items) WithValidations(val CommonValidations) *Items { + i.SetValidations(SchemaValidations{CommonValidations: val}) + return i +} + +// UnmarshalJSON hydrates this items instance with the data from JSON +func (i *Items) UnmarshalJSON(data []byte) error { + var validations CommonValidations + if err := json.Unmarshal(data, &validations); err != nil { + return err + } + var ref Refable + if err := json.Unmarshal(data, &ref); err != nil { + return err + } + var simpleSchema SimpleSchema + if err := json.Unmarshal(data, &simpleSchema); err != nil { + return err + } + var vendorExtensible VendorExtensible + if err := json.Unmarshal(data, &vendorExtensible); err != nil { + return err + } + i.Refable = ref + i.CommonValidations = validations + i.SimpleSchema = simpleSchema + i.VendorExtensible = vendorExtensible + return nil +} + +// MarshalJSON converts this items object to JSON +func (i Items) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(i.CommonValidations) + if err != nil { + return nil, err + } + b2, err := json.Marshal(i.SimpleSchema) + if err != nil { + return nil, err + } + b3, err := json.Marshal(i.Refable) + if err != nil { + return nil, err + } + b4, err := json.Marshal(i.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b4, b3, b1, b2), nil +} + +// JSONLookup look up a value by the json property name +func (i Items) JSONLookup(token string) (interface{}, error) { + if token == jsonRef { + return &i.Ref, nil + } + + r, _, err := jsonpointer.GetForToken(i.CommonValidations, token) + if err != nil && !strings.HasPrefix(err.Error(), "object has no field") { + return nil, err + } + if r != nil { + return r, nil + } + r, _, err = jsonpointer.GetForToken(i.SimpleSchema, token) + return r, err +} diff --git a/vendor/github.com/go-openapi/spec/license.go b/vendor/github.com/go-openapi/spec/license.go new file mode 100644 index 00000000000..b42f80368ec --- /dev/null +++ b/vendor/github.com/go-openapi/spec/license.go @@ -0,0 +1,56 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + + "github.com/go-openapi/swag" +) + +// License information for the exposed API. +// +// For more information: http://goo.gl/8us55a#licenseObject +type License struct { + LicenseProps + VendorExtensible +} + +// LicenseProps holds the properties of a License object +type LicenseProps struct { + Name string `json:"name,omitempty"` + URL string `json:"url,omitempty"` +} + +// UnmarshalJSON hydrates License from json +func (l *License) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &l.LicenseProps); err != nil { + return err + } + return json.Unmarshal(data, &l.VendorExtensible) +} + +// MarshalJSON produces License as json +func (l License) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(l.LicenseProps) + if err != nil { + return nil, err + } + b2, err := json.Marshal(l.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2), nil +} diff --git a/vendor/github.com/go-openapi/spec/normalizer.go b/vendor/github.com/go-openapi/spec/normalizer.go new file mode 100644 index 00000000000..d6c48397128 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/normalizer.go @@ -0,0 +1,203 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "net/url" + "path" + "strings" +) + +const fileScheme = "file" + +// normalizeURI ensures that all $ref paths used internally by the expander are canonicalized. +// +// NOTE(windows): there is a tolerance over the strict URI format on windows. +// +// The normalizer accepts relative file URLs like 'Path\File.JSON' as well as absolute file URLs like +// 'C:\Path\file.Yaml'. +// +// Both are canonicalized with a "file://" scheme, slashes and a lower-cased path: +// 'file:///c:/path/file.yaml' +// +// URLs can be specified with a file scheme, like in 'file:///folder/file.json' or +// 'file:///c:\folder\File.json'. +// +// URLs like file://C:\folder are considered invalid (i.e. there is no host 'c:\folder') and a "repair" +// is attempted. +// +// The base path argument is assumed to be canonicalized (e.g. using normalizeBase()). +func normalizeURI(refPath, base string) string { + refURL, err := url.Parse(refPath) + if err != nil { + specLogger.Printf("warning: invalid URI in $ref %q: %v", refPath, err) + refURL, refPath = repairURI(refPath) + } + + fixWindowsURI(refURL, refPath) // noop on non-windows OS + + refURL.Path = path.Clean(refURL.Path) + if refURL.Path == "." { + refURL.Path = "" + } + + r := MustCreateRef(refURL.String()) + if r.IsCanonical() { + return refURL.String() + } + + baseURL, _ := url.Parse(base) + if path.IsAbs(refURL.Path) { + baseURL.Path = refURL.Path + } else if refURL.Path != "" { + baseURL.Path = path.Join(path.Dir(baseURL.Path), refURL.Path) + } + // copying fragment from ref to base + baseURL.Fragment = refURL.Fragment + + return baseURL.String() +} + +// denormalizeRef returns the simplest notation for a normalized $ref, given the path of the original root document. +// +// When calling this, we assume that: +// * $ref is a canonical URI +// * originalRelativeBase is a canonical URI +// +// denormalizeRef is currently used when we rewrite a $ref after a circular $ref has been detected. +// In this case, expansion stops and normally renders the internal canonical $ref. +// +// This internal $ref is eventually rebased to the original RelativeBase used for the expansion. +// +// There is a special case for schemas that are anchored with an "id": +// in that case, the rebasing is performed // against the id only if this is an anchor for the initial root document. +// All other intermediate "id"'s found along the way are ignored for the purpose of rebasing. +// +func denormalizeRef(ref *Ref, originalRelativeBase, id string) Ref { + debugLog("denormalizeRef called:\n$ref: %q\noriginal: %s\nroot ID:%s", ref.String(), originalRelativeBase, id) + + if ref.String() == "" || ref.IsRoot() || ref.HasFragmentOnly { + // short circuit: $ref to current doc + return *ref + } + + if id != "" { + idBaseURL, err := url.Parse(id) + if err == nil { // if the schema id is not usable as a URI, ignore it + if ref, ok := rebase(ref, idBaseURL, true); ok { // rebase, but keep references to root unchaged (do not want $ref: "") + // $ref relative to the ID of the schema in the root document + return ref + } + } + } + + originalRelativeBaseURL, _ := url.Parse(originalRelativeBase) + + r, _ := rebase(ref, originalRelativeBaseURL, false) + + return r +} + +func rebase(ref *Ref, v *url.URL, notEqual bool) (Ref, bool) { + var newBase url.URL + + u := ref.GetURL() + + if u.Scheme != v.Scheme || u.Host != v.Host { + return *ref, false + } + + docPath := v.Path + v.Path = path.Dir(v.Path) + + if v.Path == "." { + v.Path = "" + } else if !strings.HasSuffix(v.Path, "/") { + v.Path += "/" + } + + newBase.Fragment = u.Fragment + + if strings.HasPrefix(u.Path, docPath) { + newBase.Path = strings.TrimPrefix(u.Path, docPath) + } else { + newBase.Path = strings.TrimPrefix(u.Path, v.Path) + } + + if notEqual && newBase.Path == "" && newBase.Fragment == "" { + // do not want rebasing to end up in an empty $ref + return *ref, false + } + + if path.IsAbs(newBase.Path) { + // whenever we end up with an absolute path, specify the scheme and host + newBase.Scheme = v.Scheme + newBase.Host = v.Host + } + + return MustCreateRef(newBase.String()), true +} + +// normalizeRef canonicalize a Ref, using a canonical relativeBase as its absolute anchor +func normalizeRef(ref *Ref, relativeBase string) *Ref { + r := MustCreateRef(normalizeURI(ref.String(), relativeBase)) + return &r +} + +// normalizeBase performs a normalization of the input base path. +// +// This always yields a canonical URI (absolute), usable for the document cache. +// +// It ensures that all further internal work on basePath may safely assume +// a non-empty, cross-platform, canonical URI (i.e. absolute). +// +// This normalization tolerates windows paths (e.g. C:\x\y\File.dat) and transform this +// in a file:// URL with lower cased drive letter and path. +// +// See also: https://en.wikipedia.org/wiki/File_URI_scheme +func normalizeBase(in string) string { + u, err := url.Parse(in) + if err != nil { + specLogger.Printf("warning: invalid URI in RelativeBase %q: %v", in, err) + u, in = repairURI(in) + } + + u.Fragment = "" // any fragment in the base is irrelevant + + fixWindowsURI(u, in) // noop on non-windows OS + + u.Path = path.Clean(u.Path) + if u.Path == "." { // empty after Clean() + u.Path = "" + } + + if u.Scheme != "" { + if path.IsAbs(u.Path) || u.Scheme != fileScheme { + // this is absolute or explicitly not a local file: we're good + return u.String() + } + } + + // no scheme or file scheme with relative path: assume file and make it absolute + // enforce scheme file://... with absolute path. + // + // If the input path is relative, we anchor the path to the current working directory. + // NOTE: we may end up with a host component. Leave it unchanged: e.g. file://host/folder/file.json + + u.Scheme = fileScheme + u.Path = absPath(u.Path) // platform-dependent + u.RawQuery = "" // any query component is irrelevant for a base + return u.String() +} diff --git a/vendor/github.com/go-openapi/spec/normalizer_nonwindows.go b/vendor/github.com/go-openapi/spec/normalizer_nonwindows.go new file mode 100644 index 00000000000..c8a06453474 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/normalizer_nonwindows.go @@ -0,0 +1,43 @@ +// +build !windows + +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "net/url" + "path/filepath" +) + +// absPath makes a file path absolute and compatible with a URI path component. +// +// The parameter must be a path, not an URI. +func absPath(in string) string { + anchored, err := filepath.Abs(in) + if err != nil { + specLogger.Printf("warning: could not resolve current working directory: %v", err) + return in + } + return anchored +} + +func repairURI(in string) (*url.URL, string) { + u, _ := url.Parse("") + debugLog("repaired URI: original: %q, repaired: %q", in, "") + return u, "" +} + +func fixWindowsURI(u *url.URL, in string) { +} diff --git a/vendor/github.com/go-openapi/spec/normalizer_windows.go b/vendor/github.com/go-openapi/spec/normalizer_windows.go new file mode 100644 index 00000000000..fe2d1ecd43e --- /dev/null +++ b/vendor/github.com/go-openapi/spec/normalizer_windows.go @@ -0,0 +1,154 @@ +// -build windows + +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "net/url" + "os" + "path" + "path/filepath" + "strings" +) + +// absPath makes a file path absolute and compatible with a URI path component +// +// The parameter must be a path, not an URI. +func absPath(in string) string { + // NOTE(windows): filepath.Abs exhibits a special behavior on windows for empty paths. + // See https://github.com/golang/go/issues/24441 + if in == "" { + in = "." + } + + anchored, err := filepath.Abs(in) + if err != nil { + specLogger.Printf("warning: could not resolve current working directory: %v", err) + return in + } + + pth := strings.ReplaceAll(strings.ToLower(anchored), `\`, `/`) + if !strings.HasPrefix(pth, "/") { + pth = "/" + pth + } + + return path.Clean(pth) +} + +// repairURI tolerates invalid file URIs with common typos +// such as 'file://E:\folder\file', that break the regular URL parser. +// +// Adopting the same defaults as for unixes (e.g. return an empty path) would +// result into a counter-intuitive result for that case (e.g. E:\folder\file is +// eventually resolved as the current directory). The repair will detect the missing "/". +// +// Note that this only works for the file scheme. +func repairURI(in string) (*url.URL, string) { + const prefix = fileScheme + "://" + if !strings.HasPrefix(in, prefix) { + // giving up: resolve to empty path + u, _ := url.Parse("") + + return u, "" + } + + // attempt the repair, stripping the scheme should be sufficient + u, _ := url.Parse(strings.TrimPrefix(in, prefix)) + debugLog("repaired URI: original: %q, repaired: %q", in, u.String()) + + return u, u.String() +} + +// fixWindowsURI tolerates an absolute file path on windows such as C:\Base\File.yaml or \\host\share\Base\File.yaml +// and makes it a canonical URI: file:///c:/base/file.yaml +// +// Catch 22 notes for Windows: +// +// * There may be a drive letter on windows (it is lower-cased) +// * There may be a share UNC, e.g. \\server\folder\data.xml +// * Paths are case insensitive +// * Paths may already contain slashes +// * Paths must be slashed +// +// NOTE: there is no escaping. "/" may be valid separators just like "\". +// We don't use ToSlash() (which escapes everything) because windows now also +// tolerates the use of "/". Hence, both C:\File.yaml and C:/File.yaml will work. +func fixWindowsURI(u *url.URL, in string) { + drive := filepath.VolumeName(in) + + if len(drive) > 0 { + if len(u.Scheme) == 1 && strings.EqualFold(u.Scheme, drive[:1]) { // a path with a drive letter + u.Scheme = fileScheme + u.Host = "" + u.Path = strings.Join([]string{drive, u.Opaque, u.Path}, `/`) // reconstruct the full path component (no fragment, no query) + } else if u.Host == "" && strings.HasPrefix(u.Path, drive) { // a path with a \\host volume + // NOTE: the special host@port syntax for UNC is not supported (yet) + u.Scheme = fileScheme + + // this is a modified version of filepath.Dir() to apply on the VolumeName itself + i := len(drive) - 1 + for i >= 0 && !os.IsPathSeparator(drive[i]) { + i-- + } + host := drive[:i] // \\host\share => host + + u.Path = strings.TrimPrefix(u.Path, host) + u.Host = strings.TrimPrefix(host, `\\`) + } + + u.Opaque = "" + u.Path = strings.ReplaceAll(strings.ToLower(u.Path), `\`, `/`) + + // ensure we form an absolute path + if !strings.HasPrefix(u.Path, "/") { + u.Path = "/" + u.Path + } + + u.Path = path.Clean(u.Path) + + return + } + + if u.Scheme == fileScheme { + // Handle dodgy cases for file://{...} URIs on windows. + // A canonical URI should always be followed by an absolute path. + // + // Examples: + // * file:///folder/file => valid, unchanged + // * file:///c:\folder\file => slashed + // * file:///./folder/file => valid, cleaned to remove the dot + // * file:///.\folder\file => remapped to cwd + // * file:///. => dodgy, remapped to / (consistent with the behavior on unix) + // * file:///.. => dodgy, remapped to / (consistent with the behavior on unix) + if (!path.IsAbs(u.Path) && !filepath.IsAbs(u.Path)) || (strings.HasPrefix(u.Path, `/.`) && strings.Contains(u.Path, `\`)) { + // ensure we form an absolute path + u.Path, _ = filepath.Abs(strings.TrimLeft(u.Path, `/`)) + if !strings.HasPrefix(u.Path, "/") { + u.Path = "/" + u.Path + } + } + u.Path = strings.ToLower(u.Path) + } + + // NOTE: lower case normalization does not propagate to inner resources, + // generated when rebasing: when joining a relative URI with a file to an absolute base, + // only the base is currently lower-cased. + // + // For now, we assume this is good enough for most use cases + // and try not to generate too many differences + // between the output produced on different platforms. + u.Path = path.Clean(strings.ReplaceAll(u.Path, `\`, `/`)) +} diff --git a/vendor/github.com/go-openapi/spec/operation.go b/vendor/github.com/go-openapi/spec/operation.go new file mode 100644 index 00000000000..995ce6acb17 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/operation.go @@ -0,0 +1,397 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "bytes" + "encoding/gob" + "encoding/json" + "sort" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +func init() { + gob.Register(map[string]interface{}{}) + gob.Register([]interface{}{}) +} + +// OperationProps describes an operation +// +// NOTES: +// - schemes, when present must be from [http, https, ws, wss]: see validate +// - Security is handled as a special case: see MarshalJSON function +type OperationProps struct { + Description string `json:"description,omitempty"` + Consumes []string `json:"consumes,omitempty"` + Produces []string `json:"produces,omitempty"` + Schemes []string `json:"schemes,omitempty"` + Tags []string `json:"tags,omitempty"` + Summary string `json:"summary,omitempty"` + ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` + ID string `json:"operationId,omitempty"` + Deprecated bool `json:"deprecated,omitempty"` + Security []map[string][]string `json:"security,omitempty"` + Parameters []Parameter `json:"parameters,omitempty"` + Responses *Responses `json:"responses,omitempty"` +} + +// MarshalJSON takes care of serializing operation properties to JSON +// +// We use a custom marhaller here to handle a special cases related to +// the Security field. We need to preserve zero length slice +// while omitting the field when the value is nil/unset. +func (op OperationProps) MarshalJSON() ([]byte, error) { + type Alias OperationProps + if op.Security == nil { + return json.Marshal(&struct { + Security []map[string][]string `json:"security,omitempty"` + *Alias + }{ + Security: op.Security, + Alias: (*Alias)(&op), + }) + } + return json.Marshal(&struct { + Security []map[string][]string `json:"security"` + *Alias + }{ + Security: op.Security, + Alias: (*Alias)(&op), + }) +} + +// Operation describes a single API operation on a path. +// +// For more information: http://goo.gl/8us55a#operationObject +type Operation struct { + VendorExtensible + OperationProps +} + +// SuccessResponse gets a success response model +func (o *Operation) SuccessResponse() (*Response, int, bool) { + if o.Responses == nil { + return nil, 0, false + } + + responseCodes := make([]int, 0, len(o.Responses.StatusCodeResponses)) + for k := range o.Responses.StatusCodeResponses { + if k >= 200 && k < 300 { + responseCodes = append(responseCodes, k) + } + } + if len(responseCodes) > 0 { + sort.Ints(responseCodes) + v := o.Responses.StatusCodeResponses[responseCodes[0]] + return &v, responseCodes[0], true + } + + return o.Responses.Default, 0, false +} + +// JSONLookup look up a value by the json property name +func (o Operation) JSONLookup(token string) (interface{}, error) { + if ex, ok := o.Extensions[token]; ok { + return &ex, nil + } + r, _, err := jsonpointer.GetForToken(o.OperationProps, token) + return r, err +} + +// UnmarshalJSON hydrates this items instance with the data from JSON +func (o *Operation) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &o.OperationProps); err != nil { + return err + } + return json.Unmarshal(data, &o.VendorExtensible) +} + +// MarshalJSON converts this items object to JSON +func (o Operation) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(o.OperationProps) + if err != nil { + return nil, err + } + b2, err := json.Marshal(o.VendorExtensible) + if err != nil { + return nil, err + } + concated := swag.ConcatJSON(b1, b2) + return concated, nil +} + +// NewOperation creates a new operation instance. +// It expects an ID as parameter but not passing an ID is also valid. +func NewOperation(id string) *Operation { + op := new(Operation) + op.ID = id + return op +} + +// WithID sets the ID property on this operation, allows for chaining. +func (o *Operation) WithID(id string) *Operation { + o.ID = id + return o +} + +// WithDescription sets the description on this operation, allows for chaining +func (o *Operation) WithDescription(description string) *Operation { + o.Description = description + return o +} + +// WithSummary sets the summary on this operation, allows for chaining +func (o *Operation) WithSummary(summary string) *Operation { + o.Summary = summary + return o +} + +// WithExternalDocs sets/removes the external docs for/from this operation. +// When you pass empty strings as params the external documents will be removed. +// When you pass non-empty string as one value then those values will be used on the external docs object. +// So when you pass a non-empty description, you should also pass the url and vice versa. +func (o *Operation) WithExternalDocs(description, url string) *Operation { + if description == "" && url == "" { + o.ExternalDocs = nil + return o + } + + if o.ExternalDocs == nil { + o.ExternalDocs = &ExternalDocumentation{} + } + o.ExternalDocs.Description = description + o.ExternalDocs.URL = url + return o +} + +// Deprecate marks the operation as deprecated +func (o *Operation) Deprecate() *Operation { + o.Deprecated = true + return o +} + +// Undeprecate marks the operation as not deprected +func (o *Operation) Undeprecate() *Operation { + o.Deprecated = false + return o +} + +// WithConsumes adds media types for incoming body values +func (o *Operation) WithConsumes(mediaTypes ...string) *Operation { + o.Consumes = append(o.Consumes, mediaTypes...) + return o +} + +// WithProduces adds media types for outgoing body values +func (o *Operation) WithProduces(mediaTypes ...string) *Operation { + o.Produces = append(o.Produces, mediaTypes...) + return o +} + +// WithTags adds tags for this operation +func (o *Operation) WithTags(tags ...string) *Operation { + o.Tags = append(o.Tags, tags...) + return o +} + +// AddParam adds a parameter to this operation, when a parameter for that location +// and with that name already exists it will be replaced +func (o *Operation) AddParam(param *Parameter) *Operation { + if param == nil { + return o + } + + for i, p := range o.Parameters { + if p.Name == param.Name && p.In == param.In { + params := append(o.Parameters[:i], *param) + params = append(params, o.Parameters[i+1:]...) + o.Parameters = params + return o + } + } + + o.Parameters = append(o.Parameters, *param) + return o +} + +// RemoveParam removes a parameter from the operation +func (o *Operation) RemoveParam(name, in string) *Operation { + for i, p := range o.Parameters { + if p.Name == name && p.In == in { + o.Parameters = append(o.Parameters[:i], o.Parameters[i+1:]...) + return o + } + } + return o +} + +// SecuredWith adds a security scope to this operation. +func (o *Operation) SecuredWith(name string, scopes ...string) *Operation { + o.Security = append(o.Security, map[string][]string{name: scopes}) + return o +} + +// WithDefaultResponse adds a default response to the operation. +// Passing a nil value will remove the response +func (o *Operation) WithDefaultResponse(response *Response) *Operation { + return o.RespondsWith(0, response) +} + +// RespondsWith adds a status code response to the operation. +// When the code is 0 the value of the response will be used as default response value. +// When the value of the response is nil it will be removed from the operation +func (o *Operation) RespondsWith(code int, response *Response) *Operation { + if o.Responses == nil { + o.Responses = new(Responses) + } + if code == 0 { + o.Responses.Default = response + return o + } + if response == nil { + delete(o.Responses.StatusCodeResponses, code) + return o + } + if o.Responses.StatusCodeResponses == nil { + o.Responses.StatusCodeResponses = make(map[int]Response) + } + o.Responses.StatusCodeResponses[code] = *response + return o +} + +type opsAlias OperationProps + +type gobAlias struct { + Security []map[string]struct { + List []string + Pad bool + } + Alias *opsAlias + SecurityIsEmpty bool +} + +// GobEncode provides a safe gob encoder for Operation, including empty security requirements +func (o Operation) GobEncode() ([]byte, error) { + raw := struct { + Ext VendorExtensible + Props OperationProps + }{ + Ext: o.VendorExtensible, + Props: o.OperationProps, + } + var b bytes.Buffer + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err +} + +// GobDecode provides a safe gob decoder for Operation, including empty security requirements +func (o *Operation) GobDecode(b []byte) error { + var raw struct { + Ext VendorExtensible + Props OperationProps + } + + buf := bytes.NewBuffer(b) + err := gob.NewDecoder(buf).Decode(&raw) + if err != nil { + return err + } + o.VendorExtensible = raw.Ext + o.OperationProps = raw.Props + return nil +} + +// GobEncode provides a safe gob encoder for Operation, including empty security requirements +func (op OperationProps) GobEncode() ([]byte, error) { + raw := gobAlias{ + Alias: (*opsAlias)(&op), + } + + var b bytes.Buffer + if op.Security == nil { + // nil security requirement + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err + } + + if len(op.Security) == 0 { + // empty, but non-nil security requirement + raw.SecurityIsEmpty = true + raw.Alias.Security = nil + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err + } + + raw.Security = make([]map[string]struct { + List []string + Pad bool + }, 0, len(op.Security)) + for _, req := range op.Security { + v := make(map[string]struct { + List []string + Pad bool + }, len(req)) + for k, val := range req { + v[k] = struct { + List []string + Pad bool + }{ + List: val, + } + } + raw.Security = append(raw.Security, v) + } + + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err +} + +// GobDecode provides a safe gob decoder for Operation, including empty security requirements +func (op *OperationProps) GobDecode(b []byte) error { + var raw gobAlias + + buf := bytes.NewBuffer(b) + err := gob.NewDecoder(buf).Decode(&raw) + if err != nil { + return err + } + if raw.Alias == nil { + return nil + } + + switch { + case raw.SecurityIsEmpty: + // empty, but non-nil security requirement + raw.Alias.Security = []map[string][]string{} + case len(raw.Alias.Security) == 0: + // nil security requirement + raw.Alias.Security = nil + default: + raw.Alias.Security = make([]map[string][]string, 0, len(raw.Security)) + for _, req := range raw.Security { + v := make(map[string][]string, len(req)) + for k, val := range req { + v[k] = make([]string, 0, len(val.List)) + v[k] = append(v[k], val.List...) + } + raw.Alias.Security = append(raw.Alias.Security, v) + } + } + + *op = *(*OperationProps)(raw.Alias) + return nil +} diff --git a/vendor/github.com/go-openapi/spec/parameter.go b/vendor/github.com/go-openapi/spec/parameter.go new file mode 100644 index 00000000000..2b2b89b67bf --- /dev/null +++ b/vendor/github.com/go-openapi/spec/parameter.go @@ -0,0 +1,326 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +// QueryParam creates a query parameter +func QueryParam(name string) *Parameter { + return &Parameter{ParamProps: ParamProps{Name: name, In: "query"}} +} + +// HeaderParam creates a header parameter, this is always required by default +func HeaderParam(name string) *Parameter { + return &Parameter{ParamProps: ParamProps{Name: name, In: "header", Required: true}} +} + +// PathParam creates a path parameter, this is always required +func PathParam(name string) *Parameter { + return &Parameter{ParamProps: ParamProps{Name: name, In: "path", Required: true}} +} + +// BodyParam creates a body parameter +func BodyParam(name string, schema *Schema) *Parameter { + return &Parameter{ParamProps: ParamProps{Name: name, In: "body", Schema: schema}} +} + +// FormDataParam creates a body parameter +func FormDataParam(name string) *Parameter { + return &Parameter{ParamProps: ParamProps{Name: name, In: "formData"}} +} + +// FileParam creates a body parameter +func FileParam(name string) *Parameter { + return &Parameter{ParamProps: ParamProps{Name: name, In: "formData"}, + SimpleSchema: SimpleSchema{Type: "file"}} +} + +// SimpleArrayParam creates a param for a simple array (string, int, date etc) +func SimpleArrayParam(name, tpe, fmt string) *Parameter { + return &Parameter{ParamProps: ParamProps{Name: name}, + SimpleSchema: SimpleSchema{Type: jsonArray, CollectionFormat: "csv", + Items: &Items{SimpleSchema: SimpleSchema{Type: tpe, Format: fmt}}}} +} + +// ParamRef creates a parameter that's a json reference +func ParamRef(uri string) *Parameter { + p := new(Parameter) + p.Ref = MustCreateRef(uri) + return p +} + +// ParamProps describes the specific attributes of an operation parameter +// +// NOTE: +// - Schema is defined when "in" == "body": see validate +// - AllowEmptyValue is allowed where "in" == "query" || "formData" +type ParamProps struct { + Description string `json:"description,omitempty"` + Name string `json:"name,omitempty"` + In string `json:"in,omitempty"` + Required bool `json:"required,omitempty"` + Schema *Schema `json:"schema,omitempty"` + AllowEmptyValue bool `json:"allowEmptyValue,omitempty"` +} + +// Parameter a unique parameter is defined by a combination of a [name](#parameterName) and [location](#parameterIn). +// +// There are five possible parameter types. +// * Path - Used together with [Path Templating](#pathTemplating), where the parameter value is actually part +// of the operation's URL. This does not include the host or base path of the API. For example, in `/items/{itemId}`, +// the path parameter is `itemId`. +// * Query - Parameters that are appended to the URL. For example, in `/items?id=###`, the query parameter is `id`. +// * Header - Custom headers that are expected as part of the request. +// * Body - The payload that's appended to the HTTP request. Since there can only be one payload, there can only be +// _one_ body parameter. The name of the body parameter has no effect on the parameter itself and is used for +// documentation purposes only. Since Form parameters are also in the payload, body and form parameters cannot exist +// together for the same operation. +// * Form - Used to describe the payload of an HTTP request when either `application/x-www-form-urlencoded` or +// `multipart/form-data` are used as the content type of the request (in Swagger's definition, +// the [`consumes`](#operationConsumes) property of an operation). This is the only parameter type that can be used +// to send files, thus supporting the `file` type. Since form parameters are sent in the payload, they cannot be +// declared together with a body parameter for the same operation. Form parameters have a different format based on +// the content-type used (for further details, consult http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4). +// * `application/x-www-form-urlencoded` - Similar to the format of Query parameters but as a payload. +// For example, `foo=1&bar=swagger` - both `foo` and `bar` are form parameters. This is normally used for simple +// parameters that are being transferred. +// * `multipart/form-data` - each parameter takes a section in the payload with an internal header. +// For example, for the header `Content-Disposition: form-data; name="submit-name"` the name of the parameter is +// `submit-name`. This type of form parameters is more commonly used for file transfers. +// +// For more information: http://goo.gl/8us55a#parameterObject +type Parameter struct { + Refable + CommonValidations + SimpleSchema + VendorExtensible + ParamProps +} + +// JSONLookup look up a value by the json property name +func (p Parameter) JSONLookup(token string) (interface{}, error) { + if ex, ok := p.Extensions[token]; ok { + return &ex, nil + } + if token == jsonRef { + return &p.Ref, nil + } + + r, _, err := jsonpointer.GetForToken(p.CommonValidations, token) + if err != nil && !strings.HasPrefix(err.Error(), "object has no field") { + return nil, err + } + if r != nil { + return r, nil + } + r, _, err = jsonpointer.GetForToken(p.SimpleSchema, token) + if err != nil && !strings.HasPrefix(err.Error(), "object has no field") { + return nil, err + } + if r != nil { + return r, nil + } + r, _, err = jsonpointer.GetForToken(p.ParamProps, token) + return r, err +} + +// WithDescription a fluent builder method for the description of the parameter +func (p *Parameter) WithDescription(description string) *Parameter { + p.Description = description + return p +} + +// Named a fluent builder method to override the name of the parameter +func (p *Parameter) Named(name string) *Parameter { + p.Name = name + return p +} + +// WithLocation a fluent builder method to override the location of the parameter +func (p *Parameter) WithLocation(in string) *Parameter { + p.In = in + return p +} + +// Typed a fluent builder method for the type of the parameter value +func (p *Parameter) Typed(tpe, format string) *Parameter { + p.Type = tpe + p.Format = format + return p +} + +// CollectionOf a fluent builder method for an array parameter +func (p *Parameter) CollectionOf(items *Items, format string) *Parameter { + p.Type = jsonArray + p.Items = items + p.CollectionFormat = format + return p +} + +// WithDefault sets the default value on this parameter +func (p *Parameter) WithDefault(defaultValue interface{}) *Parameter { + p.AsOptional() // with default implies optional + p.Default = defaultValue + return p +} + +// AllowsEmptyValues flags this parameter as being ok with empty values +func (p *Parameter) AllowsEmptyValues() *Parameter { + p.AllowEmptyValue = true + return p +} + +// NoEmptyValues flags this parameter as not liking empty values +func (p *Parameter) NoEmptyValues() *Parameter { + p.AllowEmptyValue = false + return p +} + +// AsOptional flags this parameter as optional +func (p *Parameter) AsOptional() *Parameter { + p.Required = false + return p +} + +// AsRequired flags this parameter as required +func (p *Parameter) AsRequired() *Parameter { + if p.Default != nil { // with a default required makes no sense + return p + } + p.Required = true + return p +} + +// WithMaxLength sets a max length value +func (p *Parameter) WithMaxLength(max int64) *Parameter { + p.MaxLength = &max + return p +} + +// WithMinLength sets a min length value +func (p *Parameter) WithMinLength(min int64) *Parameter { + p.MinLength = &min + return p +} + +// WithPattern sets a pattern value +func (p *Parameter) WithPattern(pattern string) *Parameter { + p.Pattern = pattern + return p +} + +// WithMultipleOf sets a multiple of value +func (p *Parameter) WithMultipleOf(number float64) *Parameter { + p.MultipleOf = &number + return p +} + +// WithMaximum sets a maximum number value +func (p *Parameter) WithMaximum(max float64, exclusive bool) *Parameter { + p.Maximum = &max + p.ExclusiveMaximum = exclusive + return p +} + +// WithMinimum sets a minimum number value +func (p *Parameter) WithMinimum(min float64, exclusive bool) *Parameter { + p.Minimum = &min + p.ExclusiveMinimum = exclusive + return p +} + +// WithEnum sets a the enum values (replace) +func (p *Parameter) WithEnum(values ...interface{}) *Parameter { + p.Enum = append([]interface{}{}, values...) + return p +} + +// WithMaxItems sets the max items +func (p *Parameter) WithMaxItems(size int64) *Parameter { + p.MaxItems = &size + return p +} + +// WithMinItems sets the min items +func (p *Parameter) WithMinItems(size int64) *Parameter { + p.MinItems = &size + return p +} + +// UniqueValues dictates that this array can only have unique items +func (p *Parameter) UniqueValues() *Parameter { + p.UniqueItems = true + return p +} + +// AllowDuplicates this array can have duplicates +func (p *Parameter) AllowDuplicates() *Parameter { + p.UniqueItems = false + return p +} + +// WithValidations is a fluent method to set parameter validations +func (p *Parameter) WithValidations(val CommonValidations) *Parameter { + p.SetValidations(SchemaValidations{CommonValidations: val}) + return p +} + +// UnmarshalJSON hydrates this items instance with the data from JSON +func (p *Parameter) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &p.CommonValidations); err != nil { + return err + } + if err := json.Unmarshal(data, &p.Refable); err != nil { + return err + } + if err := json.Unmarshal(data, &p.SimpleSchema); err != nil { + return err + } + if err := json.Unmarshal(data, &p.VendorExtensible); err != nil { + return err + } + return json.Unmarshal(data, &p.ParamProps) +} + +// MarshalJSON converts this items object to JSON +func (p Parameter) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(p.CommonValidations) + if err != nil { + return nil, err + } + b2, err := json.Marshal(p.SimpleSchema) + if err != nil { + return nil, err + } + b3, err := json.Marshal(p.Refable) + if err != nil { + return nil, err + } + b4, err := json.Marshal(p.VendorExtensible) + if err != nil { + return nil, err + } + b5, err := json.Marshal(p.ParamProps) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b3, b1, b2, b4, b5), nil +} diff --git a/vendor/github.com/go-openapi/spec/path_item.go b/vendor/github.com/go-openapi/spec/path_item.go new file mode 100644 index 00000000000..68fc8e90144 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/path_item.go @@ -0,0 +1,87 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +// PathItemProps the path item specific properties +type PathItemProps struct { + Get *Operation `json:"get,omitempty"` + Put *Operation `json:"put,omitempty"` + Post *Operation `json:"post,omitempty"` + Delete *Operation `json:"delete,omitempty"` + Options *Operation `json:"options,omitempty"` + Head *Operation `json:"head,omitempty"` + Patch *Operation `json:"patch,omitempty"` + Parameters []Parameter `json:"parameters,omitempty"` +} + +// PathItem describes the operations available on a single path. +// A Path Item may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering). +// The path itself is still exposed to the documentation viewer but they will +// not know which operations and parameters are available. +// +// For more information: http://goo.gl/8us55a#pathItemObject +type PathItem struct { + Refable + VendorExtensible + PathItemProps +} + +// JSONLookup look up a value by the json property name +func (p PathItem) JSONLookup(token string) (interface{}, error) { + if ex, ok := p.Extensions[token]; ok { + return &ex, nil + } + if token == jsonRef { + return &p.Ref, nil + } + r, _, err := jsonpointer.GetForToken(p.PathItemProps, token) + return r, err +} + +// UnmarshalJSON hydrates this items instance with the data from JSON +func (p *PathItem) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &p.Refable); err != nil { + return err + } + if err := json.Unmarshal(data, &p.VendorExtensible); err != nil { + return err + } + return json.Unmarshal(data, &p.PathItemProps) +} + +// MarshalJSON converts this items object to JSON +func (p PathItem) MarshalJSON() ([]byte, error) { + b3, err := json.Marshal(p.Refable) + if err != nil { + return nil, err + } + b4, err := json.Marshal(p.VendorExtensible) + if err != nil { + return nil, err + } + b5, err := json.Marshal(p.PathItemProps) + if err != nil { + return nil, err + } + concated := swag.ConcatJSON(b3, b4, b5) + return concated, nil +} diff --git a/vendor/github.com/go-openapi/spec/paths.go b/vendor/github.com/go-openapi/spec/paths.go new file mode 100644 index 00000000000..9dc82a2901d --- /dev/null +++ b/vendor/github.com/go-openapi/spec/paths.go @@ -0,0 +1,97 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "fmt" + "strings" + + "github.com/go-openapi/swag" +) + +// Paths holds the relative paths to the individual endpoints. +// The path is appended to the [`basePath`](http://goo.gl/8us55a#swaggerBasePath) in order +// to construct the full URL. +// The Paths may be empty, due to [ACL constraints](http://goo.gl/8us55a#securityFiltering). +// +// For more information: http://goo.gl/8us55a#pathsObject +type Paths struct { + VendorExtensible + Paths map[string]PathItem `json:"-"` // custom serializer to flatten this, each entry must start with "/" +} + +// JSONLookup look up a value by the json property name +func (p Paths) JSONLookup(token string) (interface{}, error) { + if pi, ok := p.Paths[token]; ok { + return &pi, nil + } + if ex, ok := p.Extensions[token]; ok { + return &ex, nil + } + return nil, fmt.Errorf("object has no field %q", token) +} + +// UnmarshalJSON hydrates this items instance with the data from JSON +func (p *Paths) UnmarshalJSON(data []byte) error { + var res map[string]json.RawMessage + if err := json.Unmarshal(data, &res); err != nil { + return err + } + for k, v := range res { + if strings.HasPrefix(strings.ToLower(k), "x-") { + if p.Extensions == nil { + p.Extensions = make(map[string]interface{}) + } + var d interface{} + if err := json.Unmarshal(v, &d); err != nil { + return err + } + p.Extensions[k] = d + } + if strings.HasPrefix(k, "/") { + if p.Paths == nil { + p.Paths = make(map[string]PathItem) + } + var pi PathItem + if err := json.Unmarshal(v, &pi); err != nil { + return err + } + p.Paths[k] = pi + } + } + return nil +} + +// MarshalJSON converts this items object to JSON +func (p Paths) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(p.VendorExtensible) + if err != nil { + return nil, err + } + + pths := make(map[string]PathItem) + for k, v := range p.Paths { + if strings.HasPrefix(k, "/") { + pths[k] = v + } + } + b2, err := json.Marshal(pths) + if err != nil { + return nil, err + } + concated := swag.ConcatJSON(b1, b2) + return concated, nil +} diff --git a/vendor/github.com/go-openapi/spec/properties.go b/vendor/github.com/go-openapi/spec/properties.go new file mode 100644 index 00000000000..2af13787ab1 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/properties.go @@ -0,0 +1,91 @@ +package spec + +import ( + "bytes" + "encoding/json" + "reflect" + "sort" +) + +// OrderSchemaItem holds a named schema (e.g. from a property of an object) +type OrderSchemaItem struct { + Name string + Schema +} + +// OrderSchemaItems is a sortable slice of named schemas. +// The ordering is defined by the x-order schema extension. +type OrderSchemaItems []OrderSchemaItem + +// MarshalJSON produces a json object with keys defined by the name schemas +// of the OrderSchemaItems slice, keeping the original order of the slice. +func (items OrderSchemaItems) MarshalJSON() ([]byte, error) { + buf := bytes.NewBuffer(nil) + buf.WriteString("{") + for i := range items { + if i > 0 { + buf.WriteString(",") + } + buf.WriteString("\"") + buf.WriteString(items[i].Name) + buf.WriteString("\":") + bs, err := json.Marshal(&items[i].Schema) + if err != nil { + return nil, err + } + buf.Write(bs) + } + buf.WriteString("}") + return buf.Bytes(), nil +} + +func (items OrderSchemaItems) Len() int { return len(items) } +func (items OrderSchemaItems) Swap(i, j int) { items[i], items[j] = items[j], items[i] } +func (items OrderSchemaItems) Less(i, j int) (ret bool) { + ii, oki := items[i].Extensions.GetString("x-order") + ij, okj := items[j].Extensions.GetString("x-order") + if oki { + if okj { + defer func() { + if err := recover(); err != nil { + defer func() { + if err = recover(); err != nil { + ret = items[i].Name < items[j].Name + } + }() + ret = reflect.ValueOf(ii).String() < reflect.ValueOf(ij).String() + } + }() + return reflect.ValueOf(ii).Int() < reflect.ValueOf(ij).Int() + } + return true + } else if okj { + return false + } + return items[i].Name < items[j].Name +} + +// SchemaProperties is a map representing the properties of a Schema object. +// It knows how to transform its keys into an ordered slice. +type SchemaProperties map[string]Schema + +// ToOrderedSchemaItems transforms the map of properties into a sortable slice +func (properties SchemaProperties) ToOrderedSchemaItems() OrderSchemaItems { + items := make(OrderSchemaItems, 0, len(properties)) + for k, v := range properties { + items = append(items, OrderSchemaItem{ + Name: k, + Schema: v, + }) + } + sort.Sort(items) + return items +} + +// MarshalJSON produces properties as json, keeping their order. +func (properties SchemaProperties) MarshalJSON() ([]byte, error) { + if properties == nil { + return []byte("null"), nil + } + return json.Marshal(properties.ToOrderedSchemaItems()) +} diff --git a/vendor/github.com/go-openapi/spec/ref.go b/vendor/github.com/go-openapi/spec/ref.go new file mode 100644 index 00000000000..b0ef9bd9c9b --- /dev/null +++ b/vendor/github.com/go-openapi/spec/ref.go @@ -0,0 +1,193 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "bytes" + "encoding/gob" + "encoding/json" + "net/http" + "os" + "path/filepath" + + "github.com/go-openapi/jsonreference" +) + +// Refable is a struct for things that accept a $ref property +type Refable struct { + Ref Ref +} + +// MarshalJSON marshals the ref to json +func (r Refable) MarshalJSON() ([]byte, error) { + return r.Ref.MarshalJSON() +} + +// UnmarshalJSON unmarshalss the ref from json +func (r *Refable) UnmarshalJSON(d []byte) error { + return json.Unmarshal(d, &r.Ref) +} + +// Ref represents a json reference that is potentially resolved +type Ref struct { + jsonreference.Ref +} + +// RemoteURI gets the remote uri part of the ref +func (r *Ref) RemoteURI() string { + if r.String() == "" { + return "" + } + + u := *r.GetURL() + u.Fragment = "" + return u.String() +} + +// IsValidURI returns true when the url the ref points to can be found +func (r *Ref) IsValidURI(basepaths ...string) bool { + if r.String() == "" { + return true + } + + v := r.RemoteURI() + if v == "" { + return true + } + + if r.HasFullURL { + //nolint:noctx,gosec + rr, err := http.Get(v) + if err != nil { + return false + } + defer rr.Body.Close() + + return rr.StatusCode/100 == 2 + } + + if !(r.HasFileScheme || r.HasFullFilePath || r.HasURLPathOnly) { + return false + } + + // check for local file + pth := v + if r.HasURLPathOnly { + base := "." + if len(basepaths) > 0 { + base = filepath.Dir(filepath.Join(basepaths...)) + } + p, e := filepath.Abs(filepath.ToSlash(filepath.Join(base, pth))) + if e != nil { + return false + } + pth = p + } + + fi, err := os.Stat(filepath.ToSlash(pth)) + if err != nil { + return false + } + + return !fi.IsDir() +} + +// Inherits creates a new reference from a parent and a child +// If the child cannot inherit from the parent, an error is returned +func (r *Ref) Inherits(child Ref) (*Ref, error) { + ref, err := r.Ref.Inherits(child.Ref) + if err != nil { + return nil, err + } + return &Ref{Ref: *ref}, nil +} + +// NewRef creates a new instance of a ref object +// returns an error when the reference uri is an invalid uri +func NewRef(refURI string) (Ref, error) { + ref, err := jsonreference.New(refURI) + if err != nil { + return Ref{}, err + } + return Ref{Ref: ref}, nil +} + +// MustCreateRef creates a ref object but panics when refURI is invalid. +// Use the NewRef method for a version that returns an error. +func MustCreateRef(refURI string) Ref { + return Ref{Ref: jsonreference.MustCreateRef(refURI)} +} + +// MarshalJSON marshals this ref into a JSON object +func (r Ref) MarshalJSON() ([]byte, error) { + str := r.String() + if str == "" { + if r.IsRoot() { + return []byte(`{"$ref":""}`), nil + } + return []byte("{}"), nil + } + v := map[string]interface{}{"$ref": str} + return json.Marshal(v) +} + +// UnmarshalJSON unmarshals this ref from a JSON object +func (r *Ref) UnmarshalJSON(d []byte) error { + var v map[string]interface{} + if err := json.Unmarshal(d, &v); err != nil { + return err + } + return r.fromMap(v) +} + +// GobEncode provides a safe gob encoder for Ref +func (r Ref) GobEncode() ([]byte, error) { + var b bytes.Buffer + raw, err := r.MarshalJSON() + if err != nil { + return nil, err + } + err = gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err +} + +// GobDecode provides a safe gob decoder for Ref +func (r *Ref) GobDecode(b []byte) error { + var raw []byte + buf := bytes.NewBuffer(b) + err := gob.NewDecoder(buf).Decode(&raw) + if err != nil { + return err + } + return json.Unmarshal(raw, r) +} + +func (r *Ref) fromMap(v map[string]interface{}) error { + if v == nil { + return nil + } + + if vv, ok := v["$ref"]; ok { + if str, ok := vv.(string); ok { + ref, err := jsonreference.New(str) + if err != nil { + return err + } + *r = Ref{Ref: ref} + } + } + + return nil +} diff --git a/vendor/github.com/go-openapi/spec/resolver.go b/vendor/github.com/go-openapi/spec/resolver.go new file mode 100644 index 00000000000..47d1ee13fc7 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/resolver.go @@ -0,0 +1,127 @@ +package spec + +import ( + "fmt" + + "github.com/go-openapi/swag" +) + +func resolveAnyWithBase(root interface{}, ref *Ref, result interface{}, options *ExpandOptions) error { + options = optionsOrDefault(options) + resolver := defaultSchemaLoader(root, options, nil, nil) + + if err := resolver.Resolve(ref, result, options.RelativeBase); err != nil { + return err + } + + return nil +} + +// ResolveRefWithBase resolves a reference against a context root with preservation of base path +func ResolveRefWithBase(root interface{}, ref *Ref, options *ExpandOptions) (*Schema, error) { + result := new(Schema) + + if err := resolveAnyWithBase(root, ref, result, options); err != nil { + return nil, err + } + + return result, nil +} + +// ResolveRef resolves a reference for a schema against a context root +// ref is guaranteed to be in root (no need to go to external files) +// +// ResolveRef is ONLY called from the code generation module +func ResolveRef(root interface{}, ref *Ref) (*Schema, error) { + res, _, err := ref.GetPointer().Get(root) + if err != nil { + return nil, err + } + + switch sch := res.(type) { + case Schema: + return &sch, nil + case *Schema: + return sch, nil + case map[string]interface{}: + newSch := new(Schema) + if err = swag.DynamicJSONToStruct(sch, newSch); err != nil { + return nil, err + } + return newSch, nil + default: + return nil, fmt.Errorf("type: %T: %w", sch, ErrUnknownTypeForReference) + } +} + +// ResolveParameterWithBase resolves a parameter reference against a context root and base path +func ResolveParameterWithBase(root interface{}, ref Ref, options *ExpandOptions) (*Parameter, error) { + result := new(Parameter) + + if err := resolveAnyWithBase(root, &ref, result, options); err != nil { + return nil, err + } + + return result, nil +} + +// ResolveParameter resolves a parameter reference against a context root +func ResolveParameter(root interface{}, ref Ref) (*Parameter, error) { + return ResolveParameterWithBase(root, ref, nil) +} + +// ResolveResponseWithBase resolves response a reference against a context root and base path +func ResolveResponseWithBase(root interface{}, ref Ref, options *ExpandOptions) (*Response, error) { + result := new(Response) + + err := resolveAnyWithBase(root, &ref, result, options) + if err != nil { + return nil, err + } + + return result, nil +} + +// ResolveResponse resolves response a reference against a context root +func ResolveResponse(root interface{}, ref Ref) (*Response, error) { + return ResolveResponseWithBase(root, ref, nil) +} + +// ResolvePathItemWithBase resolves response a path item against a context root and base path +func ResolvePathItemWithBase(root interface{}, ref Ref, options *ExpandOptions) (*PathItem, error) { + result := new(PathItem) + + if err := resolveAnyWithBase(root, &ref, result, options); err != nil { + return nil, err + } + + return result, nil +} + +// ResolvePathItem resolves response a path item against a context root and base path +// +// Deprecated: use ResolvePathItemWithBase instead +func ResolvePathItem(root interface{}, ref Ref, options *ExpandOptions) (*PathItem, error) { + return ResolvePathItemWithBase(root, ref, options) +} + +// ResolveItemsWithBase resolves parameter items reference against a context root and base path. +// +// NOTE: stricly speaking, this construct is not supported by Swagger 2.0. +// Similarly, $ref are forbidden in response headers. +func ResolveItemsWithBase(root interface{}, ref Ref, options *ExpandOptions) (*Items, error) { + result := new(Items) + + if err := resolveAnyWithBase(root, &ref, result, options); err != nil { + return nil, err + } + + return result, nil +} + +// ResolveItems resolves parameter items reference against a context root and base path. +// +// Deprecated: use ResolveItemsWithBase instead +func ResolveItems(root interface{}, ref Ref, options *ExpandOptions) (*Items, error) { + return ResolveItemsWithBase(root, ref, options) +} diff --git a/vendor/github.com/go-openapi/spec/response.go b/vendor/github.com/go-openapi/spec/response.go new file mode 100644 index 00000000000..0340b60d845 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/response.go @@ -0,0 +1,152 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +// ResponseProps properties specific to a response +type ResponseProps struct { + Description string `json:"description"` + Schema *Schema `json:"schema,omitempty"` + Headers map[string]Header `json:"headers,omitempty"` + Examples map[string]interface{} `json:"examples,omitempty"` +} + +// Response describes a single response from an API Operation. +// +// For more information: http://goo.gl/8us55a#responseObject +type Response struct { + Refable + ResponseProps + VendorExtensible +} + +// JSONLookup look up a value by the json property name +func (r Response) JSONLookup(token string) (interface{}, error) { + if ex, ok := r.Extensions[token]; ok { + return &ex, nil + } + if token == "$ref" { + return &r.Ref, nil + } + ptr, _, err := jsonpointer.GetForToken(r.ResponseProps, token) + return ptr, err +} + +// UnmarshalJSON hydrates this items instance with the data from JSON +func (r *Response) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &r.ResponseProps); err != nil { + return err + } + if err := json.Unmarshal(data, &r.Refable); err != nil { + return err + } + return json.Unmarshal(data, &r.VendorExtensible) +} + +// MarshalJSON converts this items object to JSON +func (r Response) MarshalJSON() ([]byte, error) { + var ( + b1 []byte + err error + ) + + if r.Ref.String() == "" { + // when there is no $ref, empty description is rendered as an empty string + b1, err = json.Marshal(r.ResponseProps) + } else { + // when there is $ref inside the schema, description should be omitempty-ied + b1, err = json.Marshal(struct { + Description string `json:"description,omitempty"` + Schema *Schema `json:"schema,omitempty"` + Headers map[string]Header `json:"headers,omitempty"` + Examples map[string]interface{} `json:"examples,omitempty"` + }{ + Description: r.ResponseProps.Description, + Schema: r.ResponseProps.Schema, + Examples: r.ResponseProps.Examples, + }) + } + if err != nil { + return nil, err + } + + b2, err := json.Marshal(r.Refable) + if err != nil { + return nil, err + } + b3, err := json.Marshal(r.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2, b3), nil +} + +// NewResponse creates a new response instance +func NewResponse() *Response { + return new(Response) +} + +// ResponseRef creates a response as a json reference +func ResponseRef(url string) *Response { + resp := NewResponse() + resp.Ref = MustCreateRef(url) + return resp +} + +// WithDescription sets the description on this response, allows for chaining +func (r *Response) WithDescription(description string) *Response { + r.Description = description + return r +} + +// WithSchema sets the schema on this response, allows for chaining. +// Passing a nil argument removes the schema from this response +func (r *Response) WithSchema(schema *Schema) *Response { + r.Schema = schema + return r +} + +// AddHeader adds a header to this response +func (r *Response) AddHeader(name string, header *Header) *Response { + if header == nil { + return r.RemoveHeader(name) + } + if r.Headers == nil { + r.Headers = make(map[string]Header) + } + r.Headers[name] = *header + return r +} + +// RemoveHeader removes a header from this response +func (r *Response) RemoveHeader(name string) *Response { + delete(r.Headers, name) + return r +} + +// AddExample adds an example to this response +func (r *Response) AddExample(mediaType string, example interface{}) *Response { + if r.Examples == nil { + r.Examples = make(map[string]interface{}) + } + r.Examples[mediaType] = example + return r +} diff --git a/vendor/github.com/go-openapi/spec/responses.go b/vendor/github.com/go-openapi/spec/responses.go new file mode 100644 index 00000000000..4efb6f868bd --- /dev/null +++ b/vendor/github.com/go-openapi/spec/responses.go @@ -0,0 +1,127 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "fmt" + "reflect" + "strconv" + + "github.com/go-openapi/swag" +) + +// Responses is a container for the expected responses of an operation. +// The container maps a HTTP response code to the expected response. +// It is not expected from the documentation to necessarily cover all possible HTTP response codes, +// since they may not be known in advance. However, it is expected from the documentation to cover +// a successful operation response and any known errors. +// +// The `default` can be used a default response object for all HTTP codes that are not covered +// individually by the specification. +// +// The `Responses Object` MUST contain at least one response code, and it SHOULD be the response +// for a successful operation call. +// +// For more information: http://goo.gl/8us55a#responsesObject +type Responses struct { + VendorExtensible + ResponsesProps +} + +// JSONLookup implements an interface to customize json pointer lookup +func (r Responses) JSONLookup(token string) (interface{}, error) { + if token == "default" { + return r.Default, nil + } + if ex, ok := r.Extensions[token]; ok { + return &ex, nil + } + if i, err := strconv.Atoi(token); err == nil { + if scr, ok := r.StatusCodeResponses[i]; ok { + return scr, nil + } + } + return nil, fmt.Errorf("object has no field %q", token) +} + +// UnmarshalJSON hydrates this items instance with the data from JSON +func (r *Responses) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &r.ResponsesProps); err != nil { + return err + } + if err := json.Unmarshal(data, &r.VendorExtensible); err != nil { + return err + } + if reflect.DeepEqual(ResponsesProps{}, r.ResponsesProps) { + r.ResponsesProps = ResponsesProps{} + } + return nil +} + +// MarshalJSON converts this items object to JSON +func (r Responses) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(r.ResponsesProps) + if err != nil { + return nil, err + } + b2, err := json.Marshal(r.VendorExtensible) + if err != nil { + return nil, err + } + concated := swag.ConcatJSON(b1, b2) + return concated, nil +} + +// ResponsesProps describes all responses for an operation. +// It tells what is the default response and maps all responses with a +// HTTP status code. +type ResponsesProps struct { + Default *Response + StatusCodeResponses map[int]Response +} + +// MarshalJSON marshals responses as JSON +func (r ResponsesProps) MarshalJSON() ([]byte, error) { + toser := map[string]Response{} + if r.Default != nil { + toser["default"] = *r.Default + } + for k, v := range r.StatusCodeResponses { + toser[strconv.Itoa(k)] = v + } + return json.Marshal(toser) +} + +// UnmarshalJSON unmarshals responses from JSON +func (r *ResponsesProps) UnmarshalJSON(data []byte) error { + var res map[string]Response + if err := json.Unmarshal(data, &res); err != nil { + return nil + } + if v, ok := res["default"]; ok { + r.Default = &v + delete(res, "default") + } + for k, v := range res { + if nk, err := strconv.Atoi(k); err == nil { + if r.StatusCodeResponses == nil { + r.StatusCodeResponses = map[int]Response{} + } + r.StatusCodeResponses[nk] = v + } + } + return nil +} diff --git a/vendor/github.com/go-openapi/spec/schema.go b/vendor/github.com/go-openapi/spec/schema.go new file mode 100644 index 00000000000..a8d0f737a7a --- /dev/null +++ b/vendor/github.com/go-openapi/spec/schema.go @@ -0,0 +1,646 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "fmt" + "net/url" + "strings" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +// BooleanProperty creates a boolean property +func BooleanProperty() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"boolean"}}} +} + +// BoolProperty creates a boolean property +func BoolProperty() *Schema { return BooleanProperty() } + +// StringProperty creates a string property +func StringProperty() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}}} +} + +// CharProperty creates a string property +func CharProperty() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}}} +} + +// Float64Property creates a float64/double property +func Float64Property() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"number"}, Format: "double"}} +} + +// Float32Property creates a float32/float property +func Float32Property() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"number"}, Format: "float"}} +} + +// Int8Property creates an int8 property +func Int8Property() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int8"}} +} + +// Int16Property creates an int16 property +func Int16Property() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int16"}} +} + +// Int32Property creates an int32 property +func Int32Property() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int32"}} +} + +// Int64Property creates an int64 property +func Int64Property() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"integer"}, Format: "int64"}} +} + +// StrFmtProperty creates a property for the named string format +func StrFmtProperty(format string) *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}, Format: format}} +} + +// DateProperty creates a date property +func DateProperty() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}, Format: "date"}} +} + +// DateTimeProperty creates a date time property +func DateTimeProperty() *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"string"}, Format: "date-time"}} +} + +// MapProperty creates a map property +func MapProperty(property *Schema) *Schema { + return &Schema{SchemaProps: SchemaProps{Type: []string{"object"}, + AdditionalProperties: &SchemaOrBool{Allows: true, Schema: property}}} +} + +// RefProperty creates a ref property +func RefProperty(name string) *Schema { + return &Schema{SchemaProps: SchemaProps{Ref: MustCreateRef(name)}} +} + +// RefSchema creates a ref property +func RefSchema(name string) *Schema { + return &Schema{SchemaProps: SchemaProps{Ref: MustCreateRef(name)}} +} + +// ArrayProperty creates an array property +func ArrayProperty(items *Schema) *Schema { + if items == nil { + return &Schema{SchemaProps: SchemaProps{Type: []string{"array"}}} + } + return &Schema{SchemaProps: SchemaProps{Items: &SchemaOrArray{Schema: items}, Type: []string{"array"}}} +} + +// ComposedSchema creates a schema with allOf +func ComposedSchema(schemas ...Schema) *Schema { + s := new(Schema) + s.AllOf = schemas + return s +} + +// SchemaURL represents a schema url +type SchemaURL string + +// MarshalJSON marshal this to JSON +func (r SchemaURL) MarshalJSON() ([]byte, error) { + if r == "" { + return []byte("{}"), nil + } + v := map[string]interface{}{"$schema": string(r)} + return json.Marshal(v) +} + +// UnmarshalJSON unmarshal this from JSON +func (r *SchemaURL) UnmarshalJSON(data []byte) error { + var v map[string]interface{} + if err := json.Unmarshal(data, &v); err != nil { + return err + } + return r.fromMap(v) +} + +func (r *SchemaURL) fromMap(v map[string]interface{}) error { + if v == nil { + return nil + } + if vv, ok := v["$schema"]; ok { + if str, ok := vv.(string); ok { + u, err := url.Parse(str) + if err != nil { + return err + } + + *r = SchemaURL(u.String()) + } + } + return nil +} + +// SchemaProps describes a JSON schema (draft 4) +type SchemaProps struct { + ID string `json:"id,omitempty"` + Ref Ref `json:"-"` + Schema SchemaURL `json:"-"` + Description string `json:"description,omitempty"` + Type StringOrArray `json:"type,omitempty"` + Nullable bool `json:"nullable,omitempty"` + Format string `json:"format,omitempty"` + Title string `json:"title,omitempty"` + Default interface{} `json:"default,omitempty"` + Maximum *float64 `json:"maximum,omitempty"` + ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` + Minimum *float64 `json:"minimum,omitempty"` + ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"` + MaxLength *int64 `json:"maxLength,omitempty"` + MinLength *int64 `json:"minLength,omitempty"` + Pattern string `json:"pattern,omitempty"` + MaxItems *int64 `json:"maxItems,omitempty"` + MinItems *int64 `json:"minItems,omitempty"` + UniqueItems bool `json:"uniqueItems,omitempty"` + MultipleOf *float64 `json:"multipleOf,omitempty"` + Enum []interface{} `json:"enum,omitempty"` + MaxProperties *int64 `json:"maxProperties,omitempty"` + MinProperties *int64 `json:"minProperties,omitempty"` + Required []string `json:"required,omitempty"` + Items *SchemaOrArray `json:"items,omitempty"` + AllOf []Schema `json:"allOf,omitempty"` + OneOf []Schema `json:"oneOf,omitempty"` + AnyOf []Schema `json:"anyOf,omitempty"` + Not *Schema `json:"not,omitempty"` + Properties SchemaProperties `json:"properties,omitempty"` + AdditionalProperties *SchemaOrBool `json:"additionalProperties,omitempty"` + PatternProperties SchemaProperties `json:"patternProperties,omitempty"` + Dependencies Dependencies `json:"dependencies,omitempty"` + AdditionalItems *SchemaOrBool `json:"additionalItems,omitempty"` + Definitions Definitions `json:"definitions,omitempty"` +} + +// SwaggerSchemaProps are additional properties supported by swagger schemas, but not JSON-schema (draft 4) +type SwaggerSchemaProps struct { + Discriminator string `json:"discriminator,omitempty"` + ReadOnly bool `json:"readOnly,omitempty"` + XML *XMLObject `json:"xml,omitempty"` + ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` + Example interface{} `json:"example,omitempty"` +} + +// Schema the schema object allows the definition of input and output data types. +// These types can be objects, but also primitives and arrays. +// This object is based on the [JSON Schema Specification Draft 4](http://json-schema.org/) +// and uses a predefined subset of it. +// On top of this subset, there are extensions provided by this specification to allow for more complete documentation. +// +// For more information: http://goo.gl/8us55a#schemaObject +type Schema struct { + VendorExtensible + SchemaProps + SwaggerSchemaProps + ExtraProps map[string]interface{} `json:"-"` +} + +// JSONLookup implements an interface to customize json pointer lookup +func (s Schema) JSONLookup(token string) (interface{}, error) { + if ex, ok := s.Extensions[token]; ok { + return &ex, nil + } + + if ex, ok := s.ExtraProps[token]; ok { + return &ex, nil + } + + r, _, err := jsonpointer.GetForToken(s.SchemaProps, token) + if r != nil || (err != nil && !strings.HasPrefix(err.Error(), "object has no field")) { + return r, err + } + r, _, err = jsonpointer.GetForToken(s.SwaggerSchemaProps, token) + return r, err +} + +// WithID sets the id for this schema, allows for chaining +func (s *Schema) WithID(id string) *Schema { + s.ID = id + return s +} + +// WithTitle sets the title for this schema, allows for chaining +func (s *Schema) WithTitle(title string) *Schema { + s.Title = title + return s +} + +// WithDescription sets the description for this schema, allows for chaining +func (s *Schema) WithDescription(description string) *Schema { + s.Description = description + return s +} + +// WithProperties sets the properties for this schema +func (s *Schema) WithProperties(schemas map[string]Schema) *Schema { + s.Properties = schemas + return s +} + +// SetProperty sets a property on this schema +func (s *Schema) SetProperty(name string, schema Schema) *Schema { + if s.Properties == nil { + s.Properties = make(map[string]Schema) + } + s.Properties[name] = schema + return s +} + +// WithAllOf sets the all of property +func (s *Schema) WithAllOf(schemas ...Schema) *Schema { + s.AllOf = schemas + return s +} + +// WithMaxProperties sets the max number of properties an object can have +func (s *Schema) WithMaxProperties(max int64) *Schema { + s.MaxProperties = &max + return s +} + +// WithMinProperties sets the min number of properties an object must have +func (s *Schema) WithMinProperties(min int64) *Schema { + s.MinProperties = &min + return s +} + +// Typed sets the type of this schema for a single value item +func (s *Schema) Typed(tpe, format string) *Schema { + s.Type = []string{tpe} + s.Format = format + return s +} + +// AddType adds a type with potential format to the types for this schema +func (s *Schema) AddType(tpe, format string) *Schema { + s.Type = append(s.Type, tpe) + if format != "" { + s.Format = format + } + return s +} + +// AsNullable flags this schema as nullable. +func (s *Schema) AsNullable() *Schema { + s.Nullable = true + return s +} + +// CollectionOf a fluent builder method for an array parameter +func (s *Schema) CollectionOf(items Schema) *Schema { + s.Type = []string{jsonArray} + s.Items = &SchemaOrArray{Schema: &items} + return s +} + +// WithDefault sets the default value on this parameter +func (s *Schema) WithDefault(defaultValue interface{}) *Schema { + s.Default = defaultValue + return s +} + +// WithRequired flags this parameter as required +func (s *Schema) WithRequired(items ...string) *Schema { + s.Required = items + return s +} + +// AddRequired adds field names to the required properties array +func (s *Schema) AddRequired(items ...string) *Schema { + s.Required = append(s.Required, items...) + return s +} + +// WithMaxLength sets a max length value +func (s *Schema) WithMaxLength(max int64) *Schema { + s.MaxLength = &max + return s +} + +// WithMinLength sets a min length value +func (s *Schema) WithMinLength(min int64) *Schema { + s.MinLength = &min + return s +} + +// WithPattern sets a pattern value +func (s *Schema) WithPattern(pattern string) *Schema { + s.Pattern = pattern + return s +} + +// WithMultipleOf sets a multiple of value +func (s *Schema) WithMultipleOf(number float64) *Schema { + s.MultipleOf = &number + return s +} + +// WithMaximum sets a maximum number value +func (s *Schema) WithMaximum(max float64, exclusive bool) *Schema { + s.Maximum = &max + s.ExclusiveMaximum = exclusive + return s +} + +// WithMinimum sets a minimum number value +func (s *Schema) WithMinimum(min float64, exclusive bool) *Schema { + s.Minimum = &min + s.ExclusiveMinimum = exclusive + return s +} + +// WithEnum sets a the enum values (replace) +func (s *Schema) WithEnum(values ...interface{}) *Schema { + s.Enum = append([]interface{}{}, values...) + return s +} + +// WithMaxItems sets the max items +func (s *Schema) WithMaxItems(size int64) *Schema { + s.MaxItems = &size + return s +} + +// WithMinItems sets the min items +func (s *Schema) WithMinItems(size int64) *Schema { + s.MinItems = &size + return s +} + +// UniqueValues dictates that this array can only have unique items +func (s *Schema) UniqueValues() *Schema { + s.UniqueItems = true + return s +} + +// AllowDuplicates this array can have duplicates +func (s *Schema) AllowDuplicates() *Schema { + s.UniqueItems = false + return s +} + +// AddToAllOf adds a schema to the allOf property +func (s *Schema) AddToAllOf(schemas ...Schema) *Schema { + s.AllOf = append(s.AllOf, schemas...) + return s +} + +// WithDiscriminator sets the name of the discriminator field +func (s *Schema) WithDiscriminator(discriminator string) *Schema { + s.Discriminator = discriminator + return s +} + +// AsReadOnly flags this schema as readonly +func (s *Schema) AsReadOnly() *Schema { + s.ReadOnly = true + return s +} + +// AsWritable flags this schema as writeable (not read-only) +func (s *Schema) AsWritable() *Schema { + s.ReadOnly = false + return s +} + +// WithExample sets the example for this schema +func (s *Schema) WithExample(example interface{}) *Schema { + s.Example = example + return s +} + +// WithExternalDocs sets/removes the external docs for/from this schema. +// When you pass empty strings as params the external documents will be removed. +// When you pass non-empty string as one value then those values will be used on the external docs object. +// So when you pass a non-empty description, you should also pass the url and vice versa. +func (s *Schema) WithExternalDocs(description, url string) *Schema { + if description == "" && url == "" { + s.ExternalDocs = nil + return s + } + + if s.ExternalDocs == nil { + s.ExternalDocs = &ExternalDocumentation{} + } + s.ExternalDocs.Description = description + s.ExternalDocs.URL = url + return s +} + +// WithXMLName sets the xml name for the object +func (s *Schema) WithXMLName(name string) *Schema { + if s.XML == nil { + s.XML = new(XMLObject) + } + s.XML.Name = name + return s +} + +// WithXMLNamespace sets the xml namespace for the object +func (s *Schema) WithXMLNamespace(namespace string) *Schema { + if s.XML == nil { + s.XML = new(XMLObject) + } + s.XML.Namespace = namespace + return s +} + +// WithXMLPrefix sets the xml prefix for the object +func (s *Schema) WithXMLPrefix(prefix string) *Schema { + if s.XML == nil { + s.XML = new(XMLObject) + } + s.XML.Prefix = prefix + return s +} + +// AsXMLAttribute flags this object as xml attribute +func (s *Schema) AsXMLAttribute() *Schema { + if s.XML == nil { + s.XML = new(XMLObject) + } + s.XML.Attribute = true + return s +} + +// AsXMLElement flags this object as an xml node +func (s *Schema) AsXMLElement() *Schema { + if s.XML == nil { + s.XML = new(XMLObject) + } + s.XML.Attribute = false + return s +} + +// AsWrappedXML flags this object as wrapped, this is mostly useful for array types +func (s *Schema) AsWrappedXML() *Schema { + if s.XML == nil { + s.XML = new(XMLObject) + } + s.XML.Wrapped = true + return s +} + +// AsUnwrappedXML flags this object as an xml node +func (s *Schema) AsUnwrappedXML() *Schema { + if s.XML == nil { + s.XML = new(XMLObject) + } + s.XML.Wrapped = false + return s +} + +// SetValidations defines all schema validations. +// +// NOTE: Required, ReadOnly, AllOf, AnyOf, OneOf and Not are not considered. +func (s *Schema) SetValidations(val SchemaValidations) { + s.Maximum = val.Maximum + s.ExclusiveMaximum = val.ExclusiveMaximum + s.Minimum = val.Minimum + s.ExclusiveMinimum = val.ExclusiveMinimum + s.MaxLength = val.MaxLength + s.MinLength = val.MinLength + s.Pattern = val.Pattern + s.MaxItems = val.MaxItems + s.MinItems = val.MinItems + s.UniqueItems = val.UniqueItems + s.MultipleOf = val.MultipleOf + s.Enum = val.Enum + s.MinProperties = val.MinProperties + s.MaxProperties = val.MaxProperties + s.PatternProperties = val.PatternProperties +} + +// WithValidations is a fluent method to set schema validations +func (s *Schema) WithValidations(val SchemaValidations) *Schema { + s.SetValidations(val) + return s +} + +// Validations returns a clone of the validations for this schema +func (s Schema) Validations() SchemaValidations { + return SchemaValidations{ + CommonValidations: CommonValidations{ + Maximum: s.Maximum, + ExclusiveMaximum: s.ExclusiveMaximum, + Minimum: s.Minimum, + ExclusiveMinimum: s.ExclusiveMinimum, + MaxLength: s.MaxLength, + MinLength: s.MinLength, + Pattern: s.Pattern, + MaxItems: s.MaxItems, + MinItems: s.MinItems, + UniqueItems: s.UniqueItems, + MultipleOf: s.MultipleOf, + Enum: s.Enum, + }, + MinProperties: s.MinProperties, + MaxProperties: s.MaxProperties, + PatternProperties: s.PatternProperties, + } +} + +// MarshalJSON marshal this to JSON +func (s Schema) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(s.SchemaProps) + if err != nil { + return nil, fmt.Errorf("schema props %v", err) + } + b2, err := json.Marshal(s.VendorExtensible) + if err != nil { + return nil, fmt.Errorf("vendor props %v", err) + } + b3, err := s.Ref.MarshalJSON() + if err != nil { + return nil, fmt.Errorf("ref prop %v", err) + } + b4, err := s.Schema.MarshalJSON() + if err != nil { + return nil, fmt.Errorf("schema prop %v", err) + } + b5, err := json.Marshal(s.SwaggerSchemaProps) + if err != nil { + return nil, fmt.Errorf("common validations %v", err) + } + var b6 []byte + if s.ExtraProps != nil { + jj, err := json.Marshal(s.ExtraProps) + if err != nil { + return nil, fmt.Errorf("extra props %v", err) + } + b6 = jj + } + return swag.ConcatJSON(b1, b2, b3, b4, b5, b6), nil +} + +// UnmarshalJSON marshal this from JSON +func (s *Schema) UnmarshalJSON(data []byte) error { + props := struct { + SchemaProps + SwaggerSchemaProps + }{} + if err := json.Unmarshal(data, &props); err != nil { + return err + } + + sch := Schema{ + SchemaProps: props.SchemaProps, + SwaggerSchemaProps: props.SwaggerSchemaProps, + } + + var d map[string]interface{} + if err := json.Unmarshal(data, &d); err != nil { + return err + } + + _ = sch.Ref.fromMap(d) + _ = sch.Schema.fromMap(d) + + delete(d, "$ref") + delete(d, "$schema") + for _, pn := range swag.DefaultJSONNameProvider.GetJSONNames(s) { + delete(d, pn) + } + + for k, vv := range d { + lk := strings.ToLower(k) + if strings.HasPrefix(lk, "x-") { + if sch.Extensions == nil { + sch.Extensions = map[string]interface{}{} + } + sch.Extensions[k] = vv + continue + } + if sch.ExtraProps == nil { + sch.ExtraProps = map[string]interface{}{} + } + sch.ExtraProps[k] = vv + } + + *s = sch + + return nil +} diff --git a/vendor/github.com/go-openapi/spec/schema_loader.go b/vendor/github.com/go-openapi/spec/schema_loader.go new file mode 100644 index 00000000000..b81175afdf4 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/schema_loader.go @@ -0,0 +1,338 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + "fmt" + "log" + "net/url" + "reflect" + "strings" + + "github.com/go-openapi/swag" +) + +// PathLoader is a function to use when loading remote refs. +// +// This is a package level default. It may be overridden or bypassed by +// specifying the loader in ExpandOptions. +// +// NOTE: if you are using the go-openapi/loads package, it will override +// this value with its own default (a loader to retrieve YAML documents as +// well as JSON ones). +var PathLoader = func(pth string) (json.RawMessage, error) { + data, err := swag.LoadFromFileOrHTTP(pth) + if err != nil { + return nil, err + } + return json.RawMessage(data), nil +} + +// resolverContext allows to share a context during spec processing. +// At the moment, it just holds the index of circular references found. +type resolverContext struct { + // circulars holds all visited circular references, to shortcircuit $ref resolution. + // + // This structure is privately instantiated and needs not be locked against + // concurrent access, unless we chose to implement a parallel spec walking. + circulars map[string]bool + basePath string + loadDoc func(string) (json.RawMessage, error) + rootID string +} + +func newResolverContext(options *ExpandOptions) *resolverContext { + expandOptions := optionsOrDefault(options) + + // path loader may be overridden by options + var loader func(string) (json.RawMessage, error) + if expandOptions.PathLoader == nil { + loader = PathLoader + } else { + loader = expandOptions.PathLoader + } + + return &resolverContext{ + circulars: make(map[string]bool), + basePath: expandOptions.RelativeBase, // keep the root base path in context + loadDoc: loader, + } +} + +type schemaLoader struct { + root interface{} + options *ExpandOptions + cache ResolutionCache + context *resolverContext +} + +func (r *schemaLoader) transitiveResolver(basePath string, ref Ref) *schemaLoader { + if ref.IsRoot() || ref.HasFragmentOnly { + return r + } + + baseRef := MustCreateRef(basePath) + currentRef := normalizeRef(&ref, basePath) + if strings.HasPrefix(currentRef.String(), baseRef.String()) { + return r + } + + // set a new root against which to resolve + rootURL := currentRef.GetURL() + rootURL.Fragment = "" + root, _ := r.cache.Get(rootURL.String()) + + // shallow copy of resolver options to set a new RelativeBase when + // traversing multiple documents + newOptions := r.options + newOptions.RelativeBase = rootURL.String() + + return defaultSchemaLoader(root, newOptions, r.cache, r.context) +} + +func (r *schemaLoader) updateBasePath(transitive *schemaLoader, basePath string) string { + if transitive != r { + if transitive.options != nil && transitive.options.RelativeBase != "" { + return normalizeBase(transitive.options.RelativeBase) + } + } + + return basePath +} + +func (r *schemaLoader) resolveRef(ref *Ref, target interface{}, basePath string) error { + tgt := reflect.ValueOf(target) + if tgt.Kind() != reflect.Ptr { + return ErrResolveRefNeedsAPointer + } + + if ref.GetURL() == nil { + return nil + } + + var ( + res interface{} + data interface{} + err error + ) + + // Resolve against the root if it isn't nil, and if ref is pointing at the root, or has a fragment only which means + // it is pointing somewhere in the root. + root := r.root + if (ref.IsRoot() || ref.HasFragmentOnly) && root == nil && basePath != "" { + if baseRef, erb := NewRef(basePath); erb == nil { + root, _, _, _ = r.load(baseRef.GetURL()) + } + } + + if (ref.IsRoot() || ref.HasFragmentOnly) && root != nil { + data = root + } else { + baseRef := normalizeRef(ref, basePath) + data, _, _, err = r.load(baseRef.GetURL()) + if err != nil { + return err + } + } + + res = data + if ref.String() != "" { + res, _, err = ref.GetPointer().Get(data) + if err != nil { + return err + } + } + return swag.DynamicJSONToStruct(res, target) +} + +func (r *schemaLoader) load(refURL *url.URL) (interface{}, url.URL, bool, error) { + debugLog("loading schema from url: %s", refURL) + toFetch := *refURL + toFetch.Fragment = "" + + var err error + pth := toFetch.String() + normalized := normalizeBase(pth) + debugLog("loading doc from: %s", normalized) + + unescaped, err := url.PathUnescape(normalized) + if err != nil { + return nil, url.URL{}, false, err + } + + u := url.URL{Path: unescaped} + + data, fromCache := r.cache.Get(u.RequestURI()) + if fromCache { + return data, toFetch, fromCache, nil + } + + b, err := r.context.loadDoc(normalized) + if err != nil { + return nil, url.URL{}, false, err + } + + var doc interface{} + if err := json.Unmarshal(b, &doc); err != nil { + return nil, url.URL{}, false, err + } + r.cache.Set(normalized, doc) + + return doc, toFetch, fromCache, nil +} + +// isCircular detects cycles in sequences of $ref. +// +// It relies on a private context (which needs not be locked). +func (r *schemaLoader) isCircular(ref *Ref, basePath string, parentRefs ...string) (foundCycle bool) { + normalizedRef := normalizeURI(ref.String(), basePath) + if _, ok := r.context.circulars[normalizedRef]; ok { + // circular $ref has been already detected in another explored cycle + foundCycle = true + return + } + foundCycle = swag.ContainsStrings(parentRefs, normalizedRef) // normalized windows url's are lower cased + if foundCycle { + r.context.circulars[normalizedRef] = true + } + return +} + +// Resolve resolves a reference against basePath and stores the result in target. +// +// Resolve is not in charge of following references: it only resolves ref by following its URL. +// +// If the schema the ref is referring to holds nested refs, Resolve doesn't resolve them. +// +// If basePath is an empty string, ref is resolved against the root schema stored in the schemaLoader struct +func (r *schemaLoader) Resolve(ref *Ref, target interface{}, basePath string) error { + return r.resolveRef(ref, target, basePath) +} + +func (r *schemaLoader) deref(input interface{}, parentRefs []string, basePath string) error { + var ref *Ref + switch refable := input.(type) { + case *Schema: + ref = &refable.Ref + case *Parameter: + ref = &refable.Ref + case *Response: + ref = &refable.Ref + case *PathItem: + ref = &refable.Ref + default: + return fmt.Errorf("unsupported type: %T: %w", input, ErrDerefUnsupportedType) + } + + curRef := ref.String() + if curRef == "" { + return nil + } + + normalizedRef := normalizeRef(ref, basePath) + normalizedBasePath := normalizedRef.RemoteURI() + + if r.isCircular(normalizedRef, basePath, parentRefs...) { + return nil + } + + if err := r.resolveRef(ref, input, basePath); r.shouldStopOnError(err) { + return err + } + + if ref.String() == "" || ref.String() == curRef { + // done with rereferencing + return nil + } + + parentRefs = append(parentRefs, normalizedRef.String()) + return r.deref(input, parentRefs, normalizedBasePath) +} + +func (r *schemaLoader) shouldStopOnError(err error) bool { + if err != nil && !r.options.ContinueOnError { + return true + } + + if err != nil { + log.Println(err) + } + + return false +} + +func (r *schemaLoader) setSchemaID(target interface{}, id, basePath string) (string, string) { + debugLog("schema has ID: %s", id) + + // handling the case when id is a folder + // remember that basePath has to point to a file + var refPath string + if strings.HasSuffix(id, "/") { + // ensure this is detected as a file, not a folder + refPath = fmt.Sprintf("%s%s", id, "placeholder.json") + } else { + refPath = id + } + + // updates the current base path + // * important: ID can be a relative path + // * registers target to be fetchable from the new base proposed by this id + newBasePath := normalizeURI(refPath, basePath) + + // store found IDs for possible future reuse in $ref + r.cache.Set(newBasePath, target) + + // the root document has an ID: all $ref relative to that ID may + // be rebased relative to the root document + if basePath == r.context.basePath { + debugLog("root document is a schema with ID: %s (normalized as:%s)", id, newBasePath) + r.context.rootID = newBasePath + } + + return newBasePath, refPath +} + +func defaultSchemaLoader( + root interface{}, + expandOptions *ExpandOptions, + cache ResolutionCache, + context *resolverContext) *schemaLoader { + + if expandOptions == nil { + expandOptions = &ExpandOptions{} + } + + cache = cacheOrDefault(cache) + + if expandOptions.RelativeBase == "" { + // if no relative base is provided, assume the root document + // contains all $ref, or at least, that the relative documents + // may be resolved from the current working directory. + expandOptions.RelativeBase = baseForRoot(root, cache) + } + debugLog("effective expander options: %#v", expandOptions) + + if context == nil { + context = newResolverContext(expandOptions) + } + + return &schemaLoader{ + root: root, + options: expandOptions, + cache: cache, + context: context, + } +} diff --git a/vendor/github.com/go-openapi/spec/security_scheme.go b/vendor/github.com/go-openapi/spec/security_scheme.go new file mode 100644 index 00000000000..9d0bdae9081 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/security_scheme.go @@ -0,0 +1,170 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +const ( + basic = "basic" + apiKey = "apiKey" + oauth2 = "oauth2" + implicit = "implicit" + password = "password" + application = "application" + accessCode = "accessCode" +) + +// BasicAuth creates a basic auth security scheme +func BasicAuth() *SecurityScheme { + return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{Type: basic}} +} + +// APIKeyAuth creates an api key auth security scheme +func APIKeyAuth(fieldName, valueSource string) *SecurityScheme { + return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{Type: apiKey, Name: fieldName, In: valueSource}} +} + +// OAuth2Implicit creates an implicit flow oauth2 security scheme +func OAuth2Implicit(authorizationURL string) *SecurityScheme { + return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{ + Type: oauth2, + Flow: implicit, + AuthorizationURL: authorizationURL, + }} +} + +// OAuth2Password creates a password flow oauth2 security scheme +func OAuth2Password(tokenURL string) *SecurityScheme { + return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{ + Type: oauth2, + Flow: password, + TokenURL: tokenURL, + }} +} + +// OAuth2Application creates an application flow oauth2 security scheme +func OAuth2Application(tokenURL string) *SecurityScheme { + return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{ + Type: oauth2, + Flow: application, + TokenURL: tokenURL, + }} +} + +// OAuth2AccessToken creates an access token flow oauth2 security scheme +func OAuth2AccessToken(authorizationURL, tokenURL string) *SecurityScheme { + return &SecurityScheme{SecuritySchemeProps: SecuritySchemeProps{ + Type: oauth2, + Flow: accessCode, + AuthorizationURL: authorizationURL, + TokenURL: tokenURL, + }} +} + +// SecuritySchemeProps describes a swagger security scheme in the securityDefinitions section +type SecuritySchemeProps struct { + Description string `json:"description,omitempty"` + Type string `json:"type"` + Name string `json:"name,omitempty"` // api key + In string `json:"in,omitempty"` // api key + Flow string `json:"flow,omitempty"` // oauth2 + AuthorizationURL string `json:"authorizationUrl"` // oauth2 + TokenURL string `json:"tokenUrl,omitempty"` // oauth2 + Scopes map[string]string `json:"scopes,omitempty"` // oauth2 +} + +// AddScope adds a scope to this security scheme +func (s *SecuritySchemeProps) AddScope(scope, description string) { + if s.Scopes == nil { + s.Scopes = make(map[string]string) + } + s.Scopes[scope] = description +} + +// SecurityScheme allows the definition of a security scheme that can be used by the operations. +// Supported schemes are basic authentication, an API key (either as a header or as a query parameter) +// and OAuth2's common flows (implicit, password, application and access code). +// +// For more information: http://goo.gl/8us55a#securitySchemeObject +type SecurityScheme struct { + VendorExtensible + SecuritySchemeProps +} + +// JSONLookup implements an interface to customize json pointer lookup +func (s SecurityScheme) JSONLookup(token string) (interface{}, error) { + if ex, ok := s.Extensions[token]; ok { + return &ex, nil + } + + r, _, err := jsonpointer.GetForToken(s.SecuritySchemeProps, token) + return r, err +} + +// MarshalJSON marshal this to JSON +func (s SecurityScheme) MarshalJSON() ([]byte, error) { + var ( + b1 []byte + err error + ) + + if s.Type == oauth2 && (s.Flow == "implicit" || s.Flow == "accessCode") { + // when oauth2 for implicit or accessCode flows, empty AuthorizationURL is added as empty string + b1, err = json.Marshal(s.SecuritySchemeProps) + } else { + // when not oauth2, empty AuthorizationURL should be omitted + b1, err = json.Marshal(struct { + Description string `json:"description,omitempty"` + Type string `json:"type"` + Name string `json:"name,omitempty"` // api key + In string `json:"in,omitempty"` // api key + Flow string `json:"flow,omitempty"` // oauth2 + AuthorizationURL string `json:"authorizationUrl,omitempty"` // oauth2 + TokenURL string `json:"tokenUrl,omitempty"` // oauth2 + Scopes map[string]string `json:"scopes,omitempty"` // oauth2 + }{ + Description: s.Description, + Type: s.Type, + Name: s.Name, + In: s.In, + Flow: s.Flow, + AuthorizationURL: s.AuthorizationURL, + TokenURL: s.TokenURL, + Scopes: s.Scopes, + }) + } + if err != nil { + return nil, err + } + + b2, err := json.Marshal(s.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2), nil +} + +// UnmarshalJSON marshal this from JSON +func (s *SecurityScheme) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &s.SecuritySchemeProps); err != nil { + return err + } + return json.Unmarshal(data, &s.VendorExtensible) +} diff --git a/vendor/github.com/go-openapi/spec/spec.go b/vendor/github.com/go-openapi/spec/spec.go new file mode 100644 index 00000000000..7d38b6e6251 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/spec.go @@ -0,0 +1,78 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" +) + +//go:generate curl -L --progress -o ./schemas/v2/schema.json http://swagger.io/v2/schema.json +//go:generate curl -L --progress -o ./schemas/jsonschema-draft-04.json http://json-schema.org/draft-04/schema +//go:generate go-bindata -pkg=spec -prefix=./schemas -ignore=.*\.md ./schemas/... +//go:generate perl -pi -e s,Json,JSON,g bindata.go + +const ( + // SwaggerSchemaURL the url for the swagger 2.0 schema to validate specs + SwaggerSchemaURL = "http://swagger.io/v2/schema.json#" + // JSONSchemaURL the url for the json schema schema + JSONSchemaURL = "http://json-schema.org/draft-04/schema#" +) + +// MustLoadJSONSchemaDraft04 panics when Swagger20Schema returns an error +func MustLoadJSONSchemaDraft04() *Schema { + d, e := JSONSchemaDraft04() + if e != nil { + panic(e) + } + return d +} + +// JSONSchemaDraft04 loads the json schema document for json shema draft04 +func JSONSchemaDraft04() (*Schema, error) { + b, err := Asset("jsonschema-draft-04.json") + if err != nil { + return nil, err + } + + schema := new(Schema) + if err := json.Unmarshal(b, schema); err != nil { + return nil, err + } + return schema, nil +} + +// MustLoadSwagger20Schema panics when Swagger20Schema returns an error +func MustLoadSwagger20Schema() *Schema { + d, e := Swagger20Schema() + if e != nil { + panic(e) + } + return d +} + +// Swagger20Schema loads the swagger 2.0 schema from the embedded assets +func Swagger20Schema() (*Schema, error) { + + b, err := Asset("v2/schema.json") + if err != nil { + return nil, err + } + + schema := new(Schema) + if err := json.Unmarshal(b, schema); err != nil { + return nil, err + } + return schema, nil +} diff --git a/vendor/github.com/go-openapi/spec/swagger.go b/vendor/github.com/go-openapi/spec/swagger.go new file mode 100644 index 00000000000..44722ffd5ad --- /dev/null +++ b/vendor/github.com/go-openapi/spec/swagger.go @@ -0,0 +1,448 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "bytes" + "encoding/gob" + "encoding/json" + "fmt" + "strconv" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +// Swagger this is the root document object for the API specification. +// It combines what previously was the Resource Listing and API Declaration (version 1.2 and earlier) +// together into one document. +// +// For more information: http://goo.gl/8us55a#swagger-object- +type Swagger struct { + VendorExtensible + SwaggerProps +} + +// JSONLookup look up a value by the json property name +func (s Swagger) JSONLookup(token string) (interface{}, error) { + if ex, ok := s.Extensions[token]; ok { + return &ex, nil + } + r, _, err := jsonpointer.GetForToken(s.SwaggerProps, token) + return r, err +} + +// MarshalJSON marshals this swagger structure to json +func (s Swagger) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(s.SwaggerProps) + if err != nil { + return nil, err + } + b2, err := json.Marshal(s.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2), nil +} + +// UnmarshalJSON unmarshals a swagger spec from json +func (s *Swagger) UnmarshalJSON(data []byte) error { + var sw Swagger + if err := json.Unmarshal(data, &sw.SwaggerProps); err != nil { + return err + } + if err := json.Unmarshal(data, &sw.VendorExtensible); err != nil { + return err + } + *s = sw + return nil +} + +// GobEncode provides a safe gob encoder for Swagger, including extensions +func (s Swagger) GobEncode() ([]byte, error) { + var b bytes.Buffer + raw := struct { + Props SwaggerProps + Ext VendorExtensible + }{ + Props: s.SwaggerProps, + Ext: s.VendorExtensible, + } + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err +} + +// GobDecode provides a safe gob decoder for Swagger, including extensions +func (s *Swagger) GobDecode(b []byte) error { + var raw struct { + Props SwaggerProps + Ext VendorExtensible + } + buf := bytes.NewBuffer(b) + err := gob.NewDecoder(buf).Decode(&raw) + if err != nil { + return err + } + s.SwaggerProps = raw.Props + s.VendorExtensible = raw.Ext + return nil +} + +// SwaggerProps captures the top-level properties of an Api specification +// +// NOTE: validation rules +// - the scheme, when present must be from [http, https, ws, wss] +// - BasePath must start with a leading "/" +// - Paths is required +type SwaggerProps struct { + ID string `json:"id,omitempty"` + Consumes []string `json:"consumes,omitempty"` + Produces []string `json:"produces,omitempty"` + Schemes []string `json:"schemes,omitempty"` + Swagger string `json:"swagger,omitempty"` + Info *Info `json:"info,omitempty"` + Host string `json:"host,omitempty"` + BasePath string `json:"basePath,omitempty"` + Paths *Paths `json:"paths"` + Definitions Definitions `json:"definitions,omitempty"` + Parameters map[string]Parameter `json:"parameters,omitempty"` + Responses map[string]Response `json:"responses,omitempty"` + SecurityDefinitions SecurityDefinitions `json:"securityDefinitions,omitempty"` + Security []map[string][]string `json:"security,omitempty"` + Tags []Tag `json:"tags,omitempty"` + ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` +} + +type swaggerPropsAlias SwaggerProps + +type gobSwaggerPropsAlias struct { + Security []map[string]struct { + List []string + Pad bool + } + Alias *swaggerPropsAlias + SecurityIsEmpty bool +} + +// GobEncode provides a safe gob encoder for SwaggerProps, including empty security requirements +func (o SwaggerProps) GobEncode() ([]byte, error) { + raw := gobSwaggerPropsAlias{ + Alias: (*swaggerPropsAlias)(&o), + } + + var b bytes.Buffer + if o.Security == nil { + // nil security requirement + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err + } + + if len(o.Security) == 0 { + // empty, but non-nil security requirement + raw.SecurityIsEmpty = true + raw.Alias.Security = nil + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err + } + + raw.Security = make([]map[string]struct { + List []string + Pad bool + }, 0, len(o.Security)) + for _, req := range o.Security { + v := make(map[string]struct { + List []string + Pad bool + }, len(req)) + for k, val := range req { + v[k] = struct { + List []string + Pad bool + }{ + List: val, + } + } + raw.Security = append(raw.Security, v) + } + + err := gob.NewEncoder(&b).Encode(raw) + return b.Bytes(), err +} + +// GobDecode provides a safe gob decoder for SwaggerProps, including empty security requirements +func (o *SwaggerProps) GobDecode(b []byte) error { + var raw gobSwaggerPropsAlias + + buf := bytes.NewBuffer(b) + err := gob.NewDecoder(buf).Decode(&raw) + if err != nil { + return err + } + if raw.Alias == nil { + return nil + } + + switch { + case raw.SecurityIsEmpty: + // empty, but non-nil security requirement + raw.Alias.Security = []map[string][]string{} + case len(raw.Alias.Security) == 0: + // nil security requirement + raw.Alias.Security = nil + default: + raw.Alias.Security = make([]map[string][]string, 0, len(raw.Security)) + for _, req := range raw.Security { + v := make(map[string][]string, len(req)) + for k, val := range req { + v[k] = make([]string, 0, len(val.List)) + v[k] = append(v[k], val.List...) + } + raw.Alias.Security = append(raw.Alias.Security, v) + } + } + + *o = *(*SwaggerProps)(raw.Alias) + return nil +} + +// Dependencies represent a dependencies property +type Dependencies map[string]SchemaOrStringArray + +// SchemaOrBool represents a schema or boolean value, is biased towards true for the boolean property +type SchemaOrBool struct { + Allows bool + Schema *Schema +} + +// JSONLookup implements an interface to customize json pointer lookup +func (s SchemaOrBool) JSONLookup(token string) (interface{}, error) { + if token == "allows" { + return s.Allows, nil + } + r, _, err := jsonpointer.GetForToken(s.Schema, token) + return r, err +} + +var jsTrue = []byte("true") +var jsFalse = []byte("false") + +// MarshalJSON convert this object to JSON +func (s SchemaOrBool) MarshalJSON() ([]byte, error) { + if s.Schema != nil { + return json.Marshal(s.Schema) + } + + if s.Schema == nil && !s.Allows { + return jsFalse, nil + } + return jsTrue, nil +} + +// UnmarshalJSON converts this bool or schema object from a JSON structure +func (s *SchemaOrBool) UnmarshalJSON(data []byte) error { + var nw SchemaOrBool + if len(data) >= 4 { + if data[0] == '{' { + var sch Schema + if err := json.Unmarshal(data, &sch); err != nil { + return err + } + nw.Schema = &sch + } + nw.Allows = !(data[0] == 'f' && data[1] == 'a' && data[2] == 'l' && data[3] == 's' && data[4] == 'e') + } + *s = nw + return nil +} + +// SchemaOrStringArray represents a schema or a string array +type SchemaOrStringArray struct { + Schema *Schema + Property []string +} + +// JSONLookup implements an interface to customize json pointer lookup +func (s SchemaOrStringArray) JSONLookup(token string) (interface{}, error) { + r, _, err := jsonpointer.GetForToken(s.Schema, token) + return r, err +} + +// MarshalJSON converts this schema object or array into JSON structure +func (s SchemaOrStringArray) MarshalJSON() ([]byte, error) { + if len(s.Property) > 0 { + return json.Marshal(s.Property) + } + if s.Schema != nil { + return json.Marshal(s.Schema) + } + return []byte("null"), nil +} + +// UnmarshalJSON converts this schema object or array from a JSON structure +func (s *SchemaOrStringArray) UnmarshalJSON(data []byte) error { + var first byte + if len(data) > 1 { + first = data[0] + } + var nw SchemaOrStringArray + if first == '{' { + var sch Schema + if err := json.Unmarshal(data, &sch); err != nil { + return err + } + nw.Schema = &sch + } + if first == '[' { + if err := json.Unmarshal(data, &nw.Property); err != nil { + return err + } + } + *s = nw + return nil +} + +// Definitions contains the models explicitly defined in this spec +// An object to hold data types that can be consumed and produced by operations. +// These data types can be primitives, arrays or models. +// +// For more information: http://goo.gl/8us55a#definitionsObject +type Definitions map[string]Schema + +// SecurityDefinitions a declaration of the security schemes available to be used in the specification. +// This does not enforce the security schemes on the operations and only serves to provide +// the relevant details for each scheme. +// +// For more information: http://goo.gl/8us55a#securityDefinitionsObject +type SecurityDefinitions map[string]*SecurityScheme + +// StringOrArray represents a value that can either be a string +// or an array of strings. Mainly here for serialization purposes +type StringOrArray []string + +// Contains returns true when the value is contained in the slice +func (s StringOrArray) Contains(value string) bool { + for _, str := range s { + if str == value { + return true + } + } + return false +} + +// JSONLookup implements an interface to customize json pointer lookup +func (s SchemaOrArray) JSONLookup(token string) (interface{}, error) { + if _, err := strconv.Atoi(token); err == nil { + r, _, err := jsonpointer.GetForToken(s.Schemas, token) + return r, err + } + r, _, err := jsonpointer.GetForToken(s.Schema, token) + return r, err +} + +// UnmarshalJSON unmarshals this string or array object from a JSON array or JSON string +func (s *StringOrArray) UnmarshalJSON(data []byte) error { + var first byte + if len(data) > 1 { + first = data[0] + } + + if first == '[' { + var parsed []string + if err := json.Unmarshal(data, &parsed); err != nil { + return err + } + *s = StringOrArray(parsed) + return nil + } + + var single interface{} + if err := json.Unmarshal(data, &single); err != nil { + return err + } + if single == nil { + return nil + } + switch v := single.(type) { + case string: + *s = StringOrArray([]string{v}) + return nil + default: + return fmt.Errorf("only string or array is allowed, not %T", single) + } +} + +// MarshalJSON converts this string or array to a JSON array or JSON string +func (s StringOrArray) MarshalJSON() ([]byte, error) { + if len(s) == 1 { + return json.Marshal([]string(s)[0]) + } + return json.Marshal([]string(s)) +} + +// SchemaOrArray represents a value that can either be a Schema +// or an array of Schema. Mainly here for serialization purposes +type SchemaOrArray struct { + Schema *Schema + Schemas []Schema +} + +// Len returns the number of schemas in this property +func (s SchemaOrArray) Len() int { + if s.Schema != nil { + return 1 + } + return len(s.Schemas) +} + +// ContainsType returns true when one of the schemas is of the specified type +func (s *SchemaOrArray) ContainsType(name string) bool { + if s.Schema != nil { + return s.Schema.Type != nil && s.Schema.Type.Contains(name) + } + return false +} + +// MarshalJSON converts this schema object or array into JSON structure +func (s SchemaOrArray) MarshalJSON() ([]byte, error) { + if len(s.Schemas) > 0 { + return json.Marshal(s.Schemas) + } + return json.Marshal(s.Schema) +} + +// UnmarshalJSON converts this schema object or array from a JSON structure +func (s *SchemaOrArray) UnmarshalJSON(data []byte) error { + var nw SchemaOrArray + var first byte + if len(data) > 1 { + first = data[0] + } + if first == '{' { + var sch Schema + if err := json.Unmarshal(data, &sch); err != nil { + return err + } + nw.Schema = &sch + } + if first == '[' { + if err := json.Unmarshal(data, &nw.Schemas); err != nil { + return err + } + } + *s = nw + return nil +} + +// vim:set ft=go noet sts=2 sw=2 ts=2: diff --git a/vendor/github.com/go-openapi/spec/tag.go b/vendor/github.com/go-openapi/spec/tag.go new file mode 100644 index 00000000000..faa3d3de1eb --- /dev/null +++ b/vendor/github.com/go-openapi/spec/tag.go @@ -0,0 +1,75 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +import ( + "encoding/json" + + "github.com/go-openapi/jsonpointer" + "github.com/go-openapi/swag" +) + +// TagProps describe a tag entry in the top level tags section of a swagger spec +type TagProps struct { + Description string `json:"description,omitempty"` + Name string `json:"name,omitempty"` + ExternalDocs *ExternalDocumentation `json:"externalDocs,omitempty"` +} + +// NewTag creates a new tag +func NewTag(name, description string, externalDocs *ExternalDocumentation) Tag { + return Tag{TagProps: TagProps{Description: description, Name: name, ExternalDocs: externalDocs}} +} + +// Tag allows adding meta data to a single tag that is used by the +// [Operation Object](http://goo.gl/8us55a#operationObject). +// It is not mandatory to have a Tag Object per tag used there. +// +// For more information: http://goo.gl/8us55a#tagObject +type Tag struct { + VendorExtensible + TagProps +} + +// JSONLookup implements an interface to customize json pointer lookup +func (t Tag) JSONLookup(token string) (interface{}, error) { + if ex, ok := t.Extensions[token]; ok { + return &ex, nil + } + + r, _, err := jsonpointer.GetForToken(t.TagProps, token) + return r, err +} + +// MarshalJSON marshal this to JSON +func (t Tag) MarshalJSON() ([]byte, error) { + b1, err := json.Marshal(t.TagProps) + if err != nil { + return nil, err + } + b2, err := json.Marshal(t.VendorExtensible) + if err != nil { + return nil, err + } + return swag.ConcatJSON(b1, b2), nil +} + +// UnmarshalJSON marshal this from JSON +func (t *Tag) UnmarshalJSON(data []byte) error { + if err := json.Unmarshal(data, &t.TagProps); err != nil { + return err + } + return json.Unmarshal(data, &t.VendorExtensible) +} diff --git a/vendor/github.com/go-openapi/spec/validations.go b/vendor/github.com/go-openapi/spec/validations.go new file mode 100644 index 00000000000..6360a8ea774 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/validations.go @@ -0,0 +1,215 @@ +package spec + +// CommonValidations describe common JSON-schema validations +type CommonValidations struct { + Maximum *float64 `json:"maximum,omitempty"` + ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` + Minimum *float64 `json:"minimum,omitempty"` + ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"` + MaxLength *int64 `json:"maxLength,omitempty"` + MinLength *int64 `json:"minLength,omitempty"` + Pattern string `json:"pattern,omitempty"` + MaxItems *int64 `json:"maxItems,omitempty"` + MinItems *int64 `json:"minItems,omitempty"` + UniqueItems bool `json:"uniqueItems,omitempty"` + MultipleOf *float64 `json:"multipleOf,omitempty"` + Enum []interface{} `json:"enum,omitempty"` +} + +// SetValidations defines all validations for a simple schema. +// +// NOTE: the input is the larger set of validations available for schemas. +// For simple schemas, MinProperties and MaxProperties are ignored. +func (v *CommonValidations) SetValidations(val SchemaValidations) { + v.Maximum = val.Maximum + v.ExclusiveMaximum = val.ExclusiveMaximum + v.Minimum = val.Minimum + v.ExclusiveMinimum = val.ExclusiveMinimum + v.MaxLength = val.MaxLength + v.MinLength = val.MinLength + v.Pattern = val.Pattern + v.MaxItems = val.MaxItems + v.MinItems = val.MinItems + v.UniqueItems = val.UniqueItems + v.MultipleOf = val.MultipleOf + v.Enum = val.Enum +} + +type clearedValidation struct { + Validation string + Value interface{} +} + +type clearedValidations []clearedValidation + +func (c clearedValidations) apply(cbs []func(string, interface{})) { + for _, cb := range cbs { + for _, cleared := range c { + cb(cleared.Validation, cleared.Value) + } + } +} + +// ClearNumberValidations clears all number validations. +// +// Some callbacks may be set by the caller to capture changed values. +func (v *CommonValidations) ClearNumberValidations(cbs ...func(string, interface{})) { + done := make(clearedValidations, 0, 5) + defer func() { + done.apply(cbs) + }() + + if v.Minimum != nil { + done = append(done, clearedValidation{Validation: "minimum", Value: v.Minimum}) + v.Minimum = nil + } + if v.Maximum != nil { + done = append(done, clearedValidation{Validation: "maximum", Value: v.Maximum}) + v.Maximum = nil + } + if v.ExclusiveMaximum { + done = append(done, clearedValidation{Validation: "exclusiveMaximum", Value: v.ExclusiveMaximum}) + v.ExclusiveMaximum = false + } + if v.ExclusiveMinimum { + done = append(done, clearedValidation{Validation: "exclusiveMinimum", Value: v.ExclusiveMinimum}) + v.ExclusiveMinimum = false + } + if v.MultipleOf != nil { + done = append(done, clearedValidation{Validation: "multipleOf", Value: v.MultipleOf}) + v.MultipleOf = nil + } +} + +// ClearStringValidations clears all string validations. +// +// Some callbacks may be set by the caller to capture changed values. +func (v *CommonValidations) ClearStringValidations(cbs ...func(string, interface{})) { + done := make(clearedValidations, 0, 3) + defer func() { + done.apply(cbs) + }() + + if v.Pattern != "" { + done = append(done, clearedValidation{Validation: "pattern", Value: v.Pattern}) + v.Pattern = "" + } + if v.MinLength != nil { + done = append(done, clearedValidation{Validation: "minLength", Value: v.MinLength}) + v.MinLength = nil + } + if v.MaxLength != nil { + done = append(done, clearedValidation{Validation: "maxLength", Value: v.MaxLength}) + v.MaxLength = nil + } +} + +// ClearArrayValidations clears all array validations. +// +// Some callbacks may be set by the caller to capture changed values. +func (v *CommonValidations) ClearArrayValidations(cbs ...func(string, interface{})) { + done := make(clearedValidations, 0, 3) + defer func() { + done.apply(cbs) + }() + + if v.MaxItems != nil { + done = append(done, clearedValidation{Validation: "maxItems", Value: v.MaxItems}) + v.MaxItems = nil + } + if v.MinItems != nil { + done = append(done, clearedValidation{Validation: "minItems", Value: v.MinItems}) + v.MinItems = nil + } + if v.UniqueItems { + done = append(done, clearedValidation{Validation: "uniqueItems", Value: v.UniqueItems}) + v.UniqueItems = false + } +} + +// Validations returns a clone of the validations for a simple schema. +// +// NOTE: in the context of simple schema objects, MinProperties, MaxProperties +// and PatternProperties remain unset. +func (v CommonValidations) Validations() SchemaValidations { + return SchemaValidations{ + CommonValidations: v, + } +} + +// HasNumberValidations indicates if the validations are for numbers or integers +func (v CommonValidations) HasNumberValidations() bool { + return v.Maximum != nil || v.Minimum != nil || v.MultipleOf != nil +} + +// HasStringValidations indicates if the validations are for strings +func (v CommonValidations) HasStringValidations() bool { + return v.MaxLength != nil || v.MinLength != nil || v.Pattern != "" +} + +// HasArrayValidations indicates if the validations are for arrays +func (v CommonValidations) HasArrayValidations() bool { + return v.MaxItems != nil || v.MinItems != nil || v.UniqueItems +} + +// HasEnum indicates if the validation includes some enum constraint +func (v CommonValidations) HasEnum() bool { + return len(v.Enum) > 0 +} + +// SchemaValidations describes the validation properties of a schema +// +// NOTE: at this moment, this is not embedded in SchemaProps because this would induce a breaking change +// in the exported members: all initializers using litterals would fail. +type SchemaValidations struct { + CommonValidations + + PatternProperties SchemaProperties `json:"patternProperties,omitempty"` + MaxProperties *int64 `json:"maxProperties,omitempty"` + MinProperties *int64 `json:"minProperties,omitempty"` +} + +// HasObjectValidations indicates if the validations are for objects +func (v SchemaValidations) HasObjectValidations() bool { + return v.MaxProperties != nil || v.MinProperties != nil || v.PatternProperties != nil +} + +// SetValidations for schema validations +func (v *SchemaValidations) SetValidations(val SchemaValidations) { + v.CommonValidations.SetValidations(val) + v.PatternProperties = val.PatternProperties + v.MaxProperties = val.MaxProperties + v.MinProperties = val.MinProperties +} + +// Validations for a schema +func (v SchemaValidations) Validations() SchemaValidations { + val := v.CommonValidations.Validations() + val.PatternProperties = v.PatternProperties + val.MinProperties = v.MinProperties + val.MaxProperties = v.MaxProperties + return val +} + +// ClearObjectValidations returns a clone of the validations with all object validations cleared. +// +// Some callbacks may be set by the caller to capture changed values. +func (v *SchemaValidations) ClearObjectValidations(cbs ...func(string, interface{})) { + done := make(clearedValidations, 0, 3) + defer func() { + done.apply(cbs) + }() + + if v.MaxProperties != nil { + done = append(done, clearedValidation{Validation: "maxProperties", Value: v.MaxProperties}) + v.MaxProperties = nil + } + if v.MinProperties != nil { + done = append(done, clearedValidation{Validation: "minProperties", Value: v.MinProperties}) + v.MinProperties = nil + } + if v.PatternProperties != nil { + done = append(done, clearedValidation{Validation: "patternProperties", Value: v.PatternProperties}) + v.PatternProperties = nil + } +} diff --git a/vendor/github.com/go-openapi/spec/xml_object.go b/vendor/github.com/go-openapi/spec/xml_object.go new file mode 100644 index 00000000000..945a46703d5 --- /dev/null +++ b/vendor/github.com/go-openapi/spec/xml_object.go @@ -0,0 +1,68 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package spec + +// XMLObject a metadata object that allows for more fine-tuned XML model definitions. +// +// For more information: http://goo.gl/8us55a#xmlObject +type XMLObject struct { + Name string `json:"name,omitempty"` + Namespace string `json:"namespace,omitempty"` + Prefix string `json:"prefix,omitempty"` + Attribute bool `json:"attribute,omitempty"` + Wrapped bool `json:"wrapped,omitempty"` +} + +// WithName sets the xml name for the object +func (x *XMLObject) WithName(name string) *XMLObject { + x.Name = name + return x +} + +// WithNamespace sets the xml namespace for the object +func (x *XMLObject) WithNamespace(namespace string) *XMLObject { + x.Namespace = namespace + return x +} + +// WithPrefix sets the xml prefix for the object +func (x *XMLObject) WithPrefix(prefix string) *XMLObject { + x.Prefix = prefix + return x +} + +// AsAttribute flags this object as xml attribute +func (x *XMLObject) AsAttribute() *XMLObject { + x.Attribute = true + return x +} + +// AsElement flags this object as an xml node +func (x *XMLObject) AsElement() *XMLObject { + x.Attribute = false + return x +} + +// AsWrapped flags this object as wrapped, this is mostly useful for array types +func (x *XMLObject) AsWrapped() *XMLObject { + x.Wrapped = true + return x +} + +// AsUnwrapped flags this object as an xml node +func (x *XMLObject) AsUnwrapped() *XMLObject { + x.Wrapped = false + return x +} diff --git a/vendor/github.com/go-openapi/strfmt/.editorconfig b/vendor/github.com/go-openapi/strfmt/.editorconfig new file mode 100644 index 00000000000..3152da69a5d --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/.editorconfig @@ -0,0 +1,26 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true + +# Set default charset +[*.{js,py,go,scala,rb,java,html,css,less,sass,md}] +charset = utf-8 + +# Tab indentation (no size specified) +[*.go] +indent_style = tab + +[*.md] +trim_trailing_whitespace = false + +# Matches the exact files either package.json or .travis.yml +[{package.json,.travis.yml}] +indent_style = space +indent_size = 2 diff --git a/vendor/github.com/go-openapi/strfmt/.gitattributes b/vendor/github.com/go-openapi/strfmt/.gitattributes new file mode 100644 index 00000000000..d020be8ea4e --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/.gitattributes @@ -0,0 +1,2 @@ +*.go text eol=lf + diff --git a/vendor/github.com/go-openapi/strfmt/.gitignore b/vendor/github.com/go-openapi/strfmt/.gitignore new file mode 100644 index 00000000000..dd91ed6a04e --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/.gitignore @@ -0,0 +1,2 @@ +secrets.yml +coverage.out diff --git a/vendor/github.com/go-openapi/strfmt/.golangci.yml b/vendor/github.com/go-openapi/strfmt/.golangci.yml new file mode 100644 index 00000000000..da12d5e3b75 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/.golangci.yml @@ -0,0 +1,49 @@ +linters-settings: + govet: + check-shadowing: true + golint: + min-confidence: 0 + gocyclo: + min-complexity: 31 + maligned: + suggest-new: true + dupl: + threshold: 100 + goconst: + min-len: 2 + min-occurrences: 4 + +linters: + enable-all: true + disable: + - maligned + - lll + - gochecknoinits + - gochecknoglobals + - godox + - gocognit + - whitespace + - wsl + - funlen + - wrapcheck + - testpackage + - nlreturn + - gofumpt + - goerr113 + - gci + - gomnd + - godot + - exhaustivestruct + - paralleltest + - varnamelen + - ireturn + #- thelper + +issues: + exclude-rules: + - path: bson.go + text: "should be .*ObjectID" + linters: + - golint + - stylecheck + diff --git a/vendor/github.com/go-openapi/strfmt/CODE_OF_CONDUCT.md b/vendor/github.com/go-openapi/strfmt/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..9322b065e37 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at ivan+abuse@flanders.co.nz. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/vendor/github.com/go-openapi/strfmt/LICENSE b/vendor/github.com/go-openapi/strfmt/LICENSE new file mode 100644 index 00000000000..d6456956733 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/go-openapi/strfmt/README.md b/vendor/github.com/go-openapi/strfmt/README.md new file mode 100644 index 00000000000..0cf89d77661 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/README.md @@ -0,0 +1,88 @@ +# Strfmt [![Build Status](https://travis-ci.org/go-openapi/strfmt.svg?branch=master)](https://travis-ci.org/go-openapi/strfmt) [![codecov](https://codecov.io/gh/go-openapi/strfmt/branch/master/graph/badge.svg)](https://codecov.io/gh/go-openapi/strfmt) [![Slack Status](https://slackin.goswagger.io/badge.svg)](https://slackin.goswagger.io) + +[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/go-openapi/strfmt/master/LICENSE) +[![GoDoc](https://godoc.org/github.com/go-openapi/strfmt?status.svg)](http://godoc.org/github.com/go-openapi/strfmt) +[![GolangCI](https://golangci.com/badges/github.com/go-openapi/strfmt.svg)](https://golangci.com) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-openapi/strfmt)](https://goreportcard.com/report/github.com/go-openapi/strfmt) + +This package exposes a registry of data types to support string formats in the go-openapi toolkit. + +strfmt represents a well known string format such as credit card or email. The go toolkit for OpenAPI specifications knows how to deal with those. + +## Supported data formats +go-openapi/strfmt follows the swagger 2.0 specification with the following formats +defined [here](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types). + +It also provides convenient extensions to go-openapi users. + +- [x] JSON-schema draft 4 formats + - date-time + - email + - hostname + - ipv4 + - ipv6 + - uri +- [x] swagger 2.0 format extensions + - binary + - byte (e.g. base64 encoded string) + - date (e.g. "1970-01-01") + - password +- [x] go-openapi custom format extensions + - bsonobjectid (BSON objectID) + - creditcard + - duration (e.g. "3 weeks", "1ms") + - hexcolor (e.g. "#FFFFFF") + - isbn, isbn10, isbn13 + - mac (e.g "01:02:03:04:05:06") + - rgbcolor (e.g. "rgb(100,100,100)") + - ssn + - uuid, uuid3, uuid4, uuid5 + - cidr (e.g. "192.0.2.1/24", "2001:db8:a0b:12f0::1/32") + - ulid (e.g. "00000PP9HGSBSSDZ1JTEXBJ0PW", [spec](https://github.com/ulid/spec)) + +> NOTE: as the name stands for, this package is intended to support string formatting only. +> It does not provide validation for numerical values with swagger format extension for JSON types "number" or +> "integer" (e.g. float, double, int32...). + +## Type conversion + +All types defined here are stringers and may be converted to strings with `.String()`. +Note that most types defined by this package may be converted directly to string like `string(Email{})`. + +`Date` and `DateTime` may be converted directly to `time.Time` like `time.Time(Time{})`. +Similarly, you can convert `Duration` to `time.Duration` as in `time.Duration(Duration{})` + +## Using pointers + +The `conv` subpackage provides helpers to convert the types to and from pointers, just like `go-openapi/swag` does +with primitive types. + +## Format types +Types defined in strfmt expose marshaling and validation capabilities. + +List of defined types: +- Base64 +- CreditCard +- Date +- DateTime +- Duration +- Email +- HexColor +- Hostname +- IPv4 +- IPv6 +- CIDR +- ISBN +- ISBN10 +- ISBN13 +- MAC +- ObjectId +- Password +- RGBColor +- SSN +- URI +- UUID +- UUID3 +- UUID4 +- UUID5 +- [ULID](https://github.com/ulid/spec) diff --git a/vendor/github.com/go-openapi/strfmt/bson.go b/vendor/github.com/go-openapi/strfmt/bson.go new file mode 100644 index 00000000000..8740b150599 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/bson.go @@ -0,0 +1,165 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package strfmt + +import ( + "database/sql/driver" + "fmt" + + "go.mongodb.org/mongo-driver/bson" + + "go.mongodb.org/mongo-driver/bson/bsontype" + bsonprim "go.mongodb.org/mongo-driver/bson/primitive" +) + +func init() { + var id ObjectId + // register this format in the default registry + Default.Add("bsonobjectid", &id, IsBSONObjectID) +} + +// IsBSONObjectID returns true when the string is a valid BSON.ObjectId +func IsBSONObjectID(str string) bool { + _, err := bsonprim.ObjectIDFromHex(str) + return err == nil +} + +// ObjectId represents a BSON object ID (alias to go.mongodb.org/mongo-driver/bson/primitive.ObjectID) +// +// swagger:strfmt bsonobjectid +type ObjectId bsonprim.ObjectID //nolint:revive + +// NewObjectId creates a ObjectId from a Hex String +func NewObjectId(hex string) ObjectId { //nolint:revive + oid, err := bsonprim.ObjectIDFromHex(hex) + if err != nil { + panic(err) + } + return ObjectId(oid) +} + +// MarshalText turns this instance into text +func (id ObjectId) MarshalText() ([]byte, error) { + oid := bsonprim.ObjectID(id) + if oid == bsonprim.NilObjectID { + return nil, nil + } + return []byte(oid.Hex()), nil +} + +// UnmarshalText hydrates this instance from text +func (id *ObjectId) UnmarshalText(data []byte) error { // validation is performed later on + if len(data) == 0 { + *id = ObjectId(bsonprim.NilObjectID) + return nil + } + oidstr := string(data) + oid, err := bsonprim.ObjectIDFromHex(oidstr) + if err != nil { + return err + } + *id = ObjectId(oid) + return nil +} + +// Scan read a value from a database driver +func (id *ObjectId) Scan(raw interface{}) error { + var data []byte + switch v := raw.(type) { + case []byte: + data = v + case string: + data = []byte(v) + default: + return fmt.Errorf("cannot sql.Scan() strfmt.URI from: %#v", v) + } + + return id.UnmarshalText(data) +} + +// Value converts a value to a database driver value +func (id ObjectId) Value() (driver.Value, error) { + return driver.Value(bsonprim.ObjectID(id).Hex()), nil +} + +func (id ObjectId) String() string { + return bsonprim.ObjectID(id).Hex() +} + +// MarshalJSON returns the ObjectId as JSON +func (id ObjectId) MarshalJSON() ([]byte, error) { + return bsonprim.ObjectID(id).MarshalJSON() +} + +// UnmarshalJSON sets the ObjectId from JSON +func (id *ObjectId) UnmarshalJSON(data []byte) error { + var obj bsonprim.ObjectID + if err := obj.UnmarshalJSON(data); err != nil { + return err + } + *id = ObjectId(obj) + return nil +} + +// MarshalBSON renders the object id as a BSON document +func (id ObjectId) MarshalBSON() ([]byte, error) { + return bson.Marshal(bson.M{"data": bsonprim.ObjectID(id)}) +} + +// UnmarshalBSON reads the objectId from a BSON document +func (id *ObjectId) UnmarshalBSON(data []byte) error { + var obj struct { + Data bsonprim.ObjectID + } + if err := bson.Unmarshal(data, &obj); err != nil { + return err + } + *id = ObjectId(obj.Data) + return nil +} + +// MarshalBSONValue is an interface implemented by types that can marshal themselves +// into a BSON document represented as bytes. The bytes returned must be a valid +// BSON document if the error is nil. +func (id ObjectId) MarshalBSONValue() (bsontype.Type, []byte, error) { + oid := bsonprim.ObjectID(id) + return bsontype.ObjectID, oid[:], nil +} + +// UnmarshalBSONValue is an interface implemented by types that can unmarshal a +// BSON value representation of themselves. The BSON bytes and type can be +// assumed to be valid. UnmarshalBSONValue must copy the BSON value bytes if it +// wishes to retain the data after returning. +func (id *ObjectId) UnmarshalBSONValue(tpe bsontype.Type, data []byte) error { + var oid bsonprim.ObjectID + copy(oid[:], data) + *id = ObjectId(oid) + return nil +} + +// DeepCopyInto copies the receiver and writes its value into out. +func (id *ObjectId) DeepCopyInto(out *ObjectId) { + *out = *id +} + +// DeepCopy copies the receiver into a new ObjectId. +func (id *ObjectId) DeepCopy() *ObjectId { + if id == nil { + return nil + } + out := new(ObjectId) + id.DeepCopyInto(out) + return out +} diff --git a/vendor/github.com/go-openapi/strfmt/date.go b/vendor/github.com/go-openapi/strfmt/date.go new file mode 100644 index 00000000000..f0b310964d9 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/date.go @@ -0,0 +1,187 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package strfmt + +import ( + "database/sql/driver" + "encoding/json" + "errors" + "fmt" + "time" + + "go.mongodb.org/mongo-driver/bson" +) + +func init() { + d := Date{} + // register this format in the default registry + Default.Add("date", &d, IsDate) +} + +// IsDate returns true when the string is a valid date +func IsDate(str string) bool { + _, err := time.Parse(RFC3339FullDate, str) + return err == nil +} + +const ( + // RFC3339FullDate represents a full-date as specified by RFC3339 + // See: http://goo.gl/xXOvVd + RFC3339FullDate = "2006-01-02" +) + +// Date represents a date from the API +// +// swagger:strfmt date +type Date time.Time + +// String converts this date into a string +func (d Date) String() string { + return time.Time(d).Format(RFC3339FullDate) +} + +// UnmarshalText parses a text representation into a date type +func (d *Date) UnmarshalText(text []byte) error { + if len(text) == 0 { + return nil + } + dd, err := time.Parse(RFC3339FullDate, string(text)) + if err != nil { + return err + } + *d = Date(dd) + return nil +} + +// MarshalText serializes this date type to string +func (d Date) MarshalText() ([]byte, error) { + return []byte(d.String()), nil +} + +// Scan scans a Date value from database driver type. +func (d *Date) Scan(raw interface{}) error { + switch v := raw.(type) { + case []byte: + return d.UnmarshalText(v) + case string: + return d.UnmarshalText([]byte(v)) + case time.Time: + *d = Date(v) + return nil + case nil: + *d = Date{} + return nil + default: + return fmt.Errorf("cannot sql.Scan() strfmt.Date from: %#v", v) + } +} + +// Value converts Date to a primitive value ready to written to a database. +func (d Date) Value() (driver.Value, error) { + return driver.Value(d.String()), nil +} + +// MarshalJSON returns the Date as JSON +func (d Date) MarshalJSON() ([]byte, error) { + return json.Marshal(time.Time(d).Format(RFC3339FullDate)) +} + +// UnmarshalJSON sets the Date from JSON +func (d *Date) UnmarshalJSON(data []byte) error { + if string(data) == jsonNull { + return nil + } + var strdate string + if err := json.Unmarshal(data, &strdate); err != nil { + return err + } + tt, err := time.Parse(RFC3339FullDate, strdate) + if err != nil { + return err + } + *d = Date(tt) + return nil +} + +func (d Date) MarshalBSON() ([]byte, error) { + return bson.Marshal(bson.M{"data": d.String()}) +} + +func (d *Date) UnmarshalBSON(data []byte) error { + var m bson.M + if err := bson.Unmarshal(data, &m); err != nil { + return err + } + + if data, ok := m["data"].(string); ok { + rd, err := time.Parse(RFC3339FullDate, data) + if err != nil { + return err + } + *d = Date(rd) + return nil + } + + return errors.New("couldn't unmarshal bson bytes value as Date") +} + +// DeepCopyInto copies the receiver and writes its value into out. +func (d *Date) DeepCopyInto(out *Date) { + *out = *d +} + +// DeepCopy copies the receiver into a new Date. +func (d *Date) DeepCopy() *Date { + if d == nil { + return nil + } + out := new(Date) + d.DeepCopyInto(out) + return out +} + +// GobEncode implements the gob.GobEncoder interface. +func (d Date) GobEncode() ([]byte, error) { + return d.MarshalBinary() +} + +// GobDecode implements the gob.GobDecoder interface. +func (d *Date) GobDecode(data []byte) error { + return d.UnmarshalBinary(data) +} + +// MarshalBinary implements the encoding.BinaryMarshaler interface. +func (d Date) MarshalBinary() ([]byte, error) { + return time.Time(d).MarshalBinary() +} + +// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. +func (d *Date) UnmarshalBinary(data []byte) error { + var original time.Time + + err := original.UnmarshalBinary(data) + if err != nil { + return err + } + + *d = Date(original) + + return nil +} + +// Equal checks if two Date instances are equal +func (d Date) Equal(d2 Date) bool { + return time.Time(d).Equal(time.Time(d2)) +} diff --git a/vendor/github.com/go-openapi/strfmt/default.go b/vendor/github.com/go-openapi/strfmt/default.go new file mode 100644 index 00000000000..a89a4de3f38 --- /dev/null +++ b/vendor/github.com/go-openapi/strfmt/default.go @@ -0,0 +1,2035 @@ +// Copyright 2015 go-swagger maintainers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package strfmt + +import ( + "database/sql/driver" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "net/mail" + "regexp" + "strings" + + "github.com/asaskevich/govalidator" + "go.mongodb.org/mongo-driver/bson" +) + +const ( + // HostnamePattern http://json-schema.org/latest/json-schema-validation.html#anchor114 + // A string instance is valid against this attribute if it is a valid + // representation for an Internet host name, as defined by RFC 1034, section 3.1 [RFC1034]. + // http://tools.ietf.org/html/rfc1034#section-3.5 + // ::= any one of the ten digits 0 through 9 + // var digit = /[0-9]/; + // ::= any one of the 52 alphabetic characters A through Z in upper case and a through z in lower case + // var letter = /[a-zA-Z]/; + // ::= | + // var letDig = /[0-9a-zA-Z]/; + // ::= | "-" + // var letDigHyp = /[-0-9a-zA-Z]/; + // ::= | + // var ldhStr = /[-0-9a-zA-Z]+/; + //